From cf896d8cff45754a3bdb00f2f277eef3a5ae0cd2 Mon Sep 17 00:00:00 2001 From: "beili.zhou" Date: Wed, 27 Sep 2017 14:37:10 -0400 Subject: 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 --- .../java/org/openecomp/appc/statemachine/StateMachine.java | 11 +++++++++++ .../openecomp/appc/statemachine/impl/StateMachineImpl.java | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'appc-lifecycle-management/state-machine-lib') 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 states; private final Set events; -- cgit 1.2.3-korg