Merge branch 'wso2-master' into origin-wso2-master

revert-70aa11f8
sinthuja 7 years ago
commit a6e85b856a

@ -22,13 +22,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Annotations</name>
<description>WSO2 Carbon - API Management Custom Annotation Module</description>

@ -21,12 +21,12 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension.api</artifactId>
<packaging>war</packaging>
<name>WSO2 Carbon - API Application Management API</name>

@ -22,12 +22,12 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension</artifactId>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Application Management</name>

@ -17,18 +17,17 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.handlers</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Security Handler Component</name>
<description>WSO2 Carbon - API Management Security Handler Module</description>

@ -13,13 +13,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.client</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Integration Client</name>
<description>WSO2 Carbon - API Management Integration Client</description>

@ -13,13 +13,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.generated.client</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Integration Generated Client</name>
<description>WSO2 Carbon - API Management Integration Client</description>

@ -22,13 +22,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Webapp Publisher</name>
<description>WSO2 Carbon - API Management Webapp Publisher</description>

@ -89,7 +89,7 @@ APIPublisherServiceTest extends BaseAPIPublisherTest {
@Test(description = "createAPIListWithNoApi | will fail if there are any exceptions")
private void publishWithNoAPIListCreated() throws APIManagerPublisherException {
APIConfig apiConfig = new APIConfig();
setApiConfigs(apiConfig, "testAPI-3");
setApiConfigs(apiConfig, "testAPI-2");
APIPublisherDataHolder apiPublisherDataHolder = Mockito.mock(APIPublisherDataHolder.getInstance().
getClass(), Mockito.CALLS_REAL_METHODS);
IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl.
@ -118,7 +118,7 @@ APIPublisherServiceTest extends BaseAPIPublisherTest {
@Test(description = "createAPIList | will fail if there are any exceptions")
private void publishWithAPIListCreated() throws APIManagerPublisherException {
APIConfig apiConfig = new APIConfig();
setApiConfigs(apiConfig, "testAPI-2");
setApiConfigs(apiConfig, "testAPI-3");
APIPublisherDataHolder apiPublisherDataHolder = Mockito.mock(APIPublisherDataHolder.getInstance().
getClass(), Mockito.CALLS_REAL_METHODS);
IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl.
@ -134,7 +134,7 @@ APIPublisherServiceTest extends BaseAPIPublisherTest {
doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString());
APIList apiList = Mockito.mock(APIList.class, Mockito.CALLS_REAL_METHODS);
APIInfo apiInfo = new APIInfo();
apiInfo.setName("testAPI-2");
apiInfo.setName("testAPI-3");
apiInfo.setVersion("1.0.0");
apiInfo.setId("test-one");
List<APIInfo> apiInfoList = new ArrayList<>();
@ -148,6 +148,18 @@ APIPublisherServiceTest extends BaseAPIPublisherTest {
apiPublisherService.publishAPI(apiConfig);
}
@Test(description = "publish API with scope added | will fail if there are any exceptions")
private void publishWithAPIScope() throws APIManagerPublisherException {
APIConfig apiConfig = new APIConfig();
setApiConfigs(apiConfig, "testAPI-4");
Set<ApiScope> scopes = new HashSet<>();
ApiScope apiScope = new ApiScope();
apiScope.setDescription("testing");
scopes.add(apiScope);
apiConfig.setScopes(scopes);
apiPublisherService.publishAPI(apiConfig);
}
private void setApiConfigs(APIConfig apiConfig, String name) {
apiConfig.setName(name);
apiConfig.setContext("api/device-mgt/windows/v1.g0/admin/devices");

@ -0,0 +1,126 @@
/*
* Copyright (c) 2017, 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.apimgt.webapp.publisher;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import org.wso2.carbon.apimgt.webapp.publisher.config.APIResource;
import org.wso2.carbon.apimgt.webapp.publisher.config.APIResourceConfiguration;
import org.wso2.carbon.apimgt.webapp.publisher.config.WebappPublisherConfig;
import org.wso2.carbon.apimgt.webapp.publisher.dto.ApiScope;
import org.wso2.carbon.apimgt.webapp.publisher.exception.APIManagerPublisherException;
import org.wso2.carbon.apimgt.webapp.publisher.utils.MockServletContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.registry.core.jdbc.realm.InMemoryRealmService;
import org.wso2.carbon.user.api.RealmConfiguration;
import org.wso2.carbon.user.api.UserRealm;
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import javax.servlet.ServletContext;
import java.util.ArrayList;
import java.util.List;
import static org.wso2.carbon.apimgt.webapp.publisher.APIPublisherUtil.buildApiConfig;
/**
* This is the test class for {@link APIPublisherUtil}
*/
public class APIPublisherUtilTest extends BaseAPIPublisherTest {
@BeforeTest
public void initialConfigs() throws WebappPublisherConfigurationFailedException,
org.wso2.carbon.user.core.UserStoreException, RegistryException {
WebappPublisherConfig.init();
setUserRealm();
}
@Test(description = "test buildAPIConfig method and ensures an APIConfig is created")
private void buildApiConfigTest() throws UserStoreException, RegistryException {
try {
startTenantFlowAsTestTenant();
ServletContext servletContext = new MockServletContext();
APIResourceConfiguration apiDef = new APIResourceConfiguration();
List<APIResource> resources = new ArrayList<>();
apiDef.setResources(resources);
APIConfig apiConfig = buildApiConfig(servletContext, apiDef);
Assert.assertNotNull(apiConfig, "API configuration is null.");
} finally {
PrivilegedCarbonContext.endTenantFlow();
}
}
@Test(description = "test buildAPIConfig method as SuperTenant and ensures" +
" an APIConfig is created")
private void buildApiConfigAsSuperTenat() throws UserStoreException {
ServletContext servletContext = new MockServletContext();
APIResourceConfiguration apiDef = new APIResourceConfiguration();
List<APIResource> resources = new ArrayList<>();
apiDef.setResources(resources);
APIConfig apiConfig = buildApiConfig(servletContext, apiDef);
Assert.assertNotNull(apiConfig, "API configuration is null.");
}
@Test(description = "test buildAPIConfig with API tags specified and ensures " +
"an APIConfig is created")
private void buildApiConfigTestWithTags() throws UserStoreException {
ServletContext servletContext = new MockServletContext();
APIResourceConfiguration apiDef = new APIResourceConfiguration();
List<APIResource> resources = new ArrayList<>();
APIResource apiResource = new APIResource();
resources.add(apiResource);
apiDef.setResources(resources);
apiDef.setTags(new String[]{"windows", "device_management"});
APIConfig apiConfig = buildApiConfig(servletContext, apiDef);
Assert.assertNotNull(apiConfig, "API configuration is null.");
}
@Test(description = "test buildAPIConfig method with API scopes specified and " +
"ensures an APIConfig is created")
private void buildApiConfigTestWithScope() throws UserStoreException, APIManagerPublisherException {
ServletContext servletContext = new MockServletContext();
APIResourceConfiguration apiDef = new APIResourceConfiguration();
List<APIResource> resources = new ArrayList<>();
APIResource apiResource = new APIResource();
ApiScope apiScope = new ApiScope();
apiScope.setDescription("testing");
apiResource.setScope(apiScope);
resources.add(apiResource);
apiDef.setResources(resources);
apiDef.setTags(new String[]{"windows", "device_management"});
APIConfig apiConfig = buildApiConfig(servletContext, apiDef);
Assert.assertNotNull(apiConfig, "API configuration is null.");
}
private void setUserRealm() throws RegistryException, org.wso2.carbon.user.core.UserStoreException {
RealmConfiguration configuration = new RealmConfiguration();
UserRealm userRealm = new InMemoryRealmService().getUserRealm(configuration);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUserRealm(userRealm);
}
private void startTenantFlowAsTestTenant() throws org.wso2.carbon.user.core.UserStoreException, RegistryException {
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(1212);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain("test.com");
setUserRealm();
}
}

@ -0,0 +1,285 @@
/*
* Copyright (c) 2017, 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.apimgt.webapp.publisher.utils;
import javax.servlet.*;
import javax.servlet.descriptor.JspConfigDescriptor;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
import java.util.EventListener;
import java.util.Map;
import java.util.Set;
public class MockServletContext implements ServletContext {
@Override
public ServletContext getContext(String s) {
return null;
}
@Override
public String getContextPath() {
return null;
}
@Override
public int getMajorVersion() {
return 0;
}
@Override
public int getMinorVersion() {
return 0;
}
@Override
public int getEffectiveMajorVersion() {
return 0;
}
@Override
public int getEffectiveMinorVersion() {
return 0;
}
@Override
public String getMimeType(String s) {
return null;
}
@Override
public Set<String> getResourcePaths(String s) {
return null;
}
@Override
public URL getResource(String s) throws MalformedURLException {
return null;
}
@Override
public InputStream getResourceAsStream(String s) {
return null;
}
@Override
public RequestDispatcher getRequestDispatcher(String s) {
return null;
}
@Override
public RequestDispatcher getNamedDispatcher(String s) {
return null;
}
@Override
public Servlet getServlet(String s) throws ServletException {
return null;
}
@Override
public Enumeration<Servlet> getServlets() {
return null;
}
@Override
public Enumeration<String> getServletNames() {
return null;
}
@Override
public void log(String s) {
}
@Override
public void log(Exception e, String s) {
}
@Override
public void log(String s, Throwable throwable) {
}
@Override
public String getRealPath(String s) {
return null;
}
@Override
public String getServerInfo() {
return null;
}
@Override
public String getInitParameter(String s) {
return "true";
}
@Override
public Enumeration<String> getInitParameterNames() {
return null;
}
@Override
public boolean setInitParameter(String s, String s1) {
return false;
}
@Override
public Object getAttribute(String s) {
return null;
}
@Override
public Enumeration<String> getAttributeNames() {
return null;
}
@Override
public void setAttribute(String s, Object o) {
}
@Override
public void removeAttribute(String s) {
}
@Override
public String getServletContextName() {
return null;
}
@Override
public ServletRegistration.Dynamic addServlet(String s, String s1) {
return null;
}
@Override
public ServletRegistration.Dynamic addServlet(String s, Servlet servlet) {
return null;
}
@Override
public ServletRegistration.Dynamic addServlet(String s, Class<? extends Servlet> aClass) {
return null;
}
@Override
public <T extends Servlet> T createServlet(Class<T> aClass) throws ServletException {
return null;
}
@Override
public ServletRegistration getServletRegistration(String s) {
return null;
}
@Override
public Map<String, ? extends ServletRegistration> getServletRegistrations() {
return null;
}
@Override
public FilterRegistration.Dynamic addFilter(String s, String s1) {
return null;
}
@Override
public FilterRegistration.Dynamic addFilter(String s, Filter filter) {
return null;
}
@Override
public FilterRegistration.Dynamic addFilter(String s, Class<? extends Filter> aClass) {
return null;
}
@Override
public <T extends Filter> T createFilter(Class<T> aClass) throws ServletException {
return null;
}
@Override
public FilterRegistration getFilterRegistration(String s) {
return null;
}
@Override
public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
return null;
}
@Override
public SessionCookieConfig getSessionCookieConfig() {
return null;
}
@Override
public void setSessionTrackingModes(Set<SessionTrackingMode> set) throws IllegalStateException, IllegalArgumentException {
}
@Override
public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
return null;
}
@Override
public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
return null;
}
@Override
public void addListener(String s) {
}
@Override
public <T extends EventListener> void addListener(T t) {
}
@Override
public void addListener(Class<? extends EventListener> aClass) {
}
@Override
public <T extends EventListener> T createListener(Class<T> aClass) throws ServletException {
return null;
}
@Override
public void declareRoles(String... strings) {
}
@Override
public ClassLoader getClassLoader() {
return null;
}
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
return null;
}
}

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apimgt-extensions</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Component</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -21,13 +21,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.core</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Certificate Management Core</name>
<description>WSO2 Carbon - Certificate Management Core</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Component</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -78,7 +78,7 @@ public class DeviceTypeCAppDeployer implements AppDeploymentHandler {
}
private void deployTypeSpecifiedArtifacts(List<Artifact> artifacts, AxisConfiguration axisConfig,
protected void deployTypeSpecifiedArtifacts(List<Artifact> artifacts, AxisConfiguration axisConfig,
String fileType, String directory) throws DeploymentException {
for (Artifact artifact : artifacts) {
Deployer deployer = AppDeployerUtils.getArtifactDeployer(axisConfig, directory, fileType);
@ -118,7 +118,7 @@ public class DeviceTypeCAppDeployer implements AppDeploymentHandler {
}
private void undeployTypeSpecifiedArtifacts(List<Artifact> artifacts, AxisConfiguration axisConfig, String fileType
protected void undeployTypeSpecifiedArtifacts(List<Artifact> artifacts, AxisConfiguration axisConfig, String fileType
, String directory) throws DeploymentException {
for (Artifact artifact : artifacts) {
Deployer deployer = AppDeployerUtils.getArtifactDeployer(axisConfig, directory, fileType);

@ -0,0 +1,131 @@
/*
* Copyright (c) 2017, 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.mgt.extensions.device.type.deployer;
import org.apache.axis2.deployment.DeploymentException;
import org.apache.axis2.engine.AxisConfiguration;
import org.mockito.Mockito;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.application.deployer.CarbonApplication;
import org.wso2.carbon.application.deployer.config.ApplicationConfiguration;
import org.wso2.carbon.application.deployer.config.Artifact;
import org.wso2.carbon.application.deployer.config.CappFile;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.util.DeviceTypePluginConstants;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
/*
Unit tests for deviceTypeCAppDeployer
*/
public class DeviceTypeCAppDeployerTest {
private DeviceTypeCAppDeployer deviceTypeCAppDeployer;
private CarbonApplication carbonApplication = null;
private AxisConfiguration axisConfiguration = null;
private ApplicationConfiguration applicationConfiguration = null;
private CappFile cappFile = new CappFile();
private void initializeActifact(String type) {
Artifact tempArtifact = new Artifact();
cappFile.setName("testCappFile");
tempArtifact.setType(type);
tempArtifact.addFile(cappFile);
Artifact.Dependency dependency = new Artifact.Dependency();
dependency.setArtifact(tempArtifact);
tempArtifact.addDependency(dependency);
Mockito.doReturn(tempArtifact).when(applicationConfiguration).getApplicationArtifact();
}
private void initializeErrorArtifact() {
Artifact errArtifact = new Artifact();
errArtifact.setType(DeviceTypePluginConstants.CDMF_PLUGIN_TYPE);
Artifact.Dependency dependency = new Artifact.Dependency();
dependency.setArtifact(errArtifact);
errArtifact.addDependency(dependency);
Mockito.doReturn(errArtifact).when(applicationConfiguration).getApplicationArtifact();
}
@BeforeClass
public void init() throws NoSuchFieldException, IllegalAccessException, IOException, RegistryException {
Field deviceTypePlugins;
Field deviceTypeUIs;
deviceTypeCAppDeployer = Mockito.mock(DeviceTypeCAppDeployer.class, Mockito.CALLS_REAL_METHODS);
carbonApplication = Mockito.mock(CarbonApplication.class, Mockito.CALLS_REAL_METHODS);
axisConfiguration = Mockito.mock(AxisConfiguration.class, Mockito.CALLS_REAL_METHODS);
applicationConfiguration = Mockito.mock(ApplicationConfiguration.class, Mockito.CALLS_REAL_METHODS);
Mockito.doReturn(applicationConfiguration).when(carbonApplication).getAppConfig();
Mockito.doNothing().when(deviceTypeCAppDeployer).deployTypeSpecifiedArtifacts(Mockito.any(), Mockito.any(),
Mockito.any(), Mockito.any());
Mockito.doNothing().when(deviceTypeCAppDeployer).undeployTypeSpecifiedArtifacts(Mockito.any(), Mockito.any(),
Mockito.any(), Mockito.any());
this.initializeCarbonContext();
deviceTypePlugins = DeviceTypeCAppDeployer.class.getDeclaredField("deviceTypePlugins");
deviceTypePlugins.setAccessible(true);
deviceTypePlugins.set(deviceTypeCAppDeployer, new ArrayList<Artifact>());
deviceTypeUIs = DeviceTypeCAppDeployer.class.getDeclaredField("deviceTypeUIs");
deviceTypeUIs.setAccessible(true);
deviceTypeUIs.set(deviceTypeCAppDeployer, new ArrayList<Artifact>());
}
private void initializeCarbonContext() throws IOException, RegistryException {
if (System.getProperty("carbon.home") == null) {
File file = new File("src/test/resources");
if (file.exists()) {
System.setProperty("carbon.home", file.getAbsolutePath());
}
}
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(
org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(
org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_ID);
}
@Test(description = "deploying a capp of plugin type")
public void testDeployCarbonAppsPluginType() throws DeploymentException, IllegalAccessException {
initializeActifact(DeviceTypePluginConstants.CDMF_PLUGIN_TYPE);
deviceTypeCAppDeployer.deployArtifacts(carbonApplication, axisConfiguration);
}
@Test(description = "deploying an erroneous car file")
public void testDeployErrorArtifact() throws DeploymentException, IllegalAccessException {
initializeErrorArtifact();
deviceTypeCAppDeployer.deployArtifacts(carbonApplication, axisConfiguration);
}
@Test(dependsOnMethods = {"testDeployCarbonAppsPluginType"}, description = "undeploying previously deployed capp")
public void testUndeployCarbonAppsPluginType() throws DeploymentException {
deviceTypeCAppDeployer.undeployArtifacts(carbonApplication, axisConfiguration);
}
@Test(dependsOnMethods = {"testUndeployCarbonAppsPluginType"}, description = "deploying a capp of UI type")
public void testDeployCarbonAppsUiType() throws DeploymentException, IllegalAccessException {
initializeActifact(DeviceTypePluginConstants.CDMF_UI_TYPE);
deviceTypeCAppDeployer.deployArtifacts(carbonApplication, axisConfiguration);
}
@Test(dependsOnMethods = {"testDeployCarbonAppsUiType"}, description = "Undeploy previously deployed capp")
public void testUndeployCarbonAppsUiType() throws DeploymentException {
deviceTypeCAppDeployer.undeployArtifacts(carbonApplication, axisConfiguration);
}
}

@ -40,9 +40,12 @@ import java.util.concurrent.ConcurrentHashMap;
public class DeviceTypePluginDeployerTest {
private DeviceTypePluginDeployer deviceTypePluginDeployer;
private DeploymentFileData deploymentFileData;
private DeploymentFileData invalidDeploymentFileData;
private Field deviceTypeServiceRegistrations = null;
private Field deviceTypeConfigurationDataMap = null;
private ServiceRegistration serviceRegistration = null;
private File file = new File("src/test/resources/android.xml");
private File invalidFile = new File("src/test/resources/invalidAndroid.xml");
@BeforeClass
public void init() throws NoSuchFieldException, IllegalAccessException, IOException, RegistryException {
@ -59,10 +62,15 @@ public class DeviceTypePluginDeployerTest {
deviceTypeConfigurationDataMap.setAccessible(true);
deviceTypeConfigurationDataMap.set(deviceTypePluginDeployer, new ConcurrentHashMap());
this.initializeCarbonContext();
if (file.exists()) {
deploymentFileData = new DeploymentFileData(file);
}
if (invalidFile.exists()) {
invalidDeploymentFileData = new DeploymentFileData(invalidFile);
}
}
private void initializeCarbonContext() throws IOException, RegistryException {
if (System.getProperty("carbon.home") == null) {
File file = new File("src/test/resources");
if (file.exists()) {
@ -78,10 +86,6 @@ public class DeviceTypePluginDeployerTest {
@SuppressWarnings("unchecked")
@Test(description = "Testing deviceType deploy method by deploying Android device type")
public void deploy() throws DeploymentException, IllegalAccessException {
File file = new File("src/test/resources/android.xml");
if (file.exists()) {
deploymentFileData = new DeploymentFileData(file);
}
deviceTypePluginDeployer.deploy(deploymentFileData);
Map<String, ServiceRegistration> tempServiceRegistration = (Map<String, ServiceRegistration>)
deviceTypeServiceRegistrations.get(deviceTypePluginDeployer);
@ -92,4 +96,29 @@ public class DeviceTypePluginDeployerTest {
.getAbsolutePath());
Assert.assertEquals(deviceTypeConfigIdentifier.getDeviceType(), "android");
}
@Test(description = "Testing exception for invalid xml files", expectedExceptions = {org.apache.axis2.deployment
.DeploymentException.class})
public void deployInvalidXml() throws DeploymentException, IllegalAccessException {
deviceTypePluginDeployer.deploy(invalidDeploymentFileData);
}
@Test(description = "Testing exception for non existing xml file", expectedExceptions = {org.apache.axis2.deployment
.DeploymentException.class})
public void unDeployInvalidXml() throws DeploymentException, IllegalAccessException {
deviceTypePluginDeployer.deploy(new DeploymentFileData(new File("src/test/resources/notExist.xml")));
}
@SuppressWarnings("unchecked")
@Test(dependsOnMethods = {"deploy"} , description = "Testing deviceType undeploy method by un-deploying Android " +
"device type")
public void unDeploy() throws DeploymentException, IllegalAccessException {
deviceTypePluginDeployer.undeploy(deploymentFileData.getAbsolutePath());
Map<String, ServiceRegistration> tempServiceRegistration = (Map<String, ServiceRegistration>)
deviceTypeServiceRegistrations.get(deviceTypePluginDeployer);
Assert.assertNull(tempServiceRegistration.get(deploymentFileData.getAbsolutePath()));
Map<String, DeviceTypeConfigIdentifier> tempDeviceTypeConfig = (Map<String, DeviceTypeConfigIdentifier>)
deviceTypeConfigurationDataMap.get(deviceTypePluginDeployer);
Assert.assertNull(tempDeviceTypeConfig.get(deploymentFileData.getAbsolutePath()));
}
}

@ -0,0 +1,382 @@
<?xml version="1.0" encoding="utf-8"?
<!--
~ Copyright (c) 2017, 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.
-->
<DeviceTypeConfiguration name="android">
<DeviceDetails table-id="AD_DEVICE"/>
<License>
<Language>en_US</Language>
<Version>1.0.0</Version>
<Text>This End User License Agreement ("Agreement") is a legal agreement between you ("You") and WSO2,
Inc., regarding the enrollment of Your personal mobile device ("Device") in SoR's mobile device
management program, and the loading to and removal from Your Device and Your use of certain
applications and any associated software and user documentation, whether provided in "online" or
electronic format, used in connection with the operation of or provision of services to WSO2,
Inc., BY SELECTING "I ACCEPT" DURING INSTALLATION, YOU ARE ENROLLING YOUR DEVICE, AND THEREBY
AUTHORIZING SOR OR ITS AGENTS TO INSTALL, UPDATE AND REMOVE THE APPS FROM YOUR DEVICE AS DESCRIBED
IN THIS AGREEMENT. YOU ARE ALSO EXPLICITLY ACKNOWLEDGING AND AGREEING THAT (1) THIS IS A BINDING
CONTRACT AND (2) YOU HAVE READ AND AGREE TO THE TERMS OF THIS AGREEMENT.
IF YOU DO NOT ACCEPT THESE TERMS, DO NOT ENROLL YOUR DEVICE AND DO NOT PROCEED ANY FURTHER.
You agree that: (1) You understand and agree to be bound by the terms and conditions contained in
this Agreement, and (2) You are at least 21 years old and have the legal capacity to enter into
this Agreement as defined by the laws of Your jurisdiction. SoR shall have the right, without
prior notice, to terminate or suspend (i) this Agreement, (ii) the enrollment of Your Device, or
(iii) the functioning of the Apps in the event of a violation of this Agreement or the cessation
of Your relationship with SoR (including termination of Your employment if You are an employee or
expiration or termination of Your applicable franchise or supply agreement if You are a franchisee
of or supplier to the WSO2 WSO2, Inc., system). SoR expressly reserves all rights not expressly
granted herein.
</Text>
</License>
<ProvisioningConfig>
<SharedWithAllTenants>true</SharedWithAllTenants>
</ProvisioningConfig>
<!--
isScheduled element used to enable scheduler task to send push notification.
Task will send push notification as batches. So this will reduce sudden request burst when many devices try to
access server after receiving push notification.
-->
<!--Configuration for enable firebase push notifications-->
<!--<PushNotificationProviderConfig type="FCM" isScheduled="false">-->
<!--</PushNotificationProviderConfig>-->
<DataSource>
<JndiConfig>
<Name>jdbc/MobileAndroidDM_DS</Name>
</JndiConfig>
<TableConfig>
<Table name="AD_DEVICE">
<PrimaryKey>DEVICE_ID</PrimaryKey>
<Attributes>
<Attribute>FCM_TOKEN</Attribute>
<Attribute>DEVICE_INFO</Attribute>
<Attribute>IMEI</Attribute>
<Attribute>IMSI</Attribute>
<Attribute>OS_VERSION</Attribute>
<Attribute>DEVICE_MODEL</Attribute>
<Attribute>VENDOR</Attribute>
<Attribute>LATITUDE</Attribute>
<Attribute>LONGITUDE</Attribute>
<Attribute>SERIAL</Attribute>
<Attribute>MAC_ADDRESS</Attribute>
<Attribute>DEVICE_NAME</Attribute>
<Attribute>OS_BUILD_DATE</Attribute>
</Attributes>
</Table>
</TableConfig>
</DataSource>
<Features>
<Feature code="DEVICE_RING">
<Name>Ring</Name>
<Description>Ring the device</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/ring" method="POST" type="application/json">
</Operation>
</Feature>
<Feature code="DEVICE_LOCK">
<Name>Device Lock</Name>
<Description>Lock the device</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/lock-devices" method="POST" type="application/json">
</Operation>
</Feature>
<Feature code="DEVICE_LOCATION">
<Name>Location</Name>
<Description>Request coordinates of device location</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/location" method="POST" type="application/json">
</Operation>
</Feature>
<Feature code="CLEAR_PASSWORD">
<Name>Clear Password</Name>
<Description>Clear current password</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/clear-password" method="POST" type="application/json">
</Operation>
</Feature>
<Feature code="DEVICE_REBOOT">
<Name>Reboot</Name>
<Description>Reboot the device</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/reboot" method="POST" type="application/json">
</Operation>
</Feature>
<Feature code="UPGRADE_FIRMWARE">
<Name>Upgrade Firmware</Name>
<Description>Upgrade Firmware</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/upgrade-firmware" method="POST" type="application/json">
</Operation>
</Feature>
<Feature code="DEVICE_MUTE">
<Name>Mute</Name>
<Description>Enable mute in the device</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/mute" method="POST" type="application/json">
</Operation>
</Feature>
<Feature code="NOTIFICATION">
<Name>Message</Name>
<Description>Send message</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/send-notification" method="POST" type="application/json">
</Operation>
</Feature>
<Feature code="CHANGE_LOCK_CODE">
<Name>Change Lock-code</Name>
<Description>Change current lock code</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/change-lock-code" method="POST" type="application/json">
</Operation>
</Feature>
<Feature code="ENTERPRISE_WIPE">
<Name>Enterprise Wipe</Name>
<Description>Remove enterprise applications</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/enterprise-wipe" method="POST" type="application/json">
</Operation>
</Feature>
<Feature code="WIPE_DATA">
<Name>Wipe Data</Name>
<Description>Factory reset the device</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/wipe" method="POST" type="application/json">
</Operation>
</Feature>
<Feature code="WIFI">
<Name>Wifi</Name>
<Description>Setting up wifi configuration</Description>
</Feature>
<Feature code="CAMERA">
<Name>Camera</Name>
<Description>Enable or disable camera</Description>
</Feature>
<Feature code="EMAIL">
<Name>Email</Name>
<Description>Configure email settings</Description>
</Feature>
<Feature code="DEVICE_INFO">
<Name>Device info</Name>
<Description>Request device information</Description>
</Feature>
<Feature code="APPLICATION_LIST">
<Name>Application List</Name>
<Description>Request list of current installed applications</Description>
</Feature>
<Feature code="INSTALL_APPLICATION">
<Name>Install App</Name>
<Description>Install App</Description>
</Feature>
<Feature code="UNINSTALL_APPLICATION">
<Name>Uninstall App</Name>
<Description>Uninstall App</Description>
</Feature>
<Feature code="BLACKLIST_APPLICATIONS">
<Name>Blacklist app</Name>
<Description>Blacklist applications</Description>
</Feature>
<Feature code="ENCRYPT_STORAGE">
<Name>Encrypt Storage</Name>
<Description>Encrypt storage</Description>
</Feature>
<Feature code="PASSCODE_POLICY">
<Name>Password Policy</Name>
<Description>Set passcode policy</Description>
</Feature>
<Feature code="VPN">
<Name>Configure VPN</Name>
<Description>Configure VPN settings</Description>
</Feature>
<Feature code="DISALLOW_ADJUST_VOLUME">
<Name>Disallow user to change volume</Name>
<Description>Allow or disallow user to change volume"</Description>
</Feature>
<Feature code="DISALLOW_CONFIG_BLUETOOTH">
<Name>Disallow bluetooth configuration</Name>
<Description>Allow or disallow bluetooth configuration</Description>
</Feature>
<Feature code="DISALLOW_CONFIG_CELL_BROADCASTS">
<Name>Disallow user to change cell broadcast configurations</Name>
<Description>Allow or disallow user to change cell broadcast configurations</Description>
</Feature>
<Feature code="DISALLOW_CONFIG_CREDENTIALS">
<Name>Disallow user to change user credentials</Name>
<Description>Allow or disallow user to change user credentials</Description>
</Feature>
<Feature code="DISALLOW_CONFIG_MOBILE_NETWORKS">
<Name>Disallow user to change mobile networks configurations</Name>
<Description>Allow or disallow user to change mobile networks configurations</Description>
</Feature>
<Feature code="DISALLOW_CONFIG_TETHERING">
<Name>Disallow user to change tethering configurations</Name>
<Description>Allow or disallow user to change tethering configurations</Description>
</Feature>
<Feature code="DISALLOW_CONFIG_VPN">
<Name>Disallow user to change VPN configurations</Name>
<Description>Allow or disallow user to change VPN configurations</Description>
</Feature>
<Feature code="DISALLOW_CONFIG_WIFI">
<Name>Disallow user to change WIFI configurations</Name>
<Description>Allow or disallow user to change WIFI configurations</Description>
</Feature>
<Feature code="DISALLOW_APPS_CONTROL">
<Name>Disallow user to change app control</Name>
<Description>Allow or disallow user to change app control</Description>
</Feature>
<Feature code="DISALLOW_CREATE_WINDOWS">
<Name>Disallow window creation</Name>
<Description>Allow or disallow window creation</Description>
</Feature>
<Feature code="DISALLOW_APPS_CONTROL">
<Name>Disallow user to change app control configurations</Name>
<Description>Allow or disallow user to change app control configurations</Description>
</Feature>
<Feature code="DISALLOW_CROSS_PROFILE_COPY_PASTE">
<Name>Disallow cross profile copy paste</Name>
<Description>Allow or disallow cross profile copy paste</Description>
</Feature>
<Feature code="DISALLOW_DEBUGGING_FEATURES">
<Name>Disallow debugging features</Name>
<Description>Allow or disallow debugging features</Description>
</Feature>
<Feature code="DISALLOW_FACTORY_RESET">
<Name>Disallow factory reset</Name>
<Description>Allow or disallow factory reset</Description>
</Feature>
<Feature code="DISALLOW_ADD_USER">
<Name>Disallow add user</Name>
<Description>Allow or disallow add user</Description>
</Feature>
<Feature code="DISALLOW_INSTALL_APPS">
<Name>Disallow install apps</Name>
<Description>Allow or disallow install apps</Description>
</Feature>
<Feature code="DISALLOW_INSTALL_UNKNOWN_SOURCES">
<Name>Disallow install unknown sources</Name>
<Description>Allow or disallow install unknown sources</Description>
</Feature>
<Feature code="DISALLOW_MODIFY_ACCOUNTS">
<Name>Disallow modify account</Name>
<Description>Allow or disallow modify account</Description>
</Feature>
<Feature code="DISALLOW_MOUNT_PHYSICAL_MEDIA">
<Name>Disallow mount physical media</Name>
<Description>Allow or disallow mount physical media</Description>
</Feature>
<Feature code="DISALLOW_NETWORK_RESET">
<Name>Disallow network reset</Name>
<Description>Allow or disallow network reset</Description>
</Feature>
<Feature code="DISALLOW_OUTGOING_BEAM">
<Name>Disallow outgoing beam</Name>
<Description>Allow or disallow outgoing beam</Description>
</Feature>
<Feature code="DISALLOW_OUTGOING_CALLS">
<Name>Disallow outgoing calls</Name>
<Description>Allow or disallow outgoing calls</Description>
</Feature>
<Feature code="DISALLOW_REMOVE_USER">
<Name>Disallow remove users</Name>
<Description>Allow or disallow remove users</Description>
</Feature>
<Feature code="DISALLOW_SAFE_BOOT">
<Name>Disallow safe boot</Name>
<Description>Allow or disallow safe boot</Description>
</Feature>
<Feature code="DISALLOW_SHARE_LOCATION">
<Name>Disallow share location</Name>
<Description>Allow or disallow share location</Description>
</Feature>
<Feature code="DISALLOW_SMS">
<Name>Disallow sms</Name>
<Description>Allow or disallow sms</Description>
</Feature>
<Feature code="DISALLOW_UNINSTALL_APPS">
<Name>Disallow uninstall app</Name>
<Description>Allow or disallow uninstall app</Description>
</Feature>
<Feature code="DISALLOW_UNMUTE_MICROPHONE">
<Name>Disallow unmute mic</Name>
<Description>Allow or disallow unmute mic</Description>
</Feature>
<Feature code="DISALLOW_USB_FILE_TRANSFER">
<Name>Disallow usb file transfer</Name>
<Description>Allow or disallow usb file transfer</Description>
</Feature>
<Feature code="ALLOW_PARENT_PROFILE_APP_LINKING">
<Name>Disallow parent profile app linking</Name>
<Description>Allow or disallow parent profile app linking</Description>
</Feature>
<Feature code="ENSURE_VERIFY_APPS">
<Name>Disallow ensure verify apps</Name>
<Description>Allow or disallow ensure verify apps</Description>
</Feature>
<Feature code="AUTO_TIME">
<Name>Disallow auto timing</Name>
<Description>Allow or disallow auto timing</Description>
</Feature>
<Feature code="REMOVE_DEVICE_OWNER">
<Name>Remove device owner</Name>
<Description>Remove device owner</Description>
</Feature>
<Feature code="LOGCAT">
<Name>Fetch device logcat</Name>
<Description>Fetch device logcat</Description>
</Feature>
<Feature code="DEVICE_UNLOCK">
<Name>Unlock the device</Name>
<Description>Unlock the device</Description>
</Feature>
</Features>
<TaskConfiguration>
<Enable>true</Enable>
<Frequency>60000</Frequency>
<Operations>
<Operation>
<Name>DEVICE_INFO</Name>
<RecurrentTimes>1</RecurrentTimes>
</Operation>
<Operation>
<Name>APPLICATION_LIST</Name>
<RecurrentTimes>5</RecurrentTimes>
</Operation>
<Operation>
<Name>DEVICE_LOCATION</Name>
<RecurrentTimes>1</RecurrentTimes>
</Operation>
</Operations>
</TaskConfiguration>
<PolicyMonitoring enabled="true"/>
<InitialOperationConfig>
<Operations>
<Operation>DEVICE_INFO</Operation>
<Operation>APPLICATION_LIST</Operation>
<Operation>DEVICE_LOCATION</Operation>
</Operations>
</InitialOperationConfig>
<!--This configures the Task service for the android device-type. Given below are the property definitions.
<RequireStatusMonitoring> - This will enable or disable status monitoring for that particular device-type.
<Frequency> - The time interval (in seconds) in which the task should run for this device-type
<IdleTimeToMarkInactive> - The time duration (in seconds) in which the device can be moved to inactive status
which means the device will be moved to inactive status if that device does not
contact the server within that time period. Better to have a multiplier of Frequency.
<IdleTimeToMarkUnreachable> - The time duration (in seconds) in which the device can be moved to unreachable status
which means the device will be moved to unreachable status if that device does not
contact the server within that time period. Better to have a multiplier of Frequency.
-->
<DeviceStatusTaskConfig>
<RequireStatusMonitoring>true</RequireStatusMonitoring>
<Frequency>300</Frequency>
<IdleTimeToMarkInactive>900</IdleTimeToMarkInactive>
<IdleTimeToMarkUnreachable>600</IdleTimeToMarkUnreachable>
</DeviceStatusTaskConfig>
</DeviceTypeConfiguration>

@ -23,6 +23,7 @@
<test name="Extension Unit Tests" preserve-order="true">
<classes>
<class name="org.wso2.carbon.device.mgt.extensions.device.type.deployer.DeviceTypePluginDeployerTest"/>
<class name="org.wso2.carbon.device.mgt.extensions.device.type.deployer.DeviceTypeCAppDeployerTest"/>
</classes>
</test>
</suite>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>carbon-devicemgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -21,7 +21,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -23,9 +23,12 @@ import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.dao.EnrollmentDAO;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationMapping;
import java.sql.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -201,11 +204,36 @@ public class EnrollmentDAOImpl implements EnrollmentDAO {
return true;
}
private int getCountOfDevicesOfOwner(String owner, int tenantID) throws DeviceManagementDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
int count = 0;
try {
conn = this.getConnection();
String checkQuery = "SELECT COUNT(ID) AS COUNT FROM DM_ENROLMENT WHERE OWNER = ? AND TENANT_ID = ?";
stmt = conn.prepareStatement(checkQuery);
stmt.setString(1, owner);
stmt.setInt(2, tenantID);
rs = stmt.executeQuery();
if(rs.next()){
count = rs.getInt("COUNT");
}
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while trying to get device " +
"count of Owner : "+owner, e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
return count;
}
@Override
public boolean setStatus(String currentOwner, EnrolmentInfo.Status status,
int tenantId) throws DeviceManagementDAOException {
Connection conn;
PreparedStatement stmt = null;
if(getCountOfDevicesOfOwner(currentOwner, tenantId) > 0){
try {
conn = this.getConnection();
String sql = "UPDATE DM_ENROLMENT SET STATUS = ? WHERE OWNER = ? AND TENANT_ID = ?";
@ -220,6 +248,9 @@ public class EnrollmentDAOImpl implements EnrollmentDAO {
DeviceManagementDAOUtil.cleanupResources(stmt, null);
}
return true;
} else {
return false;
}
}
@Override

@ -20,6 +20,7 @@ import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import java.util.ArrayList;
import java.util.List;
public class TestDeviceManager implements DeviceManager {
@ -80,7 +81,15 @@ public class TestDeviceManager implements DeviceManager {
@Override
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
return null;
List<Feature> features = new ArrayList<Feature>();
List<Device.Property> properties = new ArrayList<Device.Property>();
Device.Property prop1 = new Device.Property();
prop1.setName("Prop1");
prop1.setValue("Prop1-value");
properties.add(prop1);
Device device = new Device(deviceId.getType()+"-"+deviceId.getId(), deviceId.getType(),
"This is a test Device", deviceId.getId(), null, features, properties);
return device;
}
@Override
@ -92,7 +101,7 @@ public class TestDeviceManager implements DeviceManager {
@Override
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType)
throws DeviceManagementException {
return false;
return true;
}
@Override

@ -17,6 +17,7 @@ package org.wso2.carbon.device.mgt.core.service;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.mockito.Mockito;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -45,10 +46,12 @@ import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.registry.core.internal.RegistryDataHolder;
import org.wso2.carbon.registry.core.jdbc.realm.InMemoryRealmService;
import org.wso2.carbon.registry.core.service.RegistryService;
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.user.core.service.RealmService;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
@ -98,6 +101,20 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
Assert.assertTrue(deviceTypes.size() > 0);
}
@Test
public void testGetAvailableDeviceType() throws DeviceManagementException {
DeviceType deviceType = deviceMgtService.getDeviceType(DEVICE_TYPE);
Assert.assertTrue(deviceType.getName().equalsIgnoreCase(DEVICE_TYPE));
}
@Test
public void addLicense() throws DeviceManagementException {
License license = new License();
license.setLanguage("ENG");
license.setName("RANDON_DEVICE_LICENSE");
deviceMgtService.addLicense(DEVICE_TYPE, license);
}
@Test(expectedExceptions = DeviceManagementException.class)
public void testNullDeviceEnrollment() throws DeviceManagementException {
deviceMgtService.enrollDevice(null);
@ -176,14 +193,45 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
public void testDisenrollment() throws DeviceManagementException {
Device device = TestDataHolder.generateDummyDeviceData(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE));
boolean disenrollmentStatus = deviceMgtService.disenrollDevice(new DeviceIdentifier
(device
.getDeviceIdentifier(),
device.getType()));
(device.getDeviceIdentifier(), device.getType()));
log.info(disenrollmentStatus);
Assert.assertTrue(disenrollmentStatus);
}
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceWithOtherUser"}, expectedExceptions =
DeviceManagementException.class)
public void testDisenrollmentWithNullDeviceID() throws DeviceManagementException {
deviceMgtService.disenrollDevice(null);
}
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceWithOtherUser"})
public void testDisenrollmentWithNonExistentDT() throws DeviceManagementException {
Device device = TestDataHolder.generateDummyDeviceData(new DeviceIdentifier(DEVICE_ID,
"NON_EXISTENT_DT"));
boolean result = deviceMgtService.disenrollDevice(new DeviceIdentifier(
device.getDeviceIdentifier(), device.getType()));
Assert.assertTrue(!result);
}
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceWithOtherUser"})
public void testDisenrollmentWithNonExistentDevice() throws DeviceManagementException {
Device device = TestDataHolder.generateDummyDeviceData(new DeviceIdentifier(ALTERNATE_DEVICE_ID,
DEVICE_TYPE));
boolean result = deviceMgtService.disenrollDevice(new DeviceIdentifier(
device.getDeviceIdentifier(), device.getType()));
Assert.assertTrue(!result);
}
@Test(dependsOnMethods = {"testDisenrollment"})
public void testDisenrollAlreadyDisEnrolledDevice() throws DeviceManagementException {
Device device = TestDataHolder.generateDummyDeviceData(new DeviceIdentifier(DEVICE_ID,
DEVICE_TYPE));
boolean result = deviceMgtService.disenrollDevice(new DeviceIdentifier(
device.getDeviceIdentifier(), device.getType()));
Assert.assertTrue(result);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testGetDeviceCount() throws DeviceManagementException {
int count = deviceMgtService.getDeviceCount();
@ -259,6 +307,12 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
Assert.assertTrue(device.getDeviceInfo() != null);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testGetDeviceTypeWithProps() throws DeviceManagementException {
Device device = deviceMgtService.getDeviceWithTypeProperties(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE));
Assert.assertTrue(!device.getProperties().isEmpty());
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testGetDeviceWithOutInfo() throws DeviceManagementException {
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE)
@ -272,6 +326,35 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
Assert.assertTrue(devices.size() > 0);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}, expectedExceptions =
DeviceManagementException.class)
public void testGetAllDevicesOfRoleFailureFlow() throws DeviceManagementException, UserStoreException, NoSuchFieldException, IllegalAccessException {
int tenantID = -1234;
RealmService mockRealmService = Mockito.mock(RealmService.class, Mockito.CALLS_REAL_METHODS);
Mockito.doThrow(new UserStoreException("Mocked Exception when obtaining Tenant Realm"))
.when(mockRealmService).getTenantUserRealm(tenantID);
RealmService currentRealm = DeviceManagementDataHolder.getInstance().getRealmService();
DeviceManagementDataHolder.getInstance().setRealmService(mockRealmService);
try {
deviceMgtService.getAllDevicesOfRole("admin");
} finally {
DeviceManagementDataHolder.getInstance().setRealmService(currentRealm);
}
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testGetAllDevicesOfRoleWithNonExistentRole() throws DeviceManagementException {
List<Device> devices = deviceMgtService.getAllDevicesOfRole("non-existent-role");
Assert.assertTrue(devices.size() == 0);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}, expectedExceptions =
DeviceManagementException.class)
public void testGetAllDevicesOfRoleWithNullArgs() throws DeviceManagementException {
deviceMgtService.getAllDevicesOfRole(null);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testDeviceByOwner() throws DeviceManagementException {
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
@ -279,11 +362,47 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
Assert.assertTrue(device != null);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testDeviceByOwnerAndNonExistentDeviceID() throws DeviceManagementException {
String nonExistentDeviceID = "4455";
Device device = deviceMgtService.getDevice(new DeviceIdentifier(nonExistentDeviceID,
DEVICE_TYPE), "admin", true);
Assert.assertTrue(device == null);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}, expectedExceptions =
DeviceManagementException.class)
public void testDeviceByOwnerWithNullDeviceID() throws DeviceManagementException {
deviceMgtService.getDevice(null, "admin", true);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testDeviceByDate() throws DeviceManagementException, TransactionManagementException, DeviceDetailsMgtDAOException {
Device initialDevice = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
DEVICE_TYPE));
addDeviceInformation(initialDevice);
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
DEVICE_TYPE), yesterday());
Assert.assertTrue(device != null);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testDeviceByDateWithNonExistentDevice() throws DeviceManagementException,
TransactionManagementException, DeviceDetailsMgtDAOException {
Device device = deviceMgtService.getDevice(new DeviceIdentifier(ALTERNATE_DEVICE_ID,
DEVICE_TYPE), yesterday());
Assert.assertTrue(device == null);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}, expectedExceptions =
DeviceManagementException.class)
public void testDeviceByDateWithNullDeviceID() throws DeviceManagementException {
deviceMgtService.getDevice(null, yesterday());
}
private void addDeviceInformation(Device initialDevice) throws TransactionManagementException, DeviceDetailsMgtDAOException {
DeviceManagementDAOFactory.beginTransaction();
//Device details table will be reffered when looking for last updated time
@ -292,10 +411,6 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
.generateDummyDeviceInfo());
DeviceManagementDAOFactory.closeConnection();
Device device = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
DEVICE_TYPE), yesterday());
Assert.assertTrue(device != null);
}
@Test(dependsOnMethods = {"testDeviceByDate"})
@ -320,10 +435,18 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testGetAllDevicesPaginated() throws DeviceManagementException {
PaginationRequest request = new PaginationRequest(0, 100);
request.setOwnerRole("admin");
PaginationResult result = deviceMgtService.getAllDevices(request);
Assert.assertTrue(result.getRecordsTotal() > 0);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}, expectedExceptions =
DeviceManagementException.class)
public void testGetAllDevicesWithNullRequest() throws DeviceManagementException {
PaginationRequest request = null;
deviceMgtService.getAllDevices(request);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testGetAllDevicesByName() throws DeviceManagementException {
PaginationRequest request = new PaginationRequest(0, 100);
@ -392,8 +515,15 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
Assert.assertTrue(false);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}, expectedExceptions =
DeviceManagementException.class)
public void testGetDeviesOfUser() throws DeviceManagementException {
String username = null;
deviceMgtService.getDevicesOfUser(username);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testGetDeviesOfUserWhileUserNull() throws DeviceManagementException {
List<Device> devices = deviceMgtService.getDevicesOfUser("admin");
Assert.assertTrue(!devices.isEmpty());
}
@ -419,6 +549,13 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
Assert.assertTrue(result.getRecordsTotal() > 0);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}, expectedExceptions =
DeviceManagementException.class)
public void testGetDeviesOfUserWhileNullOwnerPaginated() throws DeviceManagementException {
PaginationRequest request = null;
deviceMgtService.getDevicesOfUser(request, true);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testGetDeviesByOwnership() throws DeviceManagementException {
PaginationRequest request = new PaginationRequest(0, 100);
@ -427,6 +564,26 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
Assert.assertTrue(result.getRecordsTotal() > 0);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testSetOwnership() throws DeviceManagementException {
boolean status = deviceMgtService.setOwnership(new DeviceIdentifier(DEVICE_ID,
DEVICE_TYPE), EnrolmentInfo.OwnerShip.COPE.toString());
Assert.assertTrue(status);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testSetOwnershipNonExistentDT() throws DeviceManagementException {
boolean status = deviceMgtService.setOwnership(new DeviceIdentifier(DEVICE_ID,
"non-existent-dt"), EnrolmentInfo.OwnerShip.COPE.toString());
Assert.assertFalse(status);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}, expectedExceptions =
DeviceManagementException.class)
public void testSetOwnershipOfNullDevice() throws DeviceManagementException {
deviceMgtService.setOwnership(null, EnrolmentInfo.OwnerShip.COPE.toString());
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testGetDeviesByStatus() throws DeviceManagementException {
PaginationRequest request = new PaginationRequest(0, 100);
@ -435,6 +592,25 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
Assert.assertTrue(result.getRecordsTotal() > 0);
}
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
public void testUpdateDevicesStatus() throws DeviceManagementException {
boolean status = deviceMgtService.setStatus("user1", EnrolmentInfo.Status.REMOVED);
Assert.assertTrue(status);
}
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
public void testUpdateDevicesStatusWithDeviceID() throws DeviceManagementException {
boolean status = deviceMgtService.setStatus(new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE),"user1",
EnrolmentInfo.Status.ACTIVE);
Assert.assertTrue(status);
}
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
public void testUpdateDevicesStatusOfNonExistingUser() throws DeviceManagementException {
boolean status = deviceMgtService.setStatus("random-user", EnrolmentInfo.Status.REMOVED);
Assert.assertFalse(status);
}
@Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"})
public void testGetDeviesOfUserAndDeviceType() throws DeviceManagementException {
List<Device> devices = deviceMgtService.getDevicesOfUser("admin", DEVICE_TYPE, true);
@ -451,7 +627,6 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes
props.setProperty("password", "!@#$$$%");
EmailMetaInfo metaInfo = new EmailMetaInfo(recipient, props);
deviceMgtService.sendRegistrationEmail(metaInfo);
Assert.assertTrue(true);
}

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -20,7 +20,7 @@ package org.wso2.carbon.device.mgt.extensions.device.type.template;
import org.h2.jdbcx.JdbcDataSource;
import org.mockito.Mockito;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.device.mgt.common.Device;
@ -69,7 +69,7 @@ public class DeviceTypeManagerNegativeTest {
private PropertyBasedPluginDAOImpl propertyBasedPluginDAO;
private Device sampleDevice;
@BeforeTest
@BeforeClass
public void setup()
throws SAXException, JAXBException, ParserConfigurationException, DeviceTypeConfigurationException,
IOException, NoSuchFieldException, IllegalAccessException {

@ -21,14 +21,16 @@ package org.wso2.carbon.device.mgt.extensions.device.type.template;
import org.mockito.Mockito;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceStatusTaskPluginConfig;
import org.wso2.carbon.device.mgt.common.InitialOperationConfig;
import org.wso2.carbon.device.mgt.common.InitialOperationConfig;
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
@ -75,7 +77,7 @@ public class DeviceTypeManagerServiceTest {
private Method setPolicyMonitoringManager;
private Method setPullNotificationSubscriber;
@BeforeTest
@BeforeClass
public void setup() throws NoSuchMethodException, SAXException, JAXBException, ParserConfigurationException,
DeviceTypeConfigurationException, IOException, NoSuchFieldException, IllegalAccessException,
DeviceManagementException, RegistryException {

@ -20,7 +20,7 @@ package org.wso2.carbon.device.mgt.extensions.device.type.template;
import org.mockito.Mockito;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
@ -73,7 +73,7 @@ public class DeviceTypeManagerTest {
private String[] customDeviceTypeProperties = {"custom_property", "custom_property2"};
private final String SQL_FOLDER = "sql-files" + File.separator;
@BeforeTest(description = "Mocking the classes for testing")
@BeforeClass(description = "Mocking the classes for testing")
public void setup() throws NoSuchFieldException, IllegalAccessException, IOException, SQLException, SAXException,
ParserConfigurationException, DeviceTypeConfigurationException, JAXBException {
ClassLoader classLoader = getClass().getClassLoader();

@ -19,7 +19,7 @@
package org.wso2.carbon.device.mgt.extensions.device.type.template;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
@ -60,7 +60,7 @@ public class HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest {
private String androidSenseDeviceType = "androidsense";
private DeviceManagementService generatedDeviceManagementService;
@BeforeTest
@BeforeClass
public void setup() throws RegistryException, IOException, SAXException, ParserConfigurationException,
DeviceTypeConfigurationException, JAXBException {
createSampleDeviceTypeMetaDefinition();

@ -20,7 +20,7 @@
package org.wso2.carbon.device.mgt.extensions.utils;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.context.PrivilegedCarbonContext;
@ -51,7 +51,7 @@ import java.util.List;
public class UtilsTest {
private FileSystemBasedLicenseManager fileSystemBasedLicenseManager;
@BeforeTest
@BeforeClass
public void setup() {
fileSystemBasedLicenseManager = new FileSystemBasedLicenseManager();
}

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -23,7 +23,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>email-sender</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - OAuth Extensions</name>
<url>http://wso2.org</url>

@ -21,7 +21,7 @@
<parent>
<artifactId>identity-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.complex.policy.decision.point</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Decision Point</name>
<description>WSO2 Carbon - Policy Decision Point</description>

@ -3,14 +3,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.decision.point</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Decision Point</name>
<description>WSO2 Carbon - Policy Decision Point</description>

@ -3,7 +3,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -11,7 +11,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.information.point</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Information Point</name>
<description>WSO2 Carbon - Policy Information Point</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Management Common</name>
<description>WSO2 Carbon - Policy Management Common</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Management Core</name>
<description>WSO2 Carbon - Policy Management Core</description>

@ -23,13 +23,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>policy-mgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Policy Management Component</name>
<url>http://wso2.org</url>

@ -21,7 +21,7 @@
<parent>
<artifactId>carbon-devicemgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.webapp.authenticator.framework</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Web Application Authenticator Framework Bundle</name>
<description>WSO2 Carbon - Web Application Authenticator Framework Bundle</description>
@ -248,6 +248,11 @@
<artifactId>h2-database-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

@ -97,44 +97,6 @@ public class OAuthTokenValidationStubFactory implements PoolableObjectFactory {
return connectionManager;
}
/**
* Creates an instance of PoolingHttpClientConnectionManager using HttpClient 4.x APIs
*
* @param properties Properties to configure PoolingHttpClientConnectionManager
* @return An instance of properly configured PoolingHttpClientConnectionManager
*/
private HttpClientConnectionManager createClientConnectionManager(Properties properties) {
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
if (properties != null) {
String maxConnectionsPerHostParam = properties.getProperty("MaxConnectionsPerHost");
if (maxConnectionsPerHostParam == null || maxConnectionsPerHostParam.isEmpty()) {
if (log.isDebugEnabled()) {
log.debug("MaxConnectionsPerHost parameter is not explicitly defined. Therefore, the default, " +
"which is 2, will be used");
}
} else {
connectionManager.setDefaultMaxPerRoute(Integer.parseInt(maxConnectionsPerHostParam));
}
String maxTotalConnectionsParam = properties.getProperty("MaxTotalConnections");
if (maxTotalConnectionsParam == null || maxTotalConnectionsParam.isEmpty()) {
if (log.isDebugEnabled()) {
log.debug("MaxTotalConnections parameter is not explicitly defined. Therefore, the default, " +
"which is 10, will be used");
}
} else {
connectionManager.setMaxTotal(Integer.parseInt(maxTotalConnectionsParam));
}
} else {
if (log.isDebugEnabled()) {
log.debug("Properties, i.e. MaxTotalConnections/MaxConnectionsPerHost, required to tune the " +
"HttpClient used in OAuth token validation service stub instances are not provided. " +
"Therefore, the defaults, 2/10 respectively, will be used");
}
}
return connectionManager;
}
@Override
public Object makeObject() throws Exception {
return this.createStub();

@ -134,10 +134,10 @@ public class Utils {
authenticationInfo.setUsername(username);
authenticationInfo.setTenantDomain(tenantDomain);
authenticationInfo.setTenantId(getTenantIdOFUser(username + "@" + tenantDomain));
if (oAuthValidationResponse.isValid())
authenticationInfo.setStatus(WebappAuthenticator.Status.CONTINUE);
} else {
authenticationInfo.setMessage(oAuthValidationResponse.getErrorMsg());
authenticationInfo.setStatus(WebappAuthenticator.Status.FAILURE);
}
return authenticationInfo;
}

@ -18,7 +18,6 @@
package org.wso2.carbon.webapp.authenticator.framework.authenticator;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JWSVerifier;
import com.nimbusds.jose.crypto.RSASSAVerifier;
import com.nimbusds.jwt.SignedJWT;
@ -46,6 +45,7 @@ import java.security.interfaces.RSAPublicKey;
import java.text.ParseException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.StringTokenizer;
@ -164,8 +164,6 @@ public class JWTAuthenticator implements WebappAuthenticator {
log.error("Error occurred while obtaining the user.", e);
} catch (ParseException e) {
log.error("Error occurred while parsing the JWT header.", e);
} catch (JOSEException e) {
log.error("Error occurred while verifying the JWT header.", e);
} catch (Exception e) {
log.error("Error occurred while verifying the JWT header.", e);
} finally {
@ -203,12 +201,12 @@ public class JWTAuthenticator implements WebappAuthenticator {
private String tenantDomain;
private final String DEFAULT_ISSUER = "default";
public IssuerAlias(String tenantDomain) {
IssuerAlias(String tenantDomain) {
this.issuer = DEFAULT_ISSUER;
this.tenantDomain = tenantDomain;
}
public IssuerAlias(String issuer, String tenantDomain) {
IssuerAlias(String issuer, String tenantDomain) {
this.issuer = issuer;
this.tenantDomain = tenantDomain;
}
@ -223,7 +221,7 @@ public class JWTAuthenticator implements WebappAuthenticator {
@Override
public boolean equals(Object obj) {
return (obj instanceof IssuerAlias) && issuer.equals(
((IssuerAlias) obj).issuer) && tenantDomain == ((IssuerAlias) obj).tenantDomain;
((IssuerAlias) obj).issuer) && Objects.equals(tenantDomain, ((IssuerAlias) obj).tenantDomain);
}
}
}

@ -68,11 +68,11 @@ public class LocalOAuthValidator implements OAuth2TokenValidator {
if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) {
tenantDomain = MultitenantUtils.getTenantDomain(userName);
}
return new OAuthValidationResponse(userName, tenantDomain, true);
} else {
OAuthValidationResponse oAuthValidationResponse = new OAuthValidationResponse();
oAuthValidationResponse.setErrorMsg(tokenValidationResponse.getErrorMsg());
return oAuthValidationResponse;
}
return new OAuthValidationResponse(userName,tenantDomain,isValid);
}
}

@ -55,42 +55,41 @@ public class RemoteOAuthValidator implements OAuth2TokenValidator {
try {
OAuth2TokenValidationRequestDTO validationRequest = createValidationRequest(accessToken, resource);
stub = (OAuth2TokenValidationServiceStub) this.stubs.borrowObject();
validationResponse =
stub.findOAuthConsumerIfTokenIsValid(validationRequest).getAccessTokenValidationResponse();
validationResponse = stub.findOAuthConsumerIfTokenIsValid(validationRequest)
.getAccessTokenValidationResponse();
} catch (RemoteException e) {
throw new OAuthTokenValidationException("Remote Exception occurred while invoking the Remote " +
"IS server for OAuth2 token validation.", e);
throw new OAuthTokenValidationException(
"Remote Exception occurred while invoking the Remote " + "IS server for OAuth2 token validation.",
e);
} catch (Exception e) {
throw new OAuthTokenValidationException("Error occurred while borrowing an oauth token validation " +
"service stub from the pool", e);
throw new OAuthTokenValidationException(
"Error occurred while borrowing an oauth token validation " + "service stub from the pool", e);
} finally {
try {
this.stubs.returnObject(stub);
} catch (Exception e) {
log.warn("Error occurred while returning the object back to the oauth token validation service " +
"stub pool", e);
log.warn("Error occurred while returning the object back to the oauth token validation service "
+ "stub pool", e);
}
}
if (validationResponse == null) {
if (log.isDebugEnabled()) {
log.debug("Response returned by the OAuth token validation service is null");
}
return null;
}
boolean isValid = validationResponse.getValid();
String tenantDomain;
String username;
if (isValid) {
username = MultitenantUtils.getTenantAwareUsername(validationResponse.getAuthorizedUser());
tenantDomain = MultitenantUtils.getTenantDomain(validationResponse.getAuthorizedUser());
return new OAuthValidationResponse(username, tenantDomain, true);
} else {
OAuthValidationResponse oAuthValidationResponse = new OAuthValidationResponse();
oAuthValidationResponse.setErrorMsg(validationResponse.getErrorMsg());
return oAuthValidationResponse;
}
return new OAuthValidationResponse(username, tenantDomain, isValid);
}
private OAuth2TokenValidationRequestDTO createValidationRequest(String accessToken, String resource) {

@ -19,12 +19,29 @@
package org.wso2.carbon.webapp.authenticator.framework.authenticator;
import org.apache.catalina.Context;
import org.apache.catalina.connector.Request;
import org.apache.catalina.core.StandardContext;
import org.apache.commons.io.FileUtils;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.MimeHeaders;
import org.mockito.Mockito;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService;
import org.wso2.carbon.identity.oauth2.dto.OAuth2ClientApplicationDTO;
import org.wso2.carbon.identity.oauth2.dto.OAuth2TokenValidationResponseDTO;
import org.wso2.carbon.webapp.authenticator.framework.AuthenticationInfo;
import org.wso2.carbon.webapp.authenticator.framework.authenticator.oauth.OAuth2TokenValidator;
import org.wso2.carbon.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder;
import org.wso2.carbon.webapp.authenticator.framework.util.TestInputBuffer;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URL;
import java.util.Properties;
/**
@ -33,11 +50,29 @@ import java.util.Properties;
public class BSTAuthenticatorTest {
private BSTAuthenticator bstAuthenticator;
private Properties properties;
private Field headersField;
private OAuth2TokenValidationService oAuth2TokenValidationService;
private OAuth2ClientApplicationDTO oAuth2ClientApplicationDTO;
@BeforeTest
public void init() {
@BeforeClass
public void init() throws NoSuchFieldException {
bstAuthenticator = new BSTAuthenticator();
properties = new Properties();
headersField = org.apache.coyote.Request.class.getDeclaredField("headers");
headersField.setAccessible(true);
oAuth2TokenValidationService = Mockito
.mock(OAuth2TokenValidationService.class, Mockito.CALLS_REAL_METHODS);
oAuth2ClientApplicationDTO = Mockito
.mock(OAuth2ClientApplicationDTO.class, Mockito.CALLS_REAL_METHODS);
OAuth2TokenValidationResponseDTO authorizedValidationResponse = new OAuth2TokenValidationResponseDTO();
authorizedValidationResponse.setValid(true);
authorizedValidationResponse.setAuthorizedUser("admin@" + MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
Mockito.doReturn(oAuth2ClientApplicationDTO).when(oAuth2TokenValidationService)
.findOAuthConsumerIfTokenIsValid(Mockito.any());
oAuth2ClientApplicationDTO.setAccessTokenValidationResponse(authorizedValidationResponse);
AuthenticatorFrameworkDataHolder.getInstance().setOAuth2TokenValidationService(oAuth2TokenValidationService);
}
@Test(description = "This test case is used to test the behaviour of BST Authenticator when the properties are "
@ -89,4 +124,125 @@ public class BSTAuthenticatorTest {
Assert.assertNotNull(oAuth2TokenValidator, "Token validation creation failed even with the required "
+ "parameters.");
}
@Test(description = "This method tests the get methods of the BST Authenticator",
dependsOnMethods = {"testInitWithRemote"})
public void testGetterMethods() {
Assert.assertNotNull(bstAuthenticator.getProperties(), "Retrieval of properties from BSTAuthenticator failed");
Assert.assertNotNull(bstAuthenticator.getProperty("Password"),
"Retrieval of added property failed in " + "BSTAuthenticator");
Assert.assertNull(bstAuthenticator.getProperty("test"),
"Retrieval of property test is successful, which is " + "never added");
Assert.assertEquals(bstAuthenticator.getName(), "BSTAuthenticator",
"Name returned by BSTAuthenticator does" + " not match.");
}
@Test(description = "This test case tests the canHandle method of the BSTAuthenticator under faulty conditions")
public void testCanHandleWithFalseConditions() throws IllegalAccessException {
Request request = new Request();
org.apache.coyote.Request coyoteRequest = new org.apache.coyote.Request();
request.setCoyoteRequest(coyoteRequest);
Assert.assertFalse(bstAuthenticator.canHandle(request),
"BST Authenticator can handle a request without content type");
MimeHeaders mimeHeaders = new MimeHeaders();
MessageBytes bytes = mimeHeaders.addValue("content-type");
bytes.setString("test");
headersField.set(coyoteRequest, mimeHeaders);
request.setCoyoteRequest(coyoteRequest);
Assert.assertFalse(bstAuthenticator.canHandle(request),
"BST Authenticator can handle a request with content type test");
}
@Test(description = "This test case tests the canHandle method of the BSTAuthenticator under valid conditions")
public void testCanHandleWithValidRequest() throws IOException, IllegalAccessException {
Request request = createSoapRequest("CorrectBST.xml");
Assert.assertTrue(bstAuthenticator.canHandle(request), "BST Authenticator cannot handle a valid "
+ "authentication request");
}
@Test(description = "This test case tests the canHandle method of the BSTAuthenticator under missing soap headers")
public void testCanHandleWithMissingHeaders() throws IOException, IllegalAccessException {
Request request = createSoapRequest("WrongBST1.xml");
Assert.assertFalse(bstAuthenticator.canHandle(request),
"BST Authenticator can handle a request with missing headers ");
request = createSoapRequest("WrongBST2.xml");
Assert.assertFalse(bstAuthenticator.canHandle(request),
"BST Authenticator can handle a request with missing headers ");
}
@Test(description = "This method tests the authenticate method of BST Authenticator when only minimal information"
+ " is provided")
public void testAuthenticateWithMinimalConditions() throws NoSuchFieldException, IllegalAccessException {
Request request = new Request();
org.apache.coyote.Request coyoteRequest = new org.apache.coyote.Request();
request.setCoyoteRequest(coyoteRequest);
AuthenticationInfo authenticationInfo = bstAuthenticator.authenticate(request, null);
Assert.assertEquals(authenticationInfo.getStatus(), WebappAuthenticator.Status.CONTINUE,
"Authentication status of authentication info is wrong");
}
@Test(description = "This method tests the authenticate method of BST Authenticator when all the relevant "
+ "details", dependsOnMethods = "testInitWithRemote")
public void testAuthenticate() throws NoSuchFieldException, IllegalAccessException, IOException {
Request request = createSoapRequest("CorrectBST.xml");
org.apache.coyote.Request coyoteRequest = request.getCoyoteRequest();
Field uriMB = org.apache.coyote.Request.class.getDeclaredField("uriMB");
uriMB.setAccessible(true);
MessageBytes bytes = MessageBytes.newInstance();
bytes.setString("test");
uriMB.set(coyoteRequest, bytes);
request.setCoyoteRequest(coyoteRequest);
bstAuthenticator.canHandle(request);
AuthenticationInfo authenticationInfo = bstAuthenticator.authenticate(request, null);
Assert.assertEquals(authenticationInfo.getStatus(), WebappAuthenticator.Status.CONTINUE,
"Authentication status of authentication info is wrong");
Assert.assertEquals(authenticationInfo.getUsername(), "admin",
"User name in the authentication info is different than original user");
OAuth2TokenValidationResponseDTO unAuthorizedValidationRespose = new OAuth2TokenValidationResponseDTO();
unAuthorizedValidationRespose.setValid(false);
unAuthorizedValidationRespose.setErrorMsg("User is not authorized");
Mockito.doReturn(oAuth2ClientApplicationDTO).when(oAuth2TokenValidationService)
.findOAuthConsumerIfTokenIsValid(Mockito.any());
oAuth2ClientApplicationDTO.setAccessTokenValidationResponse(unAuthorizedValidationRespose);
AuthenticatorFrameworkDataHolder.getInstance().setOAuth2TokenValidationService(oAuth2TokenValidationService);
authenticationInfo = bstAuthenticator.authenticate(request, null);
Assert.assertEquals(authenticationInfo.getStatus(), WebappAuthenticator.Status.FAILURE,
"Un-authorized user got authenticated with BST");
}
/**
* To create a soap request by reading the request from given file.
*
* @param fileName Name of the file that has the soap request content.
* @return Request created with soap content.
* @throws IllegalAccessException Illegal Access Exception.
* @throws IOException IO Exception.
*/
private Request createSoapRequest(String fileName) throws IllegalAccessException, IOException {
Request request = new Request();
ClassLoader classLoader = getClass().getClassLoader();
URL resourceUrl = classLoader
.getResource("requests" + File.separator + "BST" + File.separator + fileName);
String bstRequestContent = null;
if (resourceUrl != null) {
File bst = new File(resourceUrl.getFile());
bstRequestContent = FileUtils.readFileToString(bst);
}
org.apache.coyote.Request coyoteRequest = new org.apache.coyote.Request();
MimeHeaders mimeHeaders = new MimeHeaders();
MessageBytes bytes = mimeHeaders.addValue("content-type");
bytes.setString("application/xml");
bytes = mimeHeaders.addValue("custom");
bytes.setString(bstRequestContent);
headersField.set(coyoteRequest, mimeHeaders);
TestInputBuffer inputBuffer = new TestInputBuffer();
coyoteRequest.setInputBuffer(inputBuffer);
Context context = new StandardContext();
request.setContext(context);
request.setCoyoteRequest(coyoteRequest);
return request;
}
}

@ -26,6 +26,7 @@ import org.apache.commons.codec.EncoderException;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.MimeHeaders;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
@ -51,7 +52,7 @@ public class BasicAuthAuthenticatorTest {
private MessageBytes bytes;
private final String BASIC_HEADER = "basic ";
@BeforeTest
@BeforeClass
public void init() throws NoSuchFieldException {
basicAuthAuthenticator = new BasicAuthAuthenticator();
headersField = org.apache.coyote.Request.class.getDeclaredField("headers");

@ -0,0 +1,156 @@
/*
* Copyright (c) 2017, 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.webapp.authenticator.framework.authenticator;
import org.apache.catalina.connector.Request;
import org.apache.commons.pool.impl.GenericObjectPool;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.MimeHeaders;
import org.mockito.Mockito;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.core.security.AuthenticatorsConfiguration;
import org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub;
import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2ClientApplicationDTO;
import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationResponseDTO;
import org.wso2.carbon.webapp.authenticator.framework.AuthenticationInfo;
import org.wso2.carbon.webapp.authenticator.framework.BaseWebAppAuthenticatorFrameworkTest;
import org.wso2.carbon.webapp.authenticator.framework.authenticator.oauth.impl.RemoteOAuthValidator;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;
/**
* This is a test case for {@link OAuthAuthenticator}
*/
public class OauthAuthenticatorTest {
private OAuthAuthenticator oAuthAuthenticator;
private final String BEARER_HEADER = "bearer ";
private Field headersField;
private Properties properties;
@BeforeClass
public void setup()
throws NoSuchFieldException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
oAuthAuthenticator = new OAuthAuthenticator();
headersField = org.apache.coyote.Request.class.getDeclaredField("headers");
headersField.setAccessible(true);
}
@Test(description = "This method tests the successful execution of init method")
public void testInit() throws NoSuchFieldException, IllegalAccessException {
properties = new Properties();
properties.setProperty("TokenValidationEndpointUrl", "test");
properties.setProperty("Username", "admin");
properties.setProperty("Password", "admin");
properties.setProperty("IsRemote", "true");
properties.setProperty("MaxConnectionsPerHost", "100");
properties.setProperty("MaxTotalConnections", "1000");
Assert.assertNull(oAuthAuthenticator.getProperty("test"),
"OAuth authenticator is returning the properties that were never set");
oAuthAuthenticator.setProperties(properties);
oAuthAuthenticator.init();
Field tokenValidator = OAuthAuthenticator.class.getDeclaredField("tokenValidator");
tokenValidator.setAccessible(true);
Assert.assertNotNull(tokenValidator.get(oAuthAuthenticator), "OauthAuthenticator initialization failed");
Assert.assertEquals(oAuthAuthenticator.getName(), "OAuth", "Name of the OauthAuthenticator does not match");
}
@Test(description = "This method tests the canHandle method of OAuthAuthenticator")
public void testCanHandle() throws IllegalAccessException {
Request request = createOauthRequest(BEARER_HEADER);
Assert.assertTrue(oAuthAuthenticator.canHandle(request),
"The request with the bearer authorization header cannot be handled by OauthAuthenticator");
request = createOauthRequest("test");
Assert.assertFalse(oAuthAuthenticator.canHandle(request),
"The request without bearer authorization header can be handled by OauthAuthenticator");
}
@Test(description = "This method tests the authenticate under different parameters",
dependsOnMethods = {"testInit"})
public void testAuthenticate() throws Exception {
Request request = createOauthRequest(BEARER_HEADER);
Assert.assertEquals(oAuthAuthenticator.authenticate(request, null).getStatus(),
WebappAuthenticator.Status.CONTINUE, "Authentication status mismatched");
request = createOauthRequest(BEARER_HEADER + "abc");
org.apache.coyote.Request coyoteRequest = request.getCoyoteRequest();
Field uriMB = org.apache.coyote.Request.class.getDeclaredField("uriMB");
uriMB.setAccessible(true);
MessageBytes bytes = MessageBytes.newInstance();
bytes.setString("test");
uriMB.set(coyoteRequest, bytes);
request.setCoyoteRequest(coyoteRequest);
Field tokenValidator = OAuthAuthenticator.class.getDeclaredField("tokenValidator");
tokenValidator.setAccessible(true);
GenericObjectPool genericObjectPool = Mockito.mock(GenericObjectPool.class, Mockito.CALLS_REAL_METHODS);
RemoteOAuthValidator remoteOAuthValidator = Mockito
.mock(RemoteOAuthValidator.class, Mockito.CALLS_REAL_METHODS);
tokenValidator.set(oAuthAuthenticator, remoteOAuthValidator);
Field stubs = RemoteOAuthValidator.class.getDeclaredField("stubs");
stubs.setAccessible(true);
stubs.set(remoteOAuthValidator, genericObjectPool);
OAuth2TokenValidationResponseDTO oAuth2TokenValidationResponseDTO = new OAuth2TokenValidationResponseDTO();
oAuth2TokenValidationResponseDTO.setValid(true);
oAuth2TokenValidationResponseDTO.setAuthorizedUser("admin@carbon.super");
OAuth2ClientApplicationDTO oAuth2ClientApplicationDTO = Mockito
.mock(OAuth2ClientApplicationDTO.class, Mockito.CALLS_REAL_METHODS);
Mockito.doReturn(oAuth2TokenValidationResponseDTO).when(oAuth2ClientApplicationDTO)
.getAccessTokenValidationResponse();
OAuth2TokenValidationServiceStub oAuth2TokenValidationServiceStub = Mockito
.mock(OAuth2TokenValidationServiceStub.class, Mockito.CALLS_REAL_METHODS);
Mockito.doReturn(oAuth2ClientApplicationDTO).when(oAuth2TokenValidationServiceStub)
.findOAuthConsumerIfTokenIsValid(Mockito.any());
Mockito.doReturn(oAuth2TokenValidationServiceStub).when(genericObjectPool).borrowObject();
oAuthAuthenticator.canHandle(request);
AuthenticationInfo authenticationInfo = oAuthAuthenticator.authenticate(request, null);
Assert.assertEquals(authenticationInfo.getUsername(), "admin");
}
@Test(description = "This method is used to test getProperty method of the OAuthAuthenticator",
dependsOnMethods = {"testInit"})
public void testGetProperty() {
Assert.assertEquals(oAuthAuthenticator.getProperty("Username"), "admin",
"Username property of " + "OauthAuthenticator is not matching with the assigned one.");
Assert.assertEquals(oAuthAuthenticator.getProperties().size(), properties.size(),
"Property list assigned " + "does not match with retrieved list");
}
/**
* This will create an OAuth request.
*
* @param authorizationHeader Authorization Header
*/
private Request createOauthRequest(String authorizationHeader) throws IllegalAccessException {
Request request = new Request();
org.apache.coyote.Request coyoteRequest = new org.apache.coyote.Request();
MimeHeaders mimeHeaders = new MimeHeaders();
MessageBytes bytes = mimeHeaders.addValue(BaseWebAppAuthenticatorFrameworkTest.AUTHORIZATION_HEADER);
bytes.setString(authorizationHeader);
headersField.set(coyoteRequest, mimeHeaders);
request.setCoyoteRequest(coyoteRequest);
return request;
}
}

@ -0,0 +1,62 @@
/*
* Copyright (c) 2017, 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.webapp.authenticator.framework.util;
import org.apache.catalina.connector.InputBuffer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.coyote.Request;
import org.apache.tomcat.util.buf.ByteChunk;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.MimeHeaders;
import java.io.IOException;
import java.lang.reflect.Field;
/**
* This is a dummy implementation of {@link InputBuffer} for the test cases.
*/
public class TestInputBuffer implements org.apache.coyote.InputBuffer {
private Log log = LogFactory.getLog(TestInputBuffer.class);
@Override
public int doRead(ByteChunk byteChunk, Request request) throws IOException {
String string = request.getHeader("custom");
MimeHeaders mimeHeaders = new MimeHeaders();
Field byteC = null;
try {
byteC = MessageBytes.class.getDeclaredField("byteC");
byteC.setAccessible(true);
} catch (NoSuchFieldException e) {
log.error("Cannot get the byteC field", e);
}
MessageBytes bytes = mimeHeaders.addValue("content-type");
try {
if (byteC != null) {
byteC.set(bytes, byteChunk);
}
} catch (IllegalAccessException e) {
log.error("Cannot set byteC field", e);
}
bytes.setString(string);
bytes.toBytes();
return byteChunk.getLength();
}
}

@ -0,0 +1,25 @@
<!--
~ Copyright 2017 WSO2 Inc. (http://wso2.com)
~
~ Licensed 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.
-->
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:w="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<soap:Header>
<w:Security>
<w:BinarySecurityToken>test</w:BinarySecurityToken>
</w:Security>
</soap:Header>
<soap:Body>
</soap:Body>
</soap:Envelope>

@ -0,0 +1,25 @@
<!--
~ Copyright 2017 WSO2 Inc. (http://wso2.com)
~
~ Licensed 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.
-->
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:w="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<soap:Header>
<w:Security>
</w:Security>
</soap:Header>
<soap:Body>
</soap:Body>
</soap:Envelope>

@ -0,0 +1,19 @@
<!--
~ Copyright 2017 WSO2 Inc. (http://wso2.com)
~
~ Licensed 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.
-->
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header/>
<soap:Body/>
</soap:Envelope>

@ -30,6 +30,7 @@
<class name="org.wso2.carbon.webapp.authenticator.framework.WebappAuthenticatorRepositoryTest"/>
<class name="org.wso2.carbon.webapp.authenticator.framework.authenticator.BasicAuthAuthenticatorTest" />
<class name="org.wso2.carbon.webapp.authenticator.framework.authenticator.BSTAuthenticatorTest" />
<class name="org.wso2.carbon.webapp.authenticator.framework.authenticator.OauthAuthenticatorTest" />
</classes>
</test>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Webapp Authenticator Framework</name>
<url>http://wso2.org</url>

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.application.extension.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Application Extension Feature</name>
<url>http://wso2.org</url>
<description>This feature contains an implementation of a api application registration, which takes care of subscription

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.handler.server.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management - APIM handler Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the handler for the api authentications

@ -21,13 +21,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.client.feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - APIM Integration Client Feature</name>
<url>http://wso2.org</url>

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Webapp Publisher Feature</name>
<url>http://wso2.org</url>
<description>This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Feature</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - Certificate Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for back-end Certificate Management functionality

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Feature</name>
<url>http://wso2.org</url>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - Device Type Deployer Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - Device Type Deployer Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - FCM Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - MQTT Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - MQTT Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - XMPP Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - XMPP Based Push Notification Provider Feature</description>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.analytics.data.publisher.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains bundles related to device analytics data publisher</description>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -4,14 +4,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Extensions Feature</name>
<url>http://wso2.org</url>
<description>This feature contains common extensions used by key device management functionalities

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for Back-end Device Management functionality

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>email-sender-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.email.sender.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - Email Sender Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for email sender related functionality

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>email-sender-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Email Sender Feature</name>
<url>http://wso2.org</url>

@ -23,14 +23,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>jwt-client-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.jwt.client.extension.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - JWT Client Feature</name>
<url>http://wso2.org</url>
<description>This feature contains jwt client implementation from which we can get a access token using the jwt

@ -23,13 +23,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jwt-client-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - JWT Client Extension Feature</name>
<url>http://wso2.org</url>

@ -23,14 +23,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>oauth-extensions-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - Device Mgt OAuth Extensions Feature</name>
<url>http://wso2.org</url>
<description>This feature contains devicemgt related OAuth extensions</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>oauth-extensions-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Device Management OAuth Extensions Feature</name>
<url>http://wso2.org</url>

@ -23,14 +23,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt-feature</artifactId>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.policy.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.146-SNAPSHOT</version>
<version>3.0.148-SNAPSHOT</version>
<name>WSO2 Carbon - Policy Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for Back-end Device Management functionality

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save