Fixing issues in apex documents 35/73935/5
authorramverma <ram.krishna.verma@ericsson.com>
Thu, 29 Nov 2018 13:47:30 +0000 (13:47 +0000)
committerramverma <ram.krishna.verma@ericsson.com>
Thu, 29 Nov 2018 14:46:03 +0000 (14:46 +0000)
Change-Id: Ibc07c20fa8ac1018443a3c061613fdaecc5efb83
Issue-ID: POLICY-1280
Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
25 files changed:
client/client-common/pom.xml
client/client-common/src/main/assembly/resources.xml [new file with mode: 0644]
client/client-deployment/pom.xml
client/client-deployment/src/main/assembly/resources.xml [new file with mode: 0644]
client/client-editor/pom.xml
client/client-editor/src/main/assembly/resources.xml [new file with mode: 0644]
client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/RestCommandHandler.java
client/client-full/pom.xml
client/client-monitoring/pom.xml
client/client-monitoring/src/main/assembly/resources.xml [new file with mode: 0644]
context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java
context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java
context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java
context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java
context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java
core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java
core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java
model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java
services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java
testsuites/apex-pdp-stability/pom.xml
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java
tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java
tools/tools-common/src/site-docs/adoc/fragments/example-cli-version.adoc
tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc

index 92174c8..da0aa39 100644 (file)
@@ -17,7 +17,8 @@
   SPDX-License-Identifier: Apache-2.0
   ============LICENSE_END=========================================================
 -->
-<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">
+<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.onap.policy.apex-pdp.client</groupId>
     </parent>
 
     <artifactId>client-common</artifactId>
-    <packaging>jar</packaging>
+    <packaging>pom</packaging>
     <name>${project.artifactId}</name>
 
+    <build>
+        <plugins>
+
+<!-- https://blog.sonatype.com/2008/04/how-to-share-resources-across-projects-in-maven/ -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>make shared resources</id>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <phase>package</phase>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/main/assembly/resources.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+
+
+    </build>
+
     <profiles>
         <profile>
             <id>apexSite</id>
diff --git a/client/client-common/src/main/assembly/resources.xml b/client/client-common/src/main/assembly/resources.xml
new file mode 100644 (file)
index 0000000..2a6d326
--- /dev/null
@@ -0,0 +1,32 @@
+<!--
+  ============LICENSE_START=======================================================
+   Copyright (C) 2018 Ericsson. All rights reserved.
+  ================================================================================
+  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.
+
+  SPDX-License-Identifier: Apache-2.0
+  ============LICENSE_END=========================================================
+-->
+<assembly>
+    <id>resources</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>src/main/resources</directory>
+            <outputDirectory></outputDirectory>
+        </fileSet>
+    </fileSets>
+</assembly>
\ No newline at end of file
index 02ecb4a..25972ea 100644 (file)
             <artifactId>core-deployment</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.client</groupId>
-            <artifactId>client-common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.glassfish.jersey.containers</groupId>
             <artifactId>jersey-container-grizzly2-http</artifactId>
             <groupId>commons-cli</groupId>
             <artifactId>commons-cli</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.onap.policy.apex-pdp.client</groupId>
+            <artifactId>client-common</artifactId>
+            <version>${project.version}</version>
+            <classifier>resources</classifier>
+            <type>zip</type>
+            <scope>provided</scope>
+        </dependency>
+
     </dependencies>
 
     <build>
         <defaultGoal>install</defaultGoal>
         <outputDirectory>${project.build.directory}/classes</outputDirectory>
         <plugins>
-             <!-- Copy common resources to this client's webapp directory -->
+
+<!-- https://blog.sonatype.com/2008/04/how-to-share-resources-across-projects-in-maven/ -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-dependency-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>unpack-examples</id>
-                        <phase>validate</phase>
+                        <id>unpack-shared-resources</id>
                         <goals>
-                            <goal>unpack</goal>
+                            <goal>unpack-dependencies</goal>
                         </goals>
+                        <phase>generate-resources</phase>
                         <configuration>
-                            <artifactItems>
-                                <artifactItem>
-                                    <groupId>org.onap.policy.apex-pdp.client</groupId>
-                                    <artifactId>client-common</artifactId>
-                                    <version>${project.version}</version>
-                                    <type>jar</type>
-                                    <overWrite>false</overWrite>
-                                    <outputDirectory>${project.build.directory}/classes/webapp</outputDirectory>
-                                    <excludes>META-INF/</excludes>
-                                </artifactItem>
-                            </artifactItems>
-                            <overWriteReleases>true</overWriteReleases>
-                            <overWriteSnapshots>true</overWriteSnapshots>
+                            <outputDirectory>${project.build.directory}/classes/webapp</outputDirectory>
+       <!--use as much as needed to be specific...also scope,type,classifier etc-->
+                            <includeArtifacIds>client-common</includeArtifacIds>
+                            <includeGroupIds>org.onap.policy.apex-pdp.client</includeGroupIds>
+                            <excludeTransitive>true</excludeTransitive>
+                            <excludeTransitive>true</excludeTransitive>
+                            <excludeTypes>jar</excludeTypes>
+                            <includeTypes>zip</includeTypes>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>make shared resources</id>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <phase>package</phase>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/main/assembly/resources.xml</descriptor>
+                            </descriptors>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
 
+
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-shade-plugin</artifactId>
     </build>
 
     <profiles>
-        <profile>
-            <id>only-eclipse</id>
-            <activation>
-                <property>
-                    <name>m2e.version</name>
-                </property>
-            </activation>
-            <build>
-                <pluginManagement>
-                    <plugins>
-                        <plugin>
-                            <groupId>org.eclipse.m2e</groupId>
-                            <artifactId>lifecycle-mapping</artifactId>
-                            <version>1.0.0</version>
-                            <configuration>
-                                <lifecycleMappingMetadata>
-                                    <pluginExecutions>
-                                        <pluginExecution>
-                                            <pluginExecutionFilter>
-                                                <groupId>org.apache.maven.plugins</groupId>
-                                                <artifactId>maven-dependency-plugin</artifactId>
-                                                <versionRange>[2.0,)</versionRange>
-                                                <goals>
-                                                    <goal>unpack</goal>
-                                                </goals>
-                                            </pluginExecutionFilter>
-                                            <action>
-                                                <ignore />
-                                            </action>
-                                        </pluginExecution>
-                                    </pluginExecutions>
-                                </lifecycleMappingMetadata>
-                            </configuration>
-                        </plugin>
-                    </plugins>
-                </pluginManagement>
-            </build>
-        </profile>
-
         <profile>
             <id>apexSite</id>
             <activation>
diff --git a/client/client-deployment/src/main/assembly/resources.xml b/client/client-deployment/src/main/assembly/resources.xml
new file mode 100644 (file)
index 0000000..f0632c5
--- /dev/null
@@ -0,0 +1,32 @@
+<!--
+  ============LICENSE_START=======================================================
+   Copyright (C) 2018 Ericsson. All rights reserved.
+  ================================================================================
+  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.
+
+  SPDX-License-Identifier: Apache-2.0
+  ============LICENSE_END=========================================================
+-->
+<assembly>
+    <id>resources</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>target/classes/webapp</directory>
+            <outputDirectory>deployment</outputDirectory>
+        </fileSet>
+    </fileSets>
+</assembly>
\ No newline at end of file
index 4bae101..a72f88c 100644 (file)
@@ -17,7 +17,8 @@
   SPDX-License-Identifier: Apache-2.0
   ============LICENSE_END=========================================================
 -->
-<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">
+<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.onap.policy.apex-pdp.client</groupId>
             <artifactId>core-infrastructure</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.client</groupId>
-            <artifactId>client-common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.glassfish.jersey.containers</groupId>
             <artifactId>jersey-container-grizzly2-http</artifactId>
             <version>${version.jersey}</version>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.onap.policy.apex-pdp.client</groupId>
+            <artifactId>client-common</artifactId>
+            <version>${project.version}</version>
+            <classifier>resources</classifier>
+            <type>zip</type>
+            <scope>provided</scope>
+        </dependency>
+
     </dependencies>
 
     <build>
         <defaultGoal>install</defaultGoal>
         <outputDirectory>${project.build.directory}/classes</outputDirectory>
         <plugins>
-             <!-- Copy common resources to this client's webapp directory -->
+
+<!-- https://blog.sonatype.com/2008/04/how-to-share-resources-across-projects-in-maven/ -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-dependency-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>unpack-examples</id>
-                        <phase>validate</phase>
+                        <id>unpack-shared-resources</id>
                         <goals>
-                            <goal>unpack</goal>
+                            <goal>unpack-dependencies</goal>
                         </goals>
+                        <phase>generate-resources</phase>
                         <configuration>
