diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml index 56c2dd1622..79f49e3850 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml @@ -51,21 +51,8 @@ ${carbon.device.mgt.version} Application Management Common Bundle - org.osgi.framework, - org.osgi.service.component, - org.apache.commons.logging, - javax.xml.*, - org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", - org.wso2.carbon.device.mgt.core.dto.*;version="${carbon.device.mgt.version}", - org.wso2.carbon.device.mgt.core.dao.*;version="${carbon.device.mgt.version}", org.wso2.carbon.device.mgt.common.operation.mgt.*;version="${carbon.device.mgt.version}", - org.w3c.dom, - org.json, - org.xml.sax, com.google.gson, - javax.naming, - javax.xml.bind.annotation, - javax.xml.bind, io.swagger.annotations.*;resolution:=optional diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml index 04d246bb4c..932265189f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml @@ -57,7 +57,6 @@ org.osgi.framework, org.osgi.service.component, org.apache.commons.logging, - javax.xml.*, javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, org.wso2.carbon.context.*, org.wso2.carbon.utils.*, @@ -71,38 +70,43 @@ org.wso2.carbon.device.application.mgt.common.*, org.wso2.carbon.device.mgt.core.*, org.wso2.carbon.device.mgt.common.*, - org.apache.axis2.*, org.wso2.carbon.user.core.*, org.wso2.carbon.user.api.*, org.wso2.carbon.ndatasource.core, org.wso2.carbon, javax.annotation, - org.bouncycastle.cert, - org.bouncycastle.cert.jcajce, - org.bouncycastle.cms, - org.bouncycastle.jce.provider, - org.bouncycastle.util, org.xml.sax, org.xml.sax.helpers, org.apache.commons.io, org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", org.apache.commons.codec.digest;version="${commons-codec.wso2.osgi.version.range}", org.wso2.carbon.base, - org.wso2.carbon.device.mgt.core.dto.*;version="${carbon.device.mgt.version}", - org.wso2.carbon.device.mgt.core.dao.*;version="${carbon.device.mgt.version}", - net.dongliu.* + net.dongliu.apk.parser.* apk-parser;scope=compile|runtime;inline=false - true - true + + !org.wso2.carbon.device.application.mgt.core.internal.*, org.wso2.carbon.device.application.mgt.core.* - PlatformDeployer + + org.apache.maven.plugins + maven-surefire-plugin + 2.18 + + + src/test/resources/testng.xml + + + ${basedir}/target/coverage-reports/jacoco-unit.exec + file:src/test/resources/log4j.properties + + + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationStorageManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationStorageManagerImpl.java index 899887f7ca..957f32c022 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationStorageManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationStorageManagerImpl.java @@ -23,12 +23,12 @@ import com.dd.plist.NSDictionary; import com.dd.plist.NSString; import com.dd.plist.PropertyListFormatException; import com.dd.plist.PropertyListParser; -import net.dongliu.apk.parser.ApkFile; import net.dongliu.apk.parser.bean.ApkMeta; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.commons.validator.routines.UrlValidator; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.application.mgt.common.ApplicationRelease; import org.wso2.carbon.device.application.mgt.common.ApplicationType; @@ -41,16 +41,10 @@ import org.wso2.carbon.device.application.mgt.core.util.ArtifactsParser; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; import org.wso2.carbon.device.application.mgt.core.util.Constants; import org.wso2.carbon.device.application.mgt.core.util.StorageManagementUtil; -import org.apache.commons.validator.routines.UrlValidator; import org.xml.sax.SAXException; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; +import javax.xml.parsers.ParserConfigurationException; +import java.io.*; import java.text.ParseException; import java.util.HashMap; import java.util.List; @@ -59,8 +53,6 @@ import java.util.Objects; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import javax.xml.parsers.ParserConfigurationException; - import static org.wso2.carbon.device.application.mgt.core.util.StorageManagementUtil.deleteDir; import static org.wso2.carbon.device.application.mgt.core.util.StorageManagementUtil.saveFile; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ArtifactsParser.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ArtifactsParser.java index f7fa79de60..09b37e4e78 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ArtifactsParser.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ArtifactsParser.java @@ -39,6 +39,7 @@ import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.util.UUID; +import java.nio.file.Files; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/java/org.wso2.carbon.device.application.mgt.core/ArtifactParserTest.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/java/org.wso2.carbon.device.application.mgt.core/ArtifactParserTest.java new file mode 100644 index 0000000000..a8bb924ad5 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/java/org.wso2.carbon.device.application.mgt.core/ArtifactParserTest.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.wso2.carbon.device.application.mgt.core; + +import com.dd.plist.NSDictionary; +import net.dongliu.apk.parser.bean.ApkMeta; +import org.testng.Assert; +import org.testng.annotations.Test; +import org.wso2.carbon.device.application.mgt.core.exception.ParsingException; +import org.wso2.carbon.device.application.mgt.core.util.ArtifactsParser; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; + +public class ArtifactParserTest { + private static final String APK_FILE = "src/test/resources/util/app-debug.apk"; + private static final String APK_FILE_INVALID = "src/test/resources/util/app-debug1.apk"; + private static final String IPA_FILE = "src/test/resources/util/iOSMDMAgent.ipa"; + private static final String IPA_FILE_INVALID = "src/test/resources/util/iOSMDMAgent1.ipa"; + + @Test + public void testReadAndroidManifestFile() throws FileNotFoundException, ParsingException { + InputStream apk = new FileInputStream(APK_FILE); + ApkMeta apkMeta = ArtifactsParser.readAndroidManifestFile(apk); + Assert.assertEquals(apkMeta.getVersionName(), "1.0", "APK version name extraction failed."); + Assert.assertEquals(apkMeta.getPackageName(), "com.games.inosh.myapplication", + "APK package name extraction failed."); + } + + @Test(expectedExceptions = java.io.FileNotFoundException.class) + public void testReadAndroidManifestInvalidFile() throws FileNotFoundException, ParsingException { + InputStream apk = new FileInputStream(APK_FILE_INVALID); + ArtifactsParser.readAndroidManifestFile(apk); + } + + @Test + public void testReadiOSManifestFile() throws FileNotFoundException, ParsingException { + InputStream ipa = new FileInputStream(IPA_FILE); + NSDictionary ipaDictionary = ArtifactsParser.readiOSManifestFile(ipa); + Assert.assertEquals(ipaDictionary.objectForKey(ArtifactsParser.IPA_BUNDLE_IDENTIFIER_KEY).toString(), + "org.wso2.carbon.emm.ios.agent.inosh", "IPA bundle ID extraction failed."); + Assert.assertEquals(ipaDictionary.objectForKey(ArtifactsParser.IPA_BUNDLE_VERSION_KEY).toString(), + "GA", "IPA file version name extraction failed."); + } + + @Test(expectedExceptions = java.io.FileNotFoundException.class) + public void testReadiOSManifestInvalidFile() throws FileNotFoundException, ParsingException { + InputStream ipa = new FileInputStream(IPA_FILE_INVALID); + ArtifactsParser.readiOSManifestFile(ipa); + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/testng.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/testng.xml index 0af96a3777..ca512950bc 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/testng.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/testng.xml @@ -20,4 +20,9 @@ + + + + + \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/util/app-debug.apk b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/util/app-debug.apk new file mode 100644 index 0000000000..52bb95ed21 Binary files /dev/null and b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/util/app-debug.apk differ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/util/iOSMDMAgent.ipa b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/util/iOSMDMAgent.ipa new file mode 100644 index 0000000000..13af8f3cdb Binary files /dev/null and b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/util/iOSMDMAgent.ipa differ diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.api.feature/pom.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.api.feature/pom.xml index f7bedc059a..571035fb9d 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.api.feature/pom.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.api.feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt application-mgt-feature - 3.1.34-SNAPSHOT + 3.1.40-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.application.mgt.api.feature - 3.1.34-SNAPSHOT + 3.1.40-SNAPSHOT pom WSO2 Carbon - Application Management API Feature http://wso2.org diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.api.feature/src/main/resources/p2.inf b/features/application-mgt/org.wso2.carbon.device.application.mgt.api.feature/src/main/resources/p2.inf index 1d83a6da71..edf41c6ffd 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.api.feature/src/main/resources/p2.inf +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.api.feature/src/main/resources/p2.inf @@ -1,8 +1,4 @@ instructions.configure = \ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application -.mgt.api_${feature.version}/webapps/api#application-mgt-publisher#v1.0.war,target:${installFolder}/../. -./deployment/server/webapps/api#application-mgt-publisher#v1.0.war,overwrite:true);\ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application -.mgt.api_${feature.version}/webapps/api#application-mgt-store#v1.0.war,target:${installFolder}/../. -./deployment/server/webapps/api#application-mgt-store#v1.0.war,overwrite:true);\ \ No newline at end of file +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.api_${feature.version}/webapps/api#application-mgt-publisher#v1.0.war,target:${installFolder}/../../deployment/server/webapps/api#application-mgt-publisher#v1.0.war,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.api_${feature.version}/webapps/api#application-mgt-store#v1.0.war,target:${installFolder}/../../deployment/server/webapps/api#application-mgt-store#v1.0.war,overwrite:true);\ \ No newline at end of file diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.auth.handler.feature/pom.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.auth.handler.feature/pom.xml index 09c5995d73..80e42d1542 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.auth.handler.feature/pom.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.auth.handler.feature/pom.xml @@ -22,12 +22,12 @@ org.wso2.carbon.devicemgt application-mgt-feature - 3.1.34-SNAPSHOT + 3.1.40-SNAPSHOT 4.0.0 org.wso2.carbon.device.application.mgt.auth.handler.feature - 3.1.34-SNAPSHOT + 3.1.40-SNAPSHOT pom WSO2 Carbon - Application Management Authentication Handler Feature This feature contains the Authentication Handler implementation for Publisher and Store. diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.extensions.feature/pom.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.extensions.feature/pom.xml index 67e5f3bdd9..504742d404 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.extensions.feature/pom.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.extensions.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt application-mgt-feature - 3.0.46-SNAPSHOT + 3.1.40-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.application.mgt.extensions.feature pom - 3.0.46-SNAPSHOT + 3.1.40-SNAPSHOT WSO2 Carbon - Application Management Extension Feature http://wso2.org WSO2 Application Management Extension Feature diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.feature/pom.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.feature/pom.xml index 6e72589d1e..548edd110f 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.feature/pom.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt application-mgt-feature - 3.1.34-SNAPSHOT + 3.1.40-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.application.mgt.feature - 3.1.34-SNAPSHOT + 3.1.40-SNAPSHOT pom WSO2 Carbon - Application Management Aggregate Feature http://wso2.org @@ -45,14 +45,14 @@ org.wso2.carbon.device.application.mgt.publisher.ui.feature zip - - javax.servlet.jsp - javax.servlet.jsp-api - - - org.wso2.orbit.org.scannotation - scannotation - + + + + + + + + @@ -79,10 +79,10 @@ org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.server.feature:${carbon.device.mgt.version} org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.publisher.ui.feature:${carbon.device.mgt.version} - - javax.servlet.jsp:javax.servlet.jsp-api - org.wso2.orbit.org.scannotation:scannotation:${scannotation.version} - + + + + diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui.feature/pom.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui.feature/pom.xml index f9889befd7..4e1a6ce449 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui.feature/pom.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui.feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt application-mgt-feature - 3.1.34-SNAPSHOT + 3.1.40-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.application.mgt.publisher.ui.feature - 3.1.34-SNAPSHOT + 3.1.40-SNAPSHOT pom WSO2 Carbon - Application Management Publisher UI Feature http://wso2.org diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml index f30952ed26..f70e66d542 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt application-mgt-feature - 3.1.34-SNAPSHOT + 3.1.40-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.application.mgt.server.feature pom - 3.1.34-SNAPSHOT + 3.1.40-SNAPSHOT WSO2 Carbon - Application Management Server Feature http://wso2.org This feature contains the core bundles required for Back-end Application Management functionality @@ -44,16 +44,24 @@ org.wso2.carbon.devicemgt org.wso2.carbon.device.application.mgt.core - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.application.mgt.api.feature - zip - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.application.mgt.auth.handler.feature - zip - + + + + + + + + + + + + + + + + + + @@ -103,10 +111,10 @@ org.eclipse.equinox.p2.type.group:false - - org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.api.feature:${carbon.device.mgt.version} - org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.auth.handler.feature:${carbon.device.mgt.version} - + + + + org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.common:${carbon.device.mgt.version} @@ -114,12 +122,14 @@ org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.core:${carbon.device.mgt.version} + + - - org.wso2.carbon.core.server:${carbon.kernel.version} - + + + diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.store.ui.feature/pom.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.store.ui.feature/pom.xml index 95f67bde04..4984346402 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.store.ui.feature/pom.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.store.ui.feature/pom.xml @@ -23,12 +23,12 @@ org.wso2.carbon.devicemgt application-mgt-feature - 3.1.34-SNAPSHOT + 3.1.40-SNAPSHOT 4.0.0 org.wso2.carbon.device.application.mgt.store.ui.feature - 3.1.34-SNAPSHOT + 3.1.40-SNAPSHOT pom WSO2 Carbon - Application Management Store UI Feature http://wso2.org diff --git a/features/application-mgt/pom.xml b/features/application-mgt/pom.xml index 8bc11b1ec4..16d3db95a5 100644 --- a/features/application-mgt/pom.xml +++ b/features/application-mgt/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.1.34-SNAPSHOT + 3.1.40-SNAPSHOT ../../pom.xml 4.0.0 application-mgt-feature - 3.1.34-SNAPSHOT + 3.1.40-SNAPSHOT pom WSO2 Carbon - Application Management Feature http://wso2.org diff --git a/pom.xml b/pom.xml index 129a80971c..de54d16244 100644 --- a/pom.xml +++ b/pom.xml @@ -1740,7 +1740,6 @@ apk-parser ${net.dongliu.version} - javax.websocket @@ -2196,7 +2195,7 @@ 1.8 2.4.2 - + 7.0.85 1.0