summaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-dispatcher-common
diff options
context:
space:
mode:
authorbeili.zhou <beili.zhou@amdocs.com>2017-08-10 14:54:42 -0400
committerbeili.zhou <beili.zhou@amdocs.com>2017-08-11 09:22:57 -0400
commitfe0e98940048cad839c629821da78b3fcf33b6d2 (patch)
tree0d7a90c79c85413f6c73798f1aa6005c841a6ca8 /appc-dispatcher/appc-dispatcher-common
parentb51814c63253df3379cc60561c31765bc74ee266 (diff)
[APPC-44] APPC Lifecycle Management refactor
Pull APPC lifecycle Management out of APPC dispatcher, so that it can be used by both APPC dispatcher and APPC OAM. This is the pre-step of introducing APPC OAM operations. Issue-Id: APPC-44 Change-Id: Icbde399b5121fae9e1919cfdd5c77bbe55d61188 Signed-off-by: beili.zhou <beili.zhou@amdocs.com>
Diffstat (limited to 'appc-dispatcher/appc-dispatcher-common')
-rw-r--r--appc-dispatcher/appc-dispatcher-common/pom.xml17
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/.gitignore1
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/.settings/org.eclipse.wst.common.project.facet.core.xml4
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/pom.xml32
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java32
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineFactory.java46
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java96
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Event.java62
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/InvalidInputException.java31
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Response.java33
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/State.java82
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineMetadata.java82
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineResponse.java51
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Transition.java48
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/TestStateMachine.java95
15 files changed, 8 insertions, 704 deletions
diff --git a/appc-dispatcher/appc-dispatcher-common/pom.xml b/appc-dispatcher/appc-dispatcher-common/pom.xml
index 4562b9457..c1d240901 100644
--- a/appc-dispatcher/appc-dispatcher-common/pom.xml
+++ b/appc-dispatcher/appc-dispatcher-common/pom.xml
@@ -10,18 +10,17 @@
<packaging>pom</packaging>
<name>APPC Dispatcher Common</name>
<description>APPC Dispatcher Common</description>
-
- <!-- ================================================================================== -->
- <!-- The modules we build -->
- <!-- ================================================================================== -->
- <modules>
- <module>appc-data-access-lib</module>
- <module>execution-queue-management-lib</module>
- <module>state-machine-lib</module>
+
+ <!-- ================================================================================== -->
+ <!-- The modules we build -->
+ <!-- ================================================================================== -->
+ <modules>
+ <module>appc-data-access-lib</module>
+ <module>execution-queue-management-lib</module>
<module>ranking-framework-lib</module>
<module>lock-manager-lib</module>
<module>domain-model-lib</module>
<module>transaction-recorder</module>
</modules>
-
+
</project> \ No newline at end of file
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/.gitignore b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/.gitignore
deleted file mode 100644
index b83d22266..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target/
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/.settings/org.eclipse.wst.common.project.facet.core.xml
deleted file mode 100644
index f4ef8aa0a..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<faceted-project>
- <installed facet="java" version="1.8"/>
-</faceted-project>
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/pom.xml b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/pom.xml
deleted file mode 100644
index f3a085e45..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/pom.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.openecomp.appc</groupId>
- <artifactId>appc-dispatcher-common</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- </parent>
- <artifactId>state-machine-lib</artifactId>
- <packaging>bundle</packaging>
-
- <name>state-machine-lib</name>
- <url>http://maven.apache.org</url>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
- <Bundle-Version>${project.version}</Bundle-Version>
- <Export-Package>org.openecomp.appc.statemachine.*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java
deleted file mode 100644
index dc1c01512..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine;
-
-import org.openecomp.appc.statemachine.objects.*;
-
-
-public interface StateMachine {
- StateMachineResponse handleEvent(State currentState, Event event) throws InvalidInputException;
-}
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineFactory.java b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineFactory.java
deleted file mode 100644
index 034091839..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.impl;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.openecomp.appc.statemachine.StateMachine;
-import org.openecomp.appc.statemachine.objects.Event;
-import org.openecomp.appc.statemachine.objects.State;
-import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
-
-
-public class StateMachineFactory {
-
- private StateMachineFactory(){
-
- }
-
- public static StateMachine getStateMachine(StateMachineMetadata metadata){
- StateMachine machine = new StateMachineImpl(metadata);
- return machine;
- }
-}
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java
deleted file mode 100644
index 212edf8ac..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.impl;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.openecomp.appc.statemachine.StateMachine;
-import org.openecomp.appc.statemachine.objects.*;
-
-
-public class StateMachineImpl implements StateMachine {
-
- private final Set<State> states;
-
- private final Set<Event> events;
-
- StateMachineImpl(StateMachineMetadata metadata){
- this.states = new HashSet<State>();
- this.states.addAll(metadata.getStates());
- this.events = new HashSet<Event>();
- this.events.addAll(metadata.getEvents());
- }
-
- public StateMachineResponse handleEvent(State inputState, Event event) throws InvalidInputException{
-
- if(!validateInputs(inputState,event)){
- throw new InvalidInputException("VNF State or incoming event is invalid. State = " +inputState + " event = " + event );
- }
-
- StateMachineResponse response = new StateMachineResponse();
- State currentState = null,nextState = null;
- for(State stateInSet:states){
- if(stateInSet.equals(inputState)){
- currentState = stateInSet;
- break;
- }
- }
- for(Transition transition : currentState.getTransitions()){
- if(event.equals(transition.getEvent())){
- nextState = transition.getNextState();
- }
- }
- if(nextState == null){
- response.setResponse(Response.NO_TRANSITION_DEFINED);
- }
- else if(inputState.equals(nextState)){
- response.setResponse(Response.NO_STATE_CHANGE);
- }
- else{
- response.setResponse(Response.VALID_TRANSITION);
- }
- response.setNextState(nextState);
- return response;
- }
-
- private boolean validateInputs(State state,Event event){
- if(state ==null || event == null){
- return false;
- }
- if(!(this.states.contains(state) && this.events.contains(event))){
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "StateMachineImpl{" +
- "states=" + states +
- ", events=" + events +
- '}';
- }
-}
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Event.java b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Event.java
deleted file mode 100644
index 66672a548..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Event.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.objects;
-
-public class Event{
-
- private String eventName;
-
- private Event(){
-
- }
- @Override
- public int hashCode(){
- return this.eventName.hashCode();
- }
- @Override
- public boolean equals(Object obj){
- if(obj == null){
- return false;
- }
- if(!(obj instanceof Event)){
- return false;
- }
- Event event = (Event)obj;
- return this.eventName.equals(event.getEventName());
- }
-
- public Event(String eventName){
- this();
- this.eventName = eventName;
- }
-
- public String getEventName() {
- return eventName;
- }
- @Override
- public String toString(){
- return this.eventName;
- }
-}
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/InvalidInputException.java b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/InvalidInputException.java
deleted file mode 100644
index 1ed842120..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/InvalidInputException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.objects;
-
-public class InvalidInputException extends Exception{
- public InvalidInputException(String message){
- super(message);
- }
-}
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Response.java b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Response.java
deleted file mode 100644
index 073ee70a4..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Response.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.objects;
-
-
-public enum Response {
- NO_TRANSITION_DEFINED,NO_STATE_CHANGE,VALID_TRANSITION;
- public String toString(){
- return this.name();
- }
-}
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/State.java b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/State.java
deleted file mode 100644
index e2089f63a..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/State.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.objects;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-
-
-public class State{
- private String stateName;
- private List<Transition> transitions;
-
- private State(){
-
- }
-
- public State(String state){
- this();
- this.stateName = state;
- this.transitions = new ArrayList<Transition>();
- }
-
- @Override
- public int hashCode(){
- return this.stateName.hashCode();
- }
-
- @Override
- public boolean equals(Object obj){
- if(obj == null){
- return false;
- }
- if(!(obj instanceof State)){
- return false;
- }
- State state = (State)obj;
- return this.stateName.equals(state.getStateName());
- }
-
-
- public String getStateName(){
- return stateName;
- }
-
- void addTransition(Transition transition){
- this.transitions.add(transition);
- }
-
- public List<Transition> getTransitions() {
- return transitions;
- }
-
- @Override
- public String toString(){
- return this.stateName;
- }
-}
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineMetadata.java b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineMetadata.java
deleted file mode 100644
index 18767fa59..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineMetadata.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.objects;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-
-public class StateMachineMetadata {
-
- Set<State> states;
- Set<Event> events;
-
- private StateMachineMetadata(StateMachineMetadataBuilder builder){
- states = builder.states;
- events = builder.events;
- }
-
- public Set<State> getStates() {
- return states;
- }
-
- public Set<Event> getEvents() {
- return events;
- }
-
- public static class StateMachineMetadataBuilder{
-
- private Set<State> states;
- private Set<Event> events;
-
- public StateMachineMetadataBuilder(){
- states = new HashSet<State>();
- events = new HashSet<Event>();
- }
-
- public StateMachineMetadataBuilder addState(State state){
- this.states.add(state);
- return this;
- }
-
- public StateMachineMetadataBuilder addEvent(Event event){
- this.events.add(event);
- return this;
- }
-
- public StateMachineMetadataBuilder addTransition(State currentState,Event event,State nextState){
- Transition transition = new Transition(event,nextState);
- currentState.addTransition(transition);
- return this;
- }
-
- public StateMachineMetadata build(){
- StateMachineMetadata machine = new StateMachineMetadata(this);
- return machine;
- }
- }
-}
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineResponse.java b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineResponse.java
deleted file mode 100644
index a6cab8be3..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineResponse.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.objects;
-
-
-public class StateMachineResponse {
- State nextState;
- Response response;
-
- public StateMachineResponse(){
-
- }
-
- public State getNextState() {
- return nextState;
- }
-
- public Response getResponse() {
- return response;
- }
-
- public void setNextState(State nextState) {
- this.nextState = nextState;
- }
-
- public void setResponse(Response response) {
- this.response = response;
- }
-}
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Transition.java b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Transition.java
deleted file mode 100644
index 5bc94f45d..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Transition.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.objects;
-
-
-public class Transition {
- private Event event;
- private State nextState;
-
- private Transition(){
-
- }
- public Transition(Event event,State nextState){
- this();
- this.event = event;
- this.nextState = nextState;
- }
-
- public Event getEvent() {
- return event;
- }
-
- public State getNextState() {
- return nextState;
- }
-}
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/TestStateMachine.java b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/TestStateMachine.java
deleted file mode 100644
index c2f79ec15..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/TestStateMachine.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine;
-
-
-import org.junit.Test;
-import org.openecomp.appc.statemachine.objects.InvalidInputException;
-
-
-public class TestStateMachine {
-
- @Test
- public void handleEvent() throws InvalidInputException {
-
-// MetadataReader metadataReader = new MetadataReader();
-// StateMachineMetadata metadata = metadataReader.readMetadata(null);
-//
-// StateMachine machine = StateMachineFactory.getStateMachine(metadata);
-//
-// /*
-// Testing Positive Scenario passing the valid events and validating the StateMachineResponse
-// */
-// for(State state:metadata.getStates()){
-//
-// for(Transition transition:state.getTransitions()){
-// Event event = transition.getEvent();
-// State nextState = transition.getNextState();
-//
-// StateMachineResponse response = machine.handleEvent(state,event);
-// Assert.assertEquals(response.getNextState(),nextState);
-// Assert.assertEquals(response.getResponse(),Response.VALID_TRANSITION);
-// }
-// }
-//
-// /*
-// Testing Negative Scenarios, 1. Passing the valid Events for which Transition is not defined in
-// Metadata and validating the StateMachineResponse 2. Passing the invalid events which are not
-// registered as events in the StateMachineMetadata and validating StateMachineResponse
-// */
-// for(State state:metadata.getStates()){
-//
-// for(Transition transition:state.getTransitions()){
-// List<Event> negativeEvents = getNegativeEvents(state,metadata.getEvents());
-//
-// for(Event negativeEvent:negativeEvents){
-// StateMachineResponse response = machine.handleEvent(state,negativeEvent);
-// Assert.assertEquals(response.getNextState(),null);
-// Assert.assertEquals(response.getResponse(),Response.NO_TRANSITION_DEFINED);
-//
-// boolean flag =false;
-// try{
-// response = machine.handleEvent(state,new Event("PUT"));
-// }
-// catch(InvalidInputException e){
-// flag = true;
-// }
-// Assert.assertTrue(flag);
-//
-// }
-// }
-// }
- }
-
-// private List<Event> getNegativeEvents(State state,Set<Event> events) {
-// List<Event> negativeEventList = new ArrayList<>();
-// negativeEventList.addAll(events);
-//
-// for(Transition transition: state.getTransitions()){
-// negativeEventList.remove(transition.getEvent());
-// }
-// return negativeEventList;
-// }
-}