aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/client-common/pom.xml32
-rw-r--r--client/client-common/src/main/assembly/resources.xml32
-rw-r--r--client/client-deployment/pom.xml103
-rw-r--r--client/client-deployment/src/main/assembly/resources.xml32
-rw-r--r--client/client-editor/pom.xml119
-rw-r--r--client/client-editor/src/main/assembly/resources.xml32
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/RestCommandHandler.java30
-rw-r--r--client/client-full/pom.xml129
-rw-r--r--client/client-monitoring/pom.xml118
-rw-r--r--client/client-monitoring/src/main/assembly/resources.xml32
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java3
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java4
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java7
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java13
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java24
-rw-r--r--core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java26
-rw-r--r--core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java81
-rw-r--r--model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java55
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java21
-rw-r--r--testsuites/apex-pdp-stability/pom.xml19
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java1
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java1
-rw-r--r--tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java62
-rw-r--r--tools/tools-common/src/site-docs/adoc/fragments/example-cli-version.adoc4
-rw-r--r--tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc18
25 files changed, 529 insertions, 469 deletions
diff --git a/client/client-common/pom.xml b/client/client-common/pom.xml
index 92174c87f..da0aa392c 100644
--- a/client/client-common/pom.xml
+++ b/client/client-common/pom.xml
@@ -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>
@@ -26,9 +27,36 @@
</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
index 000000000..2a6d326cc
--- /dev/null
+++ b/client/client-common/src/main/assembly/resources.xml
@@ -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
diff --git a/client/client-deployment/pom.xml b/client/client-deployment/pom.xml
index 02ecb4ae6..25972ea47 100644
--- a/client/client-deployment/pom.xml
+++ b/client/client-deployment/pom.xml
@@ -37,11 +37,6 @@
<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>
@@ -65,42 +60,67 @@
<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>
@@ -197,45 +217,6 @@
<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>
<property>
diff --git a/client/client-deployment/src/main/assembly/resources.xml b/client/client-deployment/src/main/assembly/resources.xml
new file mode 100644
index 000000000..f0632c54e
--- /dev/null
+++ b/client/client-deployment/src/main/assembly/resources.xml
@@ -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
diff --git a/client/client-editor/pom.xml b/client/client-editor/pom.xml
index 4bae1013d..a72f88c76 100644
--- a/client/client-editor/pom.xml
+++ b/client/client-editor/pom.xml
@@ -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>
@@ -45,11 +46,6 @@
<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>
@@ -90,43 +86,67 @@
<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>
@@ -158,14 +178,18 @@
</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>
@@ -219,45 +243,6 @@
<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>
<property>
diff --git a/client/client-editor/src/main/assembly/resources.xml b/client/client-editor/src/main/assembly/resources.xml
new file mode 100644
index 000000000..0205c3d5d
--- /dev/null
+++ b/client/client-editor/src/main/assembly/resources.xml
@@ -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
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/RestCommandHandler.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/RestCommandHandler.java
index 5921c8960..968a98572 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/RestCommandHandler.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/RestCommandHandler.java
@@ -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;
}
}
diff --git a/client/client-full/pom.xml b/client/client-full/pom.xml
index ae987c55c..591dcada3 100644
--- a/client/client-full/pom.xml
+++ b/client/client-full/pom.xml
@@ -51,9 +51,40 @@
<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>
@@ -62,53 +93,31 @@
</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>
@@ -116,39 +125,6 @@
<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>
<executions>
<execution>
@@ -265,20 +241,7 @@
<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>
diff --git a/client/client-monitoring/pom.xml b/client/client-monitoring/pom.xml
index 17f2cc178..6d0c34e6e 100644
--- a/client/client-monitoring/pom.xml
+++ b/client/client-monitoring/pom.xml
@@ -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>
@@ -36,11 +37,6 @@
<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>
@@ -64,42 +60,67 @@
<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>
@@ -131,14 +152,18 @@
</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>
@@ -192,45 +217,6 @@
<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>
<property>
diff --git a/client/client-monitoring/src/main/assembly/resources.xml b/client/client-monitoring/src/main/assembly/resources.xml
new file mode 100644
index 000000000..bed1588b6
--- /dev/null
+++ b/client/client-monitoring/src/main/assembly/resources.xml
@@ -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
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java
index 50f968997..d3f4d4704 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java
@@ -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 {
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java
index 65f50d703..b897b83f6 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java
@@ -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);
}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java
index ee0a1072c..a673824ea 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java
@@ -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) {
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java
index cd2c2ed1f..c7043bc53 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java
@@ -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)) {
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java
index 1949769a6..ac9ae68b7 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java
@@ -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);
}
-
+
}
/**
diff --git a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java
index 95f74b708..df845f563 100644
--- a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java
+++ b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java
@@ -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();
diff --git a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java
index caf943dfc..f98485343 100644
--- a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java
+++ b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java
@@ -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) {
diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java
index ddd46c879..2b1dc5505 100644
--- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java
+++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java
@@ -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();
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java
index 77be038e5..1e92b9feb 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java
@@ -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) {
diff --git a/testsuites/apex-pdp-stability/pom.xml b/testsuites/apex-pdp-stability/pom.xml
index 8f3b6687c..5d786bc77 100644
--- a/testsuites/apex-pdp-stability/pom.xml
+++ b/testsuites/apex-pdp-stability/pom.xml
@@ -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>
@@ -55,4 +56,20 @@
</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
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java
index 0dd59ed86..08ad008f4 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java
@@ -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();
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java
index 29c58f148..8ba4b879f 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java
@@ -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();
diff --git a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java
index 7e02c7af5..4d2e99b23 100644
--- a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java
+++ b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java
@@ -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);
}
diff --git a/tools/tools-common/src/site-docs/adoc/fragments/example-cli-version.adoc b/tools/tools-common/src/site-docs/adoc/fragments/example-cli-version.adoc
index 031a3776d..178799c44 100644
--- a/tools/tools-common/src/site-docs/adoc/fragments/example-cli-version.adoc
+++ b/tools/tools-common/src/site-docs/adoc/fragments/example-cli-version.adoc
@@ -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:
diff --git a/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc b/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc
index 32a0e957b..d2edc446d 100644
--- a/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc
+++ b/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc
@@ -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: