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

feature/appm-store/pbac
Gathika94 6 years ago
parent f714feb239
commit c67117eb01

@ -74,8 +74,7 @@ public class Configuration {
return lifecycleStates; return lifecycleStates;
} }
public void setLifecycleStates( public void setLifecycleStates(List<LifecycleState> lifecycleStates) {
List<LifecycleState> lifecycleStates) {
this.lifecycleStates = 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.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List; import java.util.List;
/** /**
* This class represents the lifecycle state config * This class represents the lifecycle state config
*/ */
@XmlRootElement(name = "LifecycleState")
public class LifecycleState { public class LifecycleState {
private String name; private String name;

@ -20,6 +20,11 @@ public class LifecycleManagementTest {
private final String CURRENT_STATE = "Approved"; private final String CURRENT_STATE = "Approved";
private final String NEXT_STATE = "Published"; private final String NEXT_STATE = "Published";
private final String BOGUS_STATE = "Removed"; 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 @BeforeClass
@ -45,4 +50,36 @@ public class LifecycleManagementTest {
proceedingStates.contains(BOGUS_STATE.toUpperCase())); 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 ~ specific language governing permissions and limitations
~ under the License. ~ under the License.
--> -->
<ApplicationManagementConfiguration> <ApplicationManagementConfiguration>
<!-- Application Mgt DB schema --> <!-- Application Mgt DB schema -->
@ -35,49 +34,138 @@
<Extension name="SubscriptionManager"> <Extension name="SubscriptionManager">
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.SubscriptionManagerImpl</ClassName> <ClassName>org.wso2.carbon.device.application.mgt.core.impl.SubscriptionManagerImpl</ClassName>
</Extension> </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> </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> <LifecycleStates>
<LifecycleState name="Created"> <LifecycleState name="Created">
<IsAppUpdatable>true</IsAppUpdatable>
<IsInitialState>true</IsInitialState>
<Permission>/device-mgt/applications/life-cycle/create</Permission>
<ProceedingStates> <ProceedingStates>
<State>In-Review</State> <State>In-Review</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="In-Review"> <LifecycleState name="In-Review">
<Permission>/device-mgt/applications/life-cycle/in-review</Permission>
<ProceedingStates> <ProceedingStates>
<State>Rejected</State> <State>Rejected</State>
<State>Approved</State> <State>Approved</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Approved"> <LifecycleState name="Approved">
<Permission>/device-mgt/applications/life-cycle/approve</Permission>
<ProceedingStates> <ProceedingStates>
<State>Published</State> <State>Published</State>
<State>Created</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Rejected"> <LifecycleState name="Rejected">
<Permission>/device-mgt/applications/life-cycle/reject</Permission>
<ProceedingStates> <ProceedingStates>
<State>In-Review</State> <State>Created</State>
<State>Removed</State> <State>Removed</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Published"> <LifecycleState name="Published">
<IsAppInstallable>true</IsAppInstallable>
<Permission>/device-mgt/applications/life-cycle/publish</Permission>
<ProceedingStates> <ProceedingStates>
<State>Unpublished</State> <State>Unpublished</State>
<State>Deprecated</State> <State>Deprecated</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Unpublished"> <LifecycleState name="Unpublished">
<Permission>/device-mgt/applications/life-cycle/unpublish</Permission>
<ProceedingStates> <ProceedingStates>
<State>Published</State>
<State>In-Review</State>
<State>Removed</State> <State>Removed</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Deprecated"> <LifecycleState name="Deprecated">
<Permission>/device-mgt/applications/life-cycle/deprecate</Permission>
<ProceedingStates> <ProceedingStates>
<State>Removed</State> <State>Removed</State>
<State>In-Review</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Removed"> <LifecycleState name="Removed">
<IsEndState>true</IsEndState>
<Permission>/device-mgt/applications/life-cycle/remove</Permission>
</LifecycleState> </LifecycleState>
</LifecycleStates> </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> </ApplicationManagementConfiguration>

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

Loading…
Cancel
Save