ensure unit tests related to LifeCycleManager running without issues

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

@ -80,6 +80,18 @@ public class LifecycleStateManger {
} }
} }
public void initializeLifeCycleDetails(List<LifecycleState> states){
lifecycleStates = new HashMap<>();
for (LifecycleState s : states) {
if (s.getProceedingStates() != null) {
s.getProceedingStates().replaceAll(String::toUpperCase);
}
lifecycleStates.put(s.getName().toUpperCase(), new State(s.getName().toUpperCase(),
s.getProceedingStates(), s.getPermission(), s.isAppUpdatable(), s.isAppInstallable(),
s.isInitialState(), s.isEndState()));
}
}
public Set<String> getNextLifecycleStates(String currentLifecycleState) { public Set<String> getNextLifecycleStates(String currentLifecycleState) {
return lifecycleStates.get(currentLifecycleState.toUpperCase()).getProceedingStates(); return lifecycleStates.get(currentLifecycleState.toUpperCase()).getProceedingStates();
} }
@ -124,7 +136,7 @@ public class LifecycleStateManger {
if (pair.getKey().toString().equalsIgnoreCase(currentState)) { if (pair.getKey().toString().equalsIgnoreCase(currentState)) {
return lifecycleStates.get(pair.getKey().toString()); return lifecycleStates.get(pair.getKey().toString());
} }
it.remove(); //it.remove();
} }
return null; return null;
} }

@ -33,7 +33,7 @@ public class LifecycleManagementTest {
Configuration configuration = configurationManager.getConfiguration(); Configuration configuration = configurationManager.getConfiguration();
lifecycleStates = configuration.getLifecycleStates(); lifecycleStates = configuration.getLifecycleStates();
lifecycleStateManger = new LifecycleStateManger(); lifecycleStateManger = new LifecycleStateManger();
lifecycleStateManger.init(lifecycleStates); lifecycleStateManger.initializeLifeCycleDetails(lifecycleStates);
} }
@Test @Test
@ -53,7 +53,8 @@ public class LifecycleManagementTest {
@Test @Test
public void CheckUpdatableState() { public void CheckUpdatableState() {
Boolean isUpdatable = lifecycleStateManger.isUpdatable(UPDATABLE_STATE); Boolean isUpdatable = lifecycleStateManger.isUpdatable(UPDATABLE_STATE);
Assert.assertTrue("Updatable state: " + CURRENT_STATE, isUpdatable); System.out.println(isUpdatable);
Assert.assertTrue("Updatable state: " + UPDATABLE_STATE, isUpdatable);
} }
@Test @Test

Loading…
Cancel
Save