-                            <artifactItems>
-                                <artifactItem>
-                                    <groupId>org.onap.policy.apex-pdp.client</groupId>
-                                    <artifactId>client-common</artifactId>
-                                    <version>${project.version}</version>
-                                    <type>jar</type>
-                                    <overWrite>false</overWrite>
-                                    <outputDirectory>${project.build.directory}/classes/webapp</outputDirectory>
-                                    <excludes>META-INF/</excludes>
-                                    <excludes>webapp/css/styles.css, webapp/css/interfaceAssets.css</excludes>
-                                </artifactItem>
-                            </artifactItems>
-                            <overWriteReleases>true</overWriteReleases>
-                            <overWriteSnapshots>true</overWriteSnapshots>
+                            <outputDirectory>${project.build.directory}/classes/webapp</outputDirectory>
+       <!--use as much as needed to be specific...also scope,type,classifier etc-->
+                            <includeArtifacIds>client-common</includeArtifacIds>
+                            <includeGroupIds>org.onap.policy.apex-pdp.client</includeGroupIds>
+                            <excludeTransitive>true</excludeTransitive>
+                            <excludeTransitive>true</excludeTransitive>
+                            <excludeTypes>jar</excludeTypes>
+                            <includeTypes>zip</includeTypes>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>make shared resources</id>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <phase>package</phase>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/main/assembly/resources.xml</descriptor>
+                            </descriptors>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
 
+
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-shade-plugin</artifactId>
                         </filter>
                     </filters>
                     <transformers>
-                        <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
-                        <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+                        <transformer
+                            implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
+                        <transformer
+                            implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                             <resource>reference.conf</resource>
                         </transformer>
-                        <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
+                        <transformer
+                            implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
                             <resource>log4j.properties</resource>
                         </transformer>
-                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                        <transformer
+                            implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                             <mainClass>org.onap.policy.apex.client.editor.rest.ApexEditorMain</mainClass>
                         </transformer>
                     </transformers>
     </build>
 
     <profiles>
-        <profile>
-            <id>only-eclipse</id>
-            <activation>
-                <property>
-                    <name>m2e.version</name>
-                </property>
-            </activation>
-            <build>
-                <pluginManagement>
-                    <plugins>
-                        <plugin>
-                            <groupId>org.eclipse.m2e</groupId>
-                            <artifactId>lifecycle-mapping</artifactId>
-                            <version>1.0.0</version>
-                            <configuration>
-                                <lifecycleMappingMetadata>
-                                    <pluginExecutions>
-                                        <pluginExecution>
-                                            <pluginExecutionFilter>
-                                                <groupId>org.apache.maven.plugins</groupId>
-                                                <artifactId>maven-dependency-plugin</artifactId>
-                                                <versionRange>[2.0,)</versionRange>
-                                                <goals>
-                                                    <goal>unpack</goal>
-                                                </goals>
-                                            </pluginExecutionFilter>
-                                            <action>
-                                                <ignore />
-                                            </action>
-                                        </pluginExecution>
-                                    </pluginExecutions>
-                                </lifecycleMappingMetadata>
-                            </configuration>
-                        </plugin>
-                    </plugins>
-                </pluginManagement>
-            </build>
-        </profile>
-
         <profile>
             <id>apexSite</id>
             <activation>
diff --git a/client/client-editor/src/main/assembly/resources.xml b/client/client-editor/src/main/assembly/resources.xml
new file mode 100644 (file)
index 0000000..0205c3d
--- /dev/null
@@ -0,0 +1,32 @@
+<!--
+  ============LICENSE_START=======================================================
+   Copyright (C) 2018 Ericsson. All rights reserved.
+  ================================================================================
+  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.
+
+  SPDX-License-Identifier: Apache-2.0
+  ============LICENSE_END=========================================================
+-->
+<assembly>
+    <id>resources</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>target/classes/webapp</directory>
+            <outputDirectory>editor</outputDirectory>
+        </fileSet>
+    </fileSets>
+</assembly>
\ No newline at end of file
index 5921c89..968a985 100644 (file)
@@ -5,15 +5,15 @@
  * 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.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -38,7 +38,7 @@ public interface RestCommandHandler {
      * @return the apex api result the result of the execution
      */
     public ApexApiResult executeRestCommand(final RestSession session, final RestCommandType commandType,
-                    final RestCommand command);
+            final RestCommand command);
 
     /**
      * Process a REST command.
@@ -50,7 +50,7 @@ public interface RestCommandHandler {
      * @return the apex api result the result of the execution
      */
     public ApexApiResult executeRestCommand(final RestSession session, final RestCommandType commandType,
-                    final RestCommand command, final String jsonString);
+            final RestCommand command, final String jsonString);
 
     /**
      * Process a REST command.
@@ -63,7 +63,7 @@ public interface RestCommandHandler {
      * @return the apex api result the result of the execution
      */
     public ApexApiResult executeRestCommand(final RestSession session, final RestCommandType commandType,
-                    final RestCommand command, final String name, final String version);
+            final RestCommand command, final String name, final String version);
 
     /**
      * Get an unsupported command result message.
@@ -71,16 +71,17 @@ public interface RestCommandHandler {
      * @param session the Apex editor session
      * @param commandType the type of REST command to execute
      * @param command the REST command to execute
+     * @return the apex api result the result of the execution
      */
     public default ApexApiResult getUnsupportedCommandResultMessage(final RestSession session,
-                    final RestCommandType commandType, final RestCommand command) {
+            final RestCommandType commandType, final RestCommand command) {
         return new ApexApiResult(Result.FAILED, "session " + session.getSessionId() + ", command type " + commandType
-                        + ", command" + command + " invalid");
+                + ", command" + command + " invalid");
     }
-    
+
     /**
      * Convert blank incoming fields to nulls.
-     * 
+     *
      * @param incomingField the field to check
      * @return null if the field is blank, otherwise, the field trimmed
      */
@@ -88,13 +89,12 @@ public interface RestCommandHandler {
         if (incomingField == null) {
             return null;
         }
-        
-        String trimmedField = incomingField.trim();
-        
+
+        final String trimmedField = incomingField.trim();
+
         if (trimmedField.isEmpty()) {
             return null;
-        }
-        else {
+        } else {
             return trimmedField;
         }
     }
index ae987c5..591dcad 100644 (file)
             <artifactId>jersey-container-grizzly2-http</artifactId>
             <version>${version.jersey}</version>
         </dependency>
+
+
+        <dependency>
+            <groupId>org.onap.policy.apex-pdp.client</groupId>
+            <artifactId>client-monitoring</artifactId>
+            <version>${project.version}</version>
+            <classifier>resources</classifier>
+            <type>zip</type>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.policy.apex-pdp.client</groupId>
+            <artifactId>client-deployment</artifactId>
+            <version>${project.version}</version>
+            <classifier>resources</classifier>
+            <type>zip</type>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.policy.apex-pdp.client</groupId>
+            <artifactId>client-editor</artifactId>
+            <version>${project.version}</version>
+            <classifier>resources</classifier>
+            <type>zip</type>
+            <scope>provided</scope>
+        </dependency>
+
+
+
+
     </dependencies>
 
     <build>
+<!--
         <resources>
             <resource>
                 <directory>src/main/resources</directory>
                 </includes>
             </resource>
         </resources>
-
+-->
         <defaultGoal>install</defaultGoal>
         <outputDirectory>${project.build.directory}/classes</outputDirectory>
         <plugins>
-             <!-- Copy sub-clients this client's webapp directory -->
+
+<!-- https://blog.sonatype.com/2008/04/how-to-share-resources-across-projects-in-maven/ -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-dependency-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>unpack-examples</id>
-                        <phase>validate</phase>
+                        <id>unpack-MONITOR-resources</id>
                         <goals>
-                            <goal>unpack</goal>
+                            <goal>unpack-dependencies</goal>
                         </goals>
+                        <phase>generate-resources</phase>
                         <configuration>
