[APPC-44] APPC Lifecycle Management refactor 41/7241/5
authorbeili.zhou <beili.zhou@amdocs.com>
Thu, 10 Aug 2017 18:54:42 +0000 (14:54 -0400)
committerbeili.zhou <beili.zhou@amdocs.com>
Fri, 11 Aug 2017 13:22:57 +0000 (09:22 -0400)
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>
56 files changed:
appc-common/src/main/java/org/openecomp/appc/exceptions/InvalidInputException.java [moved from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/InvalidInputException.java with 91% similarity]
appc-common/src/main/java/org/openecomp/appc/exceptions/InvalidStateException.java [new file with mode: 0644]
appc-dispatcher/appc-dispatcher-common/pom.xml
appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java [deleted file]
appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/TestStateMachine.java [deleted file]
appc-dispatcher/appc-license-manager/appc-license-manager-core/pom.xml
appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml [deleted file]
appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/pom.xml [deleted file]
appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.settings/org.eclipse.wst.common.project.facet.core.xml [deleted file]
appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/helper/MetadataReader.java [deleted file]
appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java [deleted file]
appc-dispatcher/appc-lifecycle-management/pom.xml [deleted file]
appc-dispatcher/pom.xml
appc-lifecycle-management/.gitignore [moved from appc-dispatcher/appc-dispatcher-common/state-machine-lib/.gitignore with 100% similarity]
appc-lifecycle-management/appc-lifecycle-management-api/.gitignore [moved from appc-dispatcher/appc-lifecycle-management/.gitignore with 100% similarity]
appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml [moved from appc-dispatcher/appc-dispatcher-common/state-machine-lib/.settings/org.eclipse.wst.common.project.facet.core.xml with 100% similarity]
appc-lifecycle-management/appc-lifecycle-management-api/pom.xml [moved from appc-dispatcher/appc-dispatcher-common/state-machine-lib/pom.xml with 62% similarity]
appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/LifecycleManager.java [moved from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/LifecycleManager.java with 89% similarity]
appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LCMResponse.java [moved from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LCMResponse.java with 86% similarity]
appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LifecycleException.java [moved from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LifecycleException.java with 98% similarity]
appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/NoTransitionDefinedException.java [moved from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/NoTransitionDefinedException.java with 98% similarity]
appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/VNFOperationOutcome.java [moved from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/VNFOperationOutcome.java with 91% similarity]
appc-lifecycle-management/appc-lifecycle-management-core/.gitignore [moved from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.gitignore with 100% similarity]
appc-lifecycle-management/appc-lifecycle-management-core/pom.xml [moved from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/pom.xml with 83% similarity]
appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java [new file with mode: 0644]
appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml [moved from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml with 91% similarity]
appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties [moved from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties with 98% similarity]
appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/LifecycleManagerTest.java [moved from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/TestLifecycleManager.java with 72% similarity]
appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/OamLifeCycleManagerTest.java [new file with mode: 0644]
appc-lifecycle-management/appc-lifecycle-management-features/.gitignore [moved from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.gitignore with 100% similarity]
appc-lifecycle-management/appc-lifecycle-management-features/pom.xml [moved from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/pom.xml with 61% similarity]
appc-lifecycle-management/appc-lifecycle-management-features/src/main/resources/features.xml [moved from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/src/main/resources/features.xml with 82% similarity]
appc-lifecycle-management/appc-lifecycle-management-installer/.gitignore [new file with mode: 0644]
appc-lifecycle-management/appc-lifecycle-management-installer/pom.xml [new file with mode: 0644]
appc-lifecycle-management/appc-lifecycle-management-installer/src/assembly/assemble_installer_zip.xml [new file with mode: 0644]
appc-lifecycle-management/appc-lifecycle-management-installer/src/assembly/assemble_mvnrepo_zip.xml [new file with mode: 0644]
appc-lifecycle-management/appc-lifecycle-management-installer/src/main/resources/scripts/install-feature.sh [new file with mode: 0644]
appc-lifecycle-management/pom.xml [new file with mode: 0644]
appc-lifecycle-management/state-machine-lib/.gitignore [moved from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/.gitignore with 100% similarity]
appc-lifecycle-management/state-machine-lib/.settings/org.eclipse.wst.common.project.facet.core.xml [moved from appc-dispatcher/appc-lifecycle-management/.settings/org.eclipse.wst.common.project.facet.core.xml with 100% similarity]
appc-lifecycle-management/state-machine-lib/pom.xml [new file with mode: 0644]
appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java [new file with mode: 0644]
appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMetaDataReader.java [moved from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java with 86% similarity]
appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineFactory.java [moved from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineFactory.java with 86% similarity]
appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java [new file with mode: 0644]
appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamMetaDataReader.java [new file with mode: 0644]
appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamStates.java [new file with mode: 0644]
appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/VnfMetaDataReader.java [new file with mode: 0644]
appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Event.java [moved from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Event.java with 62% similarity]
appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Response.java [moved from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Response.java with 98% similarity]
appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/State.java [moved from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/State.java with 55% similarity]
appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineMetadata.java [moved from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineMetadata.java with 62% similarity]
appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineResponse.java [moved from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineResponse.java with 92% similarity]
appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Transition.java [moved from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Transition.java with 93% similarity]
appc-lifecycle-management/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/impl/readers/AppcOamStatesTest.java [new file with mode: 0644]
pom.xml

