change application-mgt.xml class related to the test cases

merge-requests/61/head
Gathika94 6 years ago
parent f714feb239
commit c67117eb01

@ -74,8 +74,7 @@ public class Configuration {
return lifecycleStates;
}
public void setLifecycleStates(
List<LifecycleState> lifecycleStates) {
public void setLifecycleStates(List<LifecycleState> lifecycleStates) {
this.lifecycleStates = lifecycleStates;
}

@ -3,11 +3,13 @@ package org.wso2.carbon.device.application.mgt.core.lifecycle.config;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
/**
* This class represents the lifecycle state config
*/
@XmlRootElement(name = "LifecycleState")
public class LifecycleState {
private String name;

@ -20,6 +20,11 @@ public class LifecycleManagementTest {
private final String CURRENT_STATE = "Approved";
private final String NEXT_STATE = "Published";
private final String BOGUS_STATE = "Removed";
private final String UPDATABLE_STATE = "Created";
private final String NON_UPDATABLE_STATE= "Removed";
private final String INSTALLABLE_STATE = "Published";
private final String UNINSTALlABLE_STATE = "Removed";
@BeforeClass
@ -45,4 +50,36 @@ public class LifecycleManagementTest {
proceedingStates.contains(BOGUS_STATE.toUpperCase()));
}
@Test
public void CheckUpdatableState() {
Boolean isUpdatable = lifecycleStateManger.isUpdatable(UPDATABLE_STATE);
Assert.assertTrue("Updatable state: " + CURRENT_STATE, isUpdatable);
}
@Test
public void CheckNonUpdatableState() {
Boolean isUpdatable = lifecycleStateManger.isUpdatable(NON_UPDATABLE_STATE);
Assert.assertFalse("Non Updatable state: " + CURRENT_STATE, isUpdatable);
}
@Test
public void CheckInstallableState() {
Boolean isInstallable = lifecycleStateManger.isInstallable(INSTALLABLE_STATE);
Assert.assertTrue("Installable state: " + INSTALLABLE_STATE,isInstallable);
}
@Test
public void CheckUnInstallableState() {
Boolean isInstallable = lifecycleStateManger.isInstallable(UNINSTALlABLE_STATE);
Assert.assertFalse("UnInstallable state: " + UNINSTALlABLE_STATE,isInstallable);
}
@Test
public void check() {
Set<String> proceedingStates = lifecycleStateManger.getNextLifecycleStates(CURRENT_STATE);
Assert.assertFalse("Invalid proceeding state of: " + CURRENT_STATE,
proceedingStates.contains(BOGUS_STATE.toUpperCase()));
}
}

@ -16,7 +16,6 @@
~ specific language governing permissions and limitations
~ under the License.
-->
<ApplicationManagementConfiguration>
<!-- Application Mgt DB schema -->
@ -35,49 +34,138 @@
<Extension name="SubscriptionManager">
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.SubscriptionManagerImpl</ClassName>
</Extension>
<Extension name="ApplicationStorageManager">
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.ApplicationStorageManagerImpl</ClassName>
<Parameters>
<Parameter name="StoragePath">repository/resources/apps/</Parameter>
<Parameter name="MaxScreenShotCount">6</Parameter>
</Parameters>
</Extension>
</Extensions>
<!-- This is for publisher lifecycle -->
<!-- The current lifecycle as follows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Created] -> [In-Review] -> [Approved] -> [Published] -> [Unpublished] -> [Removed]
^ | ^
| | |
| |-> [Deprecated] - - - - - - - -|
| |
|-> [Rejected] - - - - - - - - - - - - - - - - - - - - - - - - |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If there is a requirement to introduce a new state to the lifecycle, please refer above
diagram and add relevant state to the below configuration appropriately.
-->
<!-- a lifecyclestate can have following properties
<LifecycleState name="In-Review">
<IsAppInstallable>false</IsAppInstallable>
<IsAppUpdatable>true</IsAppUpdatable>
<IsInitialState>false</IsInitialState>
<IsEndState>false</IsEndState>
<Permission>
/device-mgt/applications/life-cycle/in-review
</Permission>
<ProceedingStates>
<State>Rejected</State>
<State>Approved</State>
</ProceedingStates>
</LifecycleState>
-->
<LifecycleStates>
<LifecycleState name="Created">
<IsAppUpdatable>true</IsAppUpdatable>
<IsInitialState>true</IsInitialState>
<Permission>/device-mgt/applications/life-cycle/create</Permission>
<ProceedingStates>
<State>In-Review</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="In-Review">
<Permission>/device-mgt/applications/life-cycle/in-review</Permission>
<ProceedingStates>
<State>Rejected</State>
<State>Approved</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Approved">
<Permission>/device-mgt/applications/life-cycle/approve</Permission>
<ProceedingStates>
<State>Published</State>
<State>Created</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Rejected">
<Permission>/device-mgt/applications/life-cycle/reject</Permission>
<ProceedingStates>
<State>In-Review</State>
<State>Created</State>
<State>Removed</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Published">
<IsAppInstallable>true</IsAppInstallable>
<Permission>/device-mgt/applications/life-cycle/publish</Permission>
<ProceedingStates>
<State>Unpublished</State>
<State>Deprecated</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Unpublished">
<Permission>/device-mgt/applications/life-cycle/unpublish</Permission>
<ProceedingStates>
<State>Published</State>
<State>In-Review</State>
<State>Removed</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Deprecated">
<Permission>/device-mgt/applications/life-cycle/deprecate</Permission>
<ProceedingStates>
<State>Removed</State>
<State>In-Review</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Removed">
<IsEndState>true</IsEndState>
<Permission>/device-mgt/applications/life-cycle/remove</Permission>
</LifecycleState>
</LifecycleStates>
<UIConfigs>
<EnableOAuth>true</EnableOAuth>
<EnableSSO>false</EnableSSO>
<EnableSSO>false</EnableSSO>
<AppRegistration>
<Tags>
<Tag>application_management</Tag>
<Tag>device_management</Tag>
<Tag>subscription_management</Tag>
<Tag>review_management</Tag>
</Tags>
<AllowToAllDomains>true</AllowToAllDomains>
</AppRegistration>
<Scopes>
<Scope>perm:app:review:view</Scope>
<Scope>perm:app:review:update</Scope>
<Scope>perm:app:publisher:view</Scope>
<Scope>perm:app:publisher:update</Scope>
</Scopes>
<SSOConfiguration>
<Issuer>app-mgt</Issuer>
</SSOConfiguration>
<LoginResponse>
<SuccessCallback>/application-mgt</SuccessCallback>
<FailureCallback>
<BadRequest>/pages/error/client-errors/400</BadRequest>
<Unauthorized>/pages/error/client-errors/401</Unauthorized>
<Forbidden>/pages/error/client-errors/403</Forbidden>
<NotFound>/pages/error/client-errors/404</NotFound>
<MethodNotAllowed>/pages/error/client-errors/405</MethodNotAllowed>
<NotAcceptable>/pages/error/client-errors/406</NotAcceptable>
<UnsupportedMediaType>/pages/error/client-errors/415</UnsupportedMediaType>
<InternalServerError>/pages/error/server-errors/500</InternalServerError>
<DefaultPage>/pages/error/default</DefaultPage>
</FailureCallback>
</LoginResponse>
</UIConfigs>
</ApplicationManagementConfiguration>