-                            <artifactItems>
-                                <artifactItem>
-                                    <groupId>org.onap.policy.apex-pdp.client</groupId>
-                                    <artifactId>client-monitoring</artifactId>
-                                    <version>${project.version}</version>
-                                    <type>jar</type>
-                                    <overWrite>false</overWrite>
-                                    <outputDirectory>${project.build.directory}/classes/webapp/monitoring-temp</outputDirectory>
-                                    <excludes>META-INF/, org/</excludes>
-                                </artifactItem>
-                                <artifactItem>
-                                    <groupId>org.onap.policy.apex-pdp.client</groupId>
-                                    <artifactId>client-deployment</artifactId>
-                                    <version>${project.version}</version>
-                                    <type>jar</type>
-                                    <overWrite>false</overWrite>
-                                    <outputDirectory>${project.build.directory}/classes/webapp/deployment-temp</outputDirectory>
-                                    <excludes>META-INF/, org/</excludes>
-                                </artifactItem>
-                                <artifactItem>
-                                    <groupId>org.onap.policy.apex-pdp.client</groupId>
-                                    <artifactId>client-editor</artifactId>
-                                    <version>${project.version}</version>
-                                    <type>jar</type>
-                                    <overWrite>false</overWrite>
-                                    <outputDirectory>${project.build.directory}/classes/webapp/editor-temp</outputDirectory>
-                                    <excludes>META-INF/, org/</excludes>
-                                </artifactItem>
-                            </artifactItems>
-                            <overWriteReleases>true</overWriteReleases>
-                            <overWriteSnapshots>true</overWriteSnapshots>
+                            <outputDirectory>${project.build.directory}/classes/webapp</outputDirectory>
+       <!--use as much as needed to be specific...also scope,type,classifier etc-->
+                            <includeGroupIds>org.onap.policy.apex-pdp.client</includeGroupIds>
+                            <includeArtifacIds>client-monitoring, client-deployment, client-editor</includeArtifacIds>
+                            <excludeTransitive>true</excludeTransitive>
+                            <excludeTypes>jar</excludeTypes>
+                            <includeTypes>zip</includeTypes>
+                            <scope>provided</scope>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
 
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-antrun-plugin</artifactId>
-                <version>1.8</version>
-                <executions>
-                    <execution>
-                        <phase>initialize</phase>
-                        <configuration>
-                            <target>
-                                <copy todir="${project.build.directory}/classes/webapp/deployment">
-                                    <fileset dir="${project.build.directory}/classes/webapp/deployment-temp/webapp"
-                                        includes="**" />
-                                </copy>
-                                <copy todir="${project.build.directory}/classes/webapp/monitoring">
-                                    <fileset dir="${project.build.directory}/classes/webapp/monitoring-temp/webapp"
-                                        includes="**" />
-                                </copy>
-                                <copy todir="${project.build.directory}/classes/webapp/editor">
-                                    <fileset dir="${project.build.directory}/classes/webapp/editor-temp/webapp"
-                                        includes="**" />
-                                </copy>
-                                <delete dir="${project.build.directory}/classes/webapp/deployment-temp"/>
-                                <delete dir="${project.build.directory}/classes/webapp/monitoring-temp"/>
-                                <delete dir="${project.build.directory}/classes/webapp/editor-temp"/>
-                            </target>
-                        </configuration>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-shade-plugin</artifactId>
                                                 <artifactId>maven-dependency-plugin</artifactId>
                                                 <versionRange>[2.0,)</versionRange>
                                                 <goals>
-                                                    <goal>unpack</goal>
-                                                </goals>
-                                            </pluginExecutionFilter>
-                                            <action>
-                                                <ignore />
-                                            </action>
-                                        </pluginExecution>
-                                        <pluginExecution>
-                                            <pluginExecutionFilter>
-                                                <groupId>org.apache.maven.plugins</groupId>
-                                                <artifactId>maven-antrun-plugin</artifactId>
-                                                <versionRange>[1.0,)</versionRange>
-                                                <goals>
-                                                    <goal>run</goal>
+                                                    <goal>unpack-dependencies</goal>
                                                 </goals>
                                             </pluginExecutionFilter>
                                             <action>
index 17f2cc1..6d0c34e 100644 (file)
@@ -17,7 +17,8 @@
   SPDX-License-Identifier: Apache-2.0
   ============LICENSE_END=========================================================
 -->
-<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">
+<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.onap.policy.apex-pdp.client</groupId>
             <artifactId>core-deployment</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.client</groupId>
-            <artifactId>client-common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.glassfish.jersey.containers</groupId>
             <artifactId>jersey-container-grizzly2-http</artifactId>
             <artifactId>mockito-all</artifactId>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.onap.policy.apex-pdp.client</groupId>
+            <artifactId>client-common</artifactId>
+            <version>${project.version}</version>
+            <classifier>resources</classifier>
+            <type>zip</type>
+            <scope>provided</scope>
+        </dependency>
+
     </dependencies>
 
     <build>
         <defaultGoal>install</defaultGoal>
         <outputDirectory>${project.build.directory}/classes</outputDirectory>
         <plugins>
-             <!-- Copy common resources to this client's webapp directory -->
+
+<!-- https://blog.sonatype.com/2008/04/how-to-share-resources-across-projects-in-maven/ -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-dependency-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>unpack-examples</id>
-                        <phase>validate</phase>
+                        <id>unpack-shared-resources</id>
                         <goals>
-                            <goal>unpack</goal>
+                            <goal>unpack-dependencies</goal>
                         </goals>
+                        <phase>generate-resources</phase>
                         <configuration>
-                            <artifactItems>
-                                <artifactItem>
-                                    <groupId>org.onap.policy.apex-pdp.client</groupId>
-                                    <artifactId>client-common</artifactId>
-                                    <version>${project.version}</version>
-                                    <type>jar</type>
-                                    <overWrite>false</overWrite>
-                                    <outputDirectory>${project.build.directory}/classes/webapp</outputDirectory>
-                                    <excludes>META-INF/</excludes>
-                                </artifactItem>
-                            </artifactItems>
-                            <overWriteReleases>true</overWriteReleases>
-                            <overWriteSnapshots>true</overWriteSnapshots>
+                            <outputDirectory>${project.build.directory}/classes/webapp</outputDirectory>
+       <!--use as much as needed to be specific...also scope,type,classifier etc-->
+                            <includeArtifacIds>client-common</includeArtifacIds>
+                            <includeGroupIds>org.onap.policy.apex-pdp.client</includeGroupIds>
+                            <excludeTransitive>true</excludeTransitive>
+                            <excludeTypes>jar</excludeTypes>
+                            <includeTypes>zip</includeTypes>
+                            <excludeTransitive>true</excludeTransitive>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>make shared resources</id>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <phase>package</phase>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/main/assembly/resources.xml</descriptor>
+                            </descriptors>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
 
+
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-shade-plugin</artifactId>
                         </filter>
                     </filters>
                     <transformers>
-                        <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
-                        <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+                        <transformer
+                            implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
+                        <transformer
+                            implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                             <resource>reference.conf</resource>
                         </transformer>
-                        <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
+                        <transformer
+                            implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
                             <resource>log4j.properties</resource>
                         </transformer>
-                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                        <transformer
+                            implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                             <mainClass>org.onap.policy.apex.client.monitoring.rest.ApexMonitoringRestMain</mainClass>
                         </transformer>
                     </transformers>
     </build>
 
     <profiles>
-        <profile>
-            <id>only-eclipse</id>
-            <activation>
-                <property>
-                    <name>m2e.version</name>
-                </property>
-            </activation>
-            <build>
-                <pluginManagement>
-                    <plugins>
-                        <plugin>
-                            <groupId>org.eclipse.m2e</groupId>
-                            <artifactId>lifecycle-mapping</artifactId>
-                            <version>1.0.0</version>
-                            <configuration>
-                                <lifecycleMappingMetadata>
-                                    <pluginExecutions>
-                                        <pluginExecution>
-                                            <pluginExecutionFilter>
-                                                <groupId>org.apache.maven.plugins</groupId>
-                                                <artifactId>maven-dependency-plugin</artifactId>
-                                                <versionRange>[2.0,)</versionRange>
-                                                <goals>
-                                                    <goal>unpack</goal>
-                                                </goals>
-                                            </pluginExecutionFilter>
-                                            <action>
-                                                <ignore />
-                                            </action>
-                                        </pluginExecution>
-                                    </pluginExecutions>
-                                </lifecycleMappingMetadata>
-                            </configuration>
-                        </plugin>
-                    </plugins>
-                </pluginManagement>
-            </build>
-        </profile>
-
         <profile>
             <id>apexSite</id>
             <activation>
diff --git a/client/client-monitoring/src/main/assembly/resources.xml b/client/client-monitoring/src/main/assembly/resources.xml
new file mode 100644 (file)
index 0000000..bed1588
--- /dev/null
@@ -0,0 +1,32 @@
+<!--
+  ============LICENSE_START=======================================================
+   Copyright (C) 2018 Ericsson. All rights reserved.
+  ================================================================================
+  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.
+
+  SPDX-License-Identifier: Apache-2.0
+  ============LICENSE_END=========================================================
+-->
+<assembly>
+    <id>resources</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>target/classes/webapp</directory>
+            <outputDirectory>monitoring</outputDirectory>
+        </fileSet>
+    </fileSets>
+</assembly>
\ No newline at end of file
index 50f9689..d3f4d47 100644 (file)
@@ -25,8 +25,6 @@ import static org.junit.Assert.assertNotNull;
 import static org.onap.policy.apex.context.test.utils.Constants.APEX_DISTRIBUTOR;
 import static org.onap.policy.apex.context.test.utils.Constants.VERSION;
 
-import java.io.IOException;
-
 import org.onap.policy.apex.context.ContextAlbum;
 import org.onap.policy.apex.context.Distributor;
 import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
