mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Adding license
This commit is contained in:
parent
54895f360b
commit
ec8a172b3b
@ -1,3 +1,20 @@
|
||||
/*
|
||||
* 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.policy.mgt.core.mgt.impl;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@ -9,7 +26,6 @@ import org.testng.annotations.Test;
|
||||
import org.testng.internal.collections.Pair;
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.common.Feature;
|
||||
import org.wso2.carbon.device.mgt.common.IllegalTransactionStateException;
|
||||
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
|
||||
@ -110,7 +126,8 @@ public class FeatureManagerImplTest extends BasePolicyManagementDAOTest {
|
||||
profile1 = profileManager.addProfile(profile);
|
||||
|
||||
FeatureDAO featureDAO = mock(FeatureDAO.class);
|
||||
when(featureDAO.addProfileFeature(any(ProfileFeature.class), anyInt())).thenThrow(new FeatureManagerDAOException());
|
||||
when(featureDAO.addProfileFeature(any(ProfileFeature.class), anyInt())).thenThrow(
|
||||
new FeatureManagerDAOException());
|
||||
|
||||
ProfileFeature profileFeature = profile.getProfileFeaturesList().get(0);
|
||||
testThrowingException(featureManager,
|
||||
@ -182,7 +199,8 @@ public class FeatureManagerImplTest extends BasePolicyManagementDAOTest {
|
||||
profile1 = profileManager.addProfile(profile);
|
||||
|
||||
FeatureDAO featureDAO = mock(FeatureDAO.class);
|
||||
when(featureDAO.addProfileFeature(any(ProfileFeature.class), anyInt())).thenThrow(new FeatureManagerDAOException());
|
||||
when(featureDAO.addProfileFeature(any(ProfileFeature.class), anyInt())).thenThrow(
|
||||
new FeatureManagerDAOException());
|
||||
|
||||
List<ProfileFeature> profileFeaturesList = profile.getProfileFeaturesList();
|
||||
testThrowingException(featureManager,
|
||||
@ -242,7 +260,8 @@ public class FeatureManagerImplTest extends BasePolicyManagementDAOTest {
|
||||
List<ProfileFeature> profileFeaturesList = profile.getProfileFeaturesList();
|
||||
testThrowingException(featureManager,
|
||||
profileFeaturesList,
|
||||
p -> featureManager.updateProfileFeatures((List<ProfileFeature>) p, profile1.getProfileId()),
|
||||
p -> featureManager
|
||||
.updateProfileFeatures((List<ProfileFeature>) p, profile1.getProfileId()),
|
||||
"profileDAO", profileDAO,
|
||||
ProfileManagerDAOException.class);
|
||||
}
|
||||
@ -254,12 +273,14 @@ public class FeatureManagerImplTest extends BasePolicyManagementDAOTest {
|
||||
profile1 = profileManager.addProfile(profile);
|
||||
|
||||
FeatureDAO featureDAO = mock(FeatureDAO.class);
|
||||
when(featureDAO.addProfileFeature(any(ProfileFeature.class), anyInt())).thenThrow(new FeatureManagerDAOException());
|
||||
when(featureDAO.addProfileFeature(any(ProfileFeature.class), anyInt())).thenThrow(
|
||||
new FeatureManagerDAOException());
|
||||
|
||||
List<ProfileFeature> profileFeaturesList = profile.getProfileFeaturesList();
|
||||
testThrowingException(featureManager,
|
||||
profileFeaturesList,
|
||||
p -> featureManager.updateProfileFeatures((List<ProfileFeature>) p, profile1.getProfileId()),
|
||||
p -> featureManager
|
||||
.updateProfileFeatures((List<ProfileFeature>) p, profile1.getProfileId()),
|
||||
"featureDAO", featureDAO,
|
||||
FeatureManagerDAOException.class);
|
||||
}
|
||||
@ -296,7 +317,8 @@ public class FeatureManagerImplTest extends BasePolicyManagementDAOTest {
|
||||
}
|
||||
|
||||
|
||||
@Test(description = "This test case tests handling ProfileManagerDAOException when retrieving features of a profile",
|
||||
@Test(description = "This test case tests handling ProfileManagerDAOException when retrieving features of a " +
|
||||
"profile",
|
||||
dependsOnMethods = "testGetFeaturesForProfile")
|
||||
public void testGetFeaturesForProfileThrowingProfileManagerDAOException() throws Exception {
|
||||
Profile profile = ProfileCreator.getProfile(FeatureCreator.getFeatureList(), DEVICE_TYPE_D);
|
||||
@ -312,14 +334,16 @@ public class FeatureManagerImplTest extends BasePolicyManagementDAOTest {
|
||||
ProfileManagerDAOException.class);
|
||||
}
|
||||
|
||||
@Test(description = "This test case tests handling FeatureManagerDAOException when retrieving features of a profile",
|
||||
@Test(description = "This test case tests handling FeatureManagerDAOException when retrieving features of a " +
|
||||
"profile",
|
||||
dependsOnMethods = "testGetFeaturesForProfileThrowingProfileManagerDAOException")
|
||||
public void testGetFeaturesForProfileThrowingFeatureManagerDAOException() throws Exception {
|
||||
Profile profile = ProfileCreator.getProfile(FeatureCreator.getFeatureList(), DEVICE_TYPE_D);
|
||||
profile1 = profileManager.addProfile(profile);
|
||||
|
||||
FeatureDAO featureDAO = mock(FeatureDAO.class);
|
||||
when(featureDAO.addProfileFeature(any(ProfileFeature.class), anyInt())).thenThrow(new FeatureManagerDAOException());
|
||||
when(featureDAO.addProfileFeature(any(ProfileFeature.class), anyInt())).thenThrow(
|
||||
new FeatureManagerDAOException());
|
||||
|
||||
testThrowingException(featureManager,
|
||||
null,
|
||||
|
||||
@ -1,3 +1,20 @@
|
||||
/*
|
||||
* 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.policy.mgt.core.mgt.impl;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user