diff options
Diffstat (limited to 'core')
135 files changed, 31 insertions, 4466 deletions
diff --git a/core/core-engine/pom.xml b/core/core-engine/pom.xml deleted file mode 100644 index 597da2991..000000000 --- a/core/core-engine/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ -<!-- - ============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========================================================= ---> -<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.core</groupId> - <artifactId>core</artifactId> - <version>2.7.1-SNAPSHOT</version> - </parent> - - <artifactId>core-engine</artifactId> - <name>${project.artifactId}</name> - <description>The Apex policy execution engine</description> - - <dependencies> - <dependency> - <groupId>org.onap.policy.common</groupId> - <artifactId>common-parameters</artifactId> - </dependency> - <dependency> - <groupId>org.onap.policy.apex-pdp.model</groupId> - <artifactId>model</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.policy.apex-pdp.model</groupId> - <artifactId>engine-model</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.policy.apex-pdp.context</groupId> - <artifactId>context-management</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.policy.apex-pdp.core</groupId> - <artifactId>core-infrastructure</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - </dependencies> -</project> diff --git a/core/core-infrastructure/pom.xml b/core/core-infrastructure/pom.xml deleted file mode 100644 index 2802b89eb..000000000 --- a/core/core-infrastructure/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ============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========================================================= ---> -<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.core</groupId> - <artifactId>core</artifactId> - <version>2.7.1-SNAPSHOT</version> - </parent> - - <artifactId>core-infrastructure</artifactId> - <name>${project.artifactId}</name> - <description>Common non-functional components for Apex</description> - - <dependencies> - <dependency> - <groupId>org.java-websocket</groupId> - <artifactId>Java-WebSocket</artifactId> - </dependency> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - </dependency> - </dependencies> -</project> diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/JavaHandlingException.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/JavaHandlingException.java deleted file mode 100644 index 63bd1c477..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/JavaHandlingException.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.java; - -/** - * This class will be called if an error occurs in Java handling. - * - * @author Liam Fallon - */ -public class JavaHandlingException extends Exception { - private static final long serialVersionUID = -6375859029774312663L; - - /** - * Instantiates a new Java handling exception. - * - * @param message the message - */ - public JavaHandlingException(final String message) { - super(message); - } - - /** - * Instantiates a new Java handling exception. - * - * @param exception the exception to wrap - */ - public JavaHandlingException(final Exception exception) { - super(exception); - } - - /** - * Instantiates a new Java handling exception. - * - * @param message the message - * @param exception the exception to wrap - */ - public JavaHandlingException(final String message, final Exception exception) { - super(message, exception); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java deleted file mode 100644 index 49e7d1e2e..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java +++ /dev/null @@ -1,259 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021 Bell Canada. 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.java.classes; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.InvocationTargetException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.Arrays; -import java.util.Set; -import java.util.TreeSet; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * This class is a utility class used to find Java classes on the class path, in directories, and in Jar files. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class ClassUtils { - // Get a reference to the logger - private static final XLogger LOGGER = XLoggerFactory.getXLogger(ClassUtils.class); - - // Repeated string constants - private static final String CLASS_PATTERN = "\\.class$"; - - // The boot directory in Java for predefined JARs - private static final String SUN_BOOT_LIBRARY_PATH = "sun.boot.library.path"; - - // Token for Classes directory in paths - private static final String CLASSES_TOKEN = "/classes/"; - - // Token for library fragment in path - private static final String LIBRARAY_PATH_TOKEN = "/lib"; - - /** - * Get the class names of all classes on the class path. WARNING: This is a heavy call, use sparingly - * - * @return a set of class names for all classes in the class path - */ - public static Set<String> getClassNames() { - // The return set of class names - final Set<String> classNameSet = new TreeSet<>(); - - try { - // The library path for predefined classes in Java - var sunBootLibraryPathString = System.getProperty(SUN_BOOT_LIBRARY_PATH); - - // Check it exists and has a "lib" in it - if (sunBootLibraryPathString != null && sunBootLibraryPathString.contains(LIBRARAY_PATH_TOKEN)) { - // Strip any superfluous trailer from path - sunBootLibraryPathString = sunBootLibraryPathString.substring(0, - sunBootLibraryPathString.lastIndexOf(LIBRARAY_PATH_TOKEN) + LIBRARAY_PATH_TOKEN.length()); - - final var bootLibraryFile = new File(sunBootLibraryPathString); - // The set used to hold class names is populated with predefined Java classes - classNameSet.addAll(processDir(bootLibraryFile, "")); - } - - // Get the entries on the class path - URL[] urls = ((URLClassLoader) ClassLoader.getSystemClassLoader()).getURLs(); - - // Try get the classes in the bootstrap loader - urls = getClassesFromBootstrapLoader(urls); - - // Iterate over the class path entries - for (final URL url : urls) { - if (url == null || url.getFile() == null) { - continue; - } - final var urlFile = new File(url.getFile()); - // Directories may contain ".class" files - if (urlFile.isDirectory()) { - classNameSet.addAll(processDir(urlFile, url.getFile())); - } else if (url.getFile().endsWith(".jar")) { - // JARs are processed as well - classNameSet.addAll(processJar(urlFile)); - } - // It's a resource or some other non-executable thing - } - } catch (final Exception e) { - LOGGER.warn("could not get the names of Java classes", e); - } - - return classNameSet; - } - - private static URL[] getClassesFromBootstrapLoader(URL[] urls) - throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { - try { - final Class<?> nullclassloader = Class.forName("sun.misc.Launcher"); - if (nullclassloader == null) { - return urls; - } - - var mmethod = nullclassloader.getMethod("getBootstrapClassPath"); - if (mmethod == null) { - return urls; - } - - final Object cp = mmethod.invoke(null, (Object[]) null); - if (cp == null) { - return urls; - } - - mmethod = cp.getClass().getMethod("getURLs"); - if (mmethod == null) { - return urls; - } - - final URL[] moreurls = (URL[]) (mmethod.invoke(cp, (Object[]) null)); - if (moreurls == null || moreurls.length == 0) { - return urls; - } - - if (urls.length == 0) { - return moreurls; - } else { - final URL[] result = Arrays.copyOf(urls, urls.length + moreurls.length); - System.arraycopy(moreurls, 0, result, urls.length, moreurls.length); - return result; - } - } catch (final ClassNotFoundException e) { - LOGGER.warn("Failed to find default path for JRE libraries", e); - return urls; - } - } - - /** - * Find all classes in directories and JARs in those directories. - * - * @param classDirectory The directory to search for classes - * @param rootDir The root directory, to be removed from absolute paths - * @return a set of classes which may be empty - * @throws Exception on errors processing directories - */ - public static Set<String> processDir(final File classDirectory, final String rootDir) throws Exception { - // The return set - final TreeSet<String> classNameSet = new TreeSet<>(); - - // Iterate over the directory - if (classDirectory == null || !classDirectory.isDirectory()) { - return classNameSet; - } - for (final File child : classDirectory.listFiles()) { - if (child.isDirectory()) { - // Recurse down - classNameSet.addAll(processDir(child, rootDir)); - } else if (child.getName().endsWith(".jar")) { - // Process the JAR - classNameSet.addAll(processJar(child)); - } else if (child.getName().endsWith(".class") && !child.getName().contains("$")) { - // Process the ".class" file - classNameSet.add( - child.getAbsolutePath().replace(rootDir, "").replaceFirst(CLASS_PATTERN, "").replace('/', '.')); - } - } - return classNameSet; - } - - /** - * Condition the file name as a class name. - * - * @param fileNameIn The file name to convert to a class name - * @return the conditioned class name - */ - public static String processFileName(final String fileNameIn) { - String fileName = fileNameIn; - - if (fileName == null) { - return null; - } - final int classesPos = fileName.indexOf(CLASSES_TOKEN); - - if (classesPos != -1) { - fileName = fileName.substring(classesPos + CLASSES_TOKEN.length()); - } - - return fileName.replaceFirst(CLASS_PATTERN, "").replace('/', '.'); - } - - /** - * Read all the class names from a Jar. - * - * @param jarFile the JAR file - * @return a set of class names - * @throws IOException on errors processing JARs - */ - public static Set<String> processJar(final File jarFile) throws IOException { - // Pass the file as an input stream - return processJar(new FileInputStream(jarFile.getAbsolutePath())); - } - - /** - * Read all the class names from a Jar. - * - * @param jarInputStream the JAR input stream - * @return a set of class names - * @throws IOException on errors processing JARs - */ - public static Set<String> processJar(final InputStream jarInputStream) throws IOException { - // The return set - final TreeSet<String> classPathSet = new TreeSet<>(); - - if (jarInputStream == null) { - return classPathSet; - } - // JARs are ZIP files - final var zip = new ZipInputStream(jarInputStream); - - // Iterate over each entry in the JAR - for (ZipEntry entry = zip.getNextEntry(); entry != null; entry = zip.getNextEntry()) { - if (!entry.isDirectory() && entry.getName().endsWith(".class") && !entry.getName().contains("$")) { - classPathSet.add(entry.getName().replaceFirst(CLASS_PATTERN, "").replace('/', '.')); - } - } - zip.close(); - return classPathSet; - } - - /** - * The main method exercises this class for test purposes. - * - * @param args the args - */ - public static void main(final String[] args) { - for (final String clz : getClassNames()) { - LOGGER.info("Found class: {}", clz); - } - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/package-info.java deleted file mode 100644 index c356580b3..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -/** - * Contains support to find Java classes on the class path, in directories and in Jar files. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ - -package org.onap.policy.apex.core.infrastructure.java.classes; diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassBuilder.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassBuilder.java deleted file mode 100644 index 783ac4cac..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassBuilder.java +++ /dev/null @@ -1,134 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. - * Modifications Copyright (C) 2021 Bell Canada. 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.java.compile.singleclass; - -import java.util.Arrays; -import java.util.List; -import javax.tools.Diagnostic; -import javax.tools.DiagnosticCollector; -import javax.tools.JavaCompiler; -import javax.tools.JavaFileObject; -import javax.tools.ToolProvider; -import org.onap.policy.apex.core.infrastructure.java.JavaHandlingException; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class SingleClassBuilder is used to compile the Java code for a Java object and to create an instance of the - * object. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class SingleClassBuilder { - // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(SingleClassBuilder.class); - - // The class name and source code for the class that we are compiling and instantiating - private final String className; - private final String sourceCode; - - // This specialized JavaFileManager handles class loading for the single Java class - private SingleFileManager singleFileManager = null; - - /** - * Instantiates a new single class builder. - * - * @param className the class name - * @param sourceCode the source code - */ - public SingleClassBuilder(final String className, final String sourceCode) { - // Save the fields of the class - this.className = className; - this.sourceCode = sourceCode; - } - - /** - * Compile the single class into byte code. - * - * @throws JavaHandlingException Thrown on compilation errors or handling errors on the single Java class - */ - public void compile() throws JavaHandlingException { - // Get the list of compilation units, there is only one here - final List<? extends JavaFileObject> compilationUnits = - Arrays.asList(new SingleClassCompilationUnit(className, sourceCode)); - - // Allows us to get diagnostics from the compilation - final DiagnosticCollector<JavaFileObject> diagnosticListener = new DiagnosticCollector<>(); - - // Get the Java compiler - final var compiler = ToolProvider.getSystemJavaCompiler(); - - // Set up the target file manager and call the compiler - singleFileManager = new SingleFileManager(compiler, new SingleClassByteCodeFileObject(className)); - final JavaCompiler.CompilationTask task = - compiler.getTask(null, singleFileManager, diagnosticListener, null, null, compilationUnits); - - // Check if the compilation worked - if (Boolean.FALSE.equals(task.call())) { - final var builder = new StringBuilder(); - for (final Diagnostic<? extends JavaFileObject> diagnostic : diagnosticListener.getDiagnostics()) { - builder.append("code:"); - builder.append(diagnostic.getCode()); - builder.append(", kind:"); - builder.append(diagnostic.getKind()); - builder.append(", position:"); - builder.append(diagnostic.getPosition()); - builder.append(", start position:"); - builder.append(diagnostic.getStartPosition()); - builder.append(", end position:"); - builder.append(diagnostic.getEndPosition()); - builder.append(", source:"); - builder.append(diagnostic.getSource()); - builder.append(", message:"); - builder.append(diagnostic.getMessage(null)); - builder.append("\n"); - } - - String message = "error compiling Java code for class \"" + className + "\": " + builder.toString(); - LOGGER.warn(message); - throw new JavaHandlingException(message); - } - } - - /** - * Create a new instance of the Java class using its byte code definition. - * - * @return A new instance of the object - * @throws JavaHandlingException on errors creating the object - */ - public Object createObject() - throws InstantiationException, IllegalAccessException, ClassNotFoundException, JavaHandlingException { - if (singleFileManager == null) { - String message = "error instantiating instance for class \"" + className + "\": code may not be compiled"; - LOGGER.warn(message); - throw new JavaHandlingException(message); - } - - try { - return singleFileManager.getClassLoader(null).findClass(className).getDeclaredConstructor().newInstance(); - } catch (Exception e) { - return new JavaHandlingException("could not create java class", e); - } - - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassByteCodeFileObject.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassByteCodeFileObject.java deleted file mode 100644 index 4a0536ee1..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassByteCodeFileObject.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.java.compile.singleclass; - -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URI; -import javax.tools.SimpleJavaFileObject; - -/** - * The Class SingleClassByteCodeFileObject is a specialization of the {@link SimpleJavaFileObject} class, which is - * itself an implementation of the {@code JavaFileObject} interface, which provides a file abstraction for tools - * operating on Java programming language source and class files. The {@link SimpleJavaFileObject} class provides simple - * implementations for most methods in {@code JavaFileObject}. This class is designed to be sub classed and used as a - * basis for {@code JavaFileObject} implementations. Subclasses can override the implementation and specification of any - * method of this class as long as the general contract of {@code JavaFileObject} is obeyed. - * - * <p>This class holds the byte code for a single class in memory. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class SingleClassByteCodeFileObject extends SimpleJavaFileObject { - - // The ByteArrayOutputStream holds the byte code for the class - private ByteArrayOutputStream byteArrayOutputStream; - - /** - * Instantiates the byte code for the class in memory. - * - * @param className the class name is used to compose a URI for the class - */ - public SingleClassByteCodeFileObject(final String className) { - super(URI.create("byte:///" + className + ".class"), Kind.CLASS); - } - - /** - * {@inheritDoc}. - */ - @Override - public OutputStream openOutputStream() { - // Create the byte array output stream that will hold the byte code for the class, when the class source code is - // compiled, this output stream is passed - // to the compiler and the byte code for the class is written into the output stream. - byteArrayOutputStream = new ByteArrayOutputStream(); - return byteArrayOutputStream; - } - - /** - * {@inheritDoc}. - */ - @Override - public InputStream openInputStream() { - // No input stream for streaming out the byte code - return null; - } - - /** - * Gets the byte code of the class. - * - * @return the byte code of the class - */ - public byte[] getByteCode() { - return byteArrayOutputStream.toByteArray(); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassCompilationUnit.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassCompilationUnit.java deleted file mode 100644 index 34398edd3..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassCompilationUnit.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.java.compile.singleclass; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URI; -import javax.tools.SimpleJavaFileObject; - -/** - * The Class SingleClassCompilationUnit is a container for the source code of the single Java class in memory. The class - * uses a {@link String} to hold the source code. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class SingleClassCompilationUnit extends SimpleJavaFileObject { - - private final String source; - - /** - * Instantiates a new compilation unit. - * - * @param className the class name for the source code - * @param source the source code for the class - */ - public SingleClassCompilationUnit(final String className, final String source) { - // Create a URI for the source code of the class - super(URI.create("file:///" + className + ".java"), Kind.SOURCE); - this.source = source; - } - - /** - * {@inheritDoc}. - */ - @Override - public CharSequence getCharContent(final boolean ignoreEncodingErrors) { - // Return the source code to toe caller, the compiler - return source; - } - - /** - * {@inheritDoc}. - */ - @Override - public OutputStream openOutputStream() { - throw new IllegalStateException(); - } - - /** - * {@inheritDoc}. - */ - @Override - public InputStream openInputStream() { - // Return the source code as a stream - return new ByteArrayInputStream(source.getBytes()); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassLoader.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassLoader.java deleted file mode 100644 index 55fa498fd..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassLoader.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.java.compile.singleclass; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * The Class SingleClassLoader is responsible for class loading the single Java class being held in memory. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -@Getter -@AllArgsConstructor -public class SingleClassLoader extends ClassLoader { - // The byte code of the class held in memory as byte code in a ByteCodeFileObject - private final SingleClassByteCodeFileObject fileObject; - - /** - * {@inheritDoc}. - */ - @Override - protected Class<?> findClass(final String className) throws ClassNotFoundException { - // Creates a java Class that can be instantiated from the class defined in the byte code in the - // ByteCodeFileObejct - return defineClass(className, fileObject.getByteCode(), 0, fileObject.getByteCode().length); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleFileManager.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleFileManager.java deleted file mode 100644 index ffa166393..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleFileManager.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.java.compile.singleclass; - -import java.io.IOException; -import javax.tools.FileObject; -import javax.tools.ForwardingJavaFileManager; -import javax.tools.JavaCompiler; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; - -/** - * The Class SingleFileManager is a {@link ForwardingJavaFileManager} which in turn implements {@code JavaFileManager}. - * A {@code JavaFileManager} handles source files for Java language handling tools. A {@link ForwardingJavaFileManager} - * is an implementation of {@code JavaFileManager} that forwards the {@code JavaFileManager} methods to a given file - * manager. - * - * <p>This class instantiates and forwards those requests to a {@link StandardJavaFileManager} instance to act as a - * {@code JavaFileManager} for a Java single file, managing class loading for the class. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class SingleFileManager extends ForwardingJavaFileManager<StandardJavaFileManager> { - // THe class loader for our single class - private final SingleClassLoader singleClassLoader; - - /** - * Instantiates a new single file manager. - * - * @param compiler the compiler we are using - * @param byteCodeFileObject the byte code for the compiled class - */ - public SingleFileManager(final JavaCompiler compiler, final SingleClassByteCodeFileObject byteCodeFileObject) { - super(compiler.getStandardFileManager(null, null, null)); - singleClassLoader = new SingleClassLoader(byteCodeFileObject); - } - - /** - * {@inheritDoc}. - */ - @Override - public JavaFileObject getJavaFileForOutput(final Location notUsed, final String className, - final JavaFileObject.Kind kind, final FileObject sibling) throws IOException { - // Return the JavaFileObject to the compiler so that it can write byte code into it - return singleClassLoader.getFileObject(); - } - - /** - * {@inheritDoc}. - */ - @Override - public SingleClassLoader getClassLoader(final Location location) { - return singleClassLoader; - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/package-info.java deleted file mode 100644 index 5ae0d4f59..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/package-info.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -/** - * Generates classes from source code by compiling source code and placing the resultant classes on the class path on - * the fly. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ - -package org.onap.policy.apex.core.infrastructure.java.compile.singleclass; diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/package-info.java deleted file mode 100644 index 5a8b51132..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -/** - * Allows Java classes to be created by compiling Java source code and generating classes on the fly. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ - -package org.onap.policy.apex.core.infrastructure.java; diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java deleted file mode 100644 index abc5c90de..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging; - -import java.io.Serializable; -import java.net.InetAddress; -import java.util.ArrayList; -import java.util.List; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.ToString; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class MessageHolder holds a set of messages to be sent as a single block of messages in this messaging - * implementation. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - * @param <M> the generic type of message being handled by a message holder instance - */ -@Getter -@ToString -@EqualsAndHashCode -public class MessageHolder<M> implements Serializable { - - // Serial ID - private static final long serialVersionUID = 1235487535388793719L; - - // Get a reference to the logger - private static final XLogger LOGGER = XLoggerFactory.getXLogger(MessageHolder.class); - - // Properties of the message holder - private final long creationTime; - private final InetAddress senderHostAddress; - - // Sequence of message in the message holder - @ToString.Exclude - private final List<M> messages; - - /** - * Constructor, create the message holder. - * - * @param senderHostAddress the host address of the sender of the message holder container - */ - public MessageHolder(final InetAddress senderHostAddress) { - LOGGER.entry(senderHostAddress); - messages = new ArrayList<>(); - this.senderHostAddress = senderHostAddress; - creationTime = System.currentTimeMillis(); - } - - /** - * Adds a message to this message holder. - * - * @param message the message to add - */ - public void addMessage(final M message) { - if (!messages.contains(message)) { - messages.add(message); - } else { - LOGGER.warn("duplicate message {} added to message holder", message); - } - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageListener.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageListener.java deleted file mode 100644 index 0aab650d3..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageListener.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging; - -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlock; - -/** - * The listener interface for receiving message events. The class that is interested in processing a message event - * implements this interface. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - * @param <M> of message of any given type that is being listened for and handled - */ -public interface MessageListener<M> { - - /** - * This method is called when a message block is received on a web socket and is to be forwarded to a listener. - * - * @param data the message data containing a message - */ - void onMessage(MessageBlock<M> data); - - /** - * This method is called when a string message is received on a web socket and is to be forwarded to a listener. - * - * @param messageString the message string - */ - void onMessage(String messageString); -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingService.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingService.java deleted file mode 100644 index 352e70806..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingService.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging; - -/** - * The Interface MessagingService specifies the methods that must be implemented by any implementation providing Apex - * messaging. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - * @param <M> the type of message being passed by an implementation of Apex messaging - */ -public interface MessagingService<M> { - - /** - * Start the messaging connection. - */ - void startConnection(); - - /** - * Stop the messaging connection. - */ - void stopConnection(); - - /** - * Checks if the messaging connection is started. - * - * @return true, if is started - */ - boolean isStarted(); - - /** - * Send a block of messages on the connection, the messages are contained in the the message holder container. - * - * @param messageHolder The message holder holding the messages to be sent - */ - void send(MessageHolder<M> messageHolder); - - /** - * Send a string message on the connection. - * - * @param messageString The message string to be sent - */ - void send(String messageString); - - /** - * Adds a message listener that will be called when a message is received by this messaging service implementation. - * - * @param messageListener the message listener - */ - void addMessageListener(MessageListener<M> messageListener); - - /** - * Removes the message listener. - * - * @param messageListener the message listener - */ - void removeMessageListener(MessageListener<M> messageListener); -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingServiceFactory.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingServiceFactory.java deleted file mode 100644 index 9721258c6..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingServiceFactory.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging; - -import java.net.InetSocketAddress; -import java.net.URI; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.client.MessagingClient; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.server.MessageServerImpl; - -/** - * A factory class to create a "server" or "client" type Messaging Service. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - * @param <M> the generic type of message to be handled by this messaging service - */ -public class MessagingServiceFactory<M> { - - /** - * Create a web socket server instance and returns to the caller. - * - * @param address the address of the server machine - * @return the messaging service - */ - public MessagingService<M> createServer(final InetSocketAddress address) { - return new MessageServerImpl<>(address); - } - - /** - * Create a web socket client instance and returns to the caller. - * - * @param uri the URI of the server to connect to - * @return an instance of {@link MessagingService} - */ - public MessagingService<M> createClient(final URI uri) { - if (uri == null) { - throw new IllegalArgumentException("URI cannot be null"); - } - return new MessagingClient<>(uri); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java deleted file mode 100644 index 0cdf76ffc..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java +++ /dev/null @@ -1,233 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021 Bell Canada. 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws; - -import com.google.common.eventbus.Subscribe; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.nio.ByteBuffer; -import java.util.List; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingDeque; -import java.util.concurrent.TimeUnit; -import org.onap.policy.apex.core.infrastructure.messaging.MessageHolder; -import org.onap.policy.apex.core.infrastructure.messaging.MessageListener; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlock; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlockHandler; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.RawMessageBlock; -import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class RawMessageHandler handles raw messages being received on a Java web socket and forwards the messages to the - * DataHandler instance that has subscribed to the RawMessageHandler instance. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - * @param <M> the generic type of message being received - */ -public class RawMessageHandler<M> implements WebSocketMessageListener<M>, Runnable { - // The logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(RawMessageHandler.class); - - // Repeated string constants - private static final String RAW_MESSAGE_LISTENING_INTERRUPTED = "raw message listening has been interrupted"; - - // The amount of time to sleep during shutdown for the thread of this message handler to stop - private static final int SHUTDOWN_WAIT_TIME = 10; - - // The timeout to wait between queue poll timeouts in milliseconds - private static final long QUEUE_POLL_TIMEOUT = 50; - - // A queue that temporarily holds message blocks - private final BlockingQueue<MessageBlock<M>> messageBlockQueue = new LinkedBlockingDeque<>(); - - // A queue that temporarily holds message blocks - private final BlockingQueue<String> stringMessageQueue = new LinkedBlockingDeque<>(); - - // Client applications that have subscribed for messages - private final MessageBlockHandler<M> dataHandler = new MessageBlockHandler<>("data-processor"); - - // The thread that the raw message handler is receiving messages on - private Thread thisThread = null; - - /** - * This method is called by the class with which this message listener has been registered. - * - * @param incomingData the data forwarded by the message reception class - */ - @Override - @Subscribe - public void onMessage(final RawMessageBlock incomingData) { - // Sanity check and get incoming data - ByteBuffer dataByteBuffer = null; - if (incomingData != null && incomingData.getMessage() != null) { - dataByteBuffer = incomingData.getMessage(); - } else { - return; - } - - // Read the messages from the web socket and place them on the message queue for handling by - // the queue - // processing thread - - try (final var stream = new ByteArrayInputStream(dataByteBuffer.array()); - final var ois = new ObjectInputStream(stream)) { - @SuppressWarnings("unchecked") - final MessageHolder<M> messageHolder = (MessageHolder<M>) ois.readObject(); - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("message {} recieved from the client {} ", messageHolder, - messageHolder == null ? "Apex Engine " : messageHolder.getSenderHostAddress()); - } - - if (messageHolder != null) { - final List<M> messages = messageHolder.getMessages(); - if (messages != null) { - messageBlockQueue.add(new MessageBlock<>(messages, incomingData.getWebSocket())); - } - } - } catch (final IOException | ClassNotFoundException e) { - LOGGER.error("Failed to process message received"); - LOGGER.catching(e); - } - } - - /** - * This method is called when a string message is received on a web socket and is to be forwarded to a listener. - * - * @param messageString the message string - */ - @Override - @Subscribe - public void onMessage(final String messageString) { - if (messageString == null) { - return; - } - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("message {} recieved from the client {} ", messageString); - } - stringMessageQueue.add(messageString); - } - - /** - * This method is called when a message is received on a web socket and is to be forwarded to a listener. - * - * @param data the message data containing a message - */ - @Override - public void onMessage(final MessageBlock<M> data) { - throw new UnsupportedOperationException("this operation is not supported"); - } - - /** - * This thread monitors the message queue and processes messages as they appear on the queue. - * - * @see java.lang.Runnable#run() - */ - @Override - public void run() { - LOGGER.debug("raw message listening started"); - thisThread = Thread.currentThread(); - - // Run until termination - while (thisThread.isAlive() && !thisThread.isInterrupted()) { - try { - // Read message block messages from the queue and pass it to the data handler - MessageBlock<M> messageBlock = null; - while ((messageBlock = messageBlockQueue.poll(1, TimeUnit.MILLISECONDS)) != null) { - dataHandler.post(messageBlock); - } - - // Read string messages from the queue and pass it to the data handler - String stringMessage = null; - while ((stringMessage = stringMessageQueue.poll(1, TimeUnit.MILLISECONDS)) != null) { - dataHandler.post(stringMessage); - } - - // Wait for new messages - Thread.sleep(QUEUE_POLL_TIMEOUT); - - } catch (final InterruptedException e) { - // restore the interrupt status - Thread.currentThread().interrupt(); - LOGGER.debug(RAW_MESSAGE_LISTENING_INTERRUPTED); - break; - } - } - - LOGGER.debug("raw message listening stopped"); - } - - /** - * Shutdown the message handler. - */ - public void shutdown() { - LOGGER.entry("shutting down raw message listening . . ."); - - // Interrupt the message handling thread - thisThread.interrupt(); - - // Wait for thread shutdown - while (thisThread.isAlive()) { - ThreadUtilities.sleep(SHUTDOWN_WAIT_TIME); - } - - LOGGER.exit("shut down raw message listening"); - } - - /** - * Register a data forwarder to which messages coming in on the web socket will be forwarded. - * - * @param listener The listener to register - */ - @Override - public void registerDataForwarder(final MessageListener<M> listener) { - stateCheck(listener); - dataHandler.registerMessageHandler(listener); - } - - /** - * Unregister a data forwarder that was previously registered on the web socket listener. - * - * @param listener The listener to unregister - */ - @Override - public void unRegisterDataForwarder(final MessageListener<M> listener) { - stateCheck(listener); - dataHandler.unRegisterMessageHandler(listener); - } - - /** - * Sanity check for the listener and data handler. - * - * @param listener the listener to check - */ - private void stateCheck(final MessageListener<M> listener) { - if (listener == null) { - throw new IllegalArgumentException("The listener object cannot be null"); - } - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/WebSocketMessageListener.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/WebSocketMessageListener.java deleted file mode 100644 index 529e887e4..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/WebSocketMessageListener.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws; - -import org.onap.policy.apex.core.infrastructure.messaging.MessageListener; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.RawMessageBlock; - -/** - * The listener interface for receiving webSocketMessage events. The class that is interested in processing a - * webSocketMessage event implements this interface, and the object created with that class is registered with a - * component using the component's addWebSocketMessageListener method. When the webSocketMessage event occurs, that - * object's appropriate method is invoked. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - * @param <M> the generic type - * @see RawMessageBlock - */ -public interface WebSocketMessageListener<M> extends MessageListener<M>, Runnable { - - /** - * This method is called by the class with which this message listener has been registered. - * - * @param incomingData the data forwarded by the message reception class - */ - void onMessage(RawMessageBlock incomingData); - - /** - * Register a data forwarder to which messages coming in on the web socket will be forwarded. - * - * @param listener The listener to register - */ - void registerDataForwarder(MessageListener<M> listener); - - /** - * Unregister a data forwarder that was previously registered on the web socket listener. - * - * @param listener The listener to unregister - */ - void unRegisterDataForwarder(MessageListener<M> listener); -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/InternalMessageBusClient.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/InternalMessageBusClient.java deleted file mode 100644 index ad0dbb5a4..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/InternalMessageBusClient.java +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.client; - -import java.net.URI; -import java.nio.ByteBuffer; -import org.onap.policy.apex.core.infrastructure.messaging.MessageListener; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.RawMessageHandler; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlockHandler; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.RawMessageBlock; -import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class InternalMessageBusClient handles the client side of a web socket and handles the callback mechanism used to - * receive messages on the web socket. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - * @param <M> the generic type of message being handled - */ -abstract class InternalMessageBusClient<M> extends WebSocketClientImpl { - private static final int THREAD_FACTORY_STACK_SIZE = 256; - - // The logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(InternalMessageBusClient.class); - - // Name of the event bus. - private static final String RAW_EVENT_BUS = "Raw-Event-Bus"; - - // This instance handles the raw data received from the web socket - private final RawMessageHandler<M> rawMessageHandler = new RawMessageHandler<>(); - - // The message block handler to which to pass messages coming in on this client - private MessageBlockHandler<M> messageBlockHandler = null; - - // The raw message handler uses a thread to process incoming events off a queue, this class owns and controls that - // thread. These fields hold the thread and - // the thread factory for creating threads. - private ApplicationThreadFactory threadFactory = - new ApplicationThreadFactory("ws-client-thread", THREAD_FACTORY_STACK_SIZE); - private Thread forwarderThread = null; - - /** - * Construct the class and start the forwarding thread for received messages. - * - * @param serverUri the server URI to connect to - */ - InternalMessageBusClient(final URI serverUri) { - // Call the super class to create the web socket - super(serverUri); - LOGGER.entry(serverUri.toString()); - - // Create the data handler for forwarding messages - messageBlockHandler = new MessageBlockHandler<>(RAW_EVENT_BUS); - messageBlockHandler.registerMessageHandler(rawMessageHandler); - - // Create the thread that manages the queue in the data handler - forwarderThread = threadFactory.newThread(rawMessageHandler); - forwarderThread.start(); - - LOGGER.exit(); - } - - /** - * Callback for binary messages received from the remote host. - * - * @param rawMessage the received raw message - * @see org.java_websocket.client.WebSocketClient#onMessage(java.nio.ByteBuffer) - */ - @Override - public void onMessage(final ByteBuffer rawMessage) { - // Post the message to the data handler for forwarding to its listeners - messageBlockHandler.post(new RawMessageBlock(rawMessage, null)); - } - - /** - * Callback for binary messages received from the remote host. - * - * @param stringMessage the string message - * @see org.java_websocket.client.WebSocketClient#onMessage(java.lang.String) - */ - @Override - public final void onMessage(final String stringMessage) { - messageBlockHandler.post(stringMessage); - } - - /** - * Register a subscriber class to the raw message handler. - * - * @param listener a simple class, that listens for the events from Event - */ - public void addMessageListener(final MessageListener<M> listener) { - rawMessageHandler.registerDataForwarder(listener); - } - - /** - * Removes the message listener. - * - * @param listener the listener - */ - public void removeMessageListener(final MessageListener<M> listener) { - rawMessageHandler.unRegisterDataForwarder(listener); - } - - /** - * Stop the thread handling message forwarding. - */ - protected void stopListener() { - rawMessageHandler.shutdown(); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/MessagingClient.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/MessagingClient.java deleted file mode 100644 index 0615837af..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/MessagingClient.java +++ /dev/null @@ -1,154 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. - * ================================================================================ - * 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.client; - -import java.net.URI; -import org.java_websocket.WebSocket; -import org.onap.policy.apex.core.infrastructure.messaging.MessageHolder; -import org.onap.policy.apex.core.infrastructure.messaging.MessagingService; -import org.onap.policy.apex.core.infrastructure.messaging.util.MessagingUtils; -import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; - -/** - * The Class MessagingClient is the class that wraps web socket handling, message sending, and - * message reception on the client side of a web socket in Apex. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - * @param <M> the generic type - */ -public class MessagingClient<M> extends InternalMessageBusClient<M> implements MessagingService<M> { - // The length of time to wait for a connection to a web socket server before aborting - private static final int CONNECTION_TIMEOUT_TIME_MS = 3000; - - // The length of time to wait before checking if a connection to a web socket server has worked - // or not - private static final int CONNECTION_TRY_INTERVAL_MS = 100; - - /** - * Constructor of this class, uses its {@link InternalMessageBusClient} superclass to set up the - * web socket and handle incoming message forwarding. - * - * @param serverUri The URI of the service - */ - public MessagingClient(final URI serverUri) { - // Call the super class to create the web socket and set up received message forwarding - super(serverUri); - } - - /** - * {@inheritDoc}. - */ - @Override - public void stopConnection() { - // Stop message reception in the super class - super.stopListener(); - - // Close the web socket - final WebSocket connection = super.getConnection(); - if (connection != null && connection.isOpen()) { - connection.closeConnection(0, ""); - } - this.close(); - } - - /** - * {@inheritDoc}. - */ - @Override - public void startConnection() { - // Open the web socket - final WebSocket connection = super.getConnection(); - - if (connection == null) { - throw new IllegalStateException("Could not connect to the server"); - } - if (!connection.isOpen()) { - connect(); - } - - if (!waitforConnection(connection)) { - throw new IllegalStateException("Could not connect to the server"); - } - } - - /** - * This method waits for the timeout value for the client to connect to the web socket server. - * - * @param connection the connection to wait on - * @return true, if successful - */ - private boolean waitforConnection(final WebSocket connection) { - // The total time we have before timeout - int timeoutMsCounter = CONNECTION_TIMEOUT_TIME_MS; - - // Check the connection state - do { - switch (connection.getReadyState()) { - case NOT_YET_CONNECTED: - case CLOSING: - // Not connected yet so wait for the try interval - ThreadUtilities.sleep(CONNECTION_TRY_INTERVAL_MS); - timeoutMsCounter -= CONNECTION_TRY_INTERVAL_MS; - break; - case OPEN: - // Connection is open, happy days - return true; - case CLOSED: - // Connection is closed, bah - return false; - default: - break; - } - } while (timeoutMsCounter > 0); - // While the timeout value has not expired - - // We have timed out - return false; - } - - /** - * {@inheritDoc}. - */ - @Override - public void send(final MessageHolder<M> commands) { - // Get the connection and send the message - final WebSocket connection = super.getConnection(); - connection.send(MessagingUtils.serializeObject(commands)); - } - - /** - * {@inheritDoc}. - */ - @Override - public void send(final String messageString) { - final WebSocket connection = super.getConnection(); - connection.send(messageString); - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean isStarted() { - return getConnection().isOpen(); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/WebSocketClientImpl.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/WebSocketClientImpl.java deleted file mode 100644 index 69609aefc..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/WebSocketClientImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.client; - -import java.net.URI; -import org.java_websocket.client.WebSocketClient; -import org.java_websocket.handshake.ServerHandshake; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * This class implements {@link WebSocketClient} specific methods in order to act as a Java Web Socket client. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - */ -abstract class WebSocketClientImpl extends WebSocketClient { - // The logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(WebSocketClientImpl.class); - - /** - * Constructs a WebSocketClient instance and sets it to the connect to the specified URI. The channel does not - * attempt to connect automatically. You must call {@link connect} first to initiate the socket connection. - * - * @param serverUri the URI of the web socket server to connect to - */ - WebSocketClientImpl(final URI serverUri) { - super(serverUri); - } - - /** - * {@inheritDoc}. - */ - @Override - public void onOpen(final ServerHandshake handshakedata) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Connection opened to server {} --> {}", this.getURI(), handshakedata.getHttpStatusMessage()); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public void onClose(final int code, final String reason, final boolean remote) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Connection closed to server {} --> code \"{}\", reason \"{}\"", this.getURI(), code, reason); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public void onError(final Exception ex) { - LOGGER.info("Failed to make a connection to the server {} ", getURI()); - LOGGER.catching(ex); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/package-info.java deleted file mode 100644 index d5344fe14..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -/** - * Provides the client side of messaging over web sockets. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.client; diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java deleted file mode 100644 index 75e82a0d2..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock; - -import java.util.List; -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.java_websocket.WebSocket; - -/** - * This class encapsulate messages and the web socket on which they are handled. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - * @param <M> the generic type of message being handled - */ -@Getter -@AllArgsConstructor -public final class MessageBlock<M> { - - // List of Messages received on a web socket - private final List<M> messages; - - // The web socket on which the messages are handled - private final WebSocket webSocket; -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java deleted file mode 100644 index 0349cb548..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock; - -import com.google.common.eventbus.EventBus; -import org.onap.policy.apex.core.infrastructure.messaging.MessageListener; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * This class is used to pass messages received on a Java web socket to listening application class instances using an - * event bus. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - * @param <M> the generic type - */ -public class MessageBlockHandler<M> { - // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(MessageBlockHandler.class); - - /** - * This event bus will forward the events to all of its subscribers. - */ - private EventBus eventBus = null; - - /** - * Instantiates a new data handler. - * - * @param eventBusName the name of the event bus for this message block handler - */ - public MessageBlockHandler(final String eventBusName) { - eventBus = new EventBus(eventBusName); - LOGGER.trace("message bus {} created ", eventBusName); - } - - /** - * Post a raw message block on the data handler event bus of this class. - * - * @param rawMessageBlock the block containing raw messages - */ - public void post(final RawMessageBlock rawMessageBlock) { - if (rawMessageBlock.getMessage() != null) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("new raw message recieved from {}", rawMessageBlock.getWebSocket() == null ? "server" - : rawMessageBlock.getWebSocket().getRemoteSocketAddress().getHostName()); - } - eventBus.post(rawMessageBlock); - } - } - - /** - * Post a block of typed messages on the data handler event bus of this class. - * - * @param messageBlock the block containing typed messages - */ - public void post(final MessageBlock<M> messageBlock) { - if (messageBlock.getMessages() != null) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("new data message recieved from {}", messageBlock.getWebSocket() == null ? "server" - : messageBlock.getWebSocket().getRemoteSocketAddress().getHostName()); - } - eventBus.post(messageBlock); - } - } - - /** - * Post a string message on the data handler event bus of this class. - * - * @param messageString the string message - */ - public void post(final String messageString) { - if (messageString != null) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("new string message recieved from server: {}", messageString); - } - eventBus.post(messageString); - } - } - - /** - * Register a listener to event bus. - * - * @param listener is an instance of WebSocketMessageListener - */ - public void registerMessageHandler(final MessageListener<M> listener) { - LOGGER.entry(listener); - if (listener == null) { - throw new IllegalArgumentException("listener object cannot be null"); - } - eventBus.register(listener); - LOGGER.debug("message listener {} is registered with forwarder", listener); - LOGGER.exit(); - } - - /** - * Remove the listener subscribed to the event bus. - * - * @param listener the listener - */ - public void unRegisterMessageHandler(final MessageListener<M> listener) { - if (listener == null) { - throw new IllegalArgumentException("listener object cannot be null"); - } - LOGGER.entry(listener); - eventBus.unregister(listener); - LOGGER.trace(" message listener {} unregistered from forwarder", listener); - LOGGER.exit(); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/RawMessageBlock.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/RawMessageBlock.java deleted file mode 100644 index e9448abff..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/RawMessageBlock.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock; - -import java.nio.ByteBuffer; -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.java_websocket.WebSocket; - -/** - * A container for a raw message block and the connection on which it is handled. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - */ -@Getter -@AllArgsConstructor -public final class RawMessageBlock { - // The raw message - private final ByteBuffer message; - - // The web socket on which the message is handled - private final WebSocket webSocket; -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/package-info.java deleted file mode 100644 index c01c88aed..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -/** - * Pass blocks of messages on Web Sockets to clients using an event bus. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock; diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/package-info.java deleted file mode 100644 index c8811817b..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -/** - * Provides a Web Service implementation of the Messaging interfaces. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws; diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/InternalMessageBusServer.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/InternalMessageBusServer.java deleted file mode 100644 index 18cdccce3..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/InternalMessageBusServer.java +++ /dev/null @@ -1,131 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.server; - -import java.net.InetSocketAddress; -import java.nio.ByteBuffer; -import org.java_websocket.WebSocket; -import org.onap.policy.apex.core.infrastructure.messaging.MessageListener; -import org.onap.policy.apex.core.infrastructure.messaging.MessagingService; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.RawMessageHandler; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlockHandler; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.RawMessageBlock; -import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class InternalMessageBusServer handles the server side of a web socket and handles the callback mechanism used to - * receive messages on the web socket. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - * @param <M> the generic type - */ -abstract class InternalMessageBusServer<M> extends WebSocketServerImpl implements MessagingService<M> { - // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(InternalMessageBusServer.class); - - private static final int THREAD_FACTORY_STACK_SIZE = 256; - - // Name of the event bus. - private static final String RAW_EVENT_BUS = "Raw-Event-Bus"; - - // This instance handles the raw data received from the web socket - private final RawMessageHandler<M> rawMessageHandler = new RawMessageHandler<>(); - - // The message block handler to which to pass messages coming in on this client - private MessageBlockHandler<M> messageBlockHandler = null; - - // The raw message handler uses a thread to process incoming events off a queue, this class owns and controls that - // thread. These fields hold the thread and - // the thread factory for creating threads. - private ApplicationThreadFactory threadFactory = - new ApplicationThreadFactory("ws-server-thread", THREAD_FACTORY_STACK_SIZE); - private Thread forwarderThread = null; - - /** - * Construct the class and start the forwarding thread for received messages. - * - * @param address the address of the server machine - */ - protected InternalMessageBusServer(final InetSocketAddress address) { - // Call the super class to create the web socket - super(address); - LOGGER.entry(address.getAddress().getHostAddress() + ":" + address.getPort()); - - // Create the data handler for forwarding messages - messageBlockHandler = new MessageBlockHandler<>(RAW_EVENT_BUS); - messageBlockHandler.registerMessageHandler(rawMessageHandler); - - // Create the thread that manages the queue in the data handler - forwarderThread = threadFactory.newThread(rawMessageHandler); - forwarderThread.start(); - - LOGGER.exit(); - } - - /** - * Callback for binary messages received from the remote host. - * - * @param webSocket the web socket on which the raw message was received - * @param rawMessage the received raw message - * @see #onMessage(WebSocket, String) - */ - @Override - public void onMessage(final WebSocket webSocket, final ByteBuffer rawMessage) { - messageBlockHandler.post(new RawMessageBlock(rawMessage, webSocket)); - } - - /** - * {@inheritDoc}. - */ - @Override - public void onMessage(final WebSocket webSocket, final String stringMessage) { - messageBlockHandler.post(stringMessage); - } - - /** - * Register a subscriber class to the raw message handler. - * - * @param subscriber the subscriber - */ - @Override - public void addMessageListener(final MessageListener<M> subscriber) { - rawMessageHandler.registerDataForwarder(subscriber); - } - - /** - * Removes the message listener. - * - * @param subscriber the subscriber - */ - @Override - public void removeMessageListener(final MessageListener<M> subscriber) { - rawMessageHandler.unRegisterDataForwarder(subscriber); - } - - /** - * Stop the thread handling message forwarding. - */ - protected void stopListener() { - rawMessageHandler.shutdown(); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java deleted file mode 100644 index 27ba46c43..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. - * ================================================================================ - * 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.server; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.util.Collection; -import java.util.concurrent.atomic.AtomicBoolean; -import org.java_websocket.WebSocket; -import org.onap.policy.apex.core.infrastructure.messaging.MessageHolder; -import org.onap.policy.apex.core.infrastructure.messaging.util.MessagingUtils; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * A messaging server implementation using web socket. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - * @param <M> the generic type of message being passed - */ -public class MessageServerImpl<M> extends InternalMessageBusServer<M> { - // The logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(MessageServerImpl.class); - - // The Web Socket protocol for URIs and URLs - private static final String PROTOCOL = "ws://"; - - // URI of this server - private final String connectionUri; - - // Indicates if the web socket server is started or not - private final AtomicBoolean isStarted = new AtomicBoolean(false); - - /** - * Instantiates a new web socket messaging server for Apex. - * - * @param address the address of the server machine on which to start the server - */ - public MessageServerImpl(final InetSocketAddress address) { - // Call the super class to create the web socket and set up received message forwarding - super(address); - LOGGER.entry(address); - - // Compose the Web Socket URI - connectionUri = PROTOCOL + address.getHostString() + ":" + address.getPort(); - LOGGER.debug("Server connection URI: {}", connectionUri); - - LOGGER.exit(); - } - - /** - * {@inheritDoc}. - */ - @Override - public void startConnection() { - // Start reception of connections on the web socket - start(); - } - - /** - * {@inheritDoc}. - */ - @Override - public void stopConnection() { - // Stop message listening using our super class - stopListener(); - - // Stop the web socket server - try { - // Close all connections on this web socket server - for (final WebSocket connection : getConnections()) { - connection.closeConnection(0, ""); - } - stop(); - } catch (final IOException ioe) { - LOGGER.catching(ioe); - } catch (final InterruptedException e) { - // restore the interrupt status - Thread.currentThread().interrupt(); - // This can happen in normal operation so ignore - } - isStarted.set(false); - } - - /** - * Return the current connection URI. - * - * @return connection URI - */ - public String getConnectionUrl() { - if (connectionUri == null) { - throw new IllegalStateException("URI not set - The server is not started"); - } - return connectionUri; - } - - /** - * {@inheritDoc}. - */ - @Override - public void send(final MessageHolder<M> message) { - // Send the incoming message to all clients connected to this web socket - final Collection<WebSocket> connections = getConnections(); - for (final WebSocket webSocket : connections) { - webSocket.send(MessagingUtils.serializeObject(message)); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public void send(final String messageString) { - final Collection<WebSocket> connections = getConnections(); - for (final WebSocket webSocket : connections) { - webSocket.send(messageString); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean isStarted() { - return isStarted.get(); - } - - @Override - public void onStart() { - isStarted.set(true); - LOGGER.debug("started deployment server on URI: {}", connectionUri); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/WebSocketServerImpl.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/WebSocketServerImpl.java deleted file mode 100644 index 6eda6e2bc..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/WebSocketServerImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. - * ================================================================================ - * 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.server; - -import java.net.InetSocketAddress; -import org.java_websocket.WebSocket; -import org.java_websocket.handshake.ClientHandshake; -import org.java_websocket.server.WebSocketServer; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * This class is the web socket server specific implementation for Apex. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - */ -abstract class WebSocketServerImpl extends WebSocketServer { - // The logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(MessageServerImpl.class); - - /** - * Constructor of this class. - * - * @param address host address of the local machine. - */ - protected WebSocketServerImpl(final InetSocketAddress address) { - super(address); - LOGGER.entry(address.getAddress().getHostAddress() + ":" + address.getPort()); - LOGGER.exit(); - } - - /** - * {@inheritDoc}. - */ - @Override - public void onOpen(final WebSocket conn, final ClientHandshake handshake) { - LOGGER.entry(conn, handshake); - LOGGER.debug("A client connection opened from machine {}.", - conn.getRemoteSocketAddress().getAddress().getHostAddress()); - LOGGER.exit(); - } - - /** - * {@inheritDoc}. - */ - @Override - public void onClose(final WebSocket conn, final int code, final String reason, final boolean remote) { - LOGGER.entry(conn, code, remote); - LOGGER.debug("A client connection from machine {} closing with code {}.", super.getAddress(), code); - LOGGER.exit(); - } - - /** - * {@inheritDoc}. - */ - @Override - public void onError(final WebSocket conn, final Exception ex) { - // some errors like port binding failed may not be assignable to a specific web socket - LOGGER.error("server error occurred", ex); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/package-info.java deleted file mode 100644 index 0a7235b05..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -/** - * Provides the server side of messaging over web sockets. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - */ - -package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.server; diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/package-info.java deleted file mode 100644 index adb17da04..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -/** - * Provides support for passing messages as POJOs and as strings over Web Sockets. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ - -package org.onap.policy.apex.core.infrastructure.messaging; diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageClient.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageClient.java deleted file mode 100644 index edf9ec03a..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageClient.java +++ /dev/null @@ -1,145 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. - * ================================================================================ - * 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.stringmessaging; - -import com.google.common.eventbus.Subscribe; -import java.net.URI; -import org.onap.policy.apex.core.infrastructure.messaging.MessageListener; -import org.onap.policy.apex.core.infrastructure.messaging.MessagingException; -import org.onap.policy.apex.core.infrastructure.messaging.MessagingService; -import org.onap.policy.apex.core.infrastructure.messaging.MessagingServiceFactory; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlock; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * This class uses a web socket client to send and receive strings over a web socket. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class WsStringMessageClient implements WsStringMessager { - private static final XLogger LOGGER = XLoggerFactory.getXLogger(WsStringMessageClient.class); - - // Repeated string constants - private static final String MESSAGE_PREAMBLE = "web socket event consumer client to \""; - - // Message service factory and the message service itself - private final MessagingServiceFactory<String> factory = new MessagingServiceFactory<>(); - private MessagingService<String> service = null; - - // The listener to use for reception of strings - private WsStringMessageListener wsStringMessageListener; - - // Address of the server - private final String host; - private final int port; - private String uriString; - - /** - * Constructor, define the host and port of the server to connect to. - * - * @param host the host of the server - * @param port the port of the server - */ - public WsStringMessageClient(final String host, final int port) { - this.host = host; - this.port = port; - } - - /** - * {@inheritDoc}. - */ - @Override - public void start(final WsStringMessageListener newWsStringMessageListener) throws MessagingException { - this.wsStringMessageListener = newWsStringMessageListener; - - uriString = "ws://" + host + ":" + port; - String messagePreamble = MESSAGE_PREAMBLE + uriString + "\" "; - LOGGER.entry(messagePreamble + "starting . . ."); - - try { - service = factory.createClient(new URI(uriString)); - service.addMessageListener(new WsStringMessageClientListener()); - service.startConnection(); - } catch (final Exception e) { - String message = messagePreamble + "start failed"; - LOGGER.warn(message, e); - throw new MessagingException(message, e); - } - - LOGGER.exit(messagePreamble + "started"); - } - - /** - * {@inheritDoc}. - */ - @Override - public void stop() { - LOGGER.entry(MESSAGE_PREAMBLE + uriString + "\" stopping . . ."); - service.stopConnection(); - LOGGER.exit(MESSAGE_PREAMBLE + uriString + "\" stopped"); - } - - /** - * {@inheritDoc}. - */ - @Override - public void sendString(final String stringMessage) { - service.send(stringMessage); - - if (LOGGER.isDebugEnabled()) { - String message = "message sent to server: " + stringMessage; - LOGGER.debug(message); - } - } - - /** - * The Class WSStringMessageClientListener. - */ - private class WsStringMessageClientListener implements MessageListener<String> { - /** - * {@inheritDoc}. - */ - @Subscribe - @Override - public void onMessage(final MessageBlock<String> messageBlock) { - throw new UnsupportedOperationException("raw messages are not supported on string message clients"); - } - - /** - * {@inheritDoc}. - */ - @Subscribe - @Override - public void onMessage(final String messageString) { - wsStringMessageListener.receiveString(messageString); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean isStarted() { - return service.isStarted(); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageListener.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageListener.java deleted file mode 100644 index fd8a3a365..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageListener.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.stringmessaging; - -/** - * This interface is used to call back the owner of a String Web socket message server or client. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -@FunctionalInterface -public interface WsStringMessageListener { - - /** - * Receive a string coming off a web socket. - * - * @param stringMessage the string message - */ - void receiveString(String stringMessage); -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageServer.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageServer.java deleted file mode 100644 index 8b6d0c6a8..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageServer.java +++ /dev/null @@ -1,155 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. - * Modifications Copyright (C) 2021 Bell Canada. 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.stringmessaging; - -import com.google.common.eventbus.Subscribe; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.UnknownHostException; -import org.onap.policy.apex.core.infrastructure.messaging.MessageListener; -import org.onap.policy.apex.core.infrastructure.messaging.MessagingException; -import org.onap.policy.apex.core.infrastructure.messaging.MessagingService; -import org.onap.policy.apex.core.infrastructure.messaging.MessagingServiceFactory; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlock; -import org.onap.policy.apex.core.infrastructure.messaging.util.MessagingUtils; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * This class runs a web socket server for sending and receiving of strings over a web socket. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class WsStringMessageServer implements WsStringMessager { - private static final XLogger LOGGER = XLoggerFactory.getXLogger(WsStringMessageServer.class); - - // Message service factory and the message service itself - private final MessagingServiceFactory<String> factory = new MessagingServiceFactory<>(); - private MessagingService<String> service = null; - - // The listener to use for reception of strings - private WsStringMessageListener wsStringMessageListener; - - // Address of the server - private final int port; - - /** - * Constructor, define the port of the server. - * - * @param port the port of the server - */ - public WsStringMessageServer(final int port) { - this.port = port; - } - - /** - * {@inheritDoc}. - */ - @Override - public void start(final WsStringMessageListener newWsStringMessageListener) throws MessagingException { - - LOGGER.entry("web socket event consumer server starting . . ."); - if (LOGGER.isDebugEnabled()) { - var lanaddress = "unknown"; - try { - lanaddress = MessagingUtils.getLocalHostLanAddress().getHostAddress(); - } catch (final UnknownHostException ignore) { - LOGGER.debug("Failed to find name of local address name", ignore); - } - LOGGER.debug("web socket string message server LAN address=" + lanaddress); - var hostaddress = "unknown"; - try { - hostaddress = InetAddress.getLocalHost().getHostAddress(); - } catch (final UnknownHostException ignore) { - LOGGER.debug("Failed to find name of local address", ignore); - } - LOGGER.debug("web socket string message server host address=" + hostaddress); - } - - this.wsStringMessageListener = newWsStringMessageListener; - - try { - service = factory.createServer(new InetSocketAddress(port)); - service.addMessageListener(new WsStringMessageServerListener()); - service.startConnection(); - } catch (final Exception e) { - LOGGER.warn("web socket string message server start failed", e); - throw new MessagingException("web socket string message start failed", e); - } - - LOGGER.exit("web socket string message server started"); - } - - /** - * {@inheritDoc}. - */ - @Override - public void stop() { - LOGGER.entry("web socket string message server stopping . . ."); - service.stopConnection(); - LOGGER.exit("web socket string message server stopped"); - } - - /** - * {@inheritDoc}. - */ - @Override - public void sendString(final String stringMessage) { - service.send(stringMessage); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("server sent message: {}", stringMessage); - } - } - - /** - * The listener for strings coming into the server. - */ - private class WsStringMessageServerListener implements MessageListener<String> { - - /** - * {@inheritDoc}. - */ - @Subscribe - @Override - public void onMessage(final MessageBlock<String> messageBlock) { - throw new UnsupportedOperationException("raw messages are not supported on string message clients"); - } - - /** - * {@inheritDoc}. - */ - @Subscribe - @Override - public void onMessage(final String messageString) { - wsStringMessageListener.receiveString(messageString); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean isStarted() { - return service.isStarted(); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessager.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessager.java deleted file mode 100644 index c6db1ffc7..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessager.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. - * ================================================================================ - * 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.stringmessaging; - -import org.onap.policy.apex.core.infrastructure.messaging.MessagingException; - -/** - * This interface is used to call a String Web socket message server or client to send a string. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public interface WsStringMessager { - - /** - * Start the string message sender. - * - * @param wsStringMessageListener the listener to use for listening for string messages - * @throws MessagingException the messaging exception - */ - void start(WsStringMessageListener wsStringMessageListener) throws MessagingException; - - /** - * Stop the string messaging sender. - */ - void stop(); - - /** - * Send a string on a web socket. - * - * @param stringMessage the string message to send - */ - void sendString(String stringMessage); - - /** - * Check if the string messager is started. - */ - boolean isStarted(); -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/package-info.java deleted file mode 100644 index a8e679c70..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -/** - * Provides string messaging over Web Sockets. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ - -package org.onap.policy.apex.core.infrastructure.messaging.stringmessaging; diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java deleted file mode 100644 index 071a6cfde..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java +++ /dev/null @@ -1,226 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021 Bell Canada. 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging.util; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.Socket; -import java.net.UnknownHostException; -import java.util.Enumeration; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class MessagingUtils is a class with static methods used in IPC messaging for finding free ports, translating - * host names to addresses, serializing objects and flushing object streams. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class MessagingUtils { - // The port number of the lowest user port, ports 0-1023 are system ports - private static final int LOWEST_USER_PORT = 1024; - - /** - * Port number is an unsigned 16-bit integer, so maximum port is 65535. - */ - private static final int MAX_PORT_RANGE = 65535; - - // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(MessagingUtils.class); - - /** - * This method searches the availability of the port, if the requested port not available, this method will throw an - * exception. - * - * @param port the port to check - * @return the port verified as being free - * @throws RuntimeException on port allocation errors - */ - public static int checkPort(final int port) { - LOGGER.entry("Checking availability of port {}", port); - - if (isPortAvailable(port)) { - LOGGER.debug("Port {} is available ", port); - return port; - } - LOGGER.debug("Port {} is not available", port); - throw new IllegalArgumentException("could not allocate requested port: " + port); - } - - /** - * This method searches the availability of the port, if the requested port not available,this method will increment - * the port number and check the availability of that port, this process will continue until it reaches max port - * range which is MAX_PORT_RANGE. - * - * @param port the first port to check - * @return the port that was found - * @throws RuntimeException on port allocation errors - */ - public static int findPort(final int port) { - LOGGER.entry("Checking availability of port {}", port); - - int availablePort = port; - - while (availablePort <= MAX_PORT_RANGE) { - if (isPortAvailable(availablePort)) { - LOGGER.debug("Port {} is available ", availablePort); - return availablePort; - } - LOGGER.debug("Port {} is not available", availablePort); - availablePort++; - } - throw new IllegalArgumentException("could not find free available"); - } - - /** - * Check if port is available or not. - * - * @param port the port to test - * @return true if port is available - */ - public static boolean isPortAvailable(final int port) { - try (final var socket = new Socket("localhost", port)) { - return false; - } catch (final IOException ignoredException) { - LOGGER.trace("Port {} is available", port, ignoredException); - return true; - } - } - - /** - * Returns the local host address. - * - * @return the local host address - * @throws IllegalStateException if the local host's address cannot be found - */ - public static InetAddress getHost() { - try { - return InetAddress.getLocalHost(); - } catch (final UnknownHostException e) { - throw new IllegalStateException(e.getMessage(), e); - } - } - - /** - * This method searches the availability of the port, if the requested port not available,this method will increment - * the port number and check the availability, this process will continue until it find port available. - * - * @param port the first port to check - * @return the port that was found - * @throws RuntimeException on port allocation errors - */ - public static int allocateAddress(final int port) { - if (port < LOWEST_USER_PORT) { - throw new IllegalArgumentException("The port " + port + " is already in use"); - } - return MessagingUtils.findPort(port); - } - - /** - * Get an Internet Address for the local host. - * - * @return an Internet address - * @throws UnknownHostException if the address of the local host cannot be found - */ - public static InetAddress getLocalHostLanAddress() throws UnknownHostException { - try { - InetAddress candidateAddress = null; - // Iterate all NICs (network interface cards)... - for (final Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); ifaces - .hasMoreElements();) { - final NetworkInterface iface = ifaces.nextElement(); - // Iterate all IP addresses assigned to each card... - for (final Enumeration<InetAddress> inetAddrs = iface.getInetAddresses(); inetAddrs - .hasMoreElements();) { - final InetAddress inetAddr = inetAddrs.nextElement(); - if (!inetAddr.isLoopbackAddress()) { - - if (inetAddr.isSiteLocalAddress()) { - // Found non-loopback site-local address. Return it - // immediately... - return inetAddr; - } else if (candidateAddress == null) { - // Found non-loopback address, but not - // necessarily site-local. - // Store it as a candidate to be returned if - // site-local address is not subsequently - // found... - candidateAddress = inetAddr; - // Note that we don't repeatedly assign - // non-loopback non-site-local addresses as - // candidates, - // only the first. For subsequent iterations, - // candidate will be non-null. - } - } - } - } - if (candidateAddress != null) { - // We did not find a site-local address, but we found some other - // non-loopback address. - // Server might have a non-site-local address assigned to its - // NIC (or it might be running - // IPv6 which deprecates the "site-local" concept). - // Return this non-loopback candidate address... - return candidateAddress; - } - // At this point, we did not find a non-loopback address. - // Fall back to returning whatever InetAddress.getLocalHost() - // returns... - final var jdkSuppliedAddress = InetAddress.getLocalHost(); - if (jdkSuppliedAddress == null) { - throw new UnknownHostException("The JDK InetAddress.getLocalHost() method unexpectedly returned null."); - } - return jdkSuppliedAddress; - } catch (final Exception e) { - final var unknownHostException = - new UnknownHostException("Failed to determine LAN address: " + e); - unknownHostException.initCause(e); - throw unknownHostException; - } - } - - /** - * This method serializes the message holder objects. - * - * @param object the object - * @return byte[] - */ - public static byte[] serializeObject(final Object object) { - LOGGER.entry(object.getClass().getName()); - final var bytesOut = new ByteArrayOutputStream(); - try (var oos = new ObjectOutputStream(bytesOut)) { - oos.writeObject(object); - } catch (final IOException e) { - LOGGER.warn("error on object serialization", e); - } - return bytesOut.toByteArray(); - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/package-info.java deleted file mode 100644 index ccb12f2dd..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -/** - * Contains utility classes for messaging using sockets and web sockets. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ - -package org.onap.policy.apex.core.infrastructure.messaging.util; diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/package-info.java deleted file mode 100644 index 8bd0a093f..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -/** - * Provides infrastructure and utility functions for use by other classes and modules in APEX. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ - -package org.onap.policy.apex.core.infrastructure; diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/xml/XPathReader.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/xml/XPathReader.java deleted file mode 100644 index 2f863d0e3..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/xml/XPathReader.java +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. - * Modifications Copyright (C) 2021 Bell Canada. 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.xml; - -import java.io.InputStream; -import javax.xml.XMLConstants; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; -import org.w3c.dom.Document; - -/** - * A generic class for applying the XPATH queries on XML files. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - */ -public class XPathReader { - - // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(XPathReader.class); - - private String xmlFileName = null; - private InputStream xmlStream = null; - private Document xmlDocument; - private XPath xpath; - - /** - * Construct Reader for the file passed in. - * - * @param xmlFileName the xml file name - */ - public XPathReader(final String xmlFileName) { - this.xmlFileName = xmlFileName; - init(); - } - - /** - * Construct Reader for the stream passed in. - * - * @param xmlStream a stream of XML - */ - public XPathReader(final InputStream xmlStream) { - this.xmlStream = xmlStream; - init(); - } - - /** - * Initialise the x-path reader. - */ - private void init() { - try { - LOGGER.info("Initializing XPath reader"); - var df = DocumentBuilderFactory.newInstance(); - df.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - df.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, ""); - df.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, ""); - // Check if this is operating on a file - if (xmlFileName != null) { - xmlDocument = df.newDocumentBuilder().parse(xmlFileName); - } else if (xmlStream != null) { - // Check if this is operating on a stream - xmlDocument = df.newDocumentBuilder().parse(xmlStream); - } else { - // We have an error - LOGGER.error("XPath reader not initialized with either a file or a stream"); - return; - } - - xpath = XPathFactory.newInstance().newXPath(); - LOGGER.info("Initialized XPath reader"); - } catch (final Exception ex) { - LOGGER.error("Error parsing XML file/stream from XPath reading, reason :\n" + ex.getMessage(), ex); - } - } - - /** - * Read items from the file using xpath. - * - * @param expression x-path expression - * @param returnType XML node Set - * @return last node collected - */ - public Object read(final String expression, final QName returnType) { - try { - final var xPathExpression = xpath.compile(expression); - return xPathExpression.evaluate(xmlDocument, returnType); - } catch (final XPathExpressionException ex) { - LOGGER.error("Failed to read XML file for XPath processing, reason:\n" + ex.getMessage(), ex); - return null; - } - } -} diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/xml/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/xml/package-info.java deleted file mode 100644 index 5631bd15c..000000000 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/xml/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -/** - * Provides utility XML classes for use by other classes and modules in APEX. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ - -package org.onap.policy.apex.core.infrastructure.xml; diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtilsTest.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtilsTest.java deleted file mode 100644 index 060dccef3..000000000 --- a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtilsTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (c) 2020 Nordix Foundation. - * ================================================================================ - * 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.java.classes; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.Set; -import java.util.TreeSet; -import org.junit.Test; -import org.mockito.Mockito; - -public class ClassUtilsTest { - - @Test - public void testGetClassNames() throws IOException { - InputStream input = null; - ClassUtils.getClassNames(); - assertEquals(new TreeSet<>(), ClassUtils.processJar(input)); - } - - @Test - public void testProcessFileName() { - assertEquals("testing.txt", ClassUtils.processFileName("testing.txt")); - assertNull(ClassUtils.processFileName(null)); - assertEquals("", ClassUtils.processFileName("/classes/")); - } - - @Test - public void testProcessDir() throws Exception { - File mockFile = Mockito.mock(File.class); - Mockito.when(mockFile.isDirectory()).thenReturn(false); - assertEquals(new TreeSet<>(), ClassUtils.processDir(mockFile, "Here")); - assertEquals(new TreeSet<>(), ClassUtils.processDir(null, "Test")); - Mockito.when(mockFile.isDirectory()).thenReturn(true); - - File mockChildFile = Mockito.mock(File.class); - File[] files = {mockChildFile}; - Mockito.when(mockFile.listFiles()).thenReturn(files); - Mockito.when(mockChildFile.getName()).thenReturn("test.class"); - Mockito.when(mockChildFile.getAbsolutePath()).thenReturn("/test/"); - assertEquals(Set.of(".test."), ClassUtils.processDir(mockFile, "Here")); - Mockito.when(mockChildFile.getName()).thenReturn("test.class"); - assertEquals(Set.of(".test."), ClassUtils.processDir(mockFile, "Here")); - Mockito.when(mockChildFile.getName()).thenReturn("$test.class"); - assertEquals(new TreeSet<>(), ClassUtils.processDir(mockFile, "Here")); - } - -} diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/DummyMessageListener.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/DummyMessageListener.java deleted file mode 100644 index f81394c1c..000000000 --- a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/DummyMessageListener.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging; - -import com.google.common.eventbus.Subscribe; -import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlock; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The listener interface for receiving testMessage events. The class that is interested in processing a testMessage - * event implements this interface, and the object created with that class is registered with a component using the - * component's <code>addTestMessageListener</code> method. When the testMessage event occurs, that object's appropriate - * method is invoked. - * - */ -public abstract class DummyMessageListener implements MessageListener<String> { - - /** The Constant logger. */ - private static final XLogger logger = XLoggerFactory.getXLogger(DummyMessageListener.class); - - /** - * On command. - * - * @param data the data - */ - public abstract void onCommand(MessageBlock<String> data); - - /** - * {@inheritDoc}. - */ - @Subscribe - @Override - public final void onMessage(final MessageBlock<String> data) { - if (data != null) { - if (logger.isDebugEnabled()) { - logger.debug("{} command recieved from machine {} ", data.getMessages().size(), - data.getWebSocket().getRemoteSocketAddress().getHostString()); - } - onCommand(data); - } - } -} diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java deleted file mode 100644 index e5375b770..000000000 --- a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. - * ================================================================================ - * 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging; - -import static org.awaitility.Awaitility.await; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.concurrent.TimeUnit; -import org.junit.Test; -import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageClient; -import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener; -import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageServer; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class EndToEndMessagingTest. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class EndToEndStringMessagingTest { - // Logger for this class - private static final XLogger logger = XLoggerFactory.getXLogger(EndToEndStringMessagingTest.class); - - private WsStringMessageServer server; - private WsStringMessageClient client; - - private boolean finished = false; - - @Test - public void testEndToEndMessaging() throws MessagingException { - logger.debug("end to end messaging test starting . . ."); - server = new WsStringMessageServer(44441); - assertNotNull(server); - server.start(new WsStringServerMessageListener()); - - await().atMost(2, TimeUnit.SECONDS).until(() -> server.isStarted()); - - try { - client = new WsStringMessageClient("localhost", 44441); - assertNotNull(client); - client.start(new WsStringClientMessageListener()); - - client.sendString("Hello, client here"); - - await().atLeast(50, TimeUnit.MILLISECONDS).until(() -> finished); - - } finally { - if (client != null) { - client.stop(); - } - if (server != null) { - server.stop(); - } - - } - logger.debug("end to end messaging test finished"); - } - - private class WsStringServerMessageListener implements WsStringMessageListener { - @Override - public void receiveString(final String stringMessage) { - logger.debug(stringMessage); - assertEquals("Hello, client here", stringMessage); - server.sendString("Hello back from server"); - } - } - - private class WsStringClientMessageListener implements WsStringMessageListener { - @Override - public void receiveString(final String stringMessage) { - logger.debug(stringMessage); - assertEquals("Hello back from server", stringMessage); - finished = true; - } - } -} diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingUtilsTest.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingUtilsTest.java deleted file mode 100644 index 6d5915ce8..000000000 --- a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingUtilsTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (c) 2020 Nordix Foundation. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.UnknownHostException; -import org.junit.Test; -import org.onap.policy.apex.core.infrastructure.messaging.util.MessagingUtils; - -public class MessagingUtilsTest { - - @Test - public void testCheckPort() throws UnknownHostException, IOException { - assertEquals(1, MessagingUtils.checkPort(1)); - assertEquals(1, MessagingUtils.findPort(1)); - } - - @Test(expected = IllegalArgumentException.class) - public void testIllegalArgumentException() { - MessagingUtils.findPort(65536); - } - - @Test - public void testGetHost() throws UnknownHostException { - InetAddress host = InetAddress.getLocalHost(); - assertEquals(host, MessagingUtils.getHost()); - } - - @Test - public void testValidAllocateAddress() throws UnknownHostException { - assertNotNull(MessagingUtils.getLocalHostLanAddress()); - int allocatedPort = MessagingUtils.allocateAddress(3306); - assertTrue(allocatedPort >= 3306 && allocatedPort < 65536); - } - - @Test(expected = IllegalArgumentException.class) - public void testInvalidAllocateAddress() { - MessagingUtils.allocateAddress(1); - } - - @Test - public void testSerializeObject() { - String testString = "Test"; - MessagingUtils.serializeObject(new Object()); - assertNotNull(MessagingUtils.serializeObject(testString)); - } -} diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/StringTestServer.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/StringTestServer.java deleted file mode 100644 index 9cf99feb3..000000000 --- a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/StringTestServer.java +++ /dev/null @@ -1,111 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. - * ================================================================================ - * 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.messaging; - -import static org.junit.Assert.assertNotNull; - -import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener; -import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageServer; -import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; - -/** - * The Class StringTestServer. - */ -public class StringTestServer { - private WsStringMessageServer server; - - /** - * Create a string test server. - * - * @param port port to use - * @param timeToLive time to live - * @throws MessagingException exceptions on messages - */ - public StringTestServer(final int port, long timeToLive) throws MessagingException { - System.out.println("StringTestServer starting on port " + port + " for " + timeToLive + " seconds . . ."); - server = new WsStringMessageServer(port); - assertNotNull(server); - server.start(new WsStringServerMessageListener()); - - System.out.println("StringTestServer started on port " + port + " for " + timeToLive + " seconds"); - - // convert to milliSeconds - ThreadUtilities.sleep(1000 * timeToLive); - - server.stop(); - System.out.println("StringTestServer completed"); - } - - /** - * The listener interface for receiving WSStringServerMessage events. The class that is interested in processing a - * WSStringServerMessage event implements this interface, and the object created with that class is registered with - * a component using the component's <code>addWSStringServerMessageListener</code> method. When the - * WSStringServerMessage event occurs, that object's appropriate method is invoked. - * - * @see WSStringServerMessageEvent - */ - private class WsStringServerMessageListener implements WsStringMessageListener { - - /** - * {@inheritDoc}. - */ - @Override - public void receiveString(final String stringMessage) { - System.out.println("Server received string \"" + stringMessage + "\""); - server.sendString("Server echoing back the message: \"" + stringMessage + "\""); - } - } - - /** - * The main method. - * - * @param args the arguments - * @throws MessagingException the messaging exception - */ - public static void main(final String[] args) throws MessagingException { - if (args.length != 2) { - System.err.println("Usage: StringTestServer port timeToLive"); - return; - } - - int port = 0; - try { - port = Integer.parseInt(args[0]); - } catch (final Exception e) { - System.err.println("Usage: StringTestServer port timeToLive"); - e.printStackTrace(); - return; - } - - long timeToLive = 0; - try { - timeToLive = Long.parseLong(args[1]); - } catch (final Exception e) { - System.err.println("Usage: StringTestServer port timeToLive"); - e.printStackTrace(); - return; - } - - new StringTestServer(port, timeToLive); - - } -} diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/xml/XPathReaderTest.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/xml/XPathReaderTest.java deleted file mode 100644 index a3395ae1f..000000000 --- a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/xml/XPathReaderTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation - * ================================================================================ - * 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========================================================= - */ - -package org.onap.policy.apex.core.infrastructure.xml; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.io.IOException; -import java.net.URL; -import javax.xml.xpath.XPathConstants; -import org.junit.Test; - -public class XPathReaderTest { - - final URL testResource = getClass().getClassLoader().getResource("xmlTestFile.xml"); - - @Test - public void canConstructWithFromFile() { - final XPathReader objectUnderTest = new XPathReader(testResource.getFile()); - assertNotNull(objectUnderTest); - } - - @Test - public void canConstructWithStream() throws IOException { - final XPathReader objectUnderTest = new XPathReader(testResource.openStream()); - assertNotNull(objectUnderTest); - } - - @Test - public void canConstructWithNull() { - final XPathReader objectUnderTest = new XPathReader((String) null); - assertNotNull(objectUnderTest); - } - - @Test - public void canConstructWithInvalidFileName() { - final XPathReader objectUnderTest = new XPathReader(""); - assertNotNull(objectUnderTest); - } - - @Test - public void readReturnsCorrectValueWhenUsingCorrectXpath() throws IOException { - final XPathReader objectUnderTest = new XPathReader(testResource.openStream()); - final String validXPathExpression = "/example/name"; - final Object result = objectUnderTest.read(validXPathExpression, XPathConstants.STRING); - assertEquals("This is my name", result); - } - - @Test - public void readReturnsNullWhenUsingInvalidXpath() throws IOException { - final XPathReader objectUnderTest = new XPathReader(testResource.openStream()); - final String invalidXPathExpression = ""; - assertNull(objectUnderTest.read(invalidXPathExpression, XPathConstants.STRING)); - } - -} diff --git a/core/core-infrastructure/src/test/resources/logback-test.xml b/core/core-infrastructure/src/test/resources/logback-test.xml deleted file mode 100644 index c52f2ded6..000000000 --- a/core/core-infrastructure/src/test/resources/logback-test.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ============LICENSE_START======================================================= - Copyright (C) 2016-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========================================================= ---> - -<configuration> - - <contextName>Apex</contextName> - <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> - <property name="LOG_DIR" value="${java.io.tmpdir}/apex_logging/" /> - - <!-- USE FOR STD OUT ONLY --> - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern> - </encoder> - </appender> - - <root level="INFO"> - <appender-ref ref="STDOUT" /> - </root> - - <logger name="org.infinispan" level="INFO" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="org.apache.zookeeper.ClientCnxn" level="OFF" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <appender name="FILE" class="ch.qos.logback.core.FileAppender"> - <file>${LOG_DIR}/apex.log</file> - <encoder> - <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level - %logger{26} - %msg %n %ex{full}</pattern> - </encoder> - </appender> - - <appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender"> - <file>${LOG_DIR}/apex_ctxt.log</file> - <encoder> - <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level - %logger{26} - %msg %n %ex{full}</pattern> - </encoder> - </appender> - - <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false"> - <appender-ref ref="CTXT_FILE" /> - </logger> - - <logger name="org.onap.policy.apex.core.context" level="INFO" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> -</configuration> diff --git a/core/core-infrastructure/src/test/resources/xmlTestFile.xml b/core/core-infrastructure/src/test/resources/xmlTestFile.xml deleted file mode 100644 index 73359a1d6..000000000 --- a/core/core-infrastructure/src/test/resources/xmlTestFile.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version='1.0'?> -<!-- - ============LICENSE_START======================================================= - Copyright (C) 2020 Nordix Foundation. - ================================================================================ - 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========================================================= ---> -<example> - <name>This is my name</name> -</example> diff --git a/core/core-protocols/pom.xml b/core/core-protocols/pom.xml deleted file mode 100644 index 2110acede..000000000 --- a/core/core-protocols/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ -<!-- - ============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========================================================= ---> -<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.core</groupId> - <artifactId>core</artifactId> - <version>2.7.1-SNAPSHOT</version> - </parent> - - <artifactId>core-protocols</artifactId> - <name>${project.artifactId}</name> - <description>Protocols used to transfer information between components in Apex</description> - - <dependencies> - <dependency> - <groupId>org.onap.policy.apex-pdp.model</groupId> - <artifactId>model</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> -</project> diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Action.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Action.java deleted file mode 100644 index 33679c0e1..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Action.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -package org.onap.policy.apex.core.protocols; - -import java.io.Serializable; - -/** - * This interface is used to enforce a common type on actions in the Apex messasging protocol. Action types the Apex - * messaging protocol supports implement this interface. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - */ -@FunctionalInterface -public interface Action extends Serializable { - /** - * Return a string representation of each action. - * - * @return the action string - */ - String getActionString(); -} diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java deleted file mode 100644 index 005c181a0..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java +++ /dev/null @@ -1,118 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.policy.apex.core.protocols; - -import java.io.Serializable; -import lombok.AccessLevel; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * The Class Message is used to pass protocol messages between Apex components. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - */ -@Getter -@ToString -@EqualsAndHashCode -public abstract class Message implements Serializable { - - // Serialization ID - private static final long serialVersionUID = 2271443377544488309L; - - // Default timeout on server side should be used - private static final int DEFAULT_REPLY_TIMEOUT = -1; - - // The Action or message type of the message - private Action action = null; - - // The artifact key of the artifact to which this message is related - @Getter(AccessLevel.NONE) - private AxArtifactKey targetKey = null; - - // The data of the message - @Setter - private String messageData = null; - - // The timeout time for replies in milliseconds - @Setter - @ToString.Exclude - @EqualsAndHashCode.Exclude - private int replyTimeout = DEFAULT_REPLY_TIMEOUT; - - /** - * Instantiates a new message. - * - * @param action the action or message type of the message - * @param targetKey the artifact key of the artifact to which this message relates - */ - protected Message(final Action action, final AxArtifactKey targetKey) { - this(action, targetKey, null); - } - - /** - * Instantiates a new message. - * - * @param action the action or message type of the message - * @param targetKey the artifact key of the artifact to which this message relates - * @param messageData the message data to deliver - */ - protected Message(final Action action, final AxArtifactKey targetKey, final String messageData) { - this.action = action; - this.targetKey = targetKey; - this.messageData = messageData; - } - - /** - * Append to the message data. - * - * @param newMessageData the message data - */ - public void appendMessageData(final String newMessageData) { - if (this.messageData == null) { - this.messageData = newMessageData; - } else { - this.messageData += newMessageData; - } - } - - /** - * Gets the artifact key of the target of the message. - * - * @return the target - */ - public final AxArtifactKey getTarget() { - return targetKey; - } - - /** - * Gets the artifact key name of the target of the message. - * - * @return the target name - */ - public final String getTargetName() { - return targetKey.getName(); - } -} diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/package-info.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/package-info.java deleted file mode 100644 index fceef33e2..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-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========================================================= - */ - -/** - * Contains protocols that are used for communication in APEX. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ - -package org.onap.policy.apex.core.protocols; diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java deleted file mode 100644 index 876052296..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.policy.apex.core.protocols; - -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; - -/** - * Dummy action for testing. - */ -@Getter -@Setter -@EqualsAndHashCode -@AllArgsConstructor -public class DummyAction implements Action { - private static final long serialVersionUID = 9178856761163651594L; - - private String actionString = "An Action String"; -} diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyMessage.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyMessage.java deleted file mode 100644 index 5e32c00e4..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyMessage.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. - * ================================================================================ - * 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========================================================= - */ - -package org.onap.policy.apex.core.protocols; - -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * A dummy message class for testing. - * - */ -public class DummyMessage extends Message { - private static final long serialVersionUID = 8671295165136561708L; - - public DummyMessage(final Action action, final AxArtifactKey targetKey) { - super(action, targetKey); - } - - public DummyMessage(final Action action, final AxArtifactKey targetKey, final String messageData) { - super(action, targetKey, messageData); - } -} diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTest.java deleted file mode 100644 index 8b19059b5..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.policy.apex.core.protocols; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * Test of the abstract Message class. - */ -public class SupportMessageTest { - - @Test - public void testMessage() { - assertNotNull(new DummyMessage(new DummyAction(null), new AxArtifactKey())); - assertNotNull(new DummyMessage(new DummyAction(null), new AxArtifactKey(), "Message Data")); - - DummyMessage dummyMessage = new DummyMessage(new DummyAction(null), new AxArtifactKey("Target:0.0.1")); - assertEquals(new DummyAction(null), dummyMessage.getAction()); - assertThat(dummyMessage.toString()) - .startsWith("Message(action=org.onap.policy.apex.core.protocols.DummyAction@") - .endsWith("targetKey=AxArtifactKey:(name=Target,version=0.0.1), messageData=null)"); - - dummyMessage.setMessageData("Message Data"); - assertEquals("Message Data", dummyMessage.getMessageData()); - dummyMessage.appendMessageData("\nMore Message Data"); - assertEquals("Message Data\nMore Message Data", dummyMessage.getMessageData()); - dummyMessage.setMessageData(null); - dummyMessage.appendMessageData("\nMore Message Data"); - assertEquals("\nMore Message Data", dummyMessage.getMessageData()); - - dummyMessage.setReplyTimeout(123); - assertEquals(123, dummyMessage.getReplyTimeout()); - assertEquals(new AxArtifactKey("Target:0.0.1"), dummyMessage.getTarget()); - assertEquals("Target", dummyMessage.getTargetName()); - - assertNotEquals(0, dummyMessage.hashCode()); - dummyMessage.setMessageData(null); - assertNotEquals(0, dummyMessage.hashCode()); - dummyMessage = new DummyMessage(null, null, null); - assertNotEquals(0, dummyMessage.hashCode()); - - // disabling sonar because this code tests the equals() method - assertEquals(dummyMessage, dummyMessage); // NOSONAR - assertNotNull(dummyMessage); - - dummyMessage = new DummyMessage(new DummyAction(null), null, null); - DummyMessage otherDummyMessage = new DummyMessage(null, null, null); - assertNotEquals(dummyMessage, otherDummyMessage); - otherDummyMessage = new DummyMessage(new DummyAction(null), null, null); - assertEquals(dummyMessage, otherDummyMessage); - dummyMessage = new DummyMessage(null, null, null); - assertNotEquals(dummyMessage, otherDummyMessage); - otherDummyMessage = new DummyMessage(null, null, null); - assertEquals(dummyMessage, otherDummyMessage); - - dummyMessage = new DummyMessage(null, new AxArtifactKey(), null); - otherDummyMessage = new DummyMessage(null, null, null); - assertNotEquals(dummyMessage, otherDummyMessage); - otherDummyMessage = new DummyMessage(null, new AxArtifactKey(), null); - assertEquals(dummyMessage, otherDummyMessage); - dummyMessage = new DummyMessage(null, null, null); - assertNotEquals(dummyMessage, otherDummyMessage); - otherDummyMessage = new DummyMessage(null, null, null); - assertEquals(dummyMessage, otherDummyMessage); - - dummyMessage = new DummyMessage(null, null, "Message"); - otherDummyMessage = new DummyMessage(null, null, null); - assertNotEquals(dummyMessage, otherDummyMessage); - otherDummyMessage = new DummyMessage(null, null, "Message"); - assertEquals(dummyMessage, otherDummyMessage); - dummyMessage = new DummyMessage(null, null, null); - assertNotEquals(dummyMessage, otherDummyMessage); - otherDummyMessage = new DummyMessage(null, null, null); - assertEquals(dummyMessage, otherDummyMessage); - } -} diff --git a/core/core-protocols/src/test/resources/logback-test.xml b/core/core-protocols/src/test/resources/logback-test.xml deleted file mode 100644 index c52f2ded6..000000000 --- a/core/core-protocols/src/test/resources/logback-test.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ============LICENSE_START======================================================= - Copyright (C) 2016-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========================================================= ---> - -<configuration> - - <contextName>Apex</contextName> - <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> - <property name="LOG_DIR" value="${java.io.tmpdir}/apex_logging/" /> - - <!-- USE FOR STD OUT ONLY --> - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern> - </encoder> - </appender> - - <root level="INFO"> - <appender-ref ref="STDOUT" /> - </root> - - <logger name="org.infinispan" level="INFO" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="org.apache.zookeeper.ClientCnxn" level="OFF" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <appender name="FILE" class="ch.qos.logback.core.FileAppender"> - <file>${LOG_DIR}/apex.log</file> - <encoder> - <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level - %logger{26} - %msg %n %ex{full}</pattern> - </encoder> - </appender> - - <appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender"> - <file>${LOG_DIR}/apex_ctxt.log</file> - <encoder> - <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level - %logger{26} - %msg %n %ex{full}</pattern> - </encoder> - </appender> - - <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false"> - <appender-ref ref="CTXT_FILE" /> - </logger> - - <logger name="org.onap.policy.apex.core.context" level="INFO" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> -</configuration> diff --git a/core/pom.xml b/core/pom.xml index 133527620..f87de9410 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -1,7 +1,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Ericsson. All rights reserved. - Modifications Copyright (C) 2020 Nordix Foundation. + Modifications Copyright (C) 2020,2022 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,14 +28,38 @@ <groupId>org.onap.policy.apex-pdp.core</groupId> <artifactId>core</artifactId> - <packaging>pom</packaging> <name>${project.artifactId}</name> <description>The main core of Apex, deployment independent.</description> - <modules> - <module>core-infrastructure</module> - <module>core-protocols</module> - <module>core-engine</module> - </modules> + <dependencies> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>common-parameters</artifactId> + </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.model</groupId> + <artifactId>model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.context</groupId> + <artifactId>context-management</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <scope>test</scope> + </dependency> + </dependencies> </project> diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java b/core/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java index 3cd283b74..3cd283b74 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameters.java b/core/src/main/java/org/onap/policy/apex/core/engine/EngineParameters.java index 3f8243828..3f8243828 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameters.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/EngineParameters.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java b/core/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java index f7dc5dd0b..f7dc5dd0b 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java b/core/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java index 248110419..248110419 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java b/core/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java index 1fee1971e..1fee1971e 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/package-info.java b/core/src/main/java/org/onap/policy/apex/core/engine/context/package-info.java index 887914ee0..887914ee0 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/package-info.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/context/package-info.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java b/core/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java index 4c4166380..4c4166380 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java b/core/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java index 12ba12665..12ba12665 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java b/core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java index cba2dc9f6..cba2dc9f6 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineFactory.java b/core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineFactory.java index 754181485..754181485 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineFactory.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineFactory.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java b/core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java index 35139bfe4..35139bfe4 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java b/core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java index c173d1f09..c173d1f09 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/package-info.java b/core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/package-info.java index d8e1329e7..d8e1329e7 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/package-info.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/package-info.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/package-info.java b/core/src/main/java/org/onap/policy/apex/core/engine/engine/package-info.java index ac5224d31..ac5224d31 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/package-info.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/engine/package-info.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java b/core/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java index 29802e06d..29802e06d 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnException.java b/core/src/main/java/org/onap/policy/apex/core/engine/event/EnException.java index d9520336b..d9520336b 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnException.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/event/EnException.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java b/core/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java index 99a95cae1..99a95cae1 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/package-info.java b/core/src/main/java/org/onap/policy/apex/core/engine/event/package-info.java index 23d51a41a..23d51a41a 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/package-info.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/event/package-info.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java index 7ebed1d49..7ebed1d49 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/ExecutorFactory.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/ExecutorFactory.java index fb6c7b45e..fb6c7b45e 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/ExecutorFactory.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/ExecutorFactory.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java index 5fb51ca70..5fb51ca70 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java index f490a9849..f490a9849 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java index 6cbc04678..6cbc04678 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java index 535565415..535565415 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java index ed5c0f271..ed5c0f271 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java index fa75db60e..fa75db60e 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java index 3e6d13023..3e6d13023 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java index 75d2aa82f..75d2aa82f 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java index 8a310c616..8a310c616 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java index 12e350390..12e350390 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java index a54252e05..a54252e05 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java index c79e907d9..c79e907d9 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java index 71b5e455e..71b5e455e 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineException.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineException.java index 0b64eb481..0b64eb481 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineException.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineException.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeException.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeException.java index 447c88bf9..447c88bf9 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeException.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeException.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/package-info.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/exception/package-info.java index 1cb433946..1cb433946 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/package-info.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/exception/package-info.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java index 9dc841f48..9dc841f48 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/package-info.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/impl/package-info.java index 66e23e667..66e23e667 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/package-info.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/impl/package-info.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/package-info.java b/core/src/main/java/org/onap/policy/apex/core/engine/executor/package-info.java index 062e1ae49..062e1ae49 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/package-info.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/executor/package-info.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java b/core/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java index ca564ca81..ca564ca81 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/package-info.java b/core/src/main/java/org/onap/policy/apex/core/engine/monitoring/package-info.java index 38834687d..38834687d 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/package-info.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/monitoring/package-info.java diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/package-info.java b/core/src/main/java/org/onap/policy/apex/core/engine/package-info.java index a836cd949..a836cd949 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/package-info.java +++ b/core/src/main/java/org/onap/policy/apex/core/engine/package-info.java diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingException.java b/core/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingException.java index dfaf4629f..dfaf4629f 100644 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingException.java +++ b/core/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingException.java diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ApplicationThreadFactory.java b/core/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ApplicationThreadFactory.java index 9345abaaa..9345abaaa 100644 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ApplicationThreadFactory.java +++ b/core/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ApplicationThreadFactory.java diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java b/core/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java index 58939d622..58939d622 100644 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java +++ b/core/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/package-info.java b/core/src/main/java/org/onap/policy/apex/core/infrastructure/threading/package-info.java index dc0b9ee40..dc0b9ee40 100644 --- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/package-info.java +++ b/core/src/main/java/org/onap/policy/apex/core/infrastructure/threading/package-info.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/EngineParametersTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/EngineParametersTest.java index 5427c3515..5427c3515 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/EngineParametersTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/EngineParametersTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/ExecutorParametersTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/ExecutorParametersTest.java index 784580422..784580422 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/ExecutorParametersTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/ExecutorParametersTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/context/ApexInternalContextTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/context/ApexInternalContextTest.java index 19828f6e2..19828f6e2 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/context/ApexInternalContextTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/context/ApexInternalContextTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java index 3b682acd6..3b682acd6 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummyEnEventListener.java b/core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummyEnEventListener.java index b429295ad..b429295ad 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummyEnEventListener.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummyEnEventListener.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummyListener.java b/core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummyListener.java index 6256ff498..6256ff498 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummyListener.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummyListener.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummySlowEnEventListener.java b/core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummySlowEnEventListener.java index e794a7d04..e794a7d04 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummySlowEnEventListener.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummySlowEnEventListener.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummySmExecutor.java b/core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummySmExecutor.java index df4d9279e..df4d9279e 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummySmExecutor.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummySmExecutor.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/DummyAxKey.java b/core/src/test/java/org/onap/policy/apex/core/engine/event/DummyAxKey.java index eafa7f419..eafa7f419 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/DummyAxKey.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/event/DummyAxKey.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/EnEventTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/event/EnEventTest.java index 49b4f80d2..49b4f80d2 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/EnEventTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/event/EnEventTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/EnExceptionTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/event/EnExceptionTest.java index 5ca49e479..5ca49e479 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/EnExceptionTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/event/EnExceptionTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/EnFieldTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/event/EnFieldTest.java index dbe2fa3c8..dbe2fa3c8 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/EnFieldTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/event/EnFieldTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyFailingTaskExecutor.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/DummyFailingTaskExecutor.java index 4d4fb639f..4d4fb639f 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyFailingTaskExecutor.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/DummyFailingTaskExecutor.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java index e4e3ddf0d..e4e3ddf0d 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java index 8172eefcc..8172eefcc 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java index a5525ac83..a5525ac83 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateExecutorTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/StateExecutorTest.java index f3e12cc1f..f3e12cc1f 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateExecutorTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/StateExecutorTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutorTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutorTest.java index 8f6544497..8f6544497 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutorTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutorTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java index 5d91bd2b3..5d91bd2b3 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java index 4160a9f19..4160a9f19 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutorTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutorTest.java index 613d1ae01..613d1ae01 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutorTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutorTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacadeTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacadeTest.java index 68d478877..68d478877 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacadeTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacadeTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacadeTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacadeTest.java index 9da8ecfad..9da8ecfad 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacadeTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacadeTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java index efb53a682..efb53a682 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContextTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContextTest.java index c540f51ad..c540f51ad 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContextTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContextTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContextTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContextTest.java index 24c504822..24c504822 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContextTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContextTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContextTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContextTest.java index 5857e0513..5857e0513 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContextTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContextTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeExceptionTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeExceptionTest.java index 84f330308..84f330308 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeExceptionTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeExceptionTest.java diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/impl/ExceutorFactoryImplTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/executor/impl/ExceutorFactoryImplTest.java index 5957ff347..5957ff347 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/impl/ExceutorFactoryImplTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/engine/executor/impl/ExceutorFactoryImplTest.java diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/threading/ThreadingTest.java b/core/src/test/java/org/onap/policy/apex/core/infrastructure/threading/ThreadingTest.java index 35ad9386a..35ad9386a 100644 --- a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/threading/ThreadingTest.java +++ b/core/src/test/java/org/onap/policy/apex/core/infrastructure/threading/ThreadingTest.java |