@ -76,35 +76,27 @@
<LifecycleState name="Created">
<IsAppUpdatable>true</IsAppUpdatable>
<IsInitialState>true</IsInitialState>
<Permission>
/device-mgt/applications/life-cycle/create
</Permission>
<Permission>/device-mgt/applications/life-cycle/create</Permission>
<ProceedingStates>
<State>In-Review</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="In-Review">
<Permission>
/device-mgt/applications/life-cycle/in-review
</Permission>
<Permission>/device-mgt/applications/life-cycle/in-review</Permission>
<ProceedingStates>
<State>Rejected</State>
<State>Approved</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Approved">
<Permission>
/device-mgt/applications/life-cycle/approve
</Permission>
<Permission>/device-mgt/applications/life-cycle/approve</Permission>
<ProceedingStates>
<State>Published</State>
<State>Created</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Rejected">
<Permission>
/device-mgt/applications/life-cycle/reject
</Permission>
<Permission>/device-mgt/applications/life-cycle/reject</Permission>
<ProceedingStates>
<State>Created</State>
<State>Removed</State>
@ -112,18 +104,14 @@
</LifecycleState>
<LifecycleState name="Published">
<IsAppInstallable>true</IsAppInstallable>
<Permission>
/device-mgt/applications/life-cycle/publish
</Permission>
<Permission>/device-mgt/applications/life-cycle/publish</Permission>
<ProceedingStates>
<State>Unpublished</State>
<State>Deprecated</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Unpublished">
<Permission>
/device-mgt/applications/life-cycle/unpublish
</Permission>
<Permission>/device-mgt/applications/life-cycle/unpublish</Permission>
<ProceedingStates>
<State>Published</State>
<State>In-Review</State>
@ -131,9 +119,7 @@
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Deprecated">
<Permission>
/device-mgt/applications/life-cycle/deprecate
</Permission>
<Permission>/device-mgt/applications/life-cycle/deprecate</Permission>
<ProceedingStates>
<State>Removed</State>
<State>In-Review</State>
@ -141,9 +127,7 @@
</LifecycleState>
<LifecycleState name="Removed">
<IsEndState>true</IsEndState>
<Permission>
/device-mgt/applications/life-cycle/remove
</Permission>
<Permission>/device-mgt/applications/life-cycle/remove</Permission>
</LifecycleState>
</LifecycleStates>

Loading…
Cancel
Save