@@ -1,31 +1,31 @@
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * 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);
-    }
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.exceptions;\r
+\r
+public class InvalidInputException extends Exception {\r
+    public InvalidInputException(String message){\r
+        super(message);\r
+    }\r
+}\r
diff --git a/appc-common/src/main/java/org/openecomp/appc/exceptions/InvalidStateException.java b/appc-common/src/main/java/org/openecomp/appc/exceptions/InvalidStateException.java
new file mode 100644 (file)
index 0000000..19c9e38
--- /dev/null
@@ -0,0 +1,31 @@
+/*-\r
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * 
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * 
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.exceptions;\r
+\r
+public class InvalidStateException extends Exception {\r
+    public InvalidStateException(String message) {\r
+        super(message);\r
+    }\r
+}\r
index 4562b94..c1d2409 100644 (file)
   <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/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 (file)
index 212edf8..0000000
+++ /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/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 (file)
index c2f79ec..0000000
+++ /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;
-//    }
-}
index 99ab538..522ca23 100644 (file)
             <artifactId>sli-common</artifactId>
             <scope>compile</scope>
         </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.openecomp.sdnc.core</groupId>
             <artifactId>sli-provider</artifactId>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml
deleted file mode 100644 (file)
index f4ef8aa..0000000
+++ /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-lifecycle-management/appc-lifecycle-management-api/pom.xml b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/pom.xml
deleted file mode 100644 (file)
index cea316c..0000000
+++ /dev/null
@@ -1,36 +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-lifecycle-management</artifactId>
-           <version>1.1.0-SNAPSHOT</version>
-         </parent>
-
-  <groupId>org.openecomp.appc</groupId>
-  <artifactId>appc-lifecycle-management-api</artifactId>
-  <version>1.1.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
-
-  <name>appc-lifecycle-management-api</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.lifecyclemanager.*</Export-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.settings/org.eclipse.wst.common.project.facet.core.xml
deleted file mode 100644 (file)
index f4ef8aa..0000000
+++ /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-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/helper/MetadataReader.java b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/helper/MetadataReader.java
deleted file mode 100644 (file)
index cad3db7..0000000
+++ /dev/null
@@ -1,443 +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.lifecyclemanager.helper;
-
-
-import org.openecomp.appc.domainmodel.lcm.VNFOperation;
-import org.openecomp.appc.lifecyclemanager.objects.VNFOperationOutcome;
-import org.openecomp.appc.statemachine.objects.Event;
-import org.openecomp.appc.statemachine.objects.State;
-import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
-
-
-public class MetadataReader {
-
-    private enum VNFStates {
-        Not_Instantiated, Instantiated, Configuring, Configured, Testing, Tested, Rebuilding, Restarting, Starting, Error, Running, Unknown, Terminating, Stopping, Stopped,
-        Backing_Up, Snapshotting, Software_Uploading, Upgrading, Rollbacking, Licensing, Migrating, Evacuating , NOT_ORCHESTRATED("NOT ORCHESTRATED"),Created;
-
-        String stateName;
-
-        VNFStates(String name){
-            this.stateName = name;
-        }
-
-        VNFStates(){
-            this.stateName = name();
-        }
-
-        public String toString(){
-            return this.stateName.toLowerCase();
-        }
-    }
-
-    @SuppressWarnings("unused")
-    public StateMachineMetadata readMetadata(String vnfType){
-        State NOT_INSTANTIATED = new State(VNFStates.Not_Instantiated.toString());
-        State INSTANTIATED = new State(VNFStates.Instantiated.toString());
-        State CONFIGURING = new State(VNFStates.Configuring.toString());
-        State CONFIGURED = new State(VNFStates.Configured.toString());
-        State TESTING = new State(VNFStates.Testing.toString());
-        State TESTED = new State(VNFStates.Tested.toString());
-        State REBUILDING = new State(VNFStates.Rebuilding.toString());
-        State RESTARTING = new State(VNFStates.Restarting.toString());
-        State STARTING = new State(VNFStates.Starting.toString());
-        State ERROR = new State(VNFStates.Error.toString());
-        State RUNNING = new State(VNFStates.Running.toString());
-        State UNKNOWN = new State(VNFStates.Unknown.toString());
-        State TERMINATING = new State(VNFStates.Terminating.toString());
-        State STOPPING = new State(VNFStates.Stopping.toString());
-        State STOPPED = new State(VNFStates.Stopped.toString());
-        State NOT_ORCHESTRATED = new State(VNFStates.NOT_ORCHESTRATED.toString());
-
-        State BACKING_UP = new State(VNFStates.Backing_Up.toString());
-        State SNAPSHOTTING = new State(VNFStates.Snapshotting.toString());
-        State SOFTWARE_UPLOADING = new State(VNFStates.Software_Uploading.toString());
-        State UPGRADING = new State(VNFStates.Upgrading.toString());
-        State ROLLBACKING = new State(VNFStates.Rollbacking.toString());
-
-        State MIGRATING = new State(VNFStates.Migrating.toString());
-        State EVACUATING = new State(VNFStates.Evacuating.toString());
-        State CREATED= new State(VNFStates.Created.toString());
-
-        Event CONFIGURE = new Event(VNFOperation.Configure.toString());
-        Event HEALTHCHECK = new Event(VNFOperation.HealthCheck.toString());
-        Event TEST = new Event(VNFOperation.Test.toString());
-        Event START = new Event(VNFOperation.Start.toString());
-        Event TERMINATE = new Event(VNFOperation.Terminate.toString());
-        Event RESTART = new Event(VNFOperation.Restart.toString());
-        Event REBUILD = new Event(VNFOperation.Rebuild.toString());
-        Event STOP = new Event(VNFOperation.Stop.toString());
-        Event CONFIG_MODIFY = new Event(VNFOperation.ConfigModify.toString());
-        Event CONFIG_SCALEOUT = new Event(VNFOperation.ConfigScaleOut.toString());
-        Event CONFIG_RESTORE = new Event(VNFOperation.ConfigRestore.toString());
-        Event BACKUP = new Event(VNFOperation.Backup.toString());
-        Event SNAPSHOT = new Event(VNFOperation.Snapshot.toString());
-        Event SOFTWARE_UPLOAD = new Event(VNFOperation.SoftwareUpload.toString());
-        Event LIVE_UPGRADE = new Event(VNFOperation.LiveUpgrade.toString());
-        Event ROLLBACK = new Event(VNFOperation.Rollback.toString());
-        Event SYNC = new Event(VNFOperation.Sync.toString());
-        Event AUDIT = new Event(VNFOperation.Audit.toString());
-        Event MIGRATE = new Event(VNFOperation.Migrate.toString());
-        Event EVACUATE = new Event(VNFOperation.Evacuate.toString());
-        Event CONFIG_BACKUP = new Event(VNFOperation.ConfigBackup.toString());
-        Event CONFIG_BACKUP_DELETE = new Event(VNFOperation.ConfigBackupDelete.toString());
-        Event CONFIG_EXPORT = new Event(VNFOperation.ConfigExport.toString());
-
-        Event LOCK = new Event(VNFOperation.Lock.toString());
-        Event UNLOCK = new Event(VNFOperation.Unlock.toString());
-        Event CHECKLOCK = new Event(VNFOperation.CheckLock.toString());
-
-        Event SUCCESS = new Event(VNFOperationOutcome.SUCCESS.toString());
-        Event FAILURE = new Event(VNFOperationOutcome.FAILURE.toString());
-
-
-        StateMachineMetadata.StateMachineMetadataBuilder builder = new StateMachineMetadata.StateMachineMetadataBuilder();
-
-        builder = builder.addState(NOT_INSTANTIATED);
-        builder = builder.addState(INSTANTIATED);
-        builder = builder.addState(CONFIGURING);
-        builder = builder.addState(CONFIGURED);
-        builder = builder.addState(TESTING);
-        builder = builder.addState(TESTED);
-        builder = builder.addState(REBUILDING);
-        builder = builder.addState(RESTARTING);
-        builder = builder.addState(STARTING);
-        builder = builder.addState(ERROR);
-        builder = builder.addState(RUNNING);
-        builder = builder.addState(UNKNOWN);
-        builder = builder.addState(TERMINATING);
-        builder = builder.addState(STOPPING);
-        builder = builder.addState(STOPPED);
-        builder = builder.addState(BACKING_UP);
-        builder = builder.addState(SNAPSHOTTING);
-        builder = builder.addState(SOFTWARE_UPLOADING);
-        builder = builder.addState(UPGRADING);
-        builder = builder.addState(ROLLBACKING);
-        builder = builder.addState(MIGRATING);
-        builder = builder.addState(EVACUATING);
-        builder = builder.addState(NOT_ORCHESTRATED);
-        builder = builder.addState(CREATED);
-
-        builder = builder.addEvent(CONFIGURE);
-        builder = builder.addEvent(TEST);
-        builder = builder.addEvent(START);
-        builder = builder.addEvent(TERMINATE);
-        builder = builder.addEvent(RESTART);
-        builder = builder.addEvent(REBUILD);
-        builder = builder.addEvent(SUCCESS);
-        builder = builder.addEvent(FAILURE);
-        builder = builder.addEvent(STOP);
-        builder = builder.addEvent(CONFIG_MODIFY);
-        builder = builder.addEvent(CONFIG_SCALEOUT);
-        builder = builder.addEvent(CONFIG_RESTORE);
-        builder = builder.addEvent(HEALTHCHECK);
-        builder = builder.addEvent(BACKUP);
-        builder = builder.addEvent(SNAPSHOT);
-        builder = builder.addEvent(SOFTWARE_UPLOAD);
-        builder = builder.addEvent(LIVE_UPGRADE);
-        builder = builder.addEvent(ROLLBACK);
-        builder = builder.addEvent(SYNC);
-        builder = builder.addEvent(AUDIT);
-        builder = builder.addEvent(MIGRATE);
-        builder = builder.addEvent(EVACUATE);
-        builder = builder.addEvent(LOCK);
-        builder = builder.addEvent(UNLOCK);
-        builder = builder.addEvent(CHECKLOCK);
-        builder = builder.addEvent(CONFIG_BACKUP);
-        builder = builder.addEvent(CONFIG_BACKUP_DELETE);
-        builder = builder.addEvent(CONFIG_EXPORT);
-
-        builder = builder.addTransition(NOT_ORCHESTRATED,CONFIGURE,CONFIGURING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,TEST,TESTING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,START,STARTING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,TERMINATE,TERMINATING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,RESTART,RESTARTING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,REBUILD,REBUILDING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,STOP,STOPPING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,CONFIG_MODIFY,CONFIGURING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,CONFIG_SCALEOUT,CONFIGURING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,CONFIG_RESTORE,CONFIGURING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,HEALTHCHECK,TESTING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,BACKUP,BACKING_UP);
-        builder = builder.addTransition(NOT_ORCHESTRATED,SNAPSHOT,SNAPSHOTTING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,LIVE_UPGRADE,UPGRADING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,ROLLBACK,ROLLBACKING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,MIGRATE,MIGRATING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,EVACUATE,EVACUATING);
-        builder = builder.addTransition(NOT_ORCHESTRATED,LOCK,NOT_ORCHESTRATED);
-        builder = builder.addTransition(NOT_ORCHESTRATED,UNLOCK,NOT_ORCHESTRATED);
-        builder = builder.addTransition(NOT_ORCHESTRATED,CHECKLOCK,NOT_ORCHESTRATED);
-        builder = builder.addTransition(NOT_ORCHESTRATED,CONFIG_BACKUP,NOT_ORCHESTRATED);
-
-        builder = builder.addTransition(INSTANTIATED,CONFIGURE,CONFIGURING);
-        builder = builder.addTransition(INSTANTIATED,TEST,TESTING);
-        builder = builder.addTransition(INSTANTIATED,START,STARTING);
-        builder = builder.addTransition(INSTANTIATED,TERMINATE,TERMINATING);
-        builder = builder.addTransition(INSTANTIATED,RESTART,RESTARTING);
-        builder = builder.addTransition(INSTANTIATED,REBUILD,REBUILDING);
-        builder = builder.addTransition(INSTANTIATED,STOP,STOPPING);
-        builder = builder.addTransition(INSTANTIATED,CONFIG_MODIFY,CONFIGURING);
-        builder = builder.addTransition(INSTANTIATED,CONFIG_SCALEOUT,CONFIGURING);
-        builder = builder.addTransition(INSTANTIATED,CONFIG_RESTORE,CONFIGURING);
-        builder = builder.addTransition(INSTANTIATED,HEALTHCHECK,TESTING);
-        builder = builder.addTransition(INSTANTIATED,BACKUP,BACKING_UP);
-        builder = builder.addTransition(INSTANTIATED,SNAPSHOT,SNAPSHOTTING);
-        builder = builder.addTransition(INSTANTIATED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
-        builder = builder.addTransition(INSTANTIATED,LIVE_UPGRADE,UPGRADING);
-        builder = builder.addTransition(INSTANTIATED,ROLLBACK,ROLLBACKING);
-        builder = builder.addTransition(INSTANTIATED,MIGRATE,MIGRATING);
-        builder = builder.addTransition(INSTANTIATED,EVACUATE,EVACUATING);
-        builder = builder.addTransition(INSTANTIATED,LOCK,INSTANTIATED);
-        builder = builder.addTransition(INSTANTIATED,UNLOCK,INSTANTIATED);
-        builder = builder.addTransition(INSTANTIATED,CHECKLOCK,INSTANTIATED);
-
-        builder = builder.addTransition(CONFIGURED,CONFIGURE,CONFIGURING);
-        builder = builder.addTransition(CONFIGURED,TEST,TESTING);
-        builder = builder.addTransition(CONFIGURED,START,STARTING);
-        builder = builder.addTransition(CONFIGURED,TERMINATE,TERMINATING);
-        builder = builder.addTransition(CONFIGURED,RESTART,RESTARTING);
-        builder = builder.addTransition(CONFIGURED,REBUILD,REBUILDING);
-        builder = builder.addTransition(CONFIGURED,STOP,STOPPING);
-        builder = builder.addTransition(CONFIGURED,CONFIG_MODIFY,CONFIGURING);
-        builder = builder.addTransition(CONFIGURED,CONFIG_SCALEOUT,CONFIGURING);
-        builder = builder.addTransition(CONFIGURED,CONFIG_RESTORE,CONFIGURING);
-        builder = builder.addTransition(CONFIGURED,HEALTHCHECK,TESTING);
-        builder = builder.addTransition(CONFIGURED,BACKUP,BACKING_UP);
-        builder = builder.addTransition(CONFIGURED,SNAPSHOT,SNAPSHOTTING);
-        builder = builder.addTransition(CONFIGURED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
-        builder = builder.addTransition(CONFIGURED,LIVE_UPGRADE,UPGRADING);
-        builder = builder.addTransition(CONFIGURED,ROLLBACK,ROLLBACKING);
-        builder = builder.addTransition(CONFIGURED,SYNC,CONFIGURED);
-        builder = builder.addTransition(CONFIGURED,AUDIT,CONFIGURED);
-        builder = builder.addTransition(CONFIGURED,MIGRATE,MIGRATING);
-        builder = builder.addTransition(CONFIGURED,EVACUATE,EVACUATING);
-        builder = builder.addTransition(CONFIGURED,LOCK,CONFIGURED);
-        builder = builder.addTransition(CONFIGURED,UNLOCK,CONFIGURED);
-        builder = builder.addTransition(CONFIGURED,CHECKLOCK,CONFIGURED);
-        builder = builder.addTransition(CONFIGURED,CONFIG_BACKUP,CONFIGURED);
-        builder = builder.addTransition(CONFIGURED,CONFIG_BACKUP_DELETE,CONFIGURED);
-        builder = builder.addTransition(CONFIGURED,CONFIG_EXPORT,CONFIGURED);
-
-        builder = builder.addTransition(CREATED,CONFIGURE,CONFIGURING);
-        builder = builder.addTransition(CREATED,TEST,TESTING);
-        builder = builder.addTransition(CREATED,START,STARTING);
-        builder = builder.addTransition(CREATED,TERMINATE,TERMINATING);
-        builder = builder.addTransition(CREATED,RESTART,RESTARTING);
-        builder = builder.addTransition(CREATED,REBUILD,REBUILDING);
-        builder = builder.addTransition(CREATED,STOP,STOPPING);
-        builder = builder.addTransition(CREATED,CONFIG_MODIFY,CONFIGURING);
-        builder = builder.addTransition(CREATED,CONFIG_SCALEOUT,CONFIGURING);
-        builder = builder.addTransition(CREATED,CONFIG_RESTORE,CONFIGURING);
-        builder = builder.addTransition(CREATED,HEALTHCHECK,TESTING);
-        builder = builder.addTransition(CREATED,BACKUP,BACKING_UP);
-        builder = builder.addTransition(CREATED,SNAPSHOT,SNAPSHOTTING);
-        builder = builder.addTransition(CREATED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
-        builder = builder.addTransition(CREATED,LIVE_UPGRADE,UPGRADING);
-        builder = builder.addTransition(CREATED,ROLLBACK,ROLLBACKING);
-        builder = builder.addTransition(CREATED,MIGRATE,MIGRATING);
-        builder = builder.addTransition(CREATED,EVACUATE,EVACUATING);
-        builder = builder.addTransition(CREATED,LOCK,CREATED);
-        builder = builder.addTransition(CREATED,UNLOCK,CREATED);
-        builder = builder.addTransition(CREATED,CHECKLOCK,CREATED);
-        builder = builder.addTransition(CREATED,CONFIG_BACKUP,CREATED);
-
-        builder = builder.addTransition(TESTED,CONFIGURE,CONFIGURING);
-        builder = builder.addTransition(TESTED,TEST,TESTING);
-        builder = builder.addTransition(TESTED,START,STARTING);
-        builder = builder.addTransition(TESTED,TERMINATE,TERMINATING);
-        builder = builder.addTransition(TESTED,RESTART,RESTARTING);
-        builder = builder.addTransition(TESTED,REBUILD,REBUILDING);
-        builder = builder.addTransition(TESTED,STOP,STOPPING);
-        builder = builder.addTransition(TESTED,CONFIG_MODIFY,CONFIGURING);
-        builder = builder.addTransition(TESTED,CONFIG_SCALEOUT,CONFIGURING);
-        builder = builder.addTransition(TESTED,CONFIG_RESTORE,CONFIGURING);
-        builder = builder.addTransition(TESTED,HEALTHCHECK,TESTING);
-        builder = builder.addTransition(TESTED,BACKUP,BACKING_UP);
-        builder = builder.addTransition(TESTED,SNAPSHOT,SNAPSHOTTING);
-        builder = builder.addTransition(TESTED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
-        builder = builder.addTransition(TESTED,LIVE_UPGRADE,UPGRADING);
-        builder = builder.addTransition(TESTED,ROLLBACK,ROLLBACKING);
-        builder = builder.addTransition(TESTED,SYNC,TESTED);
-        builder = builder.addTransition(TESTED,AUDIT,TESTED);
-        builder = builder.addTransition(TESTED,MIGRATE,MIGRATING);
-        builder = builder.addTransition(TESTED,EVACUATE,EVACUATING);
-        builder = builder.addTransition(TESTED,LOCK,TESTED);
-        builder = builder.addTransition(TESTED,UNLOCK,TESTED);
-        builder = builder.addTransition(TESTED,CHECKLOCK,TESTED);
-        builder = builder.addTransition(TESTED,CONFIG_BACKUP,TESTED);
-        builder = builder.addTransition(TESTED,CONFIG_BACKUP_DELETE,TESTED);
-        builder = builder.addTransition(TESTED,CONFIG_EXPORT,TESTED);
-
-        builder = builder.addTransition(RUNNING,CONFIGURE,CONFIGURING);
-        builder = builder.addTransition(RUNNING,TEST,TESTING);
-        builder = builder.addTransition(RUNNING,START,STARTING);
-        builder = builder.addTransition(RUNNING,TERMINATE,TERMINATING);
-        builder = builder.addTransition(RUNNING,RESTART,RESTARTING);
-        builder = builder.addTransition(RUNNING,REBUILD,REBUILDING);
-        builder = builder.addTransition(RUNNING,STOP,STOPPING);
-        builder = builder.addTransition(RUNNING,CONFIG_MODIFY,CONFIGURING);
-        builder = builder.addTransition(RUNNING,CONFIG_SCALEOUT,CONFIGURING);
-        builder = builder.addTransition(RUNNING,CONFIG_RESTORE,CONFIGURING);
-        builder = builder.addTransition(RUNNING,HEALTHCHECK,TESTING);
-        builder = builder.addTransition(RUNNING,BACKUP,BACKING_UP);
-        builder = builder.addTransition(RUNNING,SNAPSHOT,SNAPSHOTTING);
-        builder = builder.addTransition(RUNNING,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
-        builder = builder.addTransition(RUNNING,LIVE_UPGRADE,UPGRADING);
-        builder = builder.addTransition(RUNNING,ROLLBACK,ROLLBACKING);
-        builder = builder.addTransition(RUNNING,SYNC,RUNNING);
-        builder = builder.addTransition(RUNNING,AUDIT,RUNNING);
-        builder = builder.addTransition(RUNNING,MIGRATE,MIGRATING);
-        builder = builder.addTransition(RUNNING,EVACUATE,EVACUATING);
-        builder = builder.addTransition(RUNNING,LOCK,RUNNING);
-        builder = builder.addTransition(RUNNING,UNLOCK,RUNNING);
-        builder = builder.addTransition(RUNNING,CHECKLOCK,RUNNING);
-        builder = builder.addTransition(RUNNING,CONFIG_BACKUP,RUNNING);
-        builder = builder.addTransition(RUNNING,CONFIG_BACKUP_DELETE,RUNNING);
-        builder = builder.addTransition(RUNNING,CONFIG_EXPORT,RUNNING);
-
-        builder = builder.addTransition(ERROR,CONFIGURE,CONFIGURING);
-        builder = builder.addTransition(ERROR,TEST,TESTING);
-        builder = builder.addTransition(ERROR,START,STARTING);
-        builder = builder.addTransition(ERROR,TERMINATE,TERMINATING);
-        builder = builder.addTransition(ERROR,RESTART,RESTARTING);
-        builder = builder.addTransition(ERROR,REBUILD,REBUILDING);
-        builder = builder.addTransition(ERROR,STOP,STOPPING);
-        builder = builder.addTransition(ERROR,CONFIG_MODIFY,CONFIGURING);
-        builder = builder.addTransition(ERROR,CONFIG_SCALEOUT,CONFIGURING);
-        builder = builder.addTransition(ERROR,CONFIG_RESTORE,CONFIGURING);
-        builder = builder.addTransition(ERROR,HEALTHCHECK,TESTING);
-        builder = builder.addTransition(ERROR,BACKUP,BACKING_UP);
-        builder = builder.addTransition(ERROR,SNAPSHOT,SNAPSHOTTING);
-        builder = builder.addTransition(ERROR,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
-        builder = builder.addTransition(ERROR,LIVE_UPGRADE,UPGRADING);
-        builder = builder.addTransition(ERROR,ROLLBACK,ROLLBACKING);
-        builder = builder.addTransition(ERROR,SYNC,ERROR);
-        builder = builder.addTransition(ERROR,AUDIT,ERROR);
-        builder = builder.addTransition(ERROR,MIGRATE,MIGRATING);
-        builder = builder.addTransition(ERROR,EVACUATE,EVACUATING);
-        builder = builder.addTransition(ERROR,LOCK,ERROR);
-        builder = builder.addTransition(ERROR,UNLOCK,ERROR);
-        builder = builder.addTransition(ERROR,CHECKLOCK,ERROR);
-        builder = builder.addTransition(ERROR,CONFIG_BACKUP,ERROR);
-        builder = builder.addTransition(ERROR,CONFIG_BACKUP_DELETE,ERROR);
-        builder = builder.addTransition(ERROR,CONFIG_EXPORT,ERROR);
-
-        builder = builder.addTransition(UNKNOWN,CONFIGURE,CONFIGURING);
-        builder = builder.addTransition(UNKNOWN,TEST,TESTING);
-        builder = builder.addTransition(UNKNOWN,START,STARTING);
-        builder = builder.addTransition(UNKNOWN,TERMINATE,TERMINATING);
-        builder = builder.addTransition(UNKNOWN,RESTART,RESTARTING);
-        builder = builder.addTransition(UNKNOWN,REBUILD,REBUILDING);
-        builder = builder.addTransition(UNKNOWN,STOP,STOPPING);
-        builder = builder.addTransition(UNKNOWN,CONFIG_MODIFY,CONFIGURING);
-        builder = builder.addTransition(UNKNOWN,CONFIG_SCALEOUT,CONFIGURING);
-        builder = builder.addTransition(UNKNOWN,CONFIG_RESTORE,CONFIGURING);
-        builder = builder.addTransition(UNKNOWN,HEALTHCHECK,TESTING);
-        builder = builder.addTransition(UNKNOWN,BACKUP,BACKING_UP);
-        builder = builder.addTransition(UNKNOWN,SNAPSHOT,SNAPSHOTTING);
-        builder = builder.addTransition(UNKNOWN,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
-        builder = builder.addTransition(UNKNOWN,LIVE_UPGRADE,UPGRADING);
-        builder = builder.addTransition(UNKNOWN,ROLLBACK,ROLLBACKING);
-        builder = builder.addTransition(UNKNOWN,SYNC,UNKNOWN);
-        builder = builder.addTransition(UNKNOWN,AUDIT,UNKNOWN);
-        builder = builder.addTransition(UNKNOWN,MIGRATE,MIGRATING);
-        builder = builder.addTransition(UNKNOWN,EVACUATE,EVACUATING);
-        builder = builder.addTransition(UNKNOWN,LOCK,UNKNOWN);
-        builder = builder.addTransition(UNKNOWN,UNLOCK,UNKNOWN);
-        builder = builder.addTransition(UNKNOWN,CHECKLOCK,UNKNOWN);
-        builder = builder.addTransition(UNKNOWN,CONFIG_BACKUP,UNKNOWN);
-        builder = builder.addTransition(UNKNOWN,CONFIG_BACKUP_DELETE,UNKNOWN);
-        builder = builder.addTransition(UNKNOWN,CONFIG_EXPORT,UNKNOWN);
-
-        builder = builder.addTransition(STOPPED,CONFIGURE,CONFIGURING);
-        builder = builder.addTransition(STOPPED,TEST,TESTING);
-        builder = builder.addTransition(STOPPED,START,STARTING);
-        builder = builder.addTransition(STOPPED,TERMINATE,TERMINATING);
-        builder = builder.addTransition(STOPPED,RESTART,RESTARTING);
-        builder = builder.addTransition(STOPPED,REBUILD,REBUILDING);
-        builder = builder.addTransition(STOPPED,CONFIG_MODIFY,CONFIGURING);
-        builder = builder.addTransition(STOPPED,CONFIG_SCALEOUT,CONFIGURING);
-        builder = builder.addTransition(STOPPED,CONFIG_RESTORE,CONFIGURING);
-        builder = builder.addTransition(STOPPED,HEALTHCHECK,TESTING);
-        builder = builder.addTransition(STOPPED,BACKUP,BACKING_UP);
-        builder = builder.addTransition(STOPPED,SNAPSHOT,SNAPSHOTTING);
-        builder = builder.addTransition(STOPPED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
-        builder = builder.addTransition(STOPPED,LIVE_UPGRADE,UPGRADING);
-        builder = builder.addTransition(STOPPED,ROLLBACK,ROLLBACKING);
-        builder = builder.addTransition(STOPPED,MIGRATE,MIGRATING);
-        builder = builder.addTransition(STOPPED,EVACUATE,EVACUATING);
-        builder = builder.addTransition(STOPPED,LOCK,STOPPED);
-        builder = builder.addTransition(STOPPED,UNLOCK,STOPPED);
-        builder = builder.addTransition(STOPPED,CHECKLOCK,STOPPED);
-
-        builder = builder.addTransition(CONFIGURING,SUCCESS,CONFIGURED);
-        builder = builder.addTransition(CONFIGURING,FAILURE,ERROR);
-
-        builder = builder.addTransition(TESTING,SUCCESS,TESTED);
-        builder = builder.addTransition(TESTING,FAILURE,ERROR);
-
-        builder = builder.addTransition(RESTARTING,SUCCESS,RUNNING);
-        builder = builder.addTransition(RESTARTING,FAILURE,ERROR);
-
-        builder = builder.addTransition(STARTING,SUCCESS,RUNNING);
-        builder = builder.addTransition(STARTING,FAILURE,ERROR);
-
-        builder = builder.addTransition(TERMINATING,SUCCESS,NOT_INSTANTIATED);
-        builder = builder.addTransition(TERMINATING,FAILURE,ERROR);
-
-        builder = builder.addTransition(REBUILDING,SUCCESS,RUNNING);
-        builder = builder.addTransition(REBUILDING,FAILURE,ERROR);
-
-        builder = builder.addTransition(STOPPING,SUCCESS,STOPPED);
-        builder = builder.addTransition(STOPPING,FAILURE,ERROR);
-
-        builder = builder.addTransition(BACKING_UP,SUCCESS,RUNNING);
-        builder = builder.addTransition(BACKING_UP,FAILURE,ERROR);
-
-        builder = builder.addTransition(SNAPSHOTTING,SUCCESS,RUNNING);
-        builder = builder.addTransition(SNAPSHOTTING,FAILURE,ERROR);
-
-        builder = builder.addTransition(SOFTWARE_UPLOADING,SUCCESS,RUNNING);
-        builder = builder.addTransition(SOFTWARE_UPLOADING,FAILURE,ERROR);
-
-        builder = builder.addTransition(UPGRADING,SUCCESS,RUNNING);
-        builder = builder.addTransition(UPGRADING,FAILURE,ERROR);
-
-        builder = builder.addTransition(ROLLBACKING,SUCCESS,RUNNING);
-        builder = builder.addTransition(ROLLBACKING,FAILURE,ERROR);
-
-        builder = builder.addTransition(MIGRATING,SUCCESS,RUNNING);
-        builder = builder.addTransition(MIGRATING,FAILURE,ERROR);
-
-        builder = builder.addTransition(EVACUATING,SUCCESS,RUNNING);
-        builder = builder.addTransition(EVACUATING,FAILURE,ERROR);
-
-        return builder.build();
-
-    }
-
-}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java
deleted file mode 100644 (file)
index 8741b1b..0000000
+++ /dev/null
@@ -1,98 +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.lifecyclemanager.impl;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.att.eelf.i18n.EELFResourceManager;
-import org.openecomp.appc.i18n.Msg;
-import org.openecomp.appc.lifecyclemanager.LifecycleManager;
-import org.openecomp.appc.lifecyclemanager.helper.MetadataReader;
-import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
-import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;
-import org.openecomp.appc.statemachine.StateMachine;
-import org.openecomp.appc.statemachine.impl.StateMachineFactory;
-import org.openecomp.appc.statemachine.objects.*;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-
-public class LifecycleManagerImpl implements LifecycleManager{
-
-       private MetadataReader metadataReader;
-       private static Map<String,StateMachine> stateMachineMap = new ConcurrentHashMap<String,StateMachine>();
-       private static final EELFLogger logger = EELFManager.getInstance().getLogger(LifecycleManagerImpl.class);
-       private static EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger();
-       public LifecycleManagerImpl(){
-               this.metadataReader = new MetadataReader();
-       }
-
-       @Override
-       public String getNextState(String vnfType, String currentState, String event) throws NoTransitionDefinedException,LifecycleException{
-               if (logger.isTraceEnabled()) {
-                       logger.trace("Entering to getNextState with vnfType = "+ vnfType +      ", currentState = " + currentState + ", event = " + event);
-               }
-
-               State nextState = null;
-               StateMachine machine = null;
-               StateMachineResponse response;
-               try {
-                       machine = this.getStateMachine(vnfType);
-                       response = machine.handleEvent(new State(currentState.toLowerCase()),new Event(event));
-                       if(Response.NO_TRANSITION_DEFINED.equals(response.getResponse())){
-                               errorLogger.error(EELFResourceManager.format(Msg.VF_ILLEGAL_COMMAND, vnfType,event,currentState));
-                               throw new NoTransitionDefinedException("No Transition Defined for currentState = " +  currentState + ", event = " + event,currentState,event);
-                       }
-                       nextState = response.getNextState();
-               } catch (InvalidInputException e) {
-                       logger.error(e.getMessage());
-                       throw new LifecycleException(e,currentState,event);
-               }
-               if (logger.isTraceEnabled()) {
-                       logger.trace("Exiting from getNextState with (nextState = "+nextState.getStateName()!=null?nextState.getStateName():"null"+")");
-               }
-               return nextState.getStateName();
-       }
-
-       private StateMachine getStateMachine(String vnfType){
-               if (logger.isTraceEnabled()) {
-                       logger.trace("Entering to getNextState with vnfType = "+ vnfType);
-               }
-               if(vnfType == null){
-                       vnfType = "DEFAULT";
-               }
-               StateMachine machine = stateMachineMap.get(vnfType);
-               if(machine == null){
-                       StateMachineMetadata metadata = metadataReader.readMetadata(vnfType);
-                       machine = StateMachineFactory.getStateMachine(metadata);
-                       stateMachineMap.put(vnfType,machine);
-               }
-
-               logger.trace("Exiting getStateMachine with (StateMachine = "+stateMachineMap.get(vnfType)!=null?stateMachineMap.get(vnfType).toString():"null"+")");
-               return stateMachineMap.get(vnfType);
-       }
-
-}
diff --git a/appc-dispatcher/appc-lifecycle-management/pom.xml b/appc-dispatcher/appc-lifecycle-management/pom.xml
deleted file mode 100644 (file)
index 335f162..0000000
+++ /dev/null
@@ -1,22 +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</artifactId>
-    <version>1.1.0-SNAPSHOT</version>
-  </parent>
-  <artifactId>appc-lifecycle-management</artifactId>
-  <packaging>pom</packaging>
-  <name>APPC Lifecycle Management</name>
-  <description>APPC Lifecycle Management</description>
-  
-       <!-- ================================================================================== -->
-       <!-- The modules we build -->
-       <!-- ================================================================================== -->
-       <modules>
-               <module>appc-lifecycle-management-api</module>
-               <module>appc-lifecycle-management-core</module>
-               <module>appc-lifecycle-management-features</module>
-       </modules>
-  
-</project>
\ No newline at end of file
index e54c5a7..a813a66 100644 (file)
@@ -9,69 +9,68 @@
   <packaging>pom</packaging>
   <name>APPC Dispatcher</name>
   <description>APPC Dispatcher</description>
-               <dependencies>
-           <dependency>
-               <groupId>junit</groupId>
-               <artifactId>junit</artifactId>
-               <scope>test</scope>
-           </dependency>
-                       <dependency>
-                         <groupId>org.mockito</groupId>
-                         <artifactId>mockito-core</artifactId>
-                         <scope>test</scope>
-                       </dependency>
-           <dependency>
-               <groupId>org.powermock</groupId>
-               <artifactId>powermock-api-mockito</artifactId>
-               <version>1.6.2</version>
-               <scope>test</scope>
-           </dependency>
-           <dependency>
-               <groupId>org.mockito</groupId>
-               <artifactId>mockito-all</artifactId>
-               <scope>test</scope>
-           </dependency>
-           <dependency>
-               <groupId>org.powermock</groupId>
-               <artifactId>powermock-module-junit4</artifactId>
-               <version>1.6.2</version>
-               <scope>test</scope>
-           </dependency>
-           <dependency>
-               <groupId>org.hamcrest</groupId>
-               <artifactId>hamcrest-core</artifactId>
-               <scope>test</scope>
-           </dependency>
-           <dependency>
-               <groupId>org.objenesis</groupId>
-               <artifactId>objenesis</artifactId>
-               <version>2.2</version>
-               <scope>test</scope>
-           </dependency>
-       </dependencies>
-       <build>
-               <pluginManagement>
-               <plugins>
-               <plugin>
-                   <groupId>org.apache.felix</groupId>
-                   <artifactId>maven-bundle-plugin</artifactId>
-                   <extensions>true</extensions>
-             </plugin>
-           </plugins>
-               </pluginManagement>
-       </build>
-       <!-- ================================================================================== -->
-       <!-- The modules we build -->
-       <!-- ================================================================================== -->
-       <modules>
-               <module>appc-dispatcher-common</module>
-               <module>appc-lifecycle-management</module>
-               <module>appc-workflow-management</module>
-               <module>appc-command-executor</module>
-               <module>appc-request-handler</module>
-               <module>appc-license-manager</module>
-               <module>appc-dispatcher-features</module>
-               <module>appc-dispatcher-installer</module>
-       </modules>
+        <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+            <dependency>
+              <groupId>org.mockito</groupId>
+              <artifactId>mockito-core</artifactId>
+              <scope>test</scope>
+            </dependency>
+        <dependency>
+            <groupId>org.powermock</groupId>
+            <artifactId>powermock-api-mockito</artifactId>
+            <version>1.6.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.powermock</groupId>
+            <artifactId>powermock-module-junit4</artifactId>
+            <version>1.6.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.objenesis</groupId>
+            <artifactId>objenesis</artifactId>
+            <version>2.2</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <pluginManagement>
+          <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+          </plugin>
+        </plugins>
+        </pluginManagement>
+    </build>
+    <!-- ================================================================================== -->
+    <!-- The modules we build -->
+    <!-- ================================================================================== -->
+    <modules>
+        <module>appc-dispatcher-common</module>
+        <module>appc-workflow-management</module>
+        <module>appc-command-executor</module>
+        <module>appc-request-handler</module>
+        <module>appc-license-manager</module>
+        <module>appc-dispatcher-features</module>
+        <module>appc-dispatcher-installer</module>
+    </modules>
 
 </project>
@@ -1,19 +1,21 @@
 <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>
+        <artifactId>appc-lifecycle-management</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>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>appc-lifecycle-management-api</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
 
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-  </properties>
+    <name>appc-lifecycle-management-api</name>
+    <url>http://maven.apache.org</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
     <build>
         <plugins>
             <plugin>
                     <instructions>
                         <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                         <Bundle-Version>${project.version}</Bundle-Version>
-                        <Export-Package>org.openecomp.appc.statemachine.*</Export-Package>
+                        <Export-Package>org.openecomp.appc.lifecyclemanager.*</Export-Package>
                     </instructions>
                 </configuration>
             </plugin>
         </plugins>
     </build>
+
 </project>
@@ -1,33 +1,33 @@
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.lifecyclemanager;
-
-
-import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
-import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;
-
-public interface LifecycleManager {
-       String getNextState(String vnfType, String currentState, String event) throws NoTransitionDefinedException,LifecycleException;
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.lifecyclemanager;\r
+\r
+import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;\r
+import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;\r
+\r
+public interface LifecycleManager {\r
+    String getNextState(String vnfType, String currentState, String event)\r
+            throws NoTransitionDefinedException,LifecycleException;\r
+}\r
@@ -1,36 +1,36 @@
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.lifecyclemanager.objects;
-
-public enum LCMResponse {
-       INVALID_INPUT_PARAMETERS,
-       NO_STATE_CHANGE,
-       NO_TRANSITION_DEFINED,
-       VALID_TRANSITION;
-       
-       public String toString(){
-               return this.name();
-       }
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.lifecyclemanager.objects;\r
+\r
+public enum LCMResponse {\r
+    INVALID_INPUT_PARAMETERS,\r
+    NO_STATE_CHANGE,\r
+    NO_TRANSITION_DEFINED,\r
+    VALID_TRANSITION;\r
+\r
+    public String toString(){\r
+        return this.name();\r
+    }\r
+}\r
@@ -1,37 +1,36 @@
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.lifecyclemanager.objects;
-
-
-public class LifecycleException extends Exception {
-    public final String currentState;
-    public final String event;
-    public LifecycleException(Exception e,String currentState,String event){
-        super(e);
-        this.currentState = currentState;
-        this.event = event;
-
-    }
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.lifecyclemanager.objects;\r
+\r
+public class LifecycleException extends Exception {\r
+    public final String currentState;\r
+    public final String event;\r
+\r
+    public LifecycleException(Exception e,String currentState,String event){\r
+        super(e);\r
+        this.currentState = currentState;\r
+        this.event = event;\r
+    }\r
+}\r
@@ -1,37 +1,36 @@
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.lifecyclemanager.objects;
-
-
-public class NoTransitionDefinedException extends Exception {
-    public final String currentState;
-    public final String event;
-    public NoTransitionDefinedException(String message,String currentState,String event){
-        super(message);
-        this.currentState = currentState;
-        this.event = event;
-
-    }
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.lifecyclemanager.objects;\r
+\r
+public class NoTransitionDefinedException extends Exception {\r
+    public final String currentState;\r
+    public final String event;\r
+\r
+    public NoTransitionDefinedException(String message,String currentState,String event){\r
+        super(message);\r
+        this.currentState = currentState;\r
+        this.event = event;\r
+    }\r
+}\r
@@ -1,32 +1,32 @@
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.lifecyclemanager.objects;
-
-public enum VNFOperationOutcome {
-       SUCCESS,FAILURE,EXPIRE;
-       public String toString(){
-               return this.name();
-       }
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.lifecyclemanager.objects;\r
+\r
+public enum VNFOperationOutcome {\r
+    SUCCESS,FAILURE,EXPIRE;\r
+    public String toString(){\r
+        return this.name();\r
+    }\r
+}\r
         limitations under the License.
     -->
 
+    <parent>
+        <groupId>org.openecomp.appc</groupId>
+        <artifactId>appc-lifecycle-management</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+    </parent>
+
     <modelVersion>4.0.0</modelVersion>
-               <parent>
-           <groupId>org.openecomp.appc</groupId>
-           <artifactId>appc-lifecycle-management</artifactId>
-           <version>1.1.0-SNAPSHOT</version>
-         </parent>
     <artifactId>appc-lifecycle-management-core</artifactId>
     <packaging>bundle</packaging>
 
             <groupId>com.att.eelf</groupId>
             <artifactId>eelf-core</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.openecomp.appc</groupId>
-            <artifactId>appc-common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.openecomp.appc</groupId>
-            <artifactId>domain-model-lib</artifactId>
-            <version>${project.version}</version>
-        </dependency>
     </dependencies>
 
     <build>
diff --git a/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java b/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java
new file mode 100644 (file)
index 0000000..890218e
--- /dev/null
@@ -0,0 +1,102 @@
+/*-\r
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * 
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * 
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.lifecyclemanager.impl;\r
+\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
+import com.att.eelf.i18n.EELFResourceManager;\r
+import org.openecomp.appc.exceptions.InvalidInputException;\r
+import org.openecomp.appc.i18n.Msg;\r
+import org.openecomp.appc.lifecyclemanager.LifecycleManager;\r
+import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;\r
+import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;\r
+import org.openecomp.appc.statemachine.StateMachine;\r
+import org.openecomp.appc.statemachine.StateMetaDataReader;\r
+import org.openecomp.appc.statemachine.impl.StateMachineFactory;\r
+import org.openecomp.appc.statemachine.impl.readers.AppcOamMetaDataReader;\r
+import org.openecomp.appc.statemachine.impl.readers.VnfMetaDataReader;\r
+import org.openecomp.appc.statemachine.objects.*;\r
+\r
+import java.util.Map;\r
+import java.util.concurrent.ConcurrentHashMap;\r
+\r
+public class LifecycleManagerImpl implements LifecycleManager{\r
+\r
+    private StateMetaDataReader metadataReader;\r
+    private static Map<String,StateMachine> stateMachineMap = new ConcurrentHashMap<>();\r
+    private final EELFLogger logger = EELFManager.getInstance().getLogger(LifecycleManagerImpl.class);\r
+    private final EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger();\r
+\r
+    @Override\r
+    public String getNextState(String vnfType, String currentState, String event) throws NoTransitionDefinedException,LifecycleException{\r
+        if (logger.isTraceEnabled()) {\r
+            logger.trace("Entering to getNextState with vnfType = "+ vnfType +    ", currentState = " + currentState + ", event = " + event);\r
+        }\r
+\r
+        State nextState;\r
+        StateMachine machine;\r
+        StateMachineResponse response;\r
+        try {\r
+            machine = this.getStateMachine(vnfType);\r
+            response = machine.handleEvent(new State(currentState),new Event(event));\r
+            if(Response.NO_TRANSITION_DEFINED.equals(response.getResponse())){\r
+                errorLogger.error(EELFResourceManager.format(Msg.VF_ILLEGAL_COMMAND, vnfType,event,currentState));\r
+                throw new NoTransitionDefinedException("No Transition Defined for currentState = " +  currentState + ", event = " + event,currentState,event);\r
+            }\r
+            nextState = response.getNextState();\r
+        } catch (InvalidInputException e) {\r
+            logger.error(e.getMessage());\r
+            throw new LifecycleException(e,currentState,event);\r
+        }\r
+        if (logger.isTraceEnabled()) {\r
+            logger.trace("Exiting from getNextState with (nextState = " + nextState.getStateName() + ")");\r
+        }\r
+        return nextState.getStateName();\r
+    }\r
+\r
+    private StateMachine getStateMachine(String vnfType){\r
+        if (logger.isTraceEnabled()) {\r
+            logger.trace("Entering to getNextState with vnfType = "+ vnfType);\r
+        }\r
+        if(vnfType == null){\r
+            vnfType = "DEFAULT";\r
+        }\r
+        StateMachine machine = stateMachineMap.get(vnfType);\r
+        if(machine == null){\r
+            metadataReader = getMetadataReader(vnfType);\r
+            StateMachineMetadata metadata = metadataReader.readMetadata();\r
+            machine = StateMachineFactory.getStateMachine(metadata);\r
+            stateMachineMap.put(vnfType,machine);\r
+        }\r
+\r
+        logger.trace("Exiting getStateMachine with StateMachine = " + stateMachineMap.get(vnfType).toString());\r
+        return stateMachineMap.get(vnfType);\r
+    }\r
+\r
+    private StateMetaDataReader getMetadataReader(String vnfType) {\r
+        return vnfType.equals("APPC") ? new AppcOamMetaDataReader() : new VnfMetaDataReader();\r
+    }\r
+\r
+}\r
@@ -1,37 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
   ============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.
-  
+  Copyright (C) 2017 Amdocs\r
+  =============================================================================\r
+  Licensed under the Apache License, Version 2.0 (the "License");\r
+  you may not use this file except in compliance with the License.\r
+  You may obtain a copy of the License at\r
+  \r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+  \r
+  Unless required by applicable law or agreed to in writing, software\r
+  distributed under the License is distributed on an "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+  See the License for the specific language governing permissions and\r
+  limitations under the License.\r
+  \r
   ECOMP is a trademark and service mark of AT&T Intellectual Property.
-  ============LICENSE_END=========================================================
-  -->
-
-<!--
-    Starter Blueprint Camel Definition appc-aai-adapter-blueprint
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
-    <bean id="lifecycleManagerBean" class="org.openecomp.appc.lifecyclemanager.impl.LifecycleManagerImpl" scope="singleton" >
-</bean>
-
-    <service id="lcmService" interface="org.openecomp.appc.lifecyclemanager.LifecycleManager" ref="lifecycleManagerBean"/>
-
-</blueprint>
+  ============LICENSE_END=========================================================\r
+  -->\r
+\r
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"\r
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">\r
+    <bean id="lifecycleManagerBean" class="org.openecomp.appc.lifecyclemanager.impl.LifecycleManagerImpl" scope="singleton">\r
+    </bean>\r
+\r
+    <service id="lcmService" interface="org.openecomp.appc.lifecyclemanager.LifecycleManager" ref="lifecycleManagerBean"/>\r
+\r
+</blueprint>\r
@@ -1,39 +1,39 @@
-###
+###\r
 # ============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.
-# 
+# Copyright (C) 2017 Amdocs\r
+# =============================================================================\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+# \r
+#      http://www.apache.org/licenses/LICENSE-2.0\r
+# \r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+# \r
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-# ============LICENSE_END=========================================================
-###
-
-# Define the name and path of any user-provided configuration (bootstrap) file that can be loaded 
-# to supply configuration options 
-org.openecomp.appc.bootstrap.file=appc.properties
-org.openecomp.appc.bootstrap.path=/opt/openecomp/appc/data/properties,${user.home},.
-
-#Property below provided by appc.properties
-appc.LCM.provider.url=https://localhost:8443/restconf/operations/appc-provider-lcm
-appc.LCM.poolMembers=<DMAAP_IP>:3904
-appc.LCM.service=dmaap
-appc.LCM.topic.write=APPC-TEST2
-appc.LCM.client.name=APPC-TEST-CLIENT-LC-MGMT-MAIN
-appc.LCM.provider.user=test
-appc.LCM.provider.pass=test
-
-
+# ============LICENSE_END=========================================================\r
+###\r
+\r
+# Define the name and path of any user-provided configuration (bootstrap) file that can be loaded \r
+# to supply configuration options \r
+org.openecomp.appc.bootstrap.file=appc.properties\r
+org.openecomp.appc.bootstrap.path=/opt/openecomp/appc/data/properties,${user.home},.\r
+\r
+#Property below provided by appc.properties\r
+appc.LCM.provider.url=https://localhost:8443/restconf/operations/appc-provider-lcm\r
+appc.LCM.poolMembers=<DMAAP_IP>:3904\r
+appc.LCM.service=dmaap\r
+appc.LCM.topic.write=APPC-TEST2\r
+appc.LCM.client.name=APPC-TEST-CLIENT-LC-MGMT-MAIN\r
+appc.LCM.provider.user=test\r
+appc.LCM.provider.pass=test\r
+\r
+\r
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.openecomp.appc.domainmodel.lcm.VNFOperation;
-import org.openecomp.appc.lifecyclemanager.LifecycleManager;
-import org.openecomp.appc.lifecyclemanager.helper.MetadataReader;
-import org.openecomp.appc.lifecyclemanager.impl.LifecycleManagerImpl;
-import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
-import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;
-import org.openecomp.appc.statemachine.objects.*;
-
-import java.util.*;
-
-
-public class TestLifecycleManager {
-
-    private static final State[] VALID_LOCK_STATES = new State[] {
-            new State("instantiated"),
-            new State("configured"),
-            new State("tested"),
-            new State("running"),
-            new State("error"),
-            new State("unknown"),
-            new State("created"),
-            new State("not orchestrated"),
-            new State("stopped"),
-    };
-
-    @Test
-    public void handleEvent() throws InvalidInputException, LifecycleException, NoTransitionDefinedException {
-
-        MetadataReader metadataReader = new MetadataReader();
-        StateMachineMetadata metadata = metadataReader.readMetadata(null);
-
-        LifecycleManagerImpl lifecycleManager = new LifecycleManagerImpl();
-
-        /*
-        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 nextStateFromMetadata = transition.getNextState();
-
-                String expectedNextState = lifecycleManager.getNextState(null,state.toString(),event.toString());
-                Assert.assertEquals(expectedNextState,nextStateFromMetadata.toString());
-            }
-        }
-
-        /*
-        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){
-                    boolean flag =false;
-                    try{
-                        String response = lifecycleManager.getNextState(null,state.toString(),negativeEvent.toString());
-
-                    }
-                    catch (NoTransitionDefinedException e){
-                        flag =true;
-                    }
-                    Assert.assertEquals(flag,true);
-
-                    flag =false;
-                    try{
-                        String response = lifecycleManager.getNextState(null,state.toString(),"PUT");
-                    }
-                    catch(LifecycleException e){
-                        flag = true;
-                    }
-                    Assert.assertTrue(flag);
-
-                }
-            }
-        }
-    }
-
-    @Test
-    public void testNotOrchestratedState() throws LifecycleException, NoTransitionDefinedException {
-        LifecycleManager lifecycleManager = new LifecycleManagerImpl();
-        String nextState = lifecycleManager.getNextState(null,"NOT ORCHESTRATED",VNFOperation.Configure.toString());
-        Assert.assertEquals(nextState,"configuring");
-    }
-
-    @Test(expected = NoTransitionDefinedException.class)
-    public void testBakckingUpState() throws LifecycleException, NoTransitionDefinedException {
-        LifecycleManager lifecycleManager = new LifecycleManagerImpl();
-        String nextState = lifecycleManager.getNextState(null,"Software_Uploading",VNFOperation.Configure.toString());
-    }
-
-    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;
-    }
-
-    @Test
-    public void testLockStates() throws LifecycleException, NoTransitionDefinedException {
-        MetadataReader metadataReader = new MetadataReader();
-        StateMachineMetadata metadata = metadataReader.readMetadata(null);
-        LifecycleManager lifecycleManager = new LifecycleManagerImpl();
-        for(State state: metadata.getStates()) {
-            if(isValidState(state, VALID_LOCK_STATES)) {
-                assertSameNextState(lifecycleManager, state, VNFOperation.Lock);
-                assertSameNextState(lifecycleManager, state, VNFOperation.Unlock);
-                assertSameNextState(lifecycleManager, state, VNFOperation.CheckLock);
-            } else {
-                assertNoNextState(lifecycleManager, state, VNFOperation.Lock);
-                assertNoNextState(lifecycleManager, state, VNFOperation.Unlock);
-                assertNoNextState(lifecycleManager, state, VNFOperation.CheckLock);
-            }
-        }
-    }
-
-    private boolean isValidState(State state, State[] validStates) {
-        for(State validState: validStates) {
-            if(validState.equals(state)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private void assertSameNextState(LifecycleManager lifecycleManager, State state, VNFOperation operation) throws LifecycleException, NoTransitionDefinedException {
-        Assert.assertEquals(state.getStateName(), lifecycleManager.getNextState("no-matter", state.getStateName(), operation.toString()));
-    }
-
-    private void assertNoNextState(LifecycleManager lifecycleManager, State state, VNFOperation operation) throws LifecycleException {
-        try {
-            lifecycleManager.getNextState("no-matter", state.getStateName(), operation.toString());
-            Assert.fail("lifecycleManager.getNextState() should fail for state [" + state + "], operation [" + operation + "]");
-        } catch(NoTransitionDefinedException e) {
-            // this exception is excepted
-        }
-    }
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.openecomp.appc.exceptions.InvalidInputException;\r
+import org.openecomp.appc.lifecyclemanager.LifecycleManager;\r
+import org.openecomp.appc.statemachine.StateMetaDataReader;\r
+import org.openecomp.appc.lifecyclemanager.impl.LifecycleManagerImpl;\r
+import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;\r
+import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;\r
+import org.openecomp.appc.statemachine.impl.readers.VnfMetaDataReader;\r
+import org.openecomp.appc.statemachine.impl.readers.VnfMetaDataReader.VNFOperation;\r
+import org.openecomp.appc.statemachine.objects.Event;\r
+import org.openecomp.appc.statemachine.objects.State;\r
+import org.openecomp.appc.statemachine.objects.StateMachineMetadata;\r
+import org.openecomp.appc.statemachine.objects.Transition;\r
+\r
+import java.util.*;\r
+\r
+\r
+public class LifecycleManagerTest {\r
+\r
+    private static final State[] VALID_LOCK_STATES = new State[] {\r
+            new State("instantiated"),\r
+            new State("configured"),\r
+            new State("tested"),\r
+            new State("running"),\r
+            new State("error"),\r
+            new State("unknown"),\r
+            new State("created"),\r
+            new State("not orchestrated"),\r
+            new State("stopped"),\r
+    };\r
+\r
+    @Test\r
+    public void handleEvent() throws InvalidInputException, LifecycleException, NoTransitionDefinedException {\r
+\r
+        StateMachineMetadata metadata = getMetaDataReader().readMetadata();\r
+        LifecycleManagerImpl lifecycleManager = new LifecycleManagerImpl();\r
+\r
+        /*\r
+         * Testing Positive Scenario passing the valid events and validating the StateMachineResponse\r
+         */\r
+        for(State state:metadata.getStates()){\r
+\r
+            for(Transition transition:state.getTransitions()){\r
+                Event event = transition.getEvent();\r
+                State nextStateFromMetadata = transition.getNextState();\r
+\r
+                String expectedNextState = lifecycleManager.getNextState(null,state.toString(),event.toString());\r
+                Assert.assertEquals(expectedNextState,nextStateFromMetadata.toString());\r
+            }\r
+        }\r
+\r
+        /*\r
+        Testing Negative Scenarios, 1. Passing the valid Events for which Transition is not defined in\r
+        Metadata and validating the StateMachineResponse 2. Passing the invalid events which are not\r
+        registered as events in the StateMachineMetadata and validating StateMachineResponse\r
+         */\r
+        for(State state:metadata.getStates()){\r
+\r
+            for(Transition transition:state.getTransitions()){\r
+                List<Event> negativeEvents = getNegativeEvents(state,metadata.getEvents());\r
+\r
+                for(Event negativeEvent:negativeEvents){\r
+                    boolean flag =false;\r
+                    try{\r
+                        lifecycleManager.getNextState(null,state.toString(),negativeEvent.toString());\r
+\r
+                    }\r
+                    catch (NoTransitionDefinedException e){\r
+                        flag =true;\r
+                    }\r
+                    Assert.assertEquals(flag,true);\r
+\r
+                    flag = false;\r
+                    try{\r
+                        lifecycleManager.getNextState(null,state.toString(),"PUT");\r
+                    }\r
+                    catch(LifecycleException e){\r
+                        flag = true;\r
+                    }\r
+                    Assert.assertTrue(flag);\r
+\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    @Test\r
+    public void testNotOrchestratedState() throws LifecycleException, NoTransitionDefinedException {\r
+        LifecycleManager lifecycleManager = new LifecycleManagerImpl();\r
+        String nextState = lifecycleManager.getNextState(\r
+                null,"NOT ORCHESTRATED",VNFOperation.Configure.toString());\r
+        Assert.assertEquals(nextState,"Configuring");\r
+    }\r
+\r
+    @Test(expected = NoTransitionDefinedException.class)\r
+    public void testBakckingUpState() throws LifecycleException, NoTransitionDefinedException {\r
+        LifecycleManager lifecycleManager = new LifecycleManagerImpl();\r
+        lifecycleManager.getNextState(null,"Software_Uploading",VNFOperation.Configure.toString());\r
+    }\r
+\r
+    private List<Event> getNegativeEvents(State state,Set<Event> events) {\r
+        List<Event> negativeEventList = new ArrayList<>();\r
+        negativeEventList.addAll(events);\r
+\r
+        for(Transition transition: state.getTransitions()){\r
+            negativeEventList.remove(transition.getEvent());\r
+        }\r
+        return negativeEventList;\r
+    }\r
+\r
+    @Test\r
+    public void testLockStates() throws LifecycleException, NoTransitionDefinedException {\r
+        StateMachineMetadata metadata = getMetaDataReader().readMetadata();\r
+        LifecycleManagerImpl lifecycleManager = new LifecycleManagerImpl();\r
+\r
+        for(State state: metadata.getStates()) {\r
+            if(isValidState(state, VALID_LOCK_STATES)) {\r
+                assertSameNextState(lifecycleManager, state, VNFOperation.Lock);\r
+                assertSameNextState(lifecycleManager, state, VnfMetaDataReader.VNFOperation.Unlock);\r
+                assertSameNextState(lifecycleManager, state, VNFOperation.CheckLock);\r
+            } else {\r
+                assertNoNextState(lifecycleManager, state, VNFOperation.Lock);\r
+                assertNoNextState(lifecycleManager, state, VNFOperation.Unlock);\r
+                assertNoNextState(lifecycleManager, state, VNFOperation.CheckLock);\r
+            }\r
+        }\r
+    }\r
+\r
+    private boolean isValidState(State state, State[] validStates) {\r
+        for(State validState: validStates) {\r
+            if(validState.equals(state)) {\r
+                return true;\r
+            }\r
+        }\r
+        return false;\r
+    }\r
+\r
+    private void assertSameNextState(LifecycleManager lifecycleManager, State state, VNFOperation operation)\r
+            throws LifecycleException, NoTransitionDefinedException {\r
+        Assert.assertEquals(state.getStateName(),\r
+                lifecycleManager.getNextState("no-matter", state.getStateName(), operation.toString()));\r
+    }\r
+\r
+    private void assertNoNextState(LifecycleManager lifecycleManager, State state, VNFOperation operation)\r
+            throws LifecycleException {\r
+        try {\r
+            lifecycleManager.getNextState("no-matter", state.getStateName(), operation.toString());\r
+            Assert.fail("lifecycleManager.getNextState() should fail for state [" + state\r
+                    + "], operation [" + operation + "]");\r
+        } catch(NoTransitionDefinedException e) {\r
+            // this exception is excepted\r
+        }\r
+    }\r
+\r
+    private StateMetaDataReader getMetaDataReader() {\r
+        return new VnfMetaDataReader();\r
+    }\r
+}\r
diff --git a/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/OamLifeCycleManagerTest.java b/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/OamLifeCycleManagerTest.java
new file mode 100644 (file)
index 0000000..d3fe3ea
--- /dev/null
@@ -0,0 +1,152 @@
+/*-\r
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * 
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * 
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Before;\r
+import org.junit.Rule;\r
+import org.junit.Test;\r
+import org.junit.rules.ExpectedException;\r
+import org.openecomp.appc.lifecyclemanager.impl.LifecycleManagerImpl;\r
+import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;\r
+import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;\r
+import org.openecomp.appc.statemachine.impl.readers.AppcOamMetaDataReader;\r
+import org.openecomp.appc.statemachine.impl.readers.AppcOamStates;\r
+\r
+import java.util.Arrays;\r
+import java.util.List;\r
+\r
+\r
+public class OamLifeCycleManagerTest {\r
+    private static final String VNF_TYPE_APPC = "APPC";\r
+    private static final String NO_DEFINITION_FORMAT = "No Transition Defined for currentState = %s, event = %s";\r
+\r
+    private LifecycleManagerImpl lifecycleManager;\r
+\r
+    @Rule\r
+    public ExpectedException expectedException = ExpectedException.none();\r
+\r
+    @Before\r
+    public void setUp() throws Exception {\r
+        lifecycleManager = new LifecycleManagerImpl();\r
+    }\r
+\r
+    private void validateProper(String state, String event, String expectedResult)\r
+            throws LifecycleException, NoTransitionDefinedException {\r
+        String nextState = lifecycleManager.getNextState(VNF_TYPE_APPC, state, event);\r
+        Assert.assertEquals(String.format("Should return %s", expectedResult), expectedResult, nextState);\r
+    }\r
+\r
+    private void validateException(String state, String event) throws LifecycleException, NoTransitionDefinedException {\r
+        expectedException.expect(NoTransitionDefinedException.class);\r
+        expectedException.expectMessage(String.format(NO_DEFINITION_FORMAT, state, event));\r
+        lifecycleManager.getNextState(VNF_TYPE_APPC, state, event);\r
+\r
+        // Reset to no expectation\r
+        expectedException = ExpectedException.none();\r
+    }\r
+\r
+    @Test\r
+    public void testOamStateTransitionForMaintenanceMode() throws Exception {\r
+        String event = AppcOamMetaDataReader.AppcOperation.MaintenanceMode.name();\r
+        String expecteResult = AppcOamStates.EnteringMaintenanceMode.toString();\r
+\r
+        for (AppcOamStates appcOamStates : AppcOamStates.values()) {\r
+            String state = appcOamStates.toString();\r
+            if (appcOamStates == AppcOamStates.Started) {\r
+                validateProper(state, event, expecteResult);\r
+            } else {\r
+                validateException(state, event);\r
+            }\r
+        }\r
+    }\r
+\r
+    @Test\r
+    public void testOamStateTransitionForStart() throws Exception {\r
+        String event = AppcOamMetaDataReader.AppcOperation.Start.name();\r
+        String expectResult = AppcOamStates.Starting.toString();\r
+\r
+        List<AppcOamStates> goodStates = Arrays.asList(\r
+                AppcOamStates.MaintenanceMode,\r
+                AppcOamStates.Stopped,\r
+                AppcOamStates.Stopping);\r
+\r
+        for (AppcOamStates appcOamStates : AppcOamStates.values()) {\r
+            String state = appcOamStates.toString();\r
+            if (goodStates.contains(appcOamStates)) {\r
+                validateProper(state, event, expectResult);\r
+            } else {\r
+                validateException(state, event);\r
+            }\r
+        }\r
+    }\r
+\r
+    @Test\r
+    public void testOamStateTransitionForStop() throws Exception {\r
+        String event = AppcOamMetaDataReader.AppcOperation.Stop.name();\r
+        String expectResult = AppcOamStates.Stopping.toString();\r
+\r
+        List<AppcOamStates> goodStates = Arrays.asList(\r
+                AppcOamStates.Error,\r
+                AppcOamStates.EnteringMaintenanceMode,\r
+                AppcOamStates.MaintenanceMode,\r
+                AppcOamStates.Started,\r
+                AppcOamStates.Starting);\r
+\r
+        for (AppcOamStates appcOamStates : AppcOamStates.values()) {\r
+            String state = appcOamStates.toString();\r
+            if (goodStates.contains(appcOamStates)) {\r
+                validateProper(state, event, expectResult);\r
+            } else {\r
+                validateException(state, event);\r
+            }\r
+        }\r
+    }\r
+\r
+\r
+    @Test\r
+    public void testOamStateTransitionForRestart() throws Exception {\r
+        String event = AppcOamMetaDataReader.AppcOperation.Restart.name();\r
+        String expectResult = AppcOamStates.Restarting.toString();\r
+\r
+        List<AppcOamStates> goodStates = Arrays.asList(\r
+                AppcOamStates.Error,\r
+                AppcOamStates.EnteringMaintenanceMode,\r
+                AppcOamStates.MaintenanceMode,\r
+                AppcOamStates.Started,\r
+                AppcOamStates.Starting,\r
+                AppcOamStates.Stopped,\r
+                AppcOamStates.Stopping);\r
+\r
+        for (AppcOamStates appcOamStates : AppcOamStates.values()) {\r
+            String state = appcOamStates.toString();\r
+            if (goodStates.contains(appcOamStates)) {\r
+                validateProper(state, event, expectResult);\r
+            } else {\r
+                validateException(state, event);\r
+            }\r
+        }\r
+    }\r
+}\r
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <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>
     <artifactId>appc-lifecycle-management</artifactId>
     <groupId>org.openecomp.appc</groupId>
     <version>1.1.0-SNAPSHOT</version>
   </parent>
+  <modelVersion>4.0.0</modelVersion>
   <name>appc-lifecycle-management-features</name>
   <artifactId>appc-lifecycle-management-features</artifactId>
 
           </execution>
         </executions>
       </plugin>
-      <!--<plugin>
-        &lt;!&ndash; launches the feature test, which validates that your karaf feature
-          can be installed inside of a karaf container. It doesn't validate that your 
-          functionality works correctly, just that you have all of the dependent bundles 
-          defined correctly. &ndash;&gt;
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <version>2.16</version>
-        <configuration>
-          <systemPropertyVariables>
-            <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
-            <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
-            <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version>
-          </systemPropertyVariables>
-          <dependenciesToScan>
-            <dependency>org.opendaylight.yangtools:features-test</dependency>
-          </dependenciesToScan>
-          <classpathDependencyExcludes>
-            &lt;!&ndash; The dependencies which bring in AbstractDataBrokerTest class
-              brings in a second PaxExam container which results in the feature tests failing 
-              with a message similar to: "ERROR o.ops4j.pax.exam.spi.PaxExamRuntime - Ambiguous 
-              TestContainer ..." This excludes the container we don't want to use. &ndash;&gt;
-            <classpathDependencyExcludes>org.ops4j.pax.exam:pax-exam-container-native</classpathDependencyExcludes>
-          </classpathDependencyExcludes>
-        </configuration>
-      </plugin>-->
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>build-helper-maven-plugin</artifactId>
@@ -1,38 +1,38 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
   ============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.
-  
+  Copyright (C) 2017 Amdocs\r
+  =============================================================================\r
+  Licensed under the Apache License, Version 2.0 (the "License");\r
+  you may not use this file except in compliance with the License.\r
+  You may obtain a copy of the License at\r
+  \r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+  \r
+  Unless required by applicable law or agreed to in writing, software\r
+  distributed under the License is distributed on an "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+  See the License for the specific language governing permissions and\r
+  limitations under the License.\r
+  \r
   ECOMP is a trademark and service mark of AT&T Intellectual Property.
-  ============LICENSE_END=========================================================
-  -->
-
-
-<features name="appc-lifecycle-management-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0  http://karaf.apache.org/xmlns/features/v1.2.0">     
-        
-    <feature name='appc-lifecycle-management' description="application executor" version='${project.version}'>
-        <bundle dependency="true">mvn:org.openecomp.appc/domain-model-lib/${project.version}</bundle>
-               <bundle>mvn:org.openecomp.appc/state-machine-lib/${project.version}</bundle>
-               <bundle>mvn:org.openecomp.appc/appc-lifecycle-management-api/${project.version}</bundle>
-        <bundle>mvn:org.openecomp.appc/appc-lifecycle-management-core/${project.version}</bundle>
-    </feature>
-
-</features>
+  ============LICENSE_END=========================================================\r
+  -->\r
+\r
+\r
+<features name="appc-lifecycle-management-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"\r
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+    xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0  http://karaf.apache.org/xmlns/features/v1.2.0">\r
+\r
+    <feature name='appc-lifecycle-management' description="application executor" version='${project.version}'>\r
+        <bundle dependency="true">mvn:org.openecomp.appc/appc-common/${project.version}</bundle>\r
+        <bundle>mvn:org.openecomp.appc/state-machine-lib/${project.version}</bundle>\r
+        <bundle>mvn:org.openecomp.appc/appc-lifecycle-management-api/${project.version}</bundle>\r
+        <bundle>mvn:org.openecomp.appc/appc-lifecycle-management-core/${project.version}</bundle>\r
+    </feature>\r
+\r
+</features>\r
diff --git a/appc-lifecycle-management/appc-lifecycle-management-installer/.gitignore b/appc-lifecycle-management/appc-lifecycle-management-installer/.gitignore
new file mode 100644 (file)
index 0000000..731eb43
--- /dev/null
@@ -0,0 +1,2 @@
+/target/
+/.settings/
diff --git a/appc-lifecycle-management/appc-lifecycle-management-installer/pom.xml b/appc-lifecycle-management/appc-lifecycle-management-installer/pom.xml
new file mode 100644 (file)
index 0000000..f9d7045
--- /dev/null
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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-lifecycle-management</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>appc-lifecycle-management-installer</artifactId>
+    <name>APPC LifeCycle Management - Karaf Installer</name>
+    <packaging>pom</packaging>
+
+    <properties>
+        <application.name>appc-lifecycle-management</application.name>
+        <features.boot>appc-lifecycle-management</features.boot>
+        <features.repositories>
+            mvn:org.openecomp.appc/appc-lifecycle-management-features/${project.version}/xml/features
+        </features.repositories>
+        <include.transitive.dependencies>false</include.transitive.dependencies>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.openecomp.appc</groupId>
+            <artifactId>appc-lifecycle-management-features</artifactId>
+            <version>${project.version}</version>
+            <classifier>features</classifier>
+            <type>xml</type>
+            <exclusions>
+                <exclusion>
+                    <groupId>*</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.appc</groupId>
+            <artifactId>appc-lifecycle-management-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.appc</groupId>
+            <artifactId>appc-lifecycle-management-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>maven-repo-zip</id>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <phase>package</phase>
+                        <configuration>
+                            <appendAssemblyId>false</appendAssemblyId>
+                            <attach>false</attach>
+                            <finalName>stage/${application.name}-${project.version}</finalName>
+                            <descriptors>
+                                <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>installer-zip</id>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <phase>package</phase>
+                        <configuration>
+                            <appendAssemblyId>false</appendAssemblyId>
+                            <attach>true</attach>
+                            <finalName>${application.name}-${project.version}</finalName>
+                            <descriptors>
+                                <descriptor>src/assembly/assemble_installer_zip.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <phase>prepare-package</phase>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
+                            <overWriteReleases>false</overWriteReleases>
+                            <overWriteSnapshots>true</overWriteSnapshots>
+                            <overWriteIfNewer>true</overWriteIfNewer>
+                            <useRepositoryLayout>true</useRepositoryLayout>
+                            <addParentPoms>false</addParentPoms>
+                            <copyPom>false</copyPom>
+                            <excludeGroupIds>org.opendaylight</excludeGroupIds>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-version</id>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <!-- here the phase you need -->
+                        <phase>validate</phase>
+                        <configuration>
+                            <outputDirectory>${basedir}/target/stage</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>src/main/resources/scripts</directory>
+                                    <includes>
+                                        <include>install-feature.sh</include>
+                                    </includes>
+                                    <filtering>true</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/appc-lifecycle-management/appc-lifecycle-management-installer/src/assembly/assemble_installer_zip.xml b/appc-lifecycle-management/appc-lifecycle-management-installer/src/assembly/assemble_installer_zip.xml
new file mode 100644 (file)
index 0000000..4b7b6f3
--- /dev/null
@@ -0,0 +1,60 @@
+<!--\r
+  ============LICENSE_START=======================================================
+  ONAP : APPC
+  ================================================================================
+  Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+  ================================================================================
+  Copyright (C) 2017 Amdocs\r
+  =============================================================================\r
+  Licensed under the Apache License, Version 2.0 (the "License");\r
+  you may not use this file except in compliance with the License.\r
+  You may obtain a copy of the License at\r
+  \r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+  \r
+  Unless required by applicable law or agreed to in writing, software\r
+  distributed under the License is distributed on an "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+  See the License for the specific language governing permissions and\r
+  limitations under the License.\r
+  \r
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  ============LICENSE_END=========================================================\r
+  -->\r
+\r
+<!-- Defines how we build the .zip file which is our distribution. -->\r
+\r
+<assembly\r
+        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"\r
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">\r
+    <id>controller</id>\r
+    <formats>\r
+        <format>zip</format>\r
+    </formats>\r
+\r
+    <!--  we want "system" and related files right at the root level\r
+          as this file is suppose to be unzip on top of a karaf\r
+          distro. -->\r
+    <includeBaseDirectory>false</includeBaseDirectory>\r
+\r
+    <fileSets>\r
+        <fileSet>\r
+            <directory>target/stage/</directory>\r
+            <outputDirectory>${application.name}</outputDirectory>\r
+            <fileMode>755</fileMode>\r
+            <includes>\r
+                <include>*.sh</include>\r
+            </includes>\r
+        </fileSet>\r
+        <fileSet>\r
+            <directory>target/stage/</directory>\r
+            <outputDirectory>${application.name}</outputDirectory>\r
+            <fileMode>644</fileMode>\r
+            <excludes>\r
+                <exclude>*.sh</exclude>\r
+            </excludes>\r
+        </fileSet>\r
+    </fileSets>\r
+\r
+</assembly>\r
diff --git a/appc-lifecycle-management/appc-lifecycle-management-installer/src/assembly/assemble_mvnrepo_zip.xml b/appc-lifecycle-management/appc-lifecycle-management-installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644 (file)
index 0000000..e735845
--- /dev/null
@@ -0,0 +1,51 @@
+<!--\r
+  ============LICENSE_START=======================================================
+  ONAP : APPC
+  ================================================================================
+  Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+  ================================================================================
+  Copyright (C) 2017 Amdocs\r
+  =============================================================================\r
+  Licensed under the Apache License, Version 2.0 (the "License");\r
+  you may not use this file except in compliance with the License.\r
+  You may obtain a copy of the License at\r
+  \r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+  \r
+  Unless required by applicable law or agreed to in writing, software\r
+  distributed under the License is distributed on an "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+  See the License for the specific language governing permissions and\r
+  limitations under the License.\r
+  \r
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  ============LICENSE_END=========================================================\r
+  -->\r
+\r
+<!-- Defines how we build the .zip file which is our distribution. -->\r
+\r
+<assembly\r
+        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"\r
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0\r
+         http://maven.apache.org/xsd/assembly-1.1.0.xsd">\r
+    <id>controller</id>\r
+    <formats>\r
+        <format>zip</format>\r
+    </formats>\r
+\r
+    <!--  we want "system" and related files right at the root level\r
+          as this file is suppose to be unzip on top of a karaf\r
+          distro. -->\r
+    <includeBaseDirectory>false</includeBaseDirectory>\r
+\r
+    <fileSets>\r
+        <fileSet>\r
+            <directory>target/assembly/</directory>\r
+            <outputDirectory>.</outputDirectory>\r
+            <excludes>\r
+            </excludes>\r
+        </fileSet>\r
+    </fileSets>\r
+\r
+</assembly>\r
diff --git a/appc-lifecycle-management/appc-lifecycle-management-installer/src/main/resources/scripts/install-feature.sh b/appc-lifecycle-management/appc-lifecycle-management-installer/src/main/resources/scripts/install-feature.sh
new file mode 100644 (file)
index 0000000..4a7e7a1
--- /dev/null
@@ -0,0 +1,63 @@
+###\r
+# ============LICENSE_START=======================================================
+# ONAP : APPC
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Copyright (C) 2017 Amdocs\r
+# =============================================================================\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+# \r
+#      http://www.apache.org/licenses/LICENSE-2.0\r
+# \r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+# \r
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# ============LICENSE_END=========================================================\r
+###\r
+\r
+#!/bin/bash\r
+\r
+ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}\r
+ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client}\r
+ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"}\r
+INSTALLERDIR=$(dirname $0)\r
+\r
+REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip\r
+\r
+if [ -f ${REPOZIP} ]\r
+then\r
+    unzip -n -d ${ODL_HOME} ${REPOZIP}\r
+else\r
+    echo "ERROR : repo zip ($REPOZIP) not found"\r
+    exit 1\r
+fi\r
+\r
+COUNT=0\r
+while [ $COUNT -lt 10 ]; do\r
+    ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} 2> /tmp/installErr\r
+    cat /tmp/installErr\r
+    if grep -q 'Failed to get the session' /tmp/installErr; then\r
+        sleep 10\r
+    else\r
+        let COUNT=10\r
+    fi\r
+    let COUNT=COUNT+1\r
+done\r
+COUNT=0\r
+while [ $COUNT -lt 10 ]; do\r
+    ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} 2> /tmp/installErr\r
+        cat /tmp/installErr\r
+    if grep -q 'Failed to get the session' /tmp/installErr; then\r
+        sleep 10\r
+    else\r
+        let COUNT=10\r
+    fi\r
+    let COUNT=COUNT+1\r
+done\r
diff --git a/appc-lifecycle-management/pom.xml b/appc-lifecycle-management/pom.xml
new file mode 100644 (file)
index 0000000..9b5dcfe
--- /dev/null
@@ -0,0 +1,50 @@
+<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">
+    <parent>
+        <groupId>org.openecomp.appc</groupId>
+        <artifactId>appc</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>appc-lifecycle-management</artifactId>
+    <packaging>pom</packaging>
+    <name>APPC Lifecycle Management</name>
+    <description>APPC Lifecycle Management</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.openecomp.appc</groupId>
+            <artifactId>appc-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>maven-bundle-plugin</artifactId>
+                    <extensions>true</extensions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+    <!-- ================================================================================== -->
+    <!-- The modules we build -->
+    <!-- ================================================================================== -->
+    <modules>
+        <module>appc-lifecycle-management-api</module>
+        <module>state-machine-lib</module>
+        <module>appc-lifecycle-management-core</module>
+        <module>appc-lifecycle-management-features</module>
+        <module>appc-lifecycle-management-installer</module>
+    </modules>
+
+</project>
\ No newline at end of file
diff --git a/appc-lifecycle-management/state-machine-lib/pom.xml b/appc-lifecycle-management/state-machine-lib/pom.xml
new file mode 100644 (file)
index 0000000..9618d61
--- /dev/null
@@ -0,0 +1,42 @@
+<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">
+    <parent>
+        <groupId>org.openecomp.appc</groupId>
+        <artifactId>appc-lifecycle-management</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>state-machine-lib</artifactId>
+    <packaging>bundle</packaging>
+
+    <name>state-machine-lib</name>
+    <url>http://maven.apache.org</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.openecomp.appc</groupId>
+            <artifactId>appc-lifecycle-management-api</artifactId>
+            <version>1.1.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <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-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
new file mode 100644 (file)
index 0000000..1c74861
--- /dev/null
@@ -0,0 +1,34 @@
+/*-\r
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * 
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * 
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.statemachine;\r
+\r
+import org.openecomp.appc.exceptions.InvalidInputException;\r
+import org.openecomp.appc.statemachine.objects.Event;\r
+import org.openecomp.appc.statemachine.objects.State;\r
+import org.openecomp.appc.statemachine.objects.StateMachineResponse;\r
+\r
+public interface StateMachine {\r
+    StateMachineResponse handleEvent(State currentState, Event event) throws InvalidInputException;\r
+}\r
@@ -1,32 +1,31 @@
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * 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;
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.statemachine;\r
+\r
+import org.openecomp.appc.statemachine.objects.StateMachineMetadata;\r
+\r
+public interface StateMetaDataReader {\r
+    StateMachineMetadata readMetadata();\r
+}\r
@@ -1,46 +1,40 @@
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * 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;
-    }
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.statemachine.impl;\r
+\r
+import org.openecomp.appc.statemachine.StateMachine;\r
+import org.openecomp.appc.statemachine.objects.StateMachineMetadata;\r
+\r
+\r
+public class StateMachineFactory {\r
+\r
+    private StateMachineFactory(){\r
+\r
+    }\r
+\r
+    public static StateMachine getStateMachine(StateMachineMetadata metadata){\r
+        return new StateMachineImpl(metadata);\r
+    }\r
+}\r
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
new file mode 100644 (file)
index 0000000..124cf36
--- /dev/null
@@ -0,0 +1,98 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP : APPC\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * \r
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.statemachine.impl;\r
+\r
+import java.util.HashSet;\r
+import java.util.Set;\r
+\r
+import org.openecomp.appc.exceptions.InvalidInputException;\r
+import org.openecomp.appc.statemachine.StateMachine;\r
+import org.openecomp.appc.statemachine.objects.Event;\r
+import org.openecomp.appc.statemachine.objects.Response;\r
+import org.openecomp.appc.statemachine.objects.State;\r
+import org.openecomp.appc.statemachine.objects.StateMachineMetadata;\r
+import org.openecomp.appc.statemachine.objects.StateMachineResponse;\r
+import org.openecomp.appc.statemachine.objects.Transition;\r
+\r
+\r
+public class StateMachineImpl implements StateMachine {\r
+\r
+    private final Set<State> states;\r
+\r
+    private final Set<Event> events;\r
+\r
+    StateMachineImpl(StateMachineMetadata metadata){\r
+        this.states = new HashSet<>();\r
+        this.states.addAll(metadata.getStates());\r
+        this.events = new HashSet<>();\r
+        this.events.addAll(metadata.getEvents());\r
+    }\r
+\r
+    public StateMachineResponse handleEvent(State inputState, Event event) throws InvalidInputException{\r
+\r
+        if(!validateInputs(inputState,event)){\r
+            throw new InvalidInputException("VNF State or incoming event is invalid. State = " +inputState + " event = " + event );\r
+        }\r
+\r
+        StateMachineResponse response = new StateMachineResponse();\r
+        State currentState = null,nextState = null;\r
+        for(State stateInSet:states){\r
+            if(stateInSet.equals(inputState)){\r
+                currentState = stateInSet;\r
+                break;\r
+            }\r
+        }\r
+        if (currentState != null) {\r
+            for (Transition transition : currentState.getTransitions()) {\r
+                if (event.equals(transition.getEvent())) {\r
+                    nextState = transition.getNextState();\r
+                }\r
+            }\r
+        }\r
+        if(nextState == null){\r
+            response.setResponse(Response.NO_TRANSITION_DEFINED);\r
+        }\r
+        else if(inputState.equals(nextState)){\r
+            response.setResponse(Response.NO_STATE_CHANGE);\r
+        }\r
+        else{\r
+            response.setResponse(Response.VALID_TRANSITION);\r
+        }\r
+        response.setNextState(nextState);\r
+        return response;\r
+    }\r
+\r
+    private boolean validateInputs(State state,Event event) {\r
+        return state != null && event != null && this.states.contains(state) && this.events.contains(event);\r
+    }\r
+\r
+    @Override\r
+    public String toString() {\r
+        return "StateMachineImpl{" +\r
+                "states=" + states +\r
+                ", events=" + events +\r
+                '}';\r
+    }\r
+}\r
diff --git a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamMetaDataReader.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamMetaDataReader.java
new file mode 100644 (file)
index 0000000..e160e7f
--- /dev/null
@@ -0,0 +1,107 @@
+/*-\r
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * 
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * 
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.statemachine.impl.readers;\r
+\r
+import org.openecomp.appc.statemachine.StateMetaDataReader;\r
+import org.openecomp.appc.statemachine.objects.Event;\r
+import org.openecomp.appc.statemachine.objects.State;\r
+import org.openecomp.appc.statemachine.objects.StateMachineMetadata;\r
+\r
+public class AppcOamMetaDataReader implements StateMetaDataReader {\r
+\r
+    public enum AppcOperation {\r
+        MaintenanceMode,\r
+        Restart,\r
+        Start,\r
+        Stop\r
+    }\r
+\r
+    @Override\r
+    public StateMachineMetadata readMetadata() {\r
+        State NOT_INSTANTIATED = new State(AppcOamStates.NotInstantiated.toString());\r
+        State INSTANTIATED = new State(AppcOamStates.Instantiated.toString());\r
+        State RESTARTING = new State(AppcOamStates.Restarting.toString());\r
+        State STARTING = new State(AppcOamStates.Starting.toString());\r
+        State STARTED = new State(AppcOamStates.Started.toString());\r
+        State ENTERING_MAINTENANCE_MODE = new State(AppcOamStates.EnteringMaintenanceMode.toString());\r
+        State MAINTENANCE_MODE = new State(AppcOamStates.MaintenanceMode.toString());\r
+        State ERROR = new State(AppcOamStates.Error.toString());\r
+        State UNKNOWN = new State(AppcOamStates.Unknown.toString());\r
+        State STOPPING = new State(AppcOamStates.Stopping.toString());\r
+        State STOPPED = new State(AppcOamStates.Stopped.toString());\r
+\r
+        Event START = new Event(AppcOperation.Start.toString());\r
+        Event STOP = new Event(AppcOperation.Stop.toString());\r
+        Event MAINTENANCE_MODE_EVENT = new Event(AppcOperation.MaintenanceMode.toString());\r
+        Event RESTART = new Event(AppcOperation.Restart.toString());\r
+\r
+        StateMachineMetadata.StateMachineMetadataBuilder builder = new StateMachineMetadata\r
+                .StateMachineMetadataBuilder();\r
+\r
+        builder = builder.addState(NOT_INSTANTIATED);\r
+        builder = builder.addState(INSTANTIATED);\r
+        builder = builder.addState(STARTING);\r
+        builder = builder.addState(STARTED);\r
+        builder = builder.addState(ERROR);\r
+        builder = builder.addState(UNKNOWN);\r
+        builder = builder.addState(STOPPING);\r
+        builder = builder.addState(STOPPED);\r
+        builder = builder.addState(ENTERING_MAINTENANCE_MODE);\r
+        builder = builder.addState(MAINTENANCE_MODE);\r
+        builder = builder.addState(RESTARTING);\r
+\r
+        builder = builder.addEvent(START);\r
+        builder = builder.addEvent(STOP);\r
+        builder = builder.addEvent(RESTART);\r
+        builder = builder.addEvent(MAINTENANCE_MODE_EVENT);\r
+\r
+        /*\r
+         *  for addTransition:\r
+         *  param 1: current state; param 2: received command/request; param 3: new transition state\r
+         */\r
+        // start\r
+        builder = builder.addTransition(STOPPED,                   START, STARTING);\r
+        builder = builder.addTransition(MAINTENANCE_MODE,          START, STARTING);\r
+        builder = builder.addTransition(ERROR,                     START, STARTING);\r
+        // stop\r
+        builder = builder.addTransition(STARTED,                   STOP, STOPPING);\r
+        builder = builder.addTransition(STARTING,                  STOP, STOPPING);\r
+        builder = builder.addTransition(ENTERING_MAINTENANCE_MODE, STOP, STOPPING);\r
+        builder = builder.addTransition(MAINTENANCE_MODE,          STOP, STOPPING);\r
+        builder = builder.addTransition(ERROR,                     STOP, STOPPING);\r
+        // maintenance mode\r
+        builder = builder.addTransition(\r
+                STARTED, MAINTENANCE_MODE_EVENT, ENTERING_MAINTENANCE_MODE);\r
+        // restart\r
+        builder = builder.addTransition(STOPPED,                   RESTART, RESTARTING);\r
+        builder = builder.addTransition(STARTING,                  RESTART, RESTARTING);\r
+        builder = builder.addTransition(STARTED,                   RESTART, RESTARTING);\r
+        builder = builder.addTransition(ENTERING_MAINTENANCE_MODE, RESTART, RESTARTING);\r
+        builder = builder.addTransition(MAINTENANCE_MODE,          RESTART, RESTARTING);\r
+        builder = builder.addTransition(ERROR,                     RESTART, RESTARTING);\r
+\r
+        return builder.build();\r
+    }\r
+}\r
diff --git a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamStates.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamStates.java
new file mode 100644 (file)
index 0000000..2f000d9
--- /dev/null
@@ -0,0 +1,56 @@
+/*-\r
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * 
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * 
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.statemachine.impl.readers;\r
+\r
+import org.osgi.framework.Bundle;\r
+\r
+public enum AppcOamStates {\r
+    EnteringMaintenanceMode(0),\r
+    Error(0),\r
+    Instantiated(Bundle.INSTALLED),\r
+    MaintenanceMode(0),\r
+    NotInstantiated(Bundle.UNINSTALLED),\r
+    Restarting(0),\r
+    Started(Bundle.ACTIVE),\r
+    Starting(Bundle.STARTING),\r
+    Stopped(Bundle.RESOLVED),\r
+    Stopping(Bundle.STOPPING),\r
+    Unknown(0);\r
+\r
+    int osgiBundleState;\r
+\r
+    AppcOamStates(Integer bundleState) {\r
+        osgiBundleState = bundleState;\r
+    }\r
+\r
+    public static AppcOamStates getOamStateFromBundleState(int bundleState) {\r
+        for (AppcOamStates aState : values()) {\r
+            if (aState.osgiBundleState == bundleState) {\r
+                return aState;\r
+            }\r
+        }\r
+        return Unknown;\r
+    }\r
+}\r
diff --git a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/VnfMetaDataReader.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/VnfMetaDataReader.java
new file mode 100644 (file)
index 0000000..e3e72f6
--- /dev/null
@@ -0,0 +1,483 @@
+/*-\r
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * 
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * 
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.statemachine.impl.readers;\r
+\r
+import org.openecomp.appc.statemachine.StateMetaDataReader;\r
+import org.openecomp.appc.lifecyclemanager.objects.VNFOperationOutcome;\r
+import org.openecomp.appc.statemachine.objects.Event;\r
+import org.openecomp.appc.statemachine.objects.State;\r
+import org.openecomp.appc.statemachine.objects.StateMachineMetadata;\r
+\r
+public class VnfMetaDataReader implements StateMetaDataReader {\r
+\r
+    public enum VNFOperation {\r
+\r
+        Configure, Test, HealthCheck, Start, Terminate, Restart, Rebuild, Stop, ConfigModify,\r
+        ConfigScaleOut,ConfigRestore,Backup, Snapshot,\r
+        SoftwareUpload, LiveUpgrade, Rollback, Sync, Audit, Test_lic, Migrate, Evacuate,\r
+        ConfigBackup, ConfigBackupDelete, ConfigExport,\r
+        Lock(true), Unlock(true), CheckLock(true), StartApplication,StopApplication;\r
+\r
+        private boolean builtIn;\r
+\r
+        VNFOperation(boolean builtIn) {\r
+            this.builtIn = builtIn;\r
+        }\r
+\r
+        VNFOperation() {\r
+            this(false);\r
+        }\r
+    }\r
+\r
+    private enum VNFStates {\r
+        Not_Instantiated, Instantiated, Configuring, Configured, Testing, Tested, Rebuilding, Restarting, Starting,\r
+        Error, Running, Unknown, Terminating, Stopping, Stopped,\r
+        Backing_Up, Snapshotting, Software_Uploading, Upgrading, Rollbacking, Licensing, Migrating, Evacuating,\r
+        NOT_ORCHESTRATED("NOT ORCHESTRATED"), Created;\r
+\r
+        String stateName;\r
+\r
+        VNFStates(String name) {\r
+            this.stateName = name;\r
+        }\r
+\r
+        VNFStates() {\r
+            this.stateName = name();\r
+        }\r
+\r
+        @Override\r
+        public String toString() {\r
+            return this.stateName;\r
+        }\r
+    }\r
+\r
+    public StateMachineMetadata readMetadata() {\r
+        {\r
+            State NOT_INSTANTIATED = new State(VNFStates.Not_Instantiated.toString());\r
+            State INSTANTIATED = new State(VNFStates.Instantiated.toString());\r
+            State CONFIGURING = new State(VNFStates.Configuring.toString());\r
+            State CONFIGURED = new State(VNFStates.Configured.toString());\r
+            State TESTING = new State(VNFStates.Testing.toString());\r
+            State TESTED = new State(VNFStates.Tested.toString());\r
+            State REBUILDING = new State(VNFStates.Rebuilding.toString());\r
+            State RESTARTING = new State(VNFStates.Restarting.toString());\r
+            State STARTING = new State(VNFStates.Starting.toString());\r
+            State ERROR = new State(VNFStates.Error.toString());\r
+            State RUNNING = new State(VNFStates.Running.toString());\r
+            State UNKNOWN = new State(VNFStates.Unknown.toString());\r
+            State TERMINATING = new State(VNFStates.Terminating.toString());\r
+            State STOPPING = new State(VNFStates.Stopping.toString());\r
+            State STOPPED = new State(VNFStates.Stopped.toString());\r
+            State NOT_ORCHESTRATED = new State(VNFStates.NOT_ORCHESTRATED.toString());\r
+\r
+            State BACKING_UP = new State(VNFStates.Backing_Up.toString());\r
+            State SNAPSHOTTING = new State(VNFStates.Snapshotting.toString());\r
+            State SOFTWARE_UPLOADING = new State(VNFStates.Software_Uploading.toString());\r
+            State UPGRADING = new State(VNFStates.Upgrading.toString());\r
+            State ROLLBACKING = new State(VNFStates.Rollbacking.toString());\r
+\r
+            State MIGRATING = new State(VNFStates.Migrating.toString());\r
+            State EVACUATING = new State(VNFStates.Evacuating.toString());\r
+            State CREATED= new State(VNFStates.Created.toString());\r
+\r
+            Event START_APPLICATION = new Event(VNFOperation.StartApplication.toString());\r
+            Event CONFIGURE = new Event(VNFOperation.Configure.toString());\r
+            Event HEALTHCHECK = new Event(VNFOperation.HealthCheck.toString());\r
+            Event TEST = new Event(VNFOperation.Test.toString());\r
+            Event START = new Event(VNFOperation.Start.toString());\r
+            Event TERMINATE = new Event(VNFOperation.Terminate.toString());\r
+            Event RESTART = new Event(VNFOperation.Restart.toString());\r
+            Event REBUILD = new Event(VNFOperation.Rebuild.toString());\r
+            Event STOP = new Event(VNFOperation.Stop.toString());\r
+            Event CONFIG_MODIFY = new Event(VNFOperation.ConfigModify.toString());\r
+            Event CONFIG_SCALEOUT = new Event(VNFOperation.ConfigScaleOut.toString());\r
+            Event CONFIG_RESTORE = new Event(VNFOperation.ConfigRestore.toString());\r
+            Event BACKUP = new Event(VNFOperation.Backup.toString());\r
+            Event SNAPSHOT = new Event(VNFOperation.Snapshot.toString());\r
+            Event SOFTWARE_UPLOAD = new Event(VNFOperation.SoftwareUpload.toString());\r
+            Event LIVE_UPGRADE = new Event(VNFOperation.LiveUpgrade.toString());\r
+            Event ROLLBACK = new Event(VNFOperation.Rollback.toString());\r
+            Event SYNC = new Event(VNFOperation.Sync.toString());\r
+            Event AUDIT = new Event(VNFOperation.Audit.toString());\r
+            Event MIGRATE = new Event(VNFOperation.Migrate.toString());\r
+            Event EVACUATE = new Event(VNFOperation.Evacuate.toString());\r
+            Event CONFIG_BACKUP = new Event(VNFOperation.ConfigBackup.toString());\r
+            Event CONFIG_BACKUP_DELETE = new Event(VNFOperation.ConfigBackupDelete.toString());\r
+            Event CONFIG_EXPORT = new Event(VNFOperation.ConfigExport.toString());\r
+            Event STOP_APPLICATION= new Event(VNFOperation.StopApplication.toString());\r
+\r
+            Event LOCK = new Event(VNFOperation.Lock.toString());\r
+            Event UNLOCK = new Event(VNFOperation.Unlock.toString());\r
+            Event CHECKLOCK = new Event(VNFOperation.CheckLock.toString());\r
+\r
+            Event SUCCESS = new Event(VNFOperationOutcome.SUCCESS.toString());\r
+            Event FAILURE = new Event(VNFOperationOutcome.FAILURE.toString());\r
+\r
+\r
+            StateMachineMetadata.StateMachineMetadataBuilder builder = new StateMachineMetadata.StateMachineMetadataBuilder();\r
+\r
+            builder = builder.addState(NOT_INSTANTIATED);\r
+            builder = builder.addState(INSTANTIATED);\r
+            builder = builder.addState(CONFIGURING);\r
+            builder = builder.addState(CONFIGURED);\r
+            builder = builder.addState(TESTING);\r
+            builder = builder.addState(TESTED);\r
+            builder = builder.addState(REBUILDING);\r
+            builder = builder.addState(RESTARTING);\r
+            builder = builder.addState(STARTING);\r
+            builder = builder.addState(ERROR);\r
+            builder = builder.addState(RUNNING);\r
+            builder = builder.addState(UNKNOWN);\r
+            builder = builder.addState(TERMINATING);\r
+            builder = builder.addState(STOPPING);\r
+            builder = builder.addState(STOPPED);\r
+\r
+            builder = builder.addState(BACKING_UP);\r
+            builder = builder.addState(SNAPSHOTTING);\r
+            builder = builder.addState(SOFTWARE_UPLOADING);\r
+            builder = builder.addState(UPGRADING);\r
+            builder = builder.addState(ROLLBACKING);\r
+            builder = builder.addState(MIGRATING);\r
+            builder = builder.addState(EVACUATING);\r
+            builder = builder.addState(NOT_ORCHESTRATED);\r
+            builder = builder.addState(CREATED);\r
+            builder = builder.addEvent(START_APPLICATION);\r
+            builder = builder.addEvent(CONFIGURE);\r
+            builder = builder.addEvent(TEST);\r
+            builder = builder.addEvent(START);\r
+            builder = builder.addEvent(TERMINATE);\r
+            builder = builder.addEvent(RESTART);\r
+            builder = builder.addEvent(REBUILD);\r
+            builder = builder.addEvent(SUCCESS);\r
+            builder = builder.addEvent(FAILURE);\r
+            builder = builder.addEvent(STOP);\r
+            builder = builder.addEvent(CONFIG_MODIFY);\r
+            builder = builder.addEvent(CONFIG_SCALEOUT);\r
+            builder = builder.addEvent(CONFIG_RESTORE);\r
+            builder = builder.addEvent(HEALTHCHECK);\r
+            builder = builder.addEvent(BACKUP);\r
+            builder = builder.addEvent(SNAPSHOT);\r
+            builder = builder.addEvent(SOFTWARE_UPLOAD);\r
+            builder = builder.addEvent(LIVE_UPGRADE);\r
+            builder = builder.addEvent(ROLLBACK);\r
+            builder = builder.addEvent(SYNC);\r
+            builder = builder.addEvent(AUDIT);\r
+            builder = builder.addEvent(MIGRATE);\r
+            builder = builder.addEvent(EVACUATE);\r
+            builder = builder.addEvent(LOCK);\r
+            builder = builder.addEvent(UNLOCK);\r
+            builder = builder.addEvent(CHECKLOCK);\r
+            builder = builder.addEvent(CONFIG_BACKUP);\r
+            builder = builder.addEvent(CONFIG_BACKUP_DELETE);\r
+            builder = builder.addEvent(CONFIG_EXPORT);\r
+            builder = builder.addEvent(STOP_APPLICATION);\r
+\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,CONFIGURE,CONFIGURING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,TEST,TESTING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,START,STARTING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,TERMINATE,TERMINATING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,RESTART,RESTARTING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,REBUILD,REBUILDING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,STOP,STOPPING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,CONFIG_MODIFY,CONFIGURING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,CONFIG_SCALEOUT,CONFIGURING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,CONFIG_RESTORE,CONFIGURING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,HEALTHCHECK,TESTING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,BACKUP,BACKING_UP);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,SNAPSHOT,SNAPSHOTTING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,LIVE_UPGRADE,UPGRADING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,ROLLBACK,ROLLBACKING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,MIGRATE,MIGRATING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,EVACUATE,EVACUATING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,LOCK,NOT_ORCHESTRATED);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,UNLOCK,NOT_ORCHESTRATED);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,CHECKLOCK,NOT_ORCHESTRATED);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,START_APPLICATION,STARTING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,STOP_APPLICATION,STOPPING);\r
+            builder = builder.addTransition(NOT_ORCHESTRATED,CONFIG_BACKUP,NOT_ORCHESTRATED);\r
+\r
+            builder = builder.addTransition(CREATED,CONFIGURE,CONFIGURING);\r
+            builder = builder.addTransition(CREATED,TEST,TESTING);\r
+            builder = builder.addTransition(CREATED,START,STARTING);\r
+            builder = builder.addTransition(CREATED,TERMINATE,TERMINATING);\r
+            builder = builder.addTransition(CREATED,RESTART,RESTARTING);\r
+            builder = builder.addTransition(CREATED,REBUILD,REBUILDING);\r
+            builder = builder.addTransition(CREATED,STOP,STOPPING);\r
+            builder = builder.addTransition(CREATED,CONFIG_MODIFY,CONFIGURING);\r
+            builder = builder.addTransition(CREATED,CONFIG_SCALEOUT,CONFIGURING);\r
+            builder = builder.addTransition(CREATED,CONFIG_RESTORE,CONFIGURING);\r
+            builder = builder.addTransition(CREATED,HEALTHCHECK,TESTING);\r
+            builder = builder.addTransition(CREATED,BACKUP,BACKING_UP);\r
+            builder = builder.addTransition(CREATED,SNAPSHOT,SNAPSHOTTING);\r
+            builder = builder.addTransition(CREATED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);\r
+            builder = builder.addTransition(CREATED,LIVE_UPGRADE,UPGRADING);\r
+            builder = builder.addTransition(CREATED,ROLLBACK,ROLLBACKING);\r
+            builder = builder.addTransition(CREATED,MIGRATE,MIGRATING);\r
+            builder = builder.addTransition(CREATED,EVACUATE,EVACUATING);\r
+            builder = builder.addTransition(CREATED,LOCK,CREATED);\r
+            builder = builder.addTransition(CREATED,UNLOCK,CREATED);\r
+            builder = builder.addTransition(CREATED,CHECKLOCK,CREATED);\r
+            builder = builder.addTransition(CREATED,START_APPLICATION,STARTING);\r
+            builder = builder.addTransition(CREATED,STOP_APPLICATION,STOPPING);\r
+            builder = builder.addTransition(CREATED,CONFIG_BACKUP,CREATED);\r
+\r
+            builder = builder.addTransition(INSTANTIATED,CONFIGURE,CONFIGURING);\r
+            builder = builder.addTransition(INSTANTIATED,TEST,TESTING);\r
+            builder = builder.addTransition(INSTANTIATED,START,STARTING);\r
+            builder = builder.addTransition(INSTANTIATED,TERMINATE,TERMINATING);\r
+            builder = builder.addTransition(INSTANTIATED,RESTART,RESTARTING);\r
+            builder = builder.addTransition(INSTANTIATED,REBUILD,REBUILDING);\r
+            builder = builder.addTransition(INSTANTIATED,STOP,STOPPING);\r
+            builder = builder.addTransition(INSTANTIATED,CONFIG_MODIFY,CONFIGURING);\r
+            builder = builder.addTransition(INSTANTIATED,CONFIG_SCALEOUT,CONFIGURING);\r
+            builder = builder.addTransition(INSTANTIATED,CONFIG_RESTORE,CONFIGURING);\r
+            builder = builder.addTransition(INSTANTIATED,HEALTHCHECK,TESTING);\r
+            builder = builder.addTransition(INSTANTIATED,BACKUP,BACKING_UP);\r
+            builder = builder.addTransition(INSTANTIATED,SNAPSHOT,SNAPSHOTTING);\r
+            builder = builder.addTransition(INSTANTIATED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);\r
+            builder = builder.addTransition(INSTANTIATED,LIVE_UPGRADE,UPGRADING);\r
+            builder = builder.addTransition(INSTANTIATED,ROLLBACK,ROLLBACKING);\r
+            builder = builder.addTransition(INSTANTIATED,MIGRATE,MIGRATING);\r
+            builder = builder.addTransition(INSTANTIATED,EVACUATE,EVACUATING);\r
+            builder = builder.addTransition(INSTANTIATED,LOCK,INSTANTIATED);\r
+            builder = builder.addTransition(INSTANTIATED,UNLOCK,INSTANTIATED);\r
+            builder = builder.addTransition(INSTANTIATED,CHECKLOCK,INSTANTIATED);\r
+\r
+            builder = builder.addTransition(CONFIGURED,CONFIGURE,CONFIGURING);\r
+            builder = builder.addTransition(CONFIGURED,TEST,TESTING);\r
+            builder = builder.addTransition(CONFIGURED,START,STARTING);\r
+            builder = builder.addTransition(CONFIGURED,TERMINATE,TERMINATING);\r
+            builder = builder.addTransition(CONFIGURED,RESTART,RESTARTING);\r
+            builder = builder.addTransition(CONFIGURED,REBUILD,REBUILDING);\r
+            builder = builder.addTransition(CONFIGURED,STOP,STOPPING);\r
+            builder = builder.addTransition(CONFIGURED,CONFIG_MODIFY,CONFIGURING);\r
+            builder = builder.addTransition(CONFIGURED,CONFIG_SCALEOUT,CONFIGURING);\r
+            builder = builder.addTransition(CONFIGURED,CONFIG_RESTORE,CONFIGURING);\r
+            builder = builder.addTransition(CONFIGURED,HEALTHCHECK,TESTING);\r
+            builder = builder.addTransition(CONFIGURED,BACKUP,BACKING_UP);\r
+            builder = builder.addTransition(CONFIGURED,SNAPSHOT,SNAPSHOTTING);\r
+            builder = builder.addTransition(CONFIGURED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);\r
+            builder = builder.addTransition(CONFIGURED,LIVE_UPGRADE,UPGRADING);\r
+            builder = builder.addTransition(CONFIGURED,ROLLBACK,ROLLBACKING);\r
+            builder = builder.addTransition(CONFIGURED,SYNC,CONFIGURED);\r
+            builder = builder.addTransition(CONFIGURED,AUDIT,CONFIGURED);\r
+            builder = builder.addTransition(CONFIGURED,MIGRATE,MIGRATING);\r
+            builder = builder.addTransition(CONFIGURED,EVACUATE,EVACUATING);\r
+            builder = builder.addTransition(CONFIGURED,LOCK,CONFIGURED);\r
+            builder = builder.addTransition(CONFIGURED,UNLOCK,CONFIGURED);\r
+            builder = builder.addTransition(CONFIGURED,CHECKLOCK,CONFIGURED);\r
+            builder = builder.addTransition(CONFIGURED,CONFIG_BACKUP,CONFIGURED);\r
+            builder = builder.addTransition(CONFIGURED,CONFIG_BACKUP_DELETE,CONFIGURED);\r
+            builder = builder.addTransition(CONFIGURED,CONFIG_EXPORT,CONFIGURED);\r
+            builder = builder.addTransition(CONFIGURED,STOP_APPLICATION,STOPPING);\r
+\r
+            builder = builder.addTransition(TESTED,CONFIGURE,CONFIGURING);\r
+            builder = builder.addTransition(TESTED,TEST,TESTING);\r
+            builder = builder.addTransition(TESTED,START,STARTING);\r
+            builder = builder.addTransition(TESTED,TERMINATE,TERMINATING);\r
+            builder = builder.addTransition(TESTED,RESTART,RESTARTING);\r
+            builder = builder.addTransition(TESTED,REBUILD,REBUILDING);\r
+            builder = builder.addTransition(TESTED,STOP,STOPPING);\r
+            builder = builder.addTransition(TESTED,CONFIG_MODIFY,CONFIGURING);\r
+            builder = builder.addTransition(TESTED,CONFIG_SCALEOUT,CONFIGURING);\r
+            builder = builder.addTransition(TESTED,CONFIG_RESTORE,CONFIGURING);\r
+            builder = builder.addTransition(TESTED,HEALTHCHECK,TESTING);\r
+            builder = builder.addTransition(TESTED,BACKUP,BACKING_UP);\r
+            builder = builder.addTransition(TESTED,SNAPSHOT,SNAPSHOTTING);\r
+            builder = builder.addTransition(TESTED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);\r
+            builder = builder.addTransition(TESTED,LIVE_UPGRADE,UPGRADING);\r
+            builder = builder.addTransition(TESTED,ROLLBACK,ROLLBACKING);\r
+            builder = builder.addTransition(TESTED,SYNC,TESTED);\r
+            builder = builder.addTransition(TESTED,AUDIT,TESTED);\r
+            builder = builder.addTransition(TESTED,MIGRATE,MIGRATING);\r
+            builder = builder.addTransition(TESTED,EVACUATE,EVACUATING);\r
+            builder = builder.addTransition(TESTED,LOCK,TESTED);\r
+            builder = builder.addTransition(TESTED,UNLOCK,TESTED);\r
+            builder = builder.addTransition(TESTED,CHECKLOCK,TESTED);\r
+            builder = builder.addTransition(TESTED,CONFIG_BACKUP,TESTED);\r
+            builder = builder.addTransition(TESTED,CONFIG_BACKUP_DELETE,TESTED);\r
+            builder = builder.addTransition(TESTED,CONFIG_EXPORT,TESTED);\r
+            builder = builder.addTransition(TESTED,STOP_APPLICATION,STOPPING);\r
+\r
+            builder = builder.addTransition(RUNNING,CONFIGURE,CONFIGURING);\r
+            builder = builder.addTransition(RUNNING,TEST,TESTING);\r
+            builder = builder.addTransition(RUNNING,START,STARTING);\r
+            builder = builder.addTransition(RUNNING,TERMINATE,TERMINATING);\r
+            builder = builder.addTransition(RUNNING,RESTART,RESTARTING);\r
+            builder = builder.addTransition(RUNNING,REBUILD,REBUILDING);\r
+            builder = builder.addTransition(RUNNING,STOP,STOPPING);\r
+            builder = builder.addTransition(RUNNING,CONFIG_MODIFY,CONFIGURING);\r
+            builder = builder.addTransition(RUNNING,CONFIG_SCALEOUT,CONFIGURING);\r
+            builder = builder.addTransition(RUNNING,CONFIG_RESTORE,CONFIGURING);\r
+            builder = builder.addTransition(RUNNING,HEALTHCHECK,TESTING);\r
+            builder = builder.addTransition(RUNNING,BACKUP,BACKING_UP);\r
+            builder = builder.addTransition(RUNNING,SNAPSHOT,SNAPSHOTTING);\r
+            builder = builder.addTransition(RUNNING,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);\r
+            builder = builder.addTransition(RUNNING,LIVE_UPGRADE,UPGRADING);\r
+            builder = builder.addTransition(RUNNING,ROLLBACK,ROLLBACKING);\r
+            builder = builder.addTransition(RUNNING,SYNC,RUNNING);\r
+            builder = builder.addTransition(RUNNING,AUDIT,RUNNING);\r
+            builder = builder.addTransition(RUNNING,MIGRATE,MIGRATING);\r
+            builder = builder.addTransition(RUNNING,EVACUATE,EVACUATING);\r
+            builder = builder.addTransition(RUNNING,LOCK,RUNNING);\r
+            builder = builder.addTransition(RUNNING,UNLOCK,RUNNING);\r
+            builder = builder.addTransition(RUNNING,CHECKLOCK,RUNNING);\r
+            builder = builder.addTransition(RUNNING,CONFIG_BACKUP,RUNNING);\r
+            builder = builder.addTransition(RUNNING,CONFIG_BACKUP_DELETE,RUNNING);\r
+            builder = builder.addTransition(RUNNING,CONFIG_EXPORT,RUNNING);\r
+            builder = builder.addTransition(RUNNING,STOP_APPLICATION,STOPPING);\r
+\r
+            builder = builder.addTransition(ERROR,CONFIGURE,CONFIGURING);\r
+            builder = builder.addTransition(ERROR,TEST,TESTING);\r
+            builder = builder.addTransition(ERROR,START,STARTING);\r
+            builder = builder.addTransition(ERROR,TERMINATE,TERMINATING);\r
+            builder = builder.addTransition(ERROR,RESTART,RESTARTING);\r
+            builder = builder.addTransition(ERROR,REBUILD,REBUILDING);\r
+            builder = builder.addTransition(ERROR,STOP,STOPPING);\r
+            builder = builder.addTransition(ERROR,CONFIG_MODIFY,CONFIGURING);\r
+            builder = builder.addTransition(ERROR,CONFIG_SCALEOUT,CONFIGURING);\r
+            builder = builder.addTransition(ERROR,CONFIG_RESTORE,CONFIGURING);\r
+            builder = builder.addTransition(ERROR,HEALTHCHECK,TESTING);\r
+            builder = builder.addTransition(ERROR,BACKUP,BACKING_UP);\r
+            builder = builder.addTransition(ERROR,SNAPSHOT,SNAPSHOTTING);\r
+            builder = builder.addTransition(ERROR,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);\r
+            builder = builder.addTransition(ERROR,LIVE_UPGRADE,UPGRADING);\r
+            builder = builder.addTransition(ERROR,ROLLBACK,ROLLBACKING);\r
+            builder = builder.addTransition(ERROR,SYNC,ERROR);\r
+            builder = builder.addTransition(ERROR,AUDIT,ERROR);\r
+            builder = builder.addTransition(ERROR,MIGRATE,MIGRATING);\r
+            builder = builder.addTransition(ERROR,EVACUATE,EVACUATING);\r
+            builder = builder.addTransition(ERROR,LOCK,ERROR);\r
+            builder = builder.addTransition(ERROR,UNLOCK,ERROR);\r
+            builder = builder.addTransition(ERROR,CHECKLOCK,ERROR);\r
+            builder = builder.addTransition(ERROR,CONFIG_BACKUP,ERROR);\r
+            builder = builder.addTransition(ERROR,CONFIG_BACKUP_DELETE,ERROR);\r
+            builder = builder.addTransition(ERROR,CONFIG_EXPORT,ERROR);\r
+            builder = builder.addTransition(ERROR,STOP_APPLICATION,STOPPING);\r
+\r
+            builder = builder.addTransition(UNKNOWN,CONFIGURE,CONFIGURING);\r
+            builder = builder.addTransition(UNKNOWN,TEST,TESTING);\r
+            builder = builder.addTransition(UNKNOWN,START,STARTING);\r
+            builder = builder.addTransition(UNKNOWN,TERMINATE,TERMINATING);\r
+            builder = builder.addTransition(UNKNOWN,RESTART,RESTARTING);\r
+            builder = builder.addTransition(UNKNOWN,REBUILD,REBUILDING);\r
+            builder = builder.addTransition(UNKNOWN,STOP,STOPPING);\r
+            builder = builder.addTransition(UNKNOWN,CONFIG_MODIFY,CONFIGURING);\r
+            builder = builder.addTransition(UNKNOWN,CONFIG_SCALEOUT,CONFIGURING);\r
+            builder = builder.addTransition(UNKNOWN,CONFIG_RESTORE,CONFIGURING);\r
+            builder = builder.addTransition(UNKNOWN,HEALTHCHECK,TESTING);\r
+            builder = builder.addTransition(UNKNOWN,BACKUP,BACKING_UP);\r
+            builder = builder.addTransition(UNKNOWN,SNAPSHOT,SNAPSHOTTING);\r
+            builder = builder.addTransition(UNKNOWN,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);\r
+            builder = builder.addTransition(UNKNOWN,LIVE_UPGRADE,UPGRADING);\r
+            builder = builder.addTransition(UNKNOWN,ROLLBACK,ROLLBACKING);\r
+            builder = builder.addTransition(UNKNOWN,SYNC,UNKNOWN);\r
+            builder = builder.addTransition(UNKNOWN,AUDIT,UNKNOWN);\r
+            builder = builder.addTransition(UNKNOWN,MIGRATE,MIGRATING);\r
+            builder = builder.addTransition(UNKNOWN,EVACUATE,EVACUATING);\r
+            builder = builder.addTransition(UNKNOWN,LOCK,UNKNOWN);\r
+            builder = builder.addTransition(UNKNOWN,UNLOCK,UNKNOWN);\r
+            builder = builder.addTransition(UNKNOWN,CHECKLOCK,UNKNOWN);\r
+            builder = builder.addTransition(UNKNOWN,CONFIG_BACKUP,UNKNOWN);\r
+            builder = builder.addTransition(UNKNOWN,CONFIG_BACKUP_DELETE,UNKNOWN);\r
+            builder = builder.addTransition(UNKNOWN,CONFIG_EXPORT,UNKNOWN);\r
+            builder = builder.addTransition(UNKNOWN,STOP_APPLICATION,STOPPING);\r
+\r
+            builder = builder.addTransition(STOPPED,CONFIGURE,CONFIGURING);\r
+            builder = builder.addTransition(STOPPED,TEST,TESTING);\r
+            builder = builder.addTransition(STOPPED,START,STARTING);\r
+            builder = builder.addTransition(STOPPED,TERMINATE,TERMINATING);\r
+            builder = builder.addTransition(STOPPED,RESTART,RESTARTING);\r
+            builder = builder.addTransition(STOPPED,REBUILD,REBUILDING);\r
+            builder = builder.addTransition(STOPPED,CONFIG_MODIFY,CONFIGURING);\r
+            builder = builder.addTransition(STOPPED,CONFIG_SCALEOUT,CONFIGURING);\r
+            builder = builder.addTransition(STOPPED,CONFIG_RESTORE,CONFIGURING);\r
+            builder = builder.addTransition(STOPPED,HEALTHCHECK,TESTING);\r
+            builder = builder.addTransition(STOPPED,BACKUP,BACKING_UP);\r
+            builder = builder.addTransition(STOPPED,SNAPSHOT,SNAPSHOTTING);\r
+            builder = builder.addTransition(STOPPED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);\r
+            builder = builder.addTransition(STOPPED,LIVE_UPGRADE,UPGRADING);\r
+            builder = builder.addTransition(STOPPED,ROLLBACK,ROLLBACKING);\r
+            builder = builder.addTransition(STOPPED,MIGRATE,MIGRATING);\r
+            builder = builder.addTransition(STOPPED,EVACUATE,EVACUATING);\r
+            builder = builder.addTransition(STOPPED,LOCK,STOPPED);\r
+            builder = builder.addTransition(STOPPED,UNLOCK,STOPPED);\r
+            builder = builder.addTransition(STOPPED,CHECKLOCK,STOPPED);\r
+\r
+            builder = builder.addTransition(CONFIGURING,SUCCESS,CONFIGURED);\r
+            builder = builder.addTransition(CONFIGURING,FAILURE,ERROR);\r
+\r
+            builder = builder.addTransition(TESTING,SUCCESS,TESTED);\r
+            builder = builder.addTransition(TESTING,FAILURE,ERROR);\r
+\r
+            builder = builder.addTransition(RESTARTING,SUCCESS,RUNNING);\r
+            builder = builder.addTransition(RESTARTING,FAILURE,ERROR);\r
+\r
+            builder = builder.addTransition(STARTING,SUCCESS,RUNNING);\r
+            builder = builder.addTransition(STARTING,FAILURE,ERROR);\r
+\r
+            builder = builder.addTransition(TERMINATING,SUCCESS,NOT_INSTANTIATED);\r
+            builder = builder.addTransition(TERMINATING,FAILURE,ERROR);\r
+\r
+            builder = builder.addTransition(REBUILDING,SUCCESS,RUNNING);\r
+            builder = builder.addTransition(REBUILDING,FAILURE,ERROR);\r
+\r
+            builder = builder.addTransition(STOPPING,SUCCESS,STOPPED);\r
+            builder = builder.addTransition(STOPPING,FAILURE,ERROR);\r
+\r
+            builder = builder.addTransition(BACKING_UP,SUCCESS,RUNNING);\r
+            builder = builder.addTransition(BACKING_UP,FAILURE,ERROR);\r
+\r
+            builder = builder.addTransition(SNAPSHOTTING,SUCCESS,RUNNING);\r
+            builder = builder.addTransition(SNAPSHOTTING,FAILURE,ERROR);\r
+\r
+            builder = builder.addTransition(SOFTWARE_UPLOADING,SUCCESS,RUNNING);\r
+            builder = builder.addTransition(SOFTWARE_UPLOADING,FAILURE,ERROR);\r
+\r
+            builder = builder.addTransition(UPGRADING,SUCCESS,RUNNING);\r
+            builder = builder.addTransition(UPGRADING,FAILURE,ERROR);\r
+\r
+            builder = builder.addTransition(ROLLBACKING,SUCCESS,RUNNING);\r
+            builder = builder.addTransition(ROLLBACKING,FAILURE,ERROR);\r
+\r
+            builder = builder.addTransition(MIGRATING,SUCCESS,RUNNING);\r
+            builder = builder.addTransition(MIGRATING,FAILURE,ERROR);\r
+\r
+            builder = builder.addTransition(EVACUATING,SUCCESS,RUNNING);\r
+            builder = builder.addTransition(EVACUATING,FAILURE,ERROR);\r
+\r
+\r
+            builder = builder.addTransition(CONFIGURED,START_APPLICATION,STARTING);\r
+            builder = builder.addTransition(TESTED,START_APPLICATION,STARTING);\r
+            builder = builder.addTransition(ERROR,START_APPLICATION,STARTING);\r
+            builder = builder.addTransition(UNKNOWN,START_APPLICATION,STARTING);\r
+            builder = builder.addTransition(RUNNING,START_APPLICATION,STARTING);\r
+\r
+            return builder.build();\r
+\r
+        }\r
+    }\r
+}\r
@@ -1,62 +1,65 @@
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * 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;
-       }
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.statemachine.objects;\r
+\r
+public class Event{\r
+\r
+    private String eventName;\r
+\r
+    private Event(){\r
+        // do nothing\r
+    }\r
+\r
+    @Override\r
+    public int hashCode(){\r
+        return this.eventName.hashCode();\r
+    }\r
+\r
+    @Override\r
+    public boolean equals(Object obj){\r
+        if(obj == null){\r
+            return false;\r
+        }\r
+        if(!(obj instanceof Event)){\r
+            return false;\r
+        }\r
+        Event event = (Event)obj;\r
+        return this.eventName.equals(event.getEventName());\r
+    }\r
+\r
+    public Event(String eventName){\r
+        this();\r
+        this.eventName = eventName;\r
+    }\r
+\r
+    private String getEventName() {\r
+        return eventName;\r
+    }\r
+\r
+    @Override\r
+    public String toString(){\r
+        return this.eventName;\r
+    }\r
+}\r
@@ -1,33 +1,32 @@
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * 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();
-    }
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.statemachine.objects;\r
+\r
+public enum Response {\r
+    NO_TRANSITION_DEFINED,NO_STATE_CHANGE,VALID_TRANSITION;\r
+    public String toString(){\r
+        return this.name();\r
+    }\r
+}\r
@@ -1,82 +1,77 @@
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * 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;
-       }
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.statemachine.objects;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+public class State{\r
+    private String stateName;\r
+    private List<Transition> transitions;\r
+\r
+    private State(){\r
+        // do nothing\r
+    }\r
+\r
+    public State(String state){\r
+        this();\r
+        this.stateName = state;\r
+        this.transitions = new ArrayList<>();\r
+    }\r
+\r
+    @Override\r
+    public int hashCode(){\r
+        return this.stateName.hashCode();\r
+    }\r
+\r
+    @Override\r
+    public boolean equals(Object obj){\r
+        if(obj == null){\r
+            return false;\r
+        }\r
+        if(!(obj instanceof State)){\r
+            return false;\r
+        }\r
+        State state = (State)obj;\r
+        return this.stateName.equalsIgnoreCase(state.getStateName());\r
+    }\r
+\r
+    public String getStateName(){\r
+        return stateName;\r
+    }\r
+\r
+    void addTransition(Transition transition){\r
+        this.transitions.add(transition);\r
+    }\r
+\r
+    public List<Transition> getTransitions() {\r
+        return transitions;\r
+    }\r
+\r
+    @Override\r
+    public String toString(){\r
+        return this.stateName;\r
+    }\r
+}\r
@@ -1,82 +1,78 @@
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * 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;
-               }
-       }
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.statemachine.objects;\r
+\r
+import java.util.HashSet;\r
+import java.util.Set;\r
+\r
+public class StateMachineMetadata {\r
+\r
+    private Set<State> states;\r
+    private Set<Event> events;\r
+\r
+    private StateMachineMetadata(StateMachineMetadataBuilder builder){\r
+        states = builder.states;\r
+        events = builder.events;\r
+    }\r
+\r
+    public Set<State> getStates() {\r
+        return states;\r
+    }\r
+\r
+    public Set<Event> getEvents() {\r
+        return events;\r
+    }\r
+\r
+    public static class StateMachineMetadataBuilder{\r
+\r
+        private Set<State> states;\r
+        private Set<Event> events;\r
+\r
+        public StateMachineMetadataBuilder(){\r
+            states = new HashSet<>();\r
+            events = new HashSet<>();\r
+        }\r
+\r
+        public StateMachineMetadataBuilder addState(State state){\r
+            this.states.add(state);\r
+            return this;\r
+        }\r
+\r
+        public StateMachineMetadataBuilder addEvent(Event event){\r
+            this.events.add(event);\r
+            return this;\r
+        }\r
+\r
+        public StateMachineMetadataBuilder addTransition(State currentState,Event event,State nextState){\r
+            Transition transition = new Transition(event,nextState);\r
+            currentState.addTransition(transition);\r
+            return this;\r
+        }\r
+\r
+        public StateMachineMetadata build(){\r
+            return new StateMachineMetadata(this);\r
+        }\r
+    }\r
+}\r
@@ -1,51 +1,51 @@
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * 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;
-    }
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.statemachine.objects;\r
+\r
+\r
+public class StateMachineResponse {\r
+    private State nextState;\r
+    private Response response;\r
+\r
+    public StateMachineResponse(){\r
+        // do nothing\r
+    }\r
+\r
+    public State getNextState() {\r
+        return nextState;\r
+    }\r
+\r
+    public Response getResponse() {\r
+        return response;\r
+    }\r
+\r
+    public void setNextState(State nextState) {\r
+        this.nextState = nextState;\r
+    }\r
+\r
+    public void setResponse(Response response) {\r
+        this.response = response;\r
+    }\r
+}\r
@@ -1,48 +1,48 @@
-/*-
+/*-\r
  * ============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
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * 
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
  * 
- * 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.
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  * 
  * 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;
-    }
-}
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.statemachine.objects;\r
+\r
+public class Transition {\r
+    private Event event;\r
+    private State nextState;\r
+\r
+    private Transition(){\r
+        // do nothing\r
+    }\r
+\r
+    Transition(Event event, State nextState){\r
+        this();\r
+        this.event = event;\r
+        this.nextState = nextState;\r
+    }\r
+\r
+    public Event getEvent() {\r
+        return event;\r
+    }\r
+\r
+    public State getNextState() {\r
+        return nextState;\r
+    }\r
+}\r
diff --git a/appc-lifecycle-management/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/impl/readers/AppcOamStatesTest.java b/appc-lifecycle-management/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/impl/readers/AppcOamStatesTest.java
new file mode 100644 (file)
index 0000000..af08234
--- /dev/null
@@ -0,0 +1,71 @@
+/*-\r
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * 
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * 
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.appc.statemachine.impl.readers;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.osgi.framework.Bundle;\r
+\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
+public class AppcOamStatesTest {\r
+\r
+    @Test\r
+    public void testBasicFunctions() {\r
+        AppcOamStates aState = AppcOamStates.EnteringMaintenanceMode;\r
+        Assert.assertEquals("name() does not match", "EnteringMaintenanceMode", aState.name());\r
+        Assert.assertEquals("toString() does not match", "EnteringMaintenanceMode", aState.toString());\r
+        Assert.assertEquals("osgiBundleState does not match", 0, aState.osgiBundleState);\r
+    }\r
+\r
+    @Test\r
+    public void testGetOamStateFromBundleState() {\r
+        Map<Integer, AppcOamStates> resultMap = new HashMap<Integer, AppcOamStates>() {\r
+            {\r
+                put(Bundle.UNINSTALLED,     AppcOamStates.NotInstantiated);\r
+                put(Bundle.INSTALLED,       AppcOamStates.Instantiated);\r
+                put(Bundle.RESOLVED,        AppcOamStates.Stopped);\r
+                put(Bundle.STARTING,        AppcOamStates.Starting);\r
+                put(Bundle.STOPPING,        AppcOamStates.Stopping);\r
+                put(Bundle.ACTIVE,          AppcOamStates.Started);\r
+            }\r
+        };\r
+        for (Map.Entry<Integer, AppcOamStates> aEntry : resultMap.entrySet()) {\r
+            Integer bundleState = aEntry.getKey();\r
+            AppcOamStates oamState = aEntry.getValue();\r
+            Assert.assertEquals(String.format("OSGI bundle state(%d) shoule associate with oamState(%s)",\r
+                    bundleState, oamState), oamState, AppcOamStates.getOamStateFromBundleState(bundleState));\r
+        }\r
+\r
+        int bundleState = Bundle.START_TRANSIENT;\r
+        Assert.assertEquals(String.format("OSGI bundle state(%d) shoule associate with NotInstantiated state.",\r
+                bundleState), AppcOamStates.NotInstantiated, AppcOamStates.getOamStateFromBundleState(bundleState));\r
+\r
+        bundleState = Bundle.STOP_TRANSIENT;\r
+        Assert.assertEquals(String.format("OSGI bundle state(%d) shoule associate with NotInstantiated state.",\r
+                bundleState), AppcOamStates.NotInstantiated, AppcOamStates.getOamStateFromBundleState(bundleState));\r
+    }\r
+}\r
diff --git a/pom.xml b/pom.xml
index 1695565..fa874f6 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -98,7 +98,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-javadoc-plugin</artifactId>
-                <version>2.10.4</version>
+                <version>2.10</version>
                 <configuration>
                     <excludePackageNames>org.openecomp.sdnc</excludePackageNames>
                     <failOnError>false</failOnError>
                 </configuration> <executions> <execution> <id>create-bdio-file</id> <phase>package</phase> 
                 <goals> <goal>build-bom</goal> </goals> </execution> </executions> </plugin> -->
 
-            <!-- force Eclipse to skip the additional-install step specified in the 
+            <!-- force Eclipse to skip the additional-install step specified in the
                 org.opendaylight.odlparent:odlparent-lite:1.7.1-Boron-SR1.pom profile -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <executions>
                     <execution>
                         <id>additional-install</id>
-                        <phase></phase>
                         <goals>
                             <goal>install-file</goal>
                         </goals>
-                        <configuration>
-                            <skip>true</skip>
-                        </configuration>
                     </execution>
                 </executions>
             </plugin>
                 <module>appc-provider</module>
                 <module>appc-event-listener</module>
                 <module>appc-asdc-listener</module>
+                <module>appc-lifecycle-management</module>
                 <module>appc-oam</module>
             </modules>
         </profile>