@@ -51,7 +49,6 @@ public class ContextAlbumUpdate {
      * Test context album update.
      *
      * @throws ApexModelException the apex model exception
-     * @throws IOException the IO exception
      * @throws ApexException the apex exception
      */
     public void testContextAlbumUpdate() throws ApexException {
index 65f50d7..b897b83 100644 (file)
@@ -34,7 +34,6 @@ import static org.onap.policy.apex.context.test.utils.Constants.TIME_ZONE;
 import static org.onap.policy.apex.context.test.utils.Constants.VERSION;
 import static org.onap.policy.apex.context.test.utils.Constants.getAxArtifactKeyArray;
 
-import java.io.IOException;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Locale;
@@ -74,7 +73,6 @@ public class ContextUpdate {
      * Test context update.
      *
      * @throws ApexModelException the apex model exception
-     * @throws IOException the IO exception
      * @throws ApexException the apex exception
      */
     public void testContextUpdate() throws ApexException {
@@ -109,7 +107,7 @@ public class ContextUpdate {
         } catch (final ContextRuntimeException e) {
             assertEquals(
                     "Failed to set context value for key \"0\" in album \"LongContextAlbum:0.0.1\": LongContextAlbum"
-                    + ":0.0.1: object \"\" of class \"java.lang.String\" not compatible with class \"java.lang.Long\"",
+                            + ":0.0.1: object \"\" of class \"java.lang.String\" not compatible with class \"java.lang.Long\"",
                     e.getMessage());
             LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
         }
index ee0a107..a673824 100644 (file)
@@ -61,13 +61,12 @@ public class ConcurrentContext {
 
     /**
      * The method tests concurrent use of context.
+     * 
      * @return the verified context
      * @throws ApexModelException the exception occurs in model handling
-     * @throws IOException the IO exception occurs in handling IO
      * @throws ApexException the Apex exception occurs in handling Apex
      */
-    public Map<String, TestContextLongItem> testConcurrentContext()
-            throws ApexException {
+    public Map<String, TestContextLongItem> testConcurrentContext() throws ApexException {
 
         try {
             setupAndVerifyContext();
@@ -154,7 +153,7 @@ public class ConcurrentContext {
         final Map<String, TestContextLongItem> values = new HashMap<>();
         try {
 
-            for (Entry<String, Object> entry : ltypeAlbum.entrySet()) {
+            for (final Entry<String, Object> entry : ltypeAlbum.entrySet()) {
                 values.put(entry.getKey(), (TestContextLongItem) entry.getValue());
             }
         } catch (final Exception exception) {
index cd2c2ed..c7043bc 100644 (file)
@@ -76,6 +76,7 @@ public final class ConcurrentContextJvm {
 
     /**
      * This method executes the test of concurrent use of context in a single JVM.
+     * 
      * @throws ApexException the Apex exception occurs while running the test
      */
     public void execute() throws ApexException {
@@ -145,14 +146,12 @@ public final class ConcurrentContextJvm {
         for (int p = 7; p < args.length - 1; p += 2) {
             @SuppressWarnings("rawtypes")
             final Class parametersClass = Class.forName(args[p]);
-            final ParameterGroup parameters =
-                    (ParameterGroup) new Gson().fromJson(args[p + 1], parametersClass);
+            final ParameterGroup parameters = (ParameterGroup) new Gson().fromJson(args[p + 1], parametersClass);
             ParameterService.register(parameters);
         }
 
         for (final Entry<String, ParameterGroup> parameterEntry : ParameterService.getAll()) {
-            LOGGER.info("Parameter class " + parameterEntry.getKey() + "="
-                    + parameterEntry.getValue().toString());
+            LOGGER.info("Parameter class " + parameterEntry.getKey() + "=" + parameterEntry.getValue().toString());
         }
 
         try {
@@ -192,7 +191,7 @@ public final class ConcurrentContextJvm {
     /**
      * This method sets up any static configuration required by the JVM.
      *
-     * @throws Exception on configuration errors
+     * @throws ApexException on configuration errors
      */
     public static void configure() throws ApexException {
         System.setProperty("java.net.preferIPv4Stack", "true");
@@ -208,10 +207,10 @@ public final class ConcurrentContextJvm {
         Enumeration<NetworkInterface> nets;
         try {
             nets = NetworkInterface.getNetworkInterfaces();
-        } catch (SocketException e) {
+        } catch (final SocketException e) {
             throw new ApexException("cound not get network interfaces for test", e);
         }
-        
+
         for (final NetworkInterface netint : Collections.list(nets)) {
             final Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
             for (final InetAddress inetAddress : Collections.list(inetAddresses)) {
index 1949769..ac9ae68 100644 (file)
@@ -5,15 +5,15 @@
  * 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.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -65,8 +65,8 @@ public class ZooKeeperServerServiceProvider {
 
     /**
      * Start the Zookeeper server.
-     * @throws IOException the IO exception occurs while setting up Zookeeper server
-     * @throws InterruptedException the interrupted exception occurs while setting up Zookeeper server
+     *
+     * @throws ApexException on configuration errors
      */
     public void startZookeeperServer() throws ApexException {
         LOGGER.info("Starting up ZooKeeperServer using address: {} and port: {}", addr.getAddress(), addr.getPort());
@@ -76,23 +76,21 @@ public class ZooKeeperServerServiceProvider {
             server = new ZooKeeperServer(zookeeperDirectory, zookeeperDirectory, 5000);
             zookeeperFactory = new NIOServerCnxnFactory();
             zookeeperFactory.configure(addr, 100);
-        }
-        catch (IOException ioe) {
-            String message = "exception on starting Zookeeper server";
+        } catch (final IOException ioe) {
+            final String message = "exception on starting Zookeeper server";
             LOGGER.warn(message, ioe);
             throw new ApexException(message, ioe);
         }
-        
+
         try {
             zookeeperFactory.startup(server);
-        }
-        catch (InterruptedException | IOException ie) {
-            String message = "Zookeeper server start failed";
+        } catch (InterruptedException | IOException ie) {
+            final String message = "Zookeeper server start failed";
             LOGGER.warn(message, ie);
             Thread.currentThread().interrupt();
             throw new ApexException(message, ie);
         }
-        
+
     }
 
     /**
index 95f74b7..df845f5 100644 (file)
@@ -20,7 +20,6 @@
 
 package org.onap.policy.apex.core.deployment;
 
-import java.io.IOException;
 import java.io.PrintStream;
 import java.util.Arrays;
 
@@ -33,8 +32,9 @@ import org.slf4j.ext.XLoggerFactory;
  * The Class {@link BatchDeployer} deploys an Apex model held as an XML or Json file onto an Apex engine. It uses the
  * EngDep protocol to communicate with the engine, with the EngDep protocol being carried on Java web sockets.
  *
- * <p>This deployer is a simple command line deployer that reads the communication parameters and the location of the
- * Apex model file as arguments.
+ * <p>
+ * This deployer is a simple command line deployer that reads the communication parameters and the location of the Apex
+ * model file as arguments.
  *
  * @author Liam Fallon (liam.fallon@ericsson.com)
  */
@@ -73,7 +73,7 @@ public class BatchDeployer {
         try {
             engineServiceFacade.init();
         } catch (final ApexException e) {
-            String errorMessage = "model deployment failed on parameters " + hostName + " " + port;
+            final String errorMessage = "model deployment failed on parameters " + hostName + " " + port;
             LOGGER.error(errorMessage, e);
             throw new ApexDeploymentException(errorMessage);
         }
@@ -95,10 +95,9 @@ public class BatchDeployer {
      * @param ignoreConflicts true if conflicts between context in polices is to be ignored
      * @param force true if the model is to be applied even if it is incompatible with the existing model
      * @throws ApexException on Apex errors
-     * @throws IOException on IO exceptions from the operating system
      */
     public void deployModel(final String modelFileName, final boolean ignoreConflicts, final boolean force)
-                    throws ApexException {
+            throws ApexException {
         engineServiceFacade.deployModel(modelFileName, ignoreConflicts, force);
     }
 
@@ -109,16 +108,15 @@ public class BatchDeployer {
      * @param ignoreConflicts true if conflicts between context in polices is to be ignored
      * @param force true if the model is to be applied even if it is incompatible with the existing model
      * @throws ApexException on Apex errors
-     * @throws IOException on IO exceptions from the operating system
      */
     public void deployModel(final AxPolicyModel policyModel, final boolean ignoreConflicts, final boolean force)
-                    throws ApexException {
+            throws ApexException {
         engineServiceFacade.deployModel(policyModel, ignoreConflicts, force);
     }
 
     /**
      * Get the engine service facade of the event manager. This method is used for testing only.
-     * 
+     *
      * @return the engine service facade
      */
     protected EngineServiceFacade getEngineServiceFacade() {
@@ -134,8 +132,8 @@ public class BatchDeployer {
      */
     public static void main(final String[] args) throws ApexException {
         if (args.length != NUM_ARGUMENTS) {
-            String message = "invalid arguments: " + Arrays.toString(args)
-                            + "\nusage: BatchDeployer <server address> <port address> <model file path";
+            final String message = "invalid arguments: " + Arrays.toString(args)
+                    + "\nusage: BatchDeployer <server address> <port address> <model file path";
             LOGGER.error(message);
             throw new ApexDeploymentException(message);
         }
@@ -143,11 +141,11 @@ public class BatchDeployer {
         int port;
         try {
             port = Integer.parseInt(args[1]);
-        } catch (NumberFormatException nfe) {
+        } catch (final NumberFormatException nfe) {
             throw new ApexDeploymentException("argument port is invalid", nfe);
         }
-        
-        BatchDeployer deployer = new BatchDeployer(args[0], port, System.out);
+
+        final BatchDeployer deployer = new BatchDeployer(args[0], port, System.out);
         deployer.init();
         deployer.deployModel(args[2], false, false);
         deployer.close();
index caf943d..f984853 100644 (file)
@@ -22,7 +22,6 @@ package org.onap.policy.apex.core.deployment;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 import java.util.concurrent.TimeUnit;
@@ -53,8 +52,8 @@ import org.slf4j.ext.XLoggerFactory;
  * The Class Deployer deploys an Apex model held as an XML file onto an Apex engine. It uses the EngDep protocol to
  * communicate with the engine, with the EngDep protocol being carried on Java web sockets.
  *
- * <p>his deployer is a simple command line deployer that reads the communication parameters and the location of the XML
- * model file as arguments.
+ * <p>This deployer is a simple command line deployer that reads the communication parameters and the location of
+ * the XML model file as arguments.
  *
  * @author Liam Fallon (liam.fallon@ericsson.com)
  */
@@ -128,12 +127,12 @@ public class EngineServiceFacade {
             // Get engine service information to see what engines we're dealing with
             final GetEngineServiceInfo engineServiceInfo = new GetEngineServiceInfo(null);
             LOGGER.debug("sending get engine service info message {} to server {}:{} . . .", engineServiceInfo,
-                            hostName, port);
+                    hostName, port);
             client.sendMessage(engineServiceInfo);
             LOGGER.debug("sent get engine service info message to server {}:{} . . .", hostName, port);
 
-            final EngineServiceInfoResponse engineServiceInfoResponse = (EngineServiceInfoResponse) getResponse(
-                            engineServiceInfo);
+            final EngineServiceInfoResponse engineServiceInfoResponse =
+                    (EngineServiceInfoResponse) getResponse(engineServiceInfo);
             if (engineServiceInfoResponse.isSuccessful()) {
                 engineServiceKey = engineServiceInfoResponse.getEngineServiceKey();
                 engineKeyArray = engineServiceInfoResponse.getEngineKeyArray();
@@ -192,10 +191,9 @@ public class EngineServiceFacade {
      * @param ignoreConflicts true if conflicts between context in polices is to be ignored
      * @param force true if the model is to be applied even if it is incompatible with the existing model
      * @throws ApexException on Apex errors
-     * @throws IOException on IO exceptions from the operating system
      */
     public void deployModel(final String modelFileName, final boolean ignoreConflicts, final boolean force)
-                    throws ApexException {
+            throws ApexException {
         if (engineServiceKey == null || engineKeyArray == null || engineKeyArray.length == 0) {
             LOGGER.error("cound not deploy apex model, deployer is not initialized");
             throw new ApexDeploymentException("cound not deploy apex model, deployer is not initialized");
@@ -208,14 +206,14 @@ public class EngineServiceFacade {
             if (apexModelUrl == null) {
                 LOGGER.error("cound not create apex model, could not read from file {}", modelFileName);
                 throw new ApexDeploymentException(
-                                "cound not create apex model, could not read from file " + modelFileName);
+                        "cound not create apex model, could not read from file " + modelFileName);
             }
         }
 
         try {
             deployModel(modelFileName, apexModelUrl.openStream(), ignoreConflicts, force);
-        } catch (Exception deployException) {
-            String errorMessage = "could not deploy apex model from " + modelFileName;
+        } catch (final Exception deployException) {
+            final String errorMessage = "could not deploy apex model from " + modelFileName;
             LOGGER.error(errorMessage, deployException);
             throw new ApexDeploymentException(errorMessage, deployException);
         }
@@ -231,7 +229,7 @@ public class EngineServiceFacade {
      * @throws ApexException on model deployment errors
      */
     public void deployModel(final String modelFileName, final InputStream modelInputStream,
-                    final boolean ignoreConflicts, final boolean force) throws ApexException {
+            final boolean ignoreConflicts, final boolean force) throws ApexException {
         // Read the policy model from the stream
         final ApexModelReader<AxPolicyModel> modelReader = new ApexModelReader<>(AxPolicyModel.class);
         modelReader.setValidateFlag(!ignoreConflicts);
@@ -250,15 +248,15 @@ public class EngineServiceFacade {
      * @throws ApexException on model deployment errors
      */
     public void deployModel(final AxPolicyModel apexPolicyModel, final boolean ignoreConflicts, final boolean force)
-                    throws ApexException {
+            throws ApexException {
         // Write the model into a byte array
         final ByteArrayOutputStream baOutputStream = new ByteArrayOutputStream();
         final ApexModelWriter<AxPolicyModel> modelWriter = new ApexModelWriter<>(AxPolicyModel.class);
         modelWriter.write(apexPolicyModel, baOutputStream);
 
         // Create and send Update message
-        final UpdateModel umMessage = new UpdateModel(engineServiceKey, baOutputStream.toString(), ignoreConflicts,
-                        force);
+        final UpdateModel umMessage =
+                new UpdateModel(engineServiceKey, baOutputStream.toString(), ignoreConflicts, force);
 
         LOGGER.debug("sending update message {} to server {}:{} . . .", umMessage, hostName, port);
         client.sendMessage(umMessage);
@@ -268,8 +266,8 @@ public class EngineServiceFacade {
         final Response response = getResponse(umMessage);
         if (!response.isSuccessful()) {
             LOGGER.warn(FAILED_RESPONSE + "{} received from server {}:{}", response.getMessageData(), hostName, port);
-            throw new ApexException(FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER + hostName
-                            + ':' + port);
+            throw new ApexException(
+                    FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER + hostName + ':' + port);
         }
     }
 
@@ -288,8 +286,8 @@ public class EngineServiceFacade {
         // Check if we got a response
         final Response response = getResponse(startEngineMessage);
         if (!response.isSuccessful()) {
-            String message = FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER
-                            + hostName + ':' + port;
+            final String message =
+                    FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER + hostName + ':' + port;
             LOGGER.warn(message);
             throw new ApexDeploymentException(message);
         }
@@ -310,8 +308,8 @@ public class EngineServiceFacade {
         // Check if we got a response
         final Response response = getResponse(stopEngineMessage);
         if (!response.isSuccessful()) {
-            String message = FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER
-                            + hostName + ':' + port;
+            final String message =
+                    FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER + hostName + ':' + port;
             LOGGER.warn(message);
             throw new ApexDeploymentException(message);
         }
@@ -328,15 +326,15 @@ public class EngineServiceFacade {
         final StartPeriodicEvents startPerioidicEventsMessage = new StartPeriodicEvents(engineKey);
         startPerioidicEventsMessage.setMessageData(Long.toString(period));
         LOGGER.debug("sending start perioidic events {} to server {}:{} . . .", startPerioidicEventsMessage, hostName,
-                        port);
+                port);
         client.sendMessage(startPerioidicEventsMessage);
         LOGGER.debug("sent start perioidic events message to server {}:{} . . .", hostName, port);
 
         // Check if we got a response
         final Response response = getResponse(startPerioidicEventsMessage);
         if (!response.isSuccessful()) {
-            String message = FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER
-                            + hostName + ':' + port;
+            final String message =
+                    FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER + hostName + ':' + port;
             LOGGER.warn(message);
             throw new ApexDeploymentException(message);
         }
@@ -351,15 +349,15 @@ public class EngineServiceFacade {
     public void stopPerioidicEvents(final AxArtifactKey engineKey) throws ApexDeploymentException {
         final StopPeriodicEvents stopPerioidicEventsMessage = new StopPeriodicEvents(engineKey);
         LOGGER.debug("sending stop perioidic events {} to server {}:{} . . .", stopPerioidicEventsMessage, hostName,
-                        port);
+                port);
         client.sendMessage(stopPerioidicEventsMessage);
         LOGGER.debug("sent stop perioidic events message to server {}:{} . . .", hostName, port);
 
         // Check if we got a response
         final Response response = getResponse(stopPerioidicEventsMessage);
         if (!response.isSuccessful()) {
-            String message = FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER
-                            + hostName + ':' + port;
+            final String message =
+                    FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER + hostName + ':' + port;
             LOGGER.warn(message);
             throw new ApexDeploymentException(message);
         }
@@ -381,8 +379,8 @@ public class EngineServiceFacade {
         // Check if we got a response
         final Response response = getResponse(engineStatusMessage);
         if (!response.isSuccessful()) {
-            String message = FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER + hostName
-                            + ':' + port;
+            final String message =
+                    FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER + hostName + ':' + port;
             LOGGER.warn(message);
             throw new ApexException(message);
         }
@@ -403,15 +401,15 @@ public class EngineServiceFacade {
     public String getEngineInfo(final AxArtifactKey engineKey) throws ApexException {
         final GetEngineInfo engineInfoMessage = new GetEngineInfo(engineKey);
         LOGGER.debug("sending get engine information message {} to server {}:{} . . .", engineInfoMessage, hostName,
-                        port);
+                port);
         client.sendMessage(engineInfoMessage);
         LOGGER.debug("sent get engine information message to server {}:{} . . .", hostName, port);
 
         // Check if we got a response
         final Response response = getResponse(engineInfoMessage);
         if (!response.isSuccessful()) {
-            String message = FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER + hostName
-                            + ':' + port;
+            final String message =
+                    FAILED_RESPONSE + response.getMessageData() + RECEIVED_FROM_SERVER + hostName + ':' + port;
             LOGGER.warn(message);
             throw new ApexException(message);
         }
@@ -435,8 +433,8 @@ public class EngineServiceFacade {
 
         // Wait for the required amount of milliseconds for the response from the Apex server
         Message receivedMessage = null;
-        for (int timeWaitedSoFar = 0; receivedMessage == null
-                        && timeWaitedSoFar < timeoutTime; timeWaitedSoFar += REPLY_MESSAGE_TIMEOUT_INCREMENT) {
+        for (int timeWaitedSoFar = 0; receivedMessage == null && timeWaitedSoFar < timeoutTime; timeWaitedSoFar +=
+                REPLY_MESSAGE_TIMEOUT_INCREMENT) {
             try {
                 receivedMessage = client.getReceiveQueue().poll(REPLY_MESSAGE_TIMEOUT_INCREMENT, TimeUnit.MILLISECONDS);
             } catch (final InterruptedException e) {
@@ -444,7 +442,7 @@ public class EngineServiceFacade {
                 Thread.currentThread().interrupt();
                 LOGGER.warn("reception of response from server interrupted {}:{}", hostName, port, e);
                 throw new ApexDeploymentException(
-                                "reception of response from server interrupted " + hostName + ':' + port, e);
+                        "reception of response from server interrupted " + hostName + ':' + port, e);
             }
         }
 
@@ -457,9 +455,9 @@ public class EngineServiceFacade {
         // Check instance is a response message
         if (!(receivedMessage instanceof Response)) {
             LOGGER.warn("response received from server is of incorrect type {}, should be of type {}",
-                            receivedMessage.getClass().getName(), Response.class.getName());
+                    receivedMessage.getClass().getName(), Response.class.getName());
             throw new ApexDeploymentException("response received from server is of incorrect type "
-                            + receivedMessage.getClass().getName() + ", should be of type " + Response.class.getName());
+                    + receivedMessage.getClass().getName() + ", should be of type " + Response.class.getName());
         }
 
         // Cast the response message
@@ -469,23 +467,24 @@ public class EngineServiceFacade {
         if (!responseMessage.getResponseTo().equals(sentMessage)) {
             LOGGER.warn("response received is not response to sent message " + sentMessage.getAction());
             throw new ApexDeploymentException(
-                            "response received is not correct response to sent message " + sentMessage.getAction());
+                    "response received is not correct response to sent message " + sentMessage.getAction());
         }
 
         // Check if successful
         if (responseMessage.isSuccessful()) {
             LOGGER.debug("response received: {} message was succssful: {}", sentMessage.getAction(),
-                            responseMessage.getMessageData());
+                    responseMessage.getMessageData());
         } else {
             LOGGER.debug("response received: {} message failed: {}", sentMessage.getAction(),
-                            responseMessage.getMessageData());
+                    responseMessage.getMessageData());
         }
 
         return responseMessage;
     }
-    
+
     /**
      * Set a deployment client for this facade. This method is for testing.
+     * 
      * @param deploymentClient the deployment client to set
      */
     protected void setDeploymentClient(final DeploymentClient deploymentClient) {
index ddd46c8..2b1dc55 100644 (file)
@@ -5,15 +5,15 @@
  * 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.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -34,16 +34,15 @@ import javax.xml.bind.annotation.XmlEnum;
 import javax.xml.bind.annotation.XmlRootElement;
 
 /**
- * The Class ApexEditorAPIResult return the result of and messages from all model API method calls
- * on the {@link ApexModel} API.
+ * The Class ApexEditorAPIResult return the result of and messages from all model API method calls on the
+ * {@link ApexModel} API.
  */
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public class ApexApiResult {
 
     /**
-     * This enumeration is used to represent the result status of a call on the {@link ApexModel}
-     * API.
+     * This enumeration is used to represent the result status of a call on the {@link ApexModel} API.
      */
     @XmlEnum(value = String.class)
     public enum Result {
@@ -62,19 +61,19 @@ public class ApexApiResult {
         /** The method call failed because no action was specified on the method call. */
         NO_ACTION_SPECIFIED,
         /**
-         * The method call failed because of a structural error, a missing reference, or other error
-         * on the model.
+         * The method call failed because of a structural error, a missing reference, or other error on the model.
          */
         FAILED,
         /**
-         * The method call failed for another reason such as the method call is not implemented yet
-         * on the concept on which it was called.
+         * The method call failed for another reason such as the method call is not implemented yet on the concept on
+         * which it was called.
          */
         OTHER_ERROR;
 
         /**
          * Check if a result is OK.
-         * 
+         *
+         * @param result the result
          * @return true if the result is not OK
          */
         public static boolean isOk(final Result result) {
@@ -83,7 +82,8 @@ public class ApexApiResult {
 
         /**
          * Check if a result is not OK.
-         * 
+         *
+         * @param result the result
          * @return true if the result is not OK
          */
         public static boolean isNok(final Result result) {
@@ -122,9 +122,8 @@ public class ApexApiResult {
     }
 
     /**
-     * This Constructor creates a result with the given result status and {@link Throwable} object
-     * such as an exception. The message and stack trace from the {@link Throwable} object are added
-     * to the message list of this message.
+     * This Constructor creates a result with the given result status and {@link Throwable} object such as an exception.
+     * The message and stack trace from the {@link Throwable} object are added to the message list of this message.
      *
      * @param result the result status to use on this result
      * @param throwable the throwable object from which to add the message and stack trace
@@ -135,9 +134,9 @@ public class ApexApiResult {
     }
 
     /**
-     * This Constructor creates a result with the given result status, message, and
-     * {@link Throwable} object such as an exception. The message and stack trace from the
-     * {@link Throwable} object are added to the message list of this message.
+     * This Constructor creates a result with the given result status, message, and {@link Throwable} object such as an
+     * exception. The message and stack trace from the {@link Throwable} object are added to the message list of this
+     * message.
      *
      * @param result the result status to use on this result
      * @param message the message to return with the result
@@ -150,8 +149,7 @@ public class ApexApiResult {
     }
 
     /**
-     * This message is a utility message that checks if the result of an operation on the API was
-     * OK.
+     * This message is a utility message that checks if the result of an operation on the API was OK.
      *
      * @return true, if the result indicates the API operation succeeded
      */
@@ -161,8 +159,7 @@ public class ApexApiResult {
     }
 
     /**
-     * This message is a utility message that checks if the result of an operation on the API was
-     * not OK.
+     * This message is a utility message that checks if the result of an operation on the API was not OK.
      *
      * @return true, if the result indicates the API operation did not succeed
      */
@@ -228,8 +225,7 @@ public class ApexApiResult {
     /**
      * Adds a message from an API operation to the bottom of the list of messages to be returned.
      *
-     * @param message the message from an API operation to add to the bottom of the list of messages
-     *        to be returned
+     * @param message the message from an API operation to add to the bottom of the list of messages to be returned
      */
     public void addMessage(final String message) {
         if (message != null && message.trim().length() > 0) {
@@ -238,12 +234,11 @@ public class ApexApiResult {
     }
 
     /**
-     * Adds the message and stack trace from a {@link Throwable} object such as an exception from an
-     * API operation to the bottom of the list of messages to be returned.
+     * Adds the message and stack trace from a {@link Throwable} object such as an exception from an API operation to
+     * the bottom of the list of messages to be returned.
      *
-     * @param throwable the {@link Throwable} object such as an exception from an API operation from
-     *        which the message and stack trace are to be extracted and placed at the bottom of the
-     *        list of messages to be returned
+     * @param throwable the {@link Throwable} object such as an exception from an API operation from which the message
+     *        and stack trace are to be extracted and placed at the bottom of the list of messages to be returned
      */
     public void addThrowable(final Throwable throwable) {
         final StringWriter throwableStringWriter = new StringWriter();
index 77be038..1e92b9f 100644 (file)
@@ -5,15 +5,15 @@
  * 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.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -39,8 +39,8 @@ import org.slf4j.ext.XLogger;
 import org.slf4j.ext.XLoggerFactory;
 
 /**
- * This event marshaler handles events coming out of Apex and sends them on, handles threading,
- * event queuing, transformations and sending using the configured sending technology.
+ * This event marshaler handles events coming out of Apex and sends them on, handles threading, event queuing,
+ * transformations and sending using the configured sending technology.
  *
  * @author Liam Fallon (liam.fallon@ericsson.com)
  */
@@ -88,10 +88,9 @@ public class ApexEventMarshaller implements ApexEventListener, Runnable {
     }
 
     /**
-     * Configure the marshaler by setting up the producer and event converter and initialize the
-     * thread for event sending.
+     * Configure the marshaler by setting up the producer and event converter and initialize the thread for event
+     * sending.
      *
-     * @throws ApexActivatorException on errors initializing the producer
      * @throws ApexEventException on errors initializing event handling
      */
     public void init() throws ApexEventException {
@@ -170,8 +169,8 @@ public class ApexEventMarshaller implements ApexEventListener, Runnable {
     }
 
     /**
-     * Run a thread that runs forever (well until system termination anyway) and listens for
-     * outgoing events on the queue.
+     * Run a thread that runs forever (well until system termination anyway) and listens for outgoing events on the
+     * queue.
      */
     @Override
     public void run() {
@@ -190,7 +189,7 @@ public class ApexEventMarshaller implements ApexEventListener, Runnable {
                 producer.sendEvent(apexEvent.getExecutionId(), apexEvent.getName(), event);
 
                 if (LOGGER.isTraceEnabled()) {
-                    String message = "event sent : " + apexEvent.toString();
+                    final String message = "event sent : " + apexEvent.toString();
                     LOGGER.trace(message);
                 }
             } catch (final InterruptedException e) {
index 8f3b668..5d786bc 100644 (file)
@@ -18,7 +18,8 @@
   ============LICENSE_END=========================================================
 -->
 
-<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">
+<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.onap.policy.apex-pdp.testsuites</groupId>
         </plugins>
     </build>
 
+    <profiles>
+        <profile>
+            <id>apexSite</id>
+            <activation>
+                <property>
+                    <name>apexSite</name>
+                </property>
+            </activation>
+            <distributionManagement>
+                <site>
+                    <id>${project.artifactId}-site</id>
+                    <url>${apex.adsite.prefix}/modules/${project.parent.artifactId}/${project.artifactId}/</url>
+                </site>
+            </distributionManagement>
+        </profile>
+    </profiles>
 </project>
\ No newline at end of file
index 0dd59ed..08ad008 100644 (file)
@@ -36,7 +36,6 @@ public class DefaultTaskLogic {
      *
      * @param executor the executor
      * @return the event
-     * @throws ApexException the apex exception
      */
     public boolean getEvent(final TaskExecutionContext executor) {
         String idString = executor.subject.getId();
index 29c58f1..8ba4b87 100644 (file)
@@ -33,7 +33,6 @@ public class EvalTaskLogic {
      *
      * @param executor the executor
      * @return the event
-     * @throws ApexException the apex exception
      */
     public boolean getEvent(final TaskExecutionContext executor) {
         String idString = executor.subject.getId();
index 7e02c7a..4d2e99b 100644 (file)
@@ -34,7 +34,6 @@ import org.apache.commons.lang3.Validate;
 import org.onap.policy.apex.auth.clicodegen.CodeGenCliEditorBuilder;
 import org.onap.policy.apex.auth.clicodegen.CodeGeneratorCliEditor;
 import org.onap.policy.apex.auth.clicodegen.EventDeclarationBuilder;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
 import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
 import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
@@ -96,7 +95,7 @@ public class Model2Cli {
     public Model2Cli(final String modelFile, final OutputFile outFile, final boolean validate, final String appName) {
         Validate.notNull(modelFile, "Model2Cli: given model file name was blank");
         Validate.notNull(appName, "Model2Cli: given application name was blank");
-        
+
         this.modelFile = modelFile;
         this.outFile = outFile;
         this.appName = appName;
@@ -108,7 +107,6 @@ public class Model2Cli {
      *
      * @return status of the application execution, 0 for success, positive integer for exit condition (such as help or
      *         version), negative integer for errors
-     * @throws ApexException if any problem occurred in the model
      */
     public int runApp() {
         final CodeGeneratorCliEditor codeGen = new CodeGeneratorCliEditor();
@@ -118,7 +116,7 @@ public class Model2Cli {
 
         final ApexApiResult result = model.loadFromFile(modelFile);
         if (result.isNok()) {
-            String message = appName + ": " + result.getMessage();
+            final String message = appName + ": " + result.getMessage();
             LOGGER.error(message);
             return -1;
         }
@@ -130,7 +128,7 @@ public class Model2Cli {
             final AxValidationResult val = new AxValidationResult();
             policyModel.validate(val);
             if (!val.isOk()) {
-                String message = "Cannot translate the model. The model is not valid: \n" + val.toString();
+                final String message = "Cannot translate the model. The model is not valid: \n" + val.toString();
                 LOGGER.error(message);
                 return -1;
             }
@@ -141,6 +139,7 @@ public class Model2Cli {
 
     /**
      * Generate the CLI from the model.
+     *
      * @param codeGen the code generator
      * @param policyModel the policy model
      */
@@ -157,7 +156,7 @@ public class Model2Cli {
             final AxArtifactKey key = s.getKey();
 
             codeGen.addSchemaDeclaration(kig.getName(key), kig.getVersion(key), kig.getUuid(key), kig.getDesc(key),
-                            s.getSchemaFlavour(), s.getSchema());
+                    s.getSchemaFlavour(), s.getSchema());
         }
 
         // 2: tasks
@@ -170,7 +169,7 @@ public class Model2Cli {
             final List<ST> contextRefs = getCtxtRefsForTask(codeGen, t);
 
             codeGen.addTaskDeclaration(kig.getName(key), kig.getVersion(key), kig.getUuid(key), kig.getDesc(key),
-                            infields, outfields, logic, parameters, contextRefs);
+                    infields, outfields, logic, parameters, contextRefs);
         }
 
         // 3: events
@@ -194,16 +193,10 @@ public class Model2Cli {
         for (final AxContextAlbum a : policyModel.getAlbums().getAlbumsMap().values()) {
             final AxArtifactKey key = a.getKey();
 
-            codeGen.addContextAlbumDeclaration(
-                    new CodeGenCliEditorBuilder()
-                            .setName(kig.getName(key))
-                            .setVersion(kig.getVersion(key))
-                            .setUuid(kig.getUuid(key))
-                            .setDescription(kig.getDesc(key))
-                            .setScope(a.getScope())
-                            .setWritable(a.isWritable())
-                            .setSchemaName(kig.getName(a.getItemSchema()))
-                            .setSchemaVersion(kig.getVersion(a.getItemSchema())));
+            codeGen.addContextAlbumDeclaration(new CodeGenCliEditorBuilder().setName(kig.getName(key))
+                    .setVersion(kig.getVersion(key)).setUuid(kig.getUuid(key)).setDescription(kig.getDesc(key))
+                    .setScope(a.getScope()).setWritable(a.isWritable()).setSchemaName(kig.getName(a.getItemSchema()))
+                    .setSchemaVersion(kig.getVersion(a.getItemSchema())));
         }
 
         // 5: policies
@@ -211,12 +204,12 @@ public class Model2Cli {
             final AxArtifactKey key = p.getKey();
             final List<ST> states = getStatesForPolicy(codeGen, p);
             codeGen.addPolicyDefinition(kig.getName(key), kig.getVersion(key), kig.getUuid(key), kig.getDesc(key),
-                            p.getTemplate(), p.getFirstState(), states);
+                    p.getTemplate(), p.getFirstState(), states);
         }
 
         final String out = codeGen.getModel().render();
         if (outFile != null) {
-            String message = "Error writing output to file " + outFile;
+            final String message = "Error writing output to file " + outFile;
             try {
                 final Writer w = outFile.toWriter();
                 if (w == null) {
@@ -232,7 +225,7 @@ public class Model2Cli {
         } else {
             LOGGER.error(out);
         }
-        
+
         return 0;
     }
 
@@ -250,7 +243,7 @@ public class Model2Cli {
             final AxReferenceKey fkey = f.getKey();
 
             final ST val = cg.createEventFieldDefinition(kig.getPName(fkey), kig.getPVersion(fkey), kig.getLName(fkey),
-                            kig.getName(f.getSchema()), kig.getVersion(f.getSchema()), f.getOptional());
+                    kig.getName(f.getSchema()), kig.getVersion(f.getSchema()), f.getOptional());
 
             ret.add(val);
         }
@@ -271,7 +264,7 @@ public class Model2Cli {
         for (final AxArtifactKey ckey : ctxs) {
 
             final ST val = cg.createTaskDefinitionContextRef(kig.getName(tkey), kig.getVersion(tkey), kig.getName(ckey),
-                            kig.getVersion(ckey));
+                    kig.getVersion(ckey));
 
             ret.add(val);
         }
@@ -292,7 +285,7 @@ public class Model2Cli {
             final AxReferenceKey pkey = p.getKey();
 
             final ST val = cg.createTaskDefinitionParameters(kig.getPName(pkey), kig.getPVersion(pkey),
-                            kig.getLName(pkey), p.getTaskParameterValue());
+                    kig.getLName(pkey), p.getTaskParameterValue());
 
             ret.add(val);
         }
@@ -327,7 +320,7 @@ public class Model2Cli {
             final AxReferenceKey fkey = f.getKey();
 
             final ST val = cg.createTaskDefinitionOutfields(kig.getPName(fkey), kig.getPVersion(fkey),
-                            kig.getLName(fkey), kig.getName(f.getSchema()), kig.getVersion(f.getSchema()));
+                    kig.getLName(fkey), kig.getName(f.getSchema()), kig.getVersion(f.getSchema()));
 
             ret.add(val);
         }
@@ -348,7 +341,7 @@ public class Model2Cli {
             final AxReferenceKey fkey = f.getKey();
 
             final ST val = cg.createTaskDefinitionInfields(kig.getPName(fkey), kig.getPVersion(fkey),
-                            kig.getLName(fkey), kig.getName(f.getSchema()), kig.getVersion(f.getSchema()));
+                    kig.getLName(fkey), kig.getName(f.getSchema()), kig.getVersion(f.getSchema()));
 
             ret.add(val);
         }
@@ -374,9 +367,8 @@ public class Model2Cli {
             final List<ST> ctxRefs = getCtxtRefsForState(cg, st);
 
             final ST val = cg.createPolicyStateDef(kig.getPName(skey), kig.getPVersion(skey), kig.getLName(skey),
-                            kig.getName(st.getTrigger()), kig.getVersion(st.getTrigger()),
-                            kig.getName(st.getDefaultTask()), kig.getVersion(st.getDefaultTask()), outputs, tasks,
-                            tsLogic, finalizerLogics, ctxRefs);
+                    kig.getName(st.getTrigger()), kig.getVersion(st.getTrigger()), kig.getName(st.getDefaultTask()),
+                    kig.getVersion(st.getDefaultTask()), outputs, tasks, tsLogic, finalizerLogics, ctxRefs);
 
             ret.add(val);
         }
@@ -398,7 +390,7 @@ public class Model2Cli {
             final AxReferenceKey finkey = fin.getKey();
 
             final ST val = cg.createPolicyStateDefFinalizerLogic(kig.getPName(skey), kig.getPVersion(skey),
-                            kig.getLName(skey), kig.getLName(finkey), fin.getLogicFlavour(), fin.getLogic());
+                    kig.getLName(skey), kig.getLName(finkey), fin.getLogicFlavour(), fin.getLogic());
 
             ret.add(val);
         }
@@ -419,7 +411,7 @@ public class Model2Cli {
         for (final AxArtifactKey ctx : ctxs) {
 
             final ST val = cg.createPolicyStateDefContextRef(kig.getPName(skey), kig.getPVersion(skey),
-                            kig.getLName(skey), kig.getName(ctx), kig.getVersion(ctx));
+                    kig.getLName(skey), kig.getName(ctx), kig.getVersion(ctx));
 
             ret.add(val);
         }
@@ -438,7 +430,7 @@ public class Model2Cli {
         if (st.checkSetTaskSelectionLogic()) {
             final AxTaskSelectionLogic tsl = st.getTaskSelectionLogic();
             final ST val = cg.createPolicyStateDefTaskSelLogic(kig.getPName(skey), kig.getPVersion(skey),
-                            kig.getLName(skey), tsl.getLogicFlavour(), tsl.getLogic());
+                    kig.getLName(skey), tsl.getLogicFlavour(), tsl.getLogic());
             return Collections.singletonList(val);
         } else {
             return Collections.emptyList();
@@ -462,8 +454,8 @@ public class Model2Cli {
             final AxReferenceKey trkey = tr.getKey();
 
             final ST val = cg.createPolicyStateTask(kig.getPName(skey), kig.getPVersion(skey), kig.getLName(skey),
-                            kig.getLName(trkey), kig.getName(tkey), kig.getVersion(tkey),
-                            tr.getStateTaskOutputType().name(), kig.getLName(tr.getOutput()));
+                    kig.getLName(trkey), kig.getName(tkey), kig.getVersion(tkey), tr.getStateTaskOutputType().name(),
+                    kig.getLName(tr.getOutput()));
 
             ret.add(val);
         }
@@ -485,8 +477,8 @@ public class Model2Cli {
             final AxReferenceKey outkey = out.getKey();
 
             final ST val = cg.createPolicyStateOutput(kig.getPName(skey), kig.getPVersion(skey), kig.getLName(skey),
-                            kig.getLName(outkey), kig.getName(out.getOutgingEvent()),
-                            kig.getVersion(out.getOutgingEvent()), kig.getLName(out.getNextState()));
+                    kig.getLName(outkey), kig.getName(out.getOutgingEvent()), kig.getVersion(out.getOutgingEvent()),
+                    kig.getLName(out.getNextState()));
 
             ret.add(val);
         }
index 031a377..178799c 100644 (file)
@@ -22,14 +22,14 @@ First, create a new CLI Parser object, add some options (in the example an optio
 
 [source,java,linenums,subs="attributes+"]
 ----
-include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersion.java[tags=setupParser,indent=0]
+include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java[tags=setupParser,indent=0]
 ----
 
 Next, we check if the version option was used in the command line and print application name and version if it was used:
 
 [source,java,linenums,subs="attributes+"]
 ----
-include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersion.java[tags=processCliVersion,indent=0]
+include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java[tags=processCliVersion,indent=0]
 ----
 
 The output will be:
index 32a0e95..d2edc44 100644 (file)
@@ -34,7 +34,7 @@ Manually importing means to add the following lines to the start of your applica
 
 [source,java, linenums,subs="attributes+"]
 ----
-include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=import,indent=0]
+include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=import,indent=0]
 ----
 
 Now, inside your `main()` method, start setting some general application properties.
@@ -43,7 +43,7 @@ For instance:
 
 [source,java,linenums,subs="attributes+"]
 ----
-include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=setApp,indent=0]
+include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=setApp,indent=0]
 ----
 
 Next, create a new CLI Parser and add a few CLI options from the standard `CliOptions`.
@@ -51,14 +51,14 @@ The following example adds options for help, version, and a model file:
 
 [source,java,linenums,subs="attributes+"]
 ----
-include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=setCli,indent=0]
+include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=setCli,indent=0]
 ----
 
 Next, parse the given CLI arguments:
 
 [source,java,linenums,subs="attributes+"]
 ----
-include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=parseCli,indent=0]
+include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=parseCli,indent=0]
 ----
 
 Once the command line is parsed, we can look into the individual options, check if they are set, and then act accordingly.
@@ -67,7 +67,7 @@ If the option is present, we print a help screen and return:
 
 [source,java,linenums,subs="attributes+"]
 ----
-include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=processCliHelp,indent=0]
+include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=processCliHelp,indent=0]
 ----
 
 Next, we process the option for __version__.
@@ -76,7 +76,7 @@ The CLI Parser already provides a method to obtain the correct version for an AP
 
 [source,java,linenums,subs="attributes+"]
 ----
-include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=processCliVersion,indent=0]
+include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=processCliVersion,indent=0]
 ----
 
 Once help and version arguments are processed, we can proceed to look at all other options.
@@ -86,7 +86,7 @@ If we cannot load a model, we print an error and return.
 
 [source,java,linenums,subs="attributes+"]
 ----
-include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=processCliModel,indent=0]
+include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=processCliModel,indent=0]
 ----
 
 With a model file being loadable, we finish parsing command line arguments.
@@ -94,7 +94,7 @@ We also print some status messages to note that the application now is ready to
 
 [source,java,linenums,subs="attributes+"]
 ----
-include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=someStartPrint,indent=0]
+include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=someStartPrint,indent=0]
 ----
 
 The last action now is to run the actual application.
@@ -102,7 +102,7 @@ The example below is taken from a version of the `Model2Cli` application, which
 
 [source,java,linenums,subs="attributes+"]
 ----
-include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=yourApp,indent=0]
+include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=yourApp,indent=0]
 ----
 
 If this new application is now called with the command line `-h` or `--help` it will print the following help screen: