Merge branch 'application-mgt-new' of https://github.com/lasanthaDLPDS/carbon-device-mgt into application-mgt-new

feature/appm-store/pbac
lasanthaDLPDS 6 years ago
commit f861134ff6

@ -51,21 +51,8 @@
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
<Bundle-Description>Application Management Common Bundle</Bundle-Description>
<Import-Package>
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
</Import-Package>
<Export-Package>

@ -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.*
</Import-Package>
<Embed-Dependency>apk-parser;scope=compile|runtime;inline=false</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Embed-StripGroup>true</Embed-StripGroup>
<!--<Embed-Transitive>true</Embed-Transitive>-->
<!--<Embed-StripGroup>true</Embed-StripGroup>-->
<Export-Package>
!org.wso2.carbon.device.application.mgt.core.internal.*,
org.wso2.carbon.device.application.mgt.core.*
</Export-Package>
<Axis2Deployer>PlatformDeployer</Axis2Deployer>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<systemPropertyVariables>
<jacoco-agent.destfile>${basedir}/target/coverage-reports/jacoco-unit.exec</jacoco-agent.destfile>
<log4j.configuration>file:src/test/resources/log4j.properties</log4j.configuration>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>

@ -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;

@ -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;

@ -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);
}
}

@ -20,4 +20,9 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="ApplicationManagementCore">
<test name="Util classes tests" preserve-order="true">
<classes>
<class name="org.wso2.carbon.device.application.mgt.core.ArtifactParserTest"/>
</classes>
</test>
</suite>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.api.feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Application Management API Feature</name>
<url>http://wso2.org</url>

@ -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);\
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);\

@ -22,12 +22,12 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.auth.handler.feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Application Management Authentication Handler Feature</name>
<description>This feature contains the Authentication Handler implementation for Publisher and Store.</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.0.46-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.extensions.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.46-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<name>WSO2 Carbon - Application Management Extension Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Application Management Extension Feature</description>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Application Management Aggregate Feature</name>
<url>http://wso2.org</url>
@ -45,14 +45,14 @@
<artifactId>org.wso2.carbon.device.application.mgt.publisher.ui.feature</artifactId>
<type>zip</type>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.orbit.org.scannotation</groupId>
<artifactId>scannotation</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>javax.servlet.jsp</groupId>-->
<!--<artifactId>javax.servlet.jsp-api</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.wso2.orbit.org.scannotation</groupId>-->
<!--<artifactId>scannotation</artifactId>-->
<!--</dependency>-->
</dependencies>
<build>
@ -79,10 +79,10 @@
<includedFeatureDef>org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.server.feature:${carbon.device.mgt.version}</includedFeatureDef>
<includedFeatureDef>org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.publisher.ui.feature:${carbon.device.mgt.version}</includedFeatureDef>
</includedFeatures>
<bundles>
<bundleDef>javax.servlet.jsp:javax.servlet.jsp-api</bundleDef>
<bundleDef>org.wso2.orbit.org.scannotation:scannotation:${scannotation.version}</bundleDef>
</bundles>
<!--<bundles>-->
<!--<bundleDef>javax.servlet.jsp:javax.servlet.jsp-api</bundleDef>-->
<!--<bundleDef>org.wso2.orbit.org.scannotation:scannotation:${scannotation.version}</bundleDef>-->
<!--</bundles>-->
</configuration>
</execution>
</executions>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.publisher.ui.feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Application Management Publisher UI Feature</name>
<url>http://wso2.org</url>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<name>WSO2 Carbon - Application Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for Back-end Application Management functionality
@ -44,16 +44,24 @@
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.core</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.api.feature</artifactId>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.auth.handler.feature</artifactId>
<type>zip</type>
</dependency>
<!--<dependency>-->
<!--<groupId>javax.servlet.jsp</groupId>-->
<!--<artifactId>javax.servlet.jsp-api</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.wso2.orbit.org.scannotation</groupId>-->
<!--<artifactId>scannotation</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.wso2.carbon.devicemgt</groupId>-->
<!--<artifactId>org.wso2.carbon.device.application.mgt.api.feature</artifactId>-->
<!--<type>zip</type>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.wso2.carbon.devicemgt</groupId>-->
<!--<artifactId>org.wso2.carbon.device.application.mgt.auth.handler.feature</artifactId>-->
<!--<type>zip</type>-->
<!--</dependency>-->
</dependencies>
<build>
@ -103,10 +111,10 @@
<propertyDef>org.eclipse.equinox.p2.type.group:false</propertyDef>
</properties>
</adviceFile>
<includedFeatures>
<includedFeatureDef>org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.api.feature:${carbon.device.mgt.version}</includedFeatureDef>
<includedFeatureDef>org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.auth.handler.feature:${carbon.device.mgt.version}</includedFeatureDef>
</includedFeatures>
<!--<includedFeatures>-->
<!--<includedFeatureDef>org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.api.feature:${carbon.device.mgt.version}</includedFeatureDef>-->
<!--<includedFeatureDef>org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.auth.handler.feature:${carbon.device.mgt.version}</includedFeatureDef>-->
<!--</includedFeatures>-->
<bundles>
<bundleDef>
org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.common:${carbon.device.mgt.version}
@ -114,12 +122,14 @@
<bundleDef>
org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.core:${carbon.device.mgt.version}
</bundleDef>
<!--<bundleDef>javax.servlet.jsp:javax.servlet.jsp-api</bundleDef>-->
<!--<bundleDef>org.wso2.orbit.org.scannotation:scannotation:${scannotation.version}</bundleDef>-->
</bundles>
<importBundles>
</importBundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}</importFeatureDef>
</importFeatures>
<!--<importFeatures>-->
<!--<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}</importFeatureDef>-->
<!--</importFeatures>-->
</configuration>
</execution>
</executions>

@ -23,12 +23,12 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.store.ui.feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Application Management Store UI Feature</name>
<url>http://wso2.org</url>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>application-mgt-feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Application Management Feature</name>
<url>http://wso2.org</url>

@ -1740,7 +1740,6 @@
<artifactId>apk-parser</artifactId>
<version>${net.dongliu.version}</version>
</dependency>
<!--websocket dependency-->
<dependency>
<groupId>javax.websocket</groupId>

Loading…
Cancel
Save