diff options
author | beili.zhou <beili.zhou@amdocs.com> | 2017-09-27 14:37:10 -0400 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2017-09-27 22:08:10 +0000 |
commit | cf896d8cff45754a3bdb00f2f277eef3a5ae0cd2 (patch) | |
tree | cf1bbc07751b325a1f538901f07bed9361d03ee7 /appc-lifecycle-management/state-machine-lib/src/main/java | |
parent | 3f8e7fc7d4bdc18d14504e5189ac242f28ea328a (diff) |
Increase sonar coverage for common
Add Junit test in appc-common
- cache
- cache/impl
- configuration
- exceptions
- i18n
- logging
Issue-Id: APPC-230
Change-Id: I04c457da4dfa881c1109273b8fd3e16e76ebd68f
Signed-off-by: beili.zhou <beili.zhou@amdocs.com>
Diffstat (limited to 'appc-lifecycle-management/state-machine-lib/src/main/java')
2 files changed, 13 insertions, 2 deletions
diff --git a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java index bf08680f1..de22e21a6 100644 --- a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java +++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java @@ -29,6 +29,17 @@ import org.openecomp.appc.statemachine.objects.Event; import org.openecomp.appc.statemachine.objects.State; import org.openecomp.appc.statemachine.objects.StateMachineResponse; +/** + * Interface of the StateMachine + */ public interface StateMachine { + /** + * Handle event + * @param currentState the current State which the event should be handled from + * @param event the Event that needs to be handled + * @return StateMachineResponse + * @throws InvalidInputException + * when the passed in currentState and event are not predefined or no relevant transition + */ StateMachineResponse handleEvent(State currentState, Event event) throws InvalidInputException; } diff --git a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java index f0cb4919b..4e21c13f4 100644 --- a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java +++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java @@ -40,8 +40,8 @@ import org.openecomp.appc.statemachine.objects.Transition; * Implementation of StateMachine */ public class StateMachineImpl implements StateMachine { - private final String invalidInputFormat = "VNF State or incoming event is invalid. State = %s event = %s"; - final String toStringFormat = "StateMachineImpl{states=%s, events=%s}"; + private static final String invalidInputFormat = "VNF State or incoming event is invalid. State = %s event = %s"; + static final String toStringFormat = "StateMachineImpl{states=%s, events=%s}"; private final Set<State> states; private final Set<Event> events; |