summaryrefslogtreecommitdiffstats
path: root/feature-state-management
diff options
context:
space:
mode:
Diffstat (limited to 'feature-state-management')
-rw-r--r--feature-state-management/.gitignore1
-rw-r--r--feature-state-management/pom.xml127
-rw-r--r--feature-state-management/src/assembly/assemble_zip.xml76
-rw-r--r--feature-state-management/src/main/feature/config/feature-state-management.properties90
-rw-r--r--feature-state-management/src/main/feature/db/statemanagement/sql/18020-statemanagement.upgrade.sql74
-rw-r--r--feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/DbAudit.java228
-rw-r--r--feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/DroolsPdpIntegrityMonitor.java413
-rw-r--r--feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/IntegrityMonitorRestManager.java110
-rw-r--r--feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/RepositoryAudit.java559
-rw-r--r--feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeature.java256
-rw-r--r--feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementProperties.java93
-rw-r--r--feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementPropertiesException.java42
-rw-r--r--feature-state-management/src/main/resources/META-INF/services/org.onap.policy.drools.core.PolicySessionFeatureApi1
-rw-r--r--feature-state-management/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi1
-rw-r--r--feature-state-management/src/main/resources/META-INF/services/org.onap.policy.drools.statemanagement.StateManagementFeatureApi1
-rw-r--r--feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/Audit.java42
-rw-r--r--feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/StateManagementTest.java257
-rw-r--r--feature-state-management/src/test/resources/META-INF/persistence.xml50
-rw-r--r--feature-state-management/src/test/resources/feature-state-management.properties87
-rw-r--r--feature-state-management/src/test/resources/logback-test.xml50
20 files changed, 0 insertions, 2558 deletions
diff --git a/feature-state-management/.gitignore b/feature-state-management/.gitignore
deleted file mode 100644
index b83d2226..00000000
--- a/feature-state-management/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target/
diff --git a/feature-state-management/pom.xml b/feature-state-management/pom.xml
deleted file mode 100644
index a3cf9188..00000000
--- a/feature-state-management/pom.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- feature-state-management
- ================================================================================
- Copyright (C) 2017-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.
- ============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.drools-pdp</groupId>
- <artifactId>drools-pdp</artifactId>
- <version>1.10.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>feature-state-management</artifactId>
-
- <name>feature-state-management</name>
- <description>Separately loadable module for State Management</description>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>zipfile</id>
- <goals>
- <goal>single</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <attach>true</attach>
- <finalName>${project.artifactId}-${project.version}</finalName>
- <descriptors>
- <descriptor>src/assembly/assemble_zip.xml</descriptor>
- </descriptors>
- <appendAssemblyId>false</appendAssemblyId>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <phase>prepare-package</phase>
- <configuration>
- <transitive>false</transitive>
- <outputDirectory>${project.build.directory}/assembly/lib</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- <useRepositoryLayout>false</useRepositoryLayout>
- <addParentPoms>false</addParentPoms>
- <copyPom>false</copyPom>
- <includeScope>runtime</includeScope>
- <excludeTransitive>true</excludeTransitive>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.policy.drools-pdp</groupId>
- <artifactId>policy-core</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-pdp</groupId>
- <artifactId>policy-management</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-pdp</groupId>
- <artifactId>api-state-management</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>eclipselink</artifactId>
- <scope>provided</scope>
- </dependency>
- <!-- Need to pull in to assembly -->
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>integrity-monitor</artifactId>
- <version>${policy.common.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/feature-state-management/src/assembly/assemble_zip.xml b/feature-state-management/src/assembly/assemble_zip.xml
deleted file mode 100644
index f398829d..00000000
--- a/feature-state-management/src/assembly/assemble_zip.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- feature-state-management
- ================================================================================
- Copyright (C) 2017 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.
- ============LICENSE_END=========================================================
- -->
-
-<!-- Defines how we build the .zip file which is our distribution. -->
-
-<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
- <id>feature-state-management</id>
- <formats>
- <format>zip</format>
- </formats>
-
- <!-- we want "system" and related files right at the root level as this
- file is suppose to be unzip on top of a karaf distro. -->
- <includeBaseDirectory>false</includeBaseDirectory>
-
- <fileSets>
- <fileSet>
- <directory>target</directory>
- <outputDirectory>lib/feature</outputDirectory>
- <includes>
- <include>feature-state-management-${project.version}.jar</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>target/assembly/lib</directory>
- <outputDirectory>lib/dependencies</outputDirectory>
- <includes>
- <include>*.jar</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>src/main/feature/config</directory>
- <outputDirectory>config</outputDirectory>
- <fileMode>0644</fileMode>
- <excludes/>
- </fileSet>
- <fileSet>
- <directory>src/main/feature/bin</directory>
- <outputDirectory>bin</outputDirectory>
- <fileMode>0744</fileMode>
- <excludes/>
- </fileSet>
- <fileSet>
- <directory>src/main/feature/db</directory>
- <outputDirectory>db</outputDirectory>
- <fileMode>0744</fileMode>
- <excludes/>
- </fileSet>
- <fileSet>
- <directory>src/main/feature/install</directory>
- <outputDirectory>install</outputDirectory>
- <fileMode>0744</fileMode>
- <excludes/>
- </fileSet>
- </fileSets>
-</assembly>
diff --git a/feature-state-management/src/main/feature/config/feature-state-management.properties b/feature-state-management/src/main/feature/config/feature-state-management.properties
deleted file mode 100644
index da1b5486..00000000
--- a/feature-state-management/src/main/feature/config/feature-state-management.properties
+++ /dev/null
@@ -1,90 +0,0 @@
-###
-# ============LICENSE_START=======================================================
-# feature-state-management
-# ================================================================================
-# Copyright (C) 2017-2019, 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.
-# ============LICENSE_END=========================================================
-###
-
-# DB properties
-eclipselink.target-database=MySQL
-javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver
-javax.persistence.jdbc.url=jdbc:mariadb://${envd:SQL_HOST}:${envd:SQL_PORT:3306}/statemanagement
-javax.persistence.jdbc.user=${envd:SQL_USER}
-javax.persistence.jdbc.password=${envd:SQL_PASSWORD}
-
-# DroolsPDPIntegrityMonitor Properties
-# Test interface host and port defaults may be overwritten here
-http.server.services.TEST.host=0.0.0.0
-http.server.services.TEST.port=9981
-http.server.services.TEST.serialization.provider=org.onap.policy.common.gson.JacksonHandler,org.onap.policy.common.endpoints.http.server.YamlJacksonHandler
-#These properties will default to the following if no other values are provided:
-# http.server.services.TEST.restClasses=org.onap.policy.drools.statemanagement.IntegrityMonitorRestManager
-# http.server.services.TEST.managed=false
-# http.server.services.TEST.swagger=true
-
-#IntegrityMonitor Properties
-
-# Must be unique across the system
-resource.name=pdp1
-# Name of the site in which this node is hosted
-site_name=site1
-# Forward Progress Monitor update interval seconds
-fp_monitor_interval=30
-# Failed counter threshold before failover
-failed_counter_threshold=3
-# Interval between test transactions when no traffic seconds
-test_trans_interval=10
-# Interval between writes of the FPC to the DB seconds
-write_fpc_interval=5
-# Node type Note: Make sure you don't leave any trailing spaces, or you'll get an 'invalid node type' error!
-node_type=pdp_drools
-# Dependency groups are groups of resources upon which a node operational state is dependent upon.
-# Each group is a comma-separated list of resource names and groups are separated by a semicolon. For example:
-# dependency_groups=site_1.astra_1,site_1.astra_2;site_1.brms_1,site_1.brms_2;site_1.logparser_1;site_1.pypdp_1
-dependency_groups=
-# When set to true, dependent health checks are performed by using JMX to invoke test() on the dependent.
-# The default false is to use state checks for health.
-test_via_jmx=true
-# This is the max number of seconds beyond which a non incrementing FPC is considered a failure
-max_fpc_update_interval=120
-# Run the state audit every 60 seconds (60000 ms). The state audit finds stale DB entries in the
-# forwardprogressentity table and marks the node as disabled/failed in the statemanagemententity
-# table. NOTE! It will only run on nodes that have a standbystatus = providingservice.
-# A value of <= 0 will turn off the state audit.
-state_audit_interval_ms=60000
-# The refresh state audit is run every (default) 10 minutes (600000 ms) to clean up any state corruption in the
-# DB statemanagemententity table. It only refreshes the DB state entry for the local node. That is, it does not
-# refresh the state of any other nodes. A value <= 0 will turn the audit off. Any other value will override
-# the default of 600000 ms.
-refresh_state_audit_interval_ms=600000
-
-
-# Repository audit properties
-
-# Assume it's the releaseRepository that needs to be audited,
-# because that's the one BRMGW will publish to.
-repository.audit.id=${env:RELEASE_REPOSITORY_ID}
-repository.audit.url=${env:RELEASE_REPOSITORY_URL}
-repository.audit.username=${env:REPOSITORY_USERNAME}
-repository.audit.password=${env:REPOSITORY_PASSWORD}
-# Flag to control the execution of the subsystemTest for the Nexus Maven repository
-repository.audit.is.active=false
-repository.audit.ignore.errors=true
-
-# DB Audit Properties
-
-# Flag to control the execution of the subsystemTest for the Database
-db.audit.is.active=false
diff --git a/feature-state-management/src/main/feature/db/statemanagement/sql/18020-statemanagement.upgrade.sql b/feature-state-management/src/main/feature/db/statemanagement/sql/18020-statemanagement.upgrade.sql
deleted file mode 100644
index f73f992b..00000000
--- a/feature-state-management/src/main/feature/db/statemanagement/sql/18020-statemanagement.upgrade.sql
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * feature-state-management
- * ================================================================================
- * Copyright (C) 2017 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.
- * ============LICENSE_END=========================================================
- */
-
-set foreign_key_checks=0;
-
-CREATE TABLE if not exists statemanagement.StateManagementEntity
-(
- id int not null auto_increment,
- resourceName varchar(100) not null,
- adminState varchar(20) not null,
- opstate varchar(20) not null,
- availStatus varchar(20),
- standbyStatus varchar(20),
- created_date timestamp not null default current_timestamp,
- modifiedDate timestamp not null,
- primary key(id),
- unique key resource(resourceName)
-);
-
-CREATE TABLE if not exists statemanagement.ResourceRegistrationEntity
-(
- resourceRegistrationId bigint not null auto_increment,
- resourceName varchar(100) not null,
- resourceURL varchar(255) not null,
- site varchar(50),
- nodetype varchar(50),
- created_date timestamp not null default current_timestamp,
- last_updated timestamp not null,
- primary key (resourceRegistrationId),
- unique key resource (resourceName),
- unique key id_resource_url (resourceURL)
-);
-
-CREATE TABLE if not exists statemanagement.ForwardProgressEntity
-(
- forwardProgressId bigint not null auto_increment,
- resourceName varchar(100) not null,
- fpc_count bigint not null,
- created_date timestamp not null default current_timestamp,
- last_updated timestamp not null,
- primary key (forwardProgressId),
- unique key resource_key (resourceName)
-);
-
-CREATE TABLE if not exists statemanagement.sequence
-(
-SEQ_NAME VARCHAR(50) NOT NULL,
-SEQ_COUNT DECIMAL(38,0),
-PRIMARY KEY (SEQ_NAME)
-);
-
--- Will only insert a record if none exists:
-INSERT INTO statemanagement.SEQUENCE (SEQ_NAME,SEQ_COUNT)
-SELECT * FROM (SELECT 'SEQ_GEN',1) AS tmp
-WHERE NOT EXISTS(select SEQ_NAME from statemanagement.SEQUENCE where SEQ_NAME = 'SEQ_GEN') LIMIT 1;
-
-set foreign_key_checks=1; \ No newline at end of file
diff --git a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/DbAudit.java b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/DbAudit.java
deleted file mode 100644
index de378933..00000000
--- a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/DbAudit.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * feature-state-management
- * ================================================================================
- * Copyright (C) 2017-2019, 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.drools.statemanagement;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Properties;
-import java.util.UUID;
-import lombok.Getter;
-import lombok.Setter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** This class audits the database.
- */
-public class DbAudit extends DroolsPdpIntegrityMonitor.AuditBase {
- // get an instance of logger
- private static Logger logger = LoggerFactory.getLogger(DbAudit.class);
- // single global instance of this audit object
- private static final DbAudit instance = new DbAudit();
-
- // This indicates if 'CREATE TABLE IF NOT EXISTS Audit ...' should be
- // invoked -- doing this avoids the need to create the table in advance.
- private static boolean createTableNeeded = true;
-
- @Getter
- @Setter
- private static boolean junit = false;
-
- /** Constructor - set the name to 'Database'. */
- private DbAudit() {
- super("Database");
- }
-
- private static synchronized void setCreateTableNeeded(boolean isNeeded) {
- DbAudit.createTableNeeded = isNeeded;
- }
-
- /**
- * Get the instance.
- *
- * @return the single 'DbAudit' instance. */
- public static DroolsPdpIntegrityMonitor.AuditBase getInstance() {
- return instance;
- }
-
- /**
- * Invoke the audit.
- *
- * @param properties properties to be passed to the audit
- */
- @Override
- public void invoke(Properties properties) {
- logger.debug("Running 'DbAudit.invoke'");
- boolean doCreate = createTableNeeded && !isJunit();
-
- if (!isActive()) {
- logger.info("DbAudit.invoke: exiting because isActive = false");
- return;
- }
-
- // fetch DB properties from properties file -- they are already known
- // to exist, because they were verified by the 'IntegrityMonitor'
- // constructor
- String url = properties.getProperty(StateManagementProperties.DB_URL);
- String user = properties.getProperty(StateManagementProperties.DB_USER);
- String password = properties.getProperty(StateManagementProperties.DB_PWD);
-
- // operation phase currently running -- used to construct an error
- // message, if needed
- String phase = null;
-
- // create connection to DB
- phase = "creating connection";
- logger.debug("DbAudit: Creating connection to {}", url);
- try (var connection = DriverManager.getConnection(url, user, password)) {
-
- // create audit table, if needed
- if (doCreate) {
- phase = "create table";
- createTable(connection);
- }
-
- // insert an entry into the table
- phase = "insert entry";
- var key = UUID.randomUUID().toString();
- insertEntry(connection, key);
-
- phase = "fetch entry";
- findEntry(connection, key);
-
- phase = "delete entry";
- deleteEntry(connection, key);
- } catch (Exception e) {
- String message = "DbAudit: Exception during audit, phase = " + phase;
- logger.error(message, e);
- setResponse(message);
- }
- }
-
- /**
- * Determines if the DbAudit is active, based on properties. Defaults to {@code true}, if not
- * found in the properties.
- *
- * @return {@code true} if DbAudit is active, {@code false} otherwise
- */
- private boolean isActive() {
- String dbAuditIsActive = StateManagementProperties.getProperty("db.audit.is.active");
- logger.debug("DbAudit.invoke: dbAuditIsActive = {}", dbAuditIsActive);
-
- if (dbAuditIsActive != null) {
- try {
- return Boolean.parseBoolean(dbAuditIsActive.trim());
- } catch (NumberFormatException e) {
- logger.warn(
- "DbAudit.invoke: Ignoring invalid property: db.audit.is.active = {}", dbAuditIsActive);
- }
- }
-
- return true;
- }
-
- /**
- * Creates the table.
- *
- * @param connection connection
- * @throws SQLException exception
- */
- private void createTable(Connection connection) throws SQLException {
- logger.info("DbAudit: Creating 'Audit' table, if needed");
- try (PreparedStatement statement =
- connection.prepareStatement(
- "CREATE TABLE IF NOT EXISTS Audit (\n"
- + " name varchar(64) DEFAULT NULL,\n"
- + " UNIQUE KEY name (name)\n"
- + ") DEFAULT CHARSET=latin1;")) {
- statement.execute();
- DbAudit.setCreateTableNeeded(false);
- }
- }
-
- /**
- * Inserts an entry.
- *
- * @param connection connection
- * @param key key
- * @throws SQLException exception
- */
- private void insertEntry(Connection connection, String key) throws SQLException {
- try (PreparedStatement statement =
- connection.prepareStatement("INSERT INTO Audit (name) VALUES (?)")) {
- statement.setString(1, key);
- statement.executeUpdate();
- }
- }
-
- /**
- * Finds an entry.
- *
- * @param connection connection
- * @param key key
- * @throws SQLException exception
- */
- private void findEntry(Connection connection, String key) throws SQLException {
- try (PreparedStatement statement =
- connection.prepareStatement("SELECT name FROM Audit WHERE name = ?")) {
- statement.setString(1, key);
- getEntry(statement, key);
- }
- }
-
- /**
- * Executes the query to determine if the entry exists. Sets the response if it fails.
- *
- * @param statement statement
- * @param key key
- * @throws SQLException exception
- */
- private void getEntry(PreparedStatement statement, String key) throws SQLException {
- try (ResultSet rs = statement.executeQuery()) {
- if (rs.first()) {
- // found entry
- if (logger.isDebugEnabled()) {
- logger.debug("DbAudit: Found key {}", rs.getString(1));
- }
- } else {
- logger.error("DbAudit: can't find newly-created entry with key {}", key);
- setResponse("Can't find newly-created entry");
- }
- }
- }
-
- /**
- * Deletes an entry.
- *
- * @param connection connection
- * @param key key
- * @throws SQLException exception
- */
- private void deleteEntry(Connection connection, String key) throws SQLException {
- try (PreparedStatement statement =
- connection.prepareStatement("DELETE FROM Audit WHERE name = ?")) {
- statement.setString(1, key);
- statement.executeUpdate();
- }
- }
-}
diff --git a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/DroolsPdpIntegrityMonitor.java b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/DroolsPdpIntegrityMonitor.java
deleted file mode 100644
index da94302f..00000000
--- a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/DroolsPdpIntegrityMonitor.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2017-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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.drools.statemanagement;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Properties;
-import lombok.Getter;
-import lombok.Setter;
-import org.onap.policy.common.capabilities.Startable;
-import org.onap.policy.common.endpoints.http.server.HttpServletServer;
-import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
-import org.onap.policy.common.im.IntegrityMonitor;
-import org.onap.policy.common.im.IntegrityMonitorException;
-import org.onap.policy.drools.utils.PropertyUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class extends 'IntegrityMonitor' for use in the 'Drools PDP' virtual machine. The included
- * audits are 'Database' and 'Repository'.
- */
-public class DroolsPdpIntegrityMonitor extends IntegrityMonitor {
-
- private static final String INVALID_PROPERTY_VALUE = "init: property {} does not have the expected value of {}";
-
- // get an instance of logger
- private static final Logger logger = LoggerFactory.getLogger(DroolsPdpIntegrityMonitor.class);
-
- // static global instance
- private static DroolsPdpIntegrityMonitor im = null;
-
- // list of audits to run
- private static final AuditBase[] audits = new AuditBase[] {DbAudit.getInstance(), RepositoryAudit.getInstance()};
-
- private static Properties subsystemTestProperties = null;
-
- private static final String PROPERTIES_NAME = "feature-state-management.properties";
-
- /**
- * Constructor - pass arguments to superclass, but remember properties.
- *
- * @param resourceName unique name of this Integrity Monitor
- * @param consolidatedProperties properties used locally, as well as by 'IntegrityMonitor'
- * @throws IntegrityMonitorException (passed from superclass)
- */
- private DroolsPdpIntegrityMonitor(String resourceName, Properties consolidatedProperties)
- throws IntegrityMonitorException {
- super(resourceName, consolidatedProperties);
- }
-
- private static void missingProperty(String prop) throws IntegrityMonitorException {
- String msg = "init: missing IntegrityMonitor property: ".concat(prop);
- logger.error(msg);
- throw new IntegrityMonitorException(msg);
- }
-
- private static void logPropertyValue(String prop, String val) {
- logger.info("\n\n init: property: {} = {}\n", prop, val);
- }
-
- /**
- * Static initialization -- create Drools Integrity Monitor, and an HTTP server to handle REST
- * 'test' requests.
- *
- * @throws IntegrityMonitorException exception
- */
- public static DroolsPdpIntegrityMonitor init(String configDir) throws IntegrityMonitorException {
-
- logger.info("init: Entering and invoking PropertyUtil.getProperties() on '{}'", configDir);
-
- // read in properties
- var stateManagementProperties = getProperties(configDir);
-
- // fetch and verify definitions of some properties, adding defaults where
- // appropriate
- // (the 'IntegrityMonitor' constructor does some additional verification)
-
- checkPropError(stateManagementProperties, StateManagementProperties.TEST_HOST);
- checkPropError(stateManagementProperties, StateManagementProperties.TEST_PORT);
-
- addDefaultPropError(stateManagementProperties, StateManagementProperties.TEST_SERVICES,
- StateManagementProperties.TEST_SERVICES_DEFAULT);
-
- addDefaultPropError(stateManagementProperties, StateManagementProperties.TEST_REST_CLASSES,
- StateManagementProperties.TEST_REST_CLASSES_DEFAULT);
-
- addDefaultPropWarn(stateManagementProperties, StateManagementProperties.TEST_MANAGED,
- StateManagementProperties.TEST_MANAGED_DEFAULT);
-
- addDefaultPropWarn(stateManagementProperties, StateManagementProperties.TEST_SWAGGER,
- StateManagementProperties.TEST_SWAGGER_DEFAULT);
-
- checkPropError(stateManagementProperties, StateManagementProperties.RESOURCE_NAME);
- checkPropError(stateManagementProperties, StateManagementProperties.FP_MONITOR_INTERVAL);
- checkPropError(stateManagementProperties, StateManagementProperties.FAILED_COUNTER_THRESHOLD);
- checkPropError(stateManagementProperties, StateManagementProperties.TEST_TRANS_INTERVAL);
- checkPropError(stateManagementProperties, StateManagementProperties.WRITE_FPC_INTERVAL);
- checkPropError(stateManagementProperties, StateManagementProperties.SITE_NAME);
- checkPropError(stateManagementProperties, StateManagementProperties.NODE_TYPE);
- checkPropError(stateManagementProperties, StateManagementProperties.DEPENDENCY_GROUPS);
- checkPropError(stateManagementProperties, StateManagementProperties.DB_TYPE);
- checkPropError(stateManagementProperties, StateManagementProperties.DB_DRIVER);
- checkPropError(stateManagementProperties, StateManagementProperties.DB_URL);
- checkPropError(stateManagementProperties, StateManagementProperties.DB_USER);
- checkPropError(stateManagementProperties, StateManagementProperties.DB_PWD);
-
- final String testHost = stateManagementProperties.getProperty(StateManagementProperties.TEST_HOST);
- final String testPort = stateManagementProperties.getProperty(StateManagementProperties.TEST_PORT);
- final String resourceName = stateManagementProperties.getProperty(StateManagementProperties.RESOURCE_NAME);
-
- subsystemTestProperties = stateManagementProperties;
-
- // Now that we've validated the properties, create Drools Integrity Monitor
- // with these properties.
- im = makeMonitor(resourceName, stateManagementProperties);
- logger.info("init: New DroolsPDPIntegrityMonitor instantiated, resourceName = {}", resourceName);
-
- // create http server
- makeRestServer(testHost, testPort, stateManagementProperties);
- logger.info("init: Exiting and returning DroolsPDPIntegrityMonitor");
-
- return im;
- }
-
- /**
- * Makes an Integrity Monitor.
- *
- * @param resourceName unique name of this Integrity Monitor
- * @param properties properties used to configure the Integrity Monitor
- * @return monitor object
- * @throws IntegrityMonitorException exception
- */
- private static DroolsPdpIntegrityMonitor makeMonitor(String resourceName, Properties properties)
- throws IntegrityMonitorException {
-
- try {
- return new DroolsPdpIntegrityMonitor(resourceName, properties);
-
- } catch (Exception e) {
- throw new IntegrityMonitorException(e);
- }
- }
-
- /**
- * Makes a rest server for the Integrity Monitor.
- *
- * @param testHost host name
- * @param testPort port
- * @param properties properties used to configure the rest server
- * @throws IntegrityMonitorException exception
- */
- private static void makeRestServer(String testHost, String testPort, Properties properties)
- throws IntegrityMonitorException {
-
- try {
- logger.info("init: Starting HTTP server, addr= {}:{}", testHost, testPort);
-
- new IntegrityMonitorRestServer(properties);
-
- } catch (Exception e) {
- logger.error("init: Caught Exception attempting to start server on testPort={}", testPort);
- throw new IntegrityMonitorException(e);
- }
- }
-
- /**
- * Gets the properties from the property file.
- *
- * @param configDir directory containing the property file
- * @return the properties
- * @throws IntegrityMonitorException exception
- */
- private static Properties getProperties(String configDir) throws IntegrityMonitorException {
- try {
- return PropertyUtil.getProperties(configDir + "/" + PROPERTIES_NAME);
-
- } catch (IOException e) {
- throw new IntegrityMonitorException(e);
- }
- }
-
- /**
- * Checks that a property is defined.
- *
- * @param props set of properties
- * @param name name of the property to check
- * @throws IntegrityMonitorException exception
- */
- private static void checkPropError(Properties props, String name) throws IntegrityMonitorException {
- String val = props.getProperty(name);
- if (val == null) {
- missingProperty(name);
- }
-
- logPropertyValue(name, val);
- }
-
- /**
- * Checks a property's value to verify that it matches the expected value. If the property is
- * not defined, then it is added to the property set, with the expected value. Logs an error if
- * the property is defined, but does not have the expected value.
- *
- * @param props set of properties
- * @param name name of the property to check
- * @param expected expected/default value
- */
- private static void addDefaultPropError(Properties props, String name, String expected) {
- String val = props.getProperty(name);
- if (val == null) {
- props.setProperty(name, expected);
-
- } else if (!val.equals(expected)) {
- logger.error(INVALID_PROPERTY_VALUE, name, expected);
- }
-
- logPropertyValue(name, val);
- }
-
- /**
- * Checks a property's value to verify that it matches the expected value. If the property is
- * not defined, then it is added to the property set, with the expected value. Logs a warning if
- * the property is defined, but does not have the expected value.
- *
- * @param props set of properties
- * @param name name of the property to check
- * @param dflt expected/default value
- */
- private static void addDefaultPropWarn(Properties props, String name, String dflt) {
- String val = props.getProperty(name);
- if (val == null) {
- props.setProperty(name, dflt);
-
- } else if (!val.equals(dflt)) {
- logger.warn(INVALID_PROPERTY_VALUE, name, dflt);
- }
-
- logPropertyValue(name, val);
- }
-
- /**
- * Run tests (audits) unique to Drools PDP VM (Database + Repository).
- */
- @Override
- public void subsystemTest() throws IntegrityMonitorException {
- logger.info("DroolsPDPIntegrityMonitor.subsystemTest called");
-
- // clear all responses (non-null values indicate an error)
- for (AuditBase audit : audits) {
- audit.setResponse(null);
- }
-
- // invoke all of the audits
- for (AuditBase audit : audits) {
- try {
- // invoke the audit (responses are stored within the audit object)
- audit.invoke(subsystemTestProperties);
- } catch (Exception e) {
- logger.error("{} audit error", audit.getName(), e);
- if (audit.getResponse() == null) {
- // if there is no current response, use the exception message
- audit.setResponse(e.getMessage());
- }
- }
- }
-
- // will contain list of subsystems where the audit failed
- var responseMsg = "";
-
- // Loop through all of the audits, and see which ones have failed.
- // NOTE: response information is stored within the audit objects
- // themselves -- only one can run at a time.
- for (AuditBase audit : audits) {
- String response = audit.getResponse();
- if (response != null) {
- // the audit has failed -- add subsystem and
- // and 'responseValue' with the new information
- responseMsg = responseMsg.concat("\n" + audit.getName() + ": " + response);
- }
- }
-
- if (!responseMsg.isEmpty()) {
- throw new IntegrityMonitorException(responseMsg);
- }
- }
-
- /* ============================================================ */
-
- /**
- * This is the base class for audits invoked in 'subsystemTest'.
- */
- @Getter
- public abstract static class AuditBase {
- // name of the audit
- protected String name;
-
- // non-null indicates the error response
- @Setter
- protected String response;
-
- /**
- * Constructor - initialize the name, and clear the initial response.
- *
- * @param name name of the audit
- */
- protected AuditBase(String name) {
- this.name = name;
- this.response = null;
- }
-
- /**
- * Abstract method to invoke the audit.
- *
- * @param persistenceProperties Used for DB access
- * @throws IntegrityMonitorException passed in by the audit
- */
- abstract void invoke(Properties persistenceProperties) throws IntegrityMonitorException;
- }
-
- public static class IntegrityMonitorRestServer implements Startable {
- protected HttpServletServer server = null;
- protected final Properties integrityMonitorRestServerProperties;
-
- public IntegrityMonitorRestServer(Properties props) {
- this.integrityMonitorRestServerProperties = props;
- this.start();
- }
-
- @Override
- public boolean start() {
- try {
- List<HttpServletServer> servers = HttpServletServerFactoryInstance.getServerFactory()
- .build(integrityMonitorRestServerProperties);
-
- if (!servers.isEmpty()) {
- server = servers.get(0);
-
- waitServerStart();
- }
- } catch (Exception e) {
- logger.error("Exception building servers", e);
- return false;
- }
-
- return true;
- }
-
- private void waitServerStart() {
- try {
- server.waitedStart(5);
- } catch (Exception e) {
- logger.error("Exception waiting for servers to start: ", e);
- Thread.currentThread().interrupt();
- }
- }
-
- @Override
- public boolean stop() {
- try {
- server.stop();
- } catch (Exception e) {
- logger.error("Exception during stop", e);
- }
-
- return true;
- }
-
- @Override
- public void shutdown() {
- this.stop();
- }
-
- @Override
- public synchronized boolean isAlive() {
- return this.integrityMonitorRestServerProperties != null;
- }
- }
-
- /**
- * Returns the instance.
- *
- * @return DroolsPDPIntegrityMonitor object
- * @throws IntegrityMonitorException exception
- */
- public static DroolsPdpIntegrityMonitor getInstance() throws IntegrityMonitorException {
- logger.debug("getInstance() called");
- if (im == null) {
- String msg = "No DroolsPDPIntegrityMonitor instance exists."
- + " Please use the method DroolsPDPIntegrityMonitor init(String configDir)";
- throw new IntegrityMonitorException(msg);
- } else {
- return im;
- }
- }
-}
diff --git a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/IntegrityMonitorRestManager.java b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/IntegrityMonitorRestManager.java
deleted file mode 100644
index 8dd735e6..00000000
--- a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/IntegrityMonitorRestManager.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * feature-state-management
- * ================================================================================
- * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2021 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.drools.statemanagement;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Response;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-@Api(value = "test")
-@Path("/")
-public class IntegrityMonitorRestManager {
- private static Logger logger = LoggerFactory.getLogger(IntegrityMonitorRestManager.class);
- private DroolsPdpIntegrityMonitor im;
-
- /**
- * Test interface for Integrity Monitor.
- *
- * @return Exception message if exception, otherwise empty
- */
- @ApiOperation(
- value = "Test endpoint for integrity monitor",
- notes = "The TEST command is used to request data from a subcomponent "
- + "instance that can be used to determine its operational state. "
- + "A 200/success response status code should be returned if the "
- + "subcomponent instance is functioning properly and able to respond to requests.",
- response = String.class)
- @ApiResponses(value = {
- @ApiResponse(
- code = 200,
- message = "Integrity monitor sanity check passed"),
- @ApiResponse(
- code = 500,
- message = "Integrity monitor sanity check encountered an exception. "
- + "This can indicate operational state disabled or administrative state locked")
- })
- @GET
- @Path("test")
- public Response test() {
- logger.debug("integrity monitor /test accessed");
- // The responses are stored within the audit objects, so we need to
- // invoke the audits and get responses before we handle another
- // request.
- synchronized (IntegrityMonitorRestManager.class) {
- // will include messages associated with subsystem failures
- var body = new StringBuilder();
-
- // 200=SUCCESS, 500=failure
- var responseValue = 200;
-
- if (im == null) {
- try {
- im = DroolsPdpIntegrityMonitor.getInstance();
- } catch (Exception e) {
- logger.error("IntegrityMonitorRestManager: test() interface caught an exception", e);
- body.append("\nException: " + e + "\n");
- responseValue = 500;
- }
- }
-
- if (im != null) {
- try {
- // call 'IntegrityMonitor.evaluateSanity()'
- im.evaluateSanity();
- } catch (Exception e) {
- // this exception isn't coming from one of the audits,
- // because those are caught in 'subsystemTest()'
- logger.error("DroolsPDPIntegrityMonitor.evaluateSanity()", e);
-
- // include exception in HTTP response
- body.append("\nException: " + e + "\n");
- responseValue = 500;
- }
- }
-
- // send response, including the contents of 'body'
- // (which is empty if everything is successful)
- if (responseValue == 200) {
- return Response.status(Response.Status.OK).build();
- } else {
- return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(body.toString()).build();
- }
- }
- }
-}
diff --git a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/RepositoryAudit.java b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/RepositoryAudit.java
deleted file mode 100644
index ecc4acc6..00000000
--- a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/RepositoryAudit.java
+++ /dev/null
@@ -1,559 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * feature-state-management
- * ================================================================================
- * Copyright (C) 2017-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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.drools.statemanagement;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.TimeUnit;
-import java.util.regex.Pattern;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import org.apache.commons.io.FileUtils;
-import org.onap.policy.common.im.IntegrityMonitorException;
-import org.onap.policy.common.utils.resources.DirectoryUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class audits the Maven repository.
- */
-public class RepositoryAudit extends DroolsPdpIntegrityMonitor.AuditBase {
- // timeout in 60 seconds
- private static final long DEFAULT_TIMEOUT = 60;
-
- // get an instance of logger
- private static final Logger logger = LoggerFactory.getLogger(RepositoryAudit.class);
-
- // single global instance of this audit object
- @Getter
- private static RepositoryAudit instance = new RepositoryAudit();
-
- // Regex pattern used to find additional repos in the form "repository(number).id.url"
- private static final Pattern repoPattern = Pattern.compile("(repository([1-9][0-9]*))[.]audit[.]id");
-
- /**
- * Constructor - set the name to 'Repository'.
- */
- private RepositoryAudit() {
- super("Repository");
- }
-
- /**
- * First, get the names of each property from StateManagementProperties. For each property name, check if it is of
- * the form "repository(number).audit.id" If so, we extract the number and determine if there exists another
- * property in the form "repository(number).audit.url" with the same "number". Only the
- * 'repository(number).audit.id' and 'repository(number).audit.url" properties need to be specified. If both 'id'
- * and 'url' properties are found, we add it to our set. InvokeData.getProperty(String, boolean) will determine the
- * other 4 properties: '*.username', '*.password', '*.is.active', and '*.ignore.errors', or use default values.
- *
- * @return set of Integers representing a repository to support
- */
- private static TreeSet<Integer> countAdditionalNexusRepos() {
- TreeSet<Integer> returnIndices = new TreeSet<>();
- var properties = StateManagementProperties.getProperties();
- Set<String> propertyNames = properties.stringPropertyNames();
-
- for (String currName : propertyNames) {
- var matcher = repoPattern.matcher(currName);
-
- if (matcher.matches()) {
- var currRepoNum = Integer.parseInt(matcher.group(2));
- if (propertyNames.contains(matcher.group(1) + ".audit.url")) {
- returnIndices.add(currRepoNum);
- }
- }
- }
- return returnIndices;
- }
-
- /**
- * Invoke the audit.
- *
- * @param properties properties to be passed to the audit
- */
- @Override
- public void invoke(Properties properties) throws IntegrityMonitorException {
- logger.debug("Running 'RepositoryAudit.invoke'");
-
- var data = new InvokeData();
-
- logger.debug("RepositoryAudit.invoke: repoAuditIsActive = {}" + ", repoAuditIgnoreErrors = {}",
- data.repoAuditIsActive, data.repoAuditIgnoreErrors);
-
- data.initIsActive();
-
- if (!data.isActive) {
- logger.info("RepositoryAudit.invoke: exiting because isActive = {}", data.isActive);
- return;
- }
-
- try {
- // Run audit for first nexus repository
- logger.debug("Running read-only audit on first nexus repository: repository");
- runAudit(data);
-
- // set of indices for supported nexus repos (ex: repository2 -> 2)
- // TreeSet is used to maintain order so repos can be audited in numerical
- // order
- TreeSet<Integer> repoIndices = countAdditionalNexusRepos();
- logger.debug("Additional nexus repositories: {}", repoIndices);
-
- // Run audit for remaining 'numNexusRepos' repositories
- for (int index : repoIndices) {
- logger.debug("Running read-only audit on nexus repository = repository{}", index);
-
- data = new InvokeData(index);
- data.initIsActive();
-
- if (data.isActive) {
- runAudit(data);
- }
- }
-
- } catch (IOException e) {
- throw new IntegrityMonitorException(e);
-
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new IntegrityMonitorException(e);
- }
- }
-
- private void runAudit(InvokeData data) throws IOException, InterruptedException {
- data.initIgnoreErrors();
- data.initTimeout();
-
- /*
- * 1) create temporary directory
- */
- data.dir = DirectoryUtils.createTempDirectory("auditRepo");
-
- // nested 'pom.xml' file and 'repo' directory
- final Path pom = data.dir.resolve("pom.xml");
- final Path repo = data.dir.resolve("repo");
-
- /*
- * 2) Create test file, and upload to repository (only if repository information is specified)
- */
- if (data.upload) {
- data.uploadTestFile();
- }
-
- /*
- * 3) create 'pom.xml' file in temporary directory
- */
- data.createPomFile(repo, pom);
-
- /*
- * 4) Invoke external 'mvn' process to do the downloads
- */
-
- // output file = ${dir}/out (this supports step '4a')
- var output = data.dir.resolve("out").toFile();
-
- // invoke process, and wait for response
- int rval = data.runMaven(output);
-
- /*
- * 4a) Check attempted and successful downloads from output file Note: at present, this step just generates log
- * messages, but doesn't do any verification.
- */
- if (rval == 0 && output != null) {
- generateDownloadLogs(output);
- }
-
- /*
- * 5) Check the contents of the directory to make sure the downloads were successful
- */
- data.verifyDownloads(repo);
-
- /*
- * 6) Use 'curl' to delete the uploaded test file (only if repository information is specified)
- */
- if (data.upload) {
- data.deleteUploadedTestFile();
- }
-
- /*
- * 7) Remove the temporary directory
- */
- FileUtils.forceDelete(data.dir.toFile());
- }
-
-
- /**
- * Set the response string to the specified value. Overrides 'setResponse(String value)' from
- * DroolsPdpIntegrityMonitor This method prevents setting a response string that indicates whether the caller should
- * receive an error list from the audit. By NOT setting the response string to a value, this indicates that there
- * are no errors.
- *
- * @param value the new value of the response string (null = no errors)
- */
- @Override
- public void setResponse(String value) {
- // Do nothing, prevent the caller from receiving a list of errors.
- }
-
- private class InvokeData {
- private boolean isActive = true;
-
- // ignore errors by default
- private boolean ignoreErrors = true;
-
- private final String repoAuditIsActive;
- private final String repoAuditIgnoreErrors;
-
- private final String repositoryId;
- private final String repositoryUrl;
- private final String repositoryUsername;
- private final String repositoryPassword;
- private final boolean upload;
-
- // used to incrementally construct response as problems occur
- // (empty = no problems)
- private final StringBuilder response = new StringBuilder();
-
- private long timeoutInSeconds = DEFAULT_TIMEOUT;
-
- private Path dir;
-
- private String groupId = null;
- private String artifactId = null;
- private String version = null;
-
- // artifacts to be downloaded
- private final List<Artifact> artifacts = new LinkedList<>();
-
- // 0 = base repository, 2-n = additional repositories
- private final int index;
-
- public InvokeData() {
- this(0);
- }
-
- public InvokeData(int index) {
- this.index = index;
- repoAuditIsActive = getProperty("audit.is.active", true);
- repoAuditIgnoreErrors = getProperty("audit.ignore.errors", true);
-
- // Fetch repository information from 'IntegrityMonitorProperties'
- repositoryId = getProperty("audit.id", false);
- repositoryUrl = getProperty("audit.url", false);
- repositoryUsername = getProperty("audit.username", true);
- repositoryPassword = getProperty("audit.password", true);
-
- logger.debug("Nexus Repository Information retrieved from 'IntegrityMonitorProperties':");
- logger.debug("repositoryId: {}", repositoryId);
- logger.debug("repositoryUrl: {}", repositoryUrl);
-
- // Setting upload to be false so that files can no longer be created/deleted
- upload = false;
- }
-
- private String getProperty(String property, boolean useDefault) {
- String fullProperty = (index == 0 ? "repository." + property : "repository" + index + "." + property);
- String rval = StateManagementProperties.getProperty(fullProperty);
- if (rval == null && index != 0 && useDefault) {
- rval = StateManagementProperties.getProperty("repository." + property);
- }
- return rval;
- }
-
- public void initIsActive() {
- if (repoAuditIsActive != null) {
- try {
- isActive = Boolean.parseBoolean(repoAuditIsActive.trim());
- } catch (NumberFormatException e) {
- logger.warn("RepositoryAudit.invoke: Ignoring invalid property: repository.audit.is.active = {}",
- repoAuditIsActive);
- }
- }
- if (repositoryId == null || repositoryUrl == null) {
- isActive = false;
- }
- }
-
- public void initIgnoreErrors() {
- if (repoAuditIgnoreErrors != null) {
- try {
- ignoreErrors = Boolean.parseBoolean(repoAuditIgnoreErrors.trim());
- } catch (NumberFormatException e) {
- ignoreErrors = true;
- logger.warn(
- "RepositoryAudit.invoke: Ignoring invalid property: repository.audit.ignore.errors = {}",
- repoAuditIgnoreErrors);
- }
- } else {
- ignoreErrors = true;
- }
- }
-
- public void initTimeout() {
- var timeoutString = getProperty("audit.timeout", true);
- if (timeoutString != null && !timeoutString.isEmpty()) {
- try {
- timeoutInSeconds = Long.valueOf(timeoutString);
- } catch (NumberFormatException e) {
- logger.error("RepositoryAudit: Invalid 'repository.audit.timeout' value: '{}'", timeoutString, e);
- if (!ignoreErrors) {
- response.append("Invalid 'repository.audit.timeout' value: '").append(timeoutString)
- .append("'\n");
- setResponse(response.toString());
- }
- }
- }
- }
-
- private void uploadTestFile() throws IOException, InterruptedException {
- groupId = "org.onap.policy.audit";
- artifactId = "repository-audit";
- version = "0." + System.currentTimeMillis();
-
- if (repositoryUrl.toLowerCase().contains("snapshot")) {
- // use SNAPSHOT version
- version += "-SNAPSHOT";
- }
-
- // create text file to write
- try (var fos = new FileOutputStream(dir.resolve("repository-audit.txt").toFile())) {
- fos.write(version.getBytes());
- }
-
- // try to install file in repository
- if (runProcess(timeoutInSeconds, dir.toFile(), null, "mvn", "deploy:deploy-file",
- "-DrepositoryId=" + repositoryId, "-Durl=" + repositoryUrl, "-Dfile=repository-audit.txt",
- "-DgroupId=" + groupId, "-DartifactId=" + artifactId, "-Dversion=" + version, "-Dpackaging=txt",
- "-DgeneratePom=false") != 0) {
- logger.error("RepositoryAudit: 'mvn deploy:deploy-file' failed");
- if (!ignoreErrors) {
- response.append("'mvn deploy:deploy-file' failed\n");
- setResponse(response.toString());
- }
- } else {
- logger.info("RepositoryAudit: 'mvn deploy:deploy-file succeeded");
-
- // we also want to include this new artifact in the download
- // test (steps 3 and 4)
- artifacts.add(new Artifact(groupId, artifactId, version, "txt"));
- }
- }
-
- private void createPomFile(final Path repo, final Path pom) throws IOException {
-
- artifacts.add(new Artifact("org.apache.maven/maven-embedder/3.2.2"));
-
- var sb = new StringBuilder();
- sb.append(
- "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
- + " xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n"
- + "\n" + " <modelVersion>4.0.0</modelVersion>\n" + " <groupId>empty</groupId>\n"
- + " <artifactId>empty</artifactId>\n" + " <version>1.0-SNAPSHOT</version>\n"
- + " <packaging>pom</packaging>\n" + "\n" + " <build>\n" + " <plugins>\n"
- + " <plugin>\n" + " <groupId>org.apache.maven.plugins</groupId>\n"
- + " <artifactId>maven-dependency-plugin</artifactId>\n"
- + " <version>2.10</version>\n" + " <executions>\n"
- + " <execution>\n" + " <id>copy</id>\n" + " <goals>\n"
- + " <goal>copy</goal>\n" + " </goals>\n"
- + " <configuration>\n" + " <localRepositoryDirectory>")
- .append(repo).append("</localRepositoryDirectory>\n").append(" <artifactItems>\n");
-
- for (Artifact artifact : artifacts) {
- // each artifact results in an 'artifactItem' element
- sb.append(" <artifactItem>\n" + " <groupId>").append(artifact.groupId)
- .append("</groupId>\n" + " <artifactId>").append(artifact.artifactId)
- .append("</artifactId>\n" + " <version>").append(artifact.version)
- .append("</version>\n" + " <type>").append(artifact.type)
- .append("</type>\n" + " </artifactItem>\n");
- }
- sb.append(" </artifactItems>\n" + " </configuration>\n"
- + " </execution>\n" + " </executions>\n" + " </plugin>\n"
- + " </plugins>\n" + " </build>\n" + "</project>\n");
-
- try (var fos = new FileOutputStream(pom.toFile())) {
- fos.write(sb.toString().getBytes());
- }
- }
-
- private int runMaven(File output) throws IOException, InterruptedException {
- int rval = runProcess(timeoutInSeconds, dir.toFile(), output, "mvn", "compile");
- logger.info("RepositoryAudit: 'mvn' return value = {}", rval);
- if (rval != 0) {
- logger.error("RepositoryAudit: 'mvn compile' invocation failed");
- if (!ignoreErrors) {
- response.append("'mvn compile' invocation failed\n");
- setResponse(response.toString());
- }
- }
- return rval;
- }
-
- private void verifyDownloads(final Path repo) {
- for (Artifact artifact : artifacts) {
- if (repo.resolve(artifact.groupId.replace('.', '/')).resolve(artifact.artifactId)
- .resolve(artifact.version)
- .resolve(artifact.artifactId + "-" + artifact.version + "." + artifact.type).toFile()
- .exists()) {
- // artifact exists, as expected
- logger.info("RepositoryAudit: {} : exists", artifact);
- } else {
- // Audit ERROR: artifact download failed for some reason
- logger.error("RepositoryAudit: {}: does not exist", artifact);
- if (!ignoreErrors) {
- response.append("Failed to download artifact: ").append(artifact).append('\n');
- setResponse(response.toString());
- }
- }
- }
- }
-
- private void deleteUploadedTestFile() throws IOException, InterruptedException {
- if (runProcess(timeoutInSeconds, dir.toFile(), null, "curl", "--request", "DELETE", "--user",
- repositoryUsername + ":" + repositoryPassword,
- repositoryUrl + "/" + groupId.replace('.', '/') + "/" + artifactId + "/" + version) != 0) {
- logger.error("RepositoryAudit: delete of uploaded artifact failed");
- if (!ignoreErrors) {
- response.append("delete of uploaded artifact failed\n");
- setResponse(response.toString());
- }
- } else {
- logger.info("RepositoryAudit: delete of uploaded artifact succeeded");
- artifacts.add(new Artifact(groupId, artifactId, version, "txt"));
- }
- }
- }
-
- private void generateDownloadLogs(File output) throws IOException {
- // place output in 'fileContents' (replacing the Return characters
- // with Newline)
- var outputData = new byte[(int) output.length()];
- String fileContents;
- try (var fis = new FileInputStream(output)) {
- //
- // Ideally this should be in a loop or even better use
- // Java 8 nio functionality.
- //
- int bytesRead = fis.read(outputData);
- logger.info("fileContents read {} bytes", bytesRead);
- fileContents = new String(outputData).replace('\r', '\n');
- }
-
- // generate log messages from 'Downloading' and 'Downloaded'
- // messages within the 'mvn' output
- var index = 0;
- while ((index = fileContents.indexOf("\nDown", index)) > 0) {
- index += 5;
- if (fileContents.regionMatches(index, "loading: ", 0, 9)) {
- index += 9;
- int endIndex = fileContents.indexOf('\n', index);
- if (logger.isInfoEnabled()) {
- logger.info("RepositoryAudit: Attempted download: '{}'", fileContents.substring(index, endIndex));
- }
- index = endIndex;
- } else if (fileContents.regionMatches(index, "loaded: ", 0, 8)) {
- index += 8;
- int endIndex = fileContents.indexOf(' ', index);
- if (logger.isInfoEnabled()) {
- logger.info("RepositoryAudit: Successful download: '{}'", fileContents.substring(index, endIndex));
- }
- index = endIndex;
- }
- }
- }
-
- /**
- * Run a process, and wait for the response.
- *
- * @param timeoutInSeconds the number of seconds to wait for the process to terminate
- * @param directory the execution directory of the process (null = current directory)
- * @param stdout the file to contain the standard output (null = discard standard output)
- * @param command command and arguments
- * @return the return value of the process
- * @throws IOException InterruptedException
- */
- static int runProcess(long timeoutInSeconds, File directory, File stdout, String... command)
- throws IOException, InterruptedException {
- var pb = new ProcessBuilder(command);
- if (directory != null) {
- pb.directory(directory);
- }
- if (stdout != null) {
- pb.redirectOutput(stdout);
- }
-
- var process = pb.start();
- if (process.waitFor(timeoutInSeconds, TimeUnit.SECONDS)) {
- // process terminated before the timeout
- return process.exitValue();
- }
-
- // process timed out -- kill it, and return -1
- process.destroyForcibly();
- return -1;
- }
-
- /* ============================================================ */
-
- /**
- * An instance of this class exists for each artifact that we are trying to download.
- */
- @AllArgsConstructor
- static class Artifact {
- String groupId;
- String artifactId;
- String version;
- String type;
-
- /**
- * Constructor - populate an 'Artifact' instance.
- *
- * @param artifact a string of the form: {@code"<groupId>/<artifactId>/<version>[/<type>]"}
- * @throws IllegalArgumentException if 'artifact' has the incorrect format
- */
- Artifact(String artifact) {
- String[] segments = artifact.split("/");
- if (segments.length != 4 && segments.length != 3) {
- throw new IllegalArgumentException("groupId/artifactId/version/type");
- }
- groupId = segments[0];
- artifactId = segments[1];
- version = segments[2];
- type = segments.length == 4 ? segments[3] : "jar";
- }
-
- /**
- * Returns string representation.
- *
- * @return the artifact id in the form: {@code"<groupId>/<artifactId>/<version>/<type>"}
- */
- @Override
- public String toString() {
- return groupId + "/" + artifactId + "/" + version + "/" + type;
- }
- }
-}
diff --git a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeature.java b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeature.java
deleted file mode 100644
index 8f5e4e3c..00000000
--- a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeature.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * feature-state-management
- * ================================================================================
- * Copyright (C) 2017-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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.drools.statemanagement;
-
-import java.io.IOException;
-import org.onap.policy.common.im.AllSeemsWellException;
-import org.onap.policy.common.im.IntegrityMonitorException;
-import org.onap.policy.common.im.StateChangeNotifier;
-import org.onap.policy.common.im.StateManagement;
-import org.onap.policy.common.im.StateManagementException;
-import org.onap.policy.drools.core.PolicySessionFeatureApi;
-import org.onap.policy.drools.features.PolicyEngineFeatureApi;
-import org.onap.policy.drools.utils.PropertyUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * If this feature is supported, there is a single instance of it.
- * It adds persistence to Drools sessions, but it is also intertwined with
- * active/standby state management and IntegrityMonitor. For now, they are
- * all treated as a single feature, but it would be nice to separate them.
- *
- * <p>The bulk of the code here was once in other classes, such as
- * 'PolicyContainer' and 'Main'. It was moved here as part of making this
- * a separate optional feature.
- */
-
-public class StateManagementFeature implements StateManagementFeatureApi,
- PolicySessionFeatureApi, PolicyEngineFeatureApi {
- // get an instance of logger
- private static final Logger logger =
- LoggerFactory.getLogger(StateManagementFeature.class);
-
- private DroolsPdpIntegrityMonitor droolsPdpIntegrityMonitor = null;
- private StateManagement stateManagement = null;
-
- public StateManagementFeature() {
- logger.debug("StateManagementFeature() constructor");
- }
-
- @Override
- public void globalInit(String[] args, String configDir) {
- // Initialization code associated with 'PolicyContainer'
- logger.debug("StateManagementFeature.globalInit({}) entry", configDir);
-
- try {
- droolsPdpIntegrityMonitor = DroolsPdpIntegrityMonitor.init(configDir);
- } catch (Exception e) {
- logger.debug("DroolsPDPIntegrityMonitor initialization exception: ", e);
- logger.error("DroolsPDPIntegrityMonitor.init()", e);
- }
-
- initializeProperties(configDir);
-
- //At this point the DroolsPDPIntegrityMonitor instance must exist. Let's check it.
- try {
- droolsPdpIntegrityMonitor = DroolsPdpIntegrityMonitor.getInstance();
- stateManagement = droolsPdpIntegrityMonitor.getStateManager();
-
- if (stateManagement == null) {
- logger.debug("StateManagementFeature.globalInit(): stateManagement is NULL!");
- } else {
- logger.debug("StateManagementFeature.globalInit(): "
- + "stateManagement.getAdminState(): {}", stateManagement.getAdminState());
- }
- } catch (Exception e1) {
- logger.debug("StateManagementFeature.globalInit(): DroolsPDPIntegrityMonitor"
- + " initialization failed with exception:", e1);
- logger.error("DroolsPDPIntegrityMonitor.init(): StateManagementFeature startup failed "
- + "to get DroolsPDPIntegrityMonitor instance:", e1);
- }
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void addObserver(StateChangeNotifier stateChangeObserver) {
- logger.debug("StateManagementFeature.addObserver() entry\n"
- + "StateManagementFeature.addObserver(): "
- + "stateManagement.getAdminState(): {}", stateManagement.getAdminState());
-
- stateManagement.addObserver(stateChangeObserver);
-
- logger.debug("StateManagementFeature.addObserver() exit");
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String getAdminState() {
- return stateManagement.getAdminState();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String getOpState() {
- return stateManagement.getOpState();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String getAvailStatus() {
- return stateManagement.getAvailStatus();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String getStandbyStatus() {
- return stateManagement.getStandbyStatus();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String getStandbyStatus(String resourceName) {
- return stateManagement.getStandbyStatus(resourceName);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void disableFailed(String resourceName) throws StateManagementException {
- stateManagement.disableFailed(resourceName);
-
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void disableFailed() throws StateManagementException {
- stateManagement.disableFailed();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void promote() throws IntegrityMonitorException {
- stateManagement.promote();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void demote() throws StateManagementException {
- stateManagement.demote();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String getResourceName() {
- return StateManagementProperties.getProperty(StateManagementProperties.NODE_NAME);
- }
-
- /**
- * {@inheritDoc}.
- *
- * @return true if locked or false if failed
- */
- @Override
- public boolean lock() {
- try {
- stateManagement.lock();
- } catch (Exception e) {
- logger.error("StateManagementFeature.lock() failed with exception", e);
- return false;
- }
- return true;
- }
-
- /**
- * {@inheritDoc}.
- *
- * @throws Exception exception
- */
- @Override
- public boolean unlock() {
- try {
- stateManagement.unlock();
- } catch (Exception e) {
- logger.error("StateManagementFeature.unlock() failed with exception", e);
- return false;
- }
- return true;
- }
-
- /**
- * {@inheritDoc}.
- *
- * @throws Exception exception
- */
- @Override
- public boolean isLocked() {
- return StateManagement.LOCKED.equals(stateManagement.getAdminState());
- }
-
- @Override
- public int getSequenceNumber() {
- return StateManagementFeatureApiConstants.SEQ_NUM;
- }
-
- /**
- * Read in the properties and initialize the StateManagementProperties.
- */
- private static void initializeProperties(String configDir) {
- //Get the state management properties
- try {
- var props = PropertyUtil.getProperties(configDir + "/feature-state-management.properties");
- StateManagementProperties.initProperties(props);
- logger.info("initializeProperties: resourceName= {}",
- StateManagementProperties.getProperty(StateManagementProperties.NODE_NAME));
- } catch (IOException e1) {
- logger.error("initializeProperties", e1);
- }
- }
-
- @Override
- public void allSeemsWell(String key, Boolean asw, String msg)
- throws AllSeemsWellException {
-
- droolsPdpIntegrityMonitor.allSeemsWell(key, asw, msg);
-
- }
-}
diff --git a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementProperties.java b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementProperties.java
deleted file mode 100644
index 1582ace0..00000000
--- a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementProperties.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * feature-state-management
- * ================================================================================
- * Copyright (C) 2017-2018, 2020-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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.drools.statemanagement;
-
-import java.util.Properties;
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import org.eclipse.persistence.config.PersistenceUnitProperties;
-import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class StateManagementProperties {
- // get an instance of logger
- private static final Logger logger = LoggerFactory.getLogger(StateManagementProperties.class);
-
- public static final String NODE_NAME = "resource.name";
- public static final String NODE_TYPE = "node_type";
- public static final String SITE_NAME = "site_name";
-
- public static final String DB_DRIVER = PersistenceUnitProperties.JDBC_DRIVER;
- public static final String DB_URL = PersistenceUnitProperties.JDBC_URL;
- public static final String DB_USER = PersistenceUnitProperties.JDBC_USER;
- public static final String DB_PWD = PersistenceUnitProperties.JDBC_PASSWORD;
- public static final String DB_TYPE = PersistenceUnitProperties.TARGET_DATABASE;
-
- public static final String TEST_SERVICES = PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES;
- public static final String TEST_SERVICES_DEFAULT = "TEST";
- public static final String TEST_HOST =
- TEST_SERVICES + "." + TEST_SERVICES_DEFAULT + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX;
- public static final String TEST_PORT =
- TEST_SERVICES + "." + TEST_SERVICES_DEFAULT + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX;
- public static final String TEST_REST_CLASSES =
- TEST_SERVICES + "." + TEST_SERVICES_DEFAULT + PolicyEndPointProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX;
- public static final String TEST_REST_CLASSES_DEFAULT = IntegrityMonitorRestManager.class.getName();
- public static final String TEST_MANAGED =
- TEST_SERVICES + "." + TEST_SERVICES_DEFAULT + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX;
- public static final String TEST_MANAGED_DEFAULT = "false";
- public static final String TEST_SWAGGER =
- TEST_SERVICES + "." + TEST_SERVICES_DEFAULT + PolicyEndPointProperties.PROPERTY_HTTP_SWAGGER_SUFFIX;
- public static final String TEST_SWAGGER_DEFAULT = "true";
- public static final String RESOURCE_NAME = "resource.name";
- public static final String FP_MONITOR_INTERVAL = "fp_monitor_interval";
- public static final String FAILED_COUNTER_THRESHOLD = "failed_counter_threshold";
- public static final String TEST_TRANS_INTERVAL = "test_trans_interval";
- public static final String WRITE_FPC_INTERVAL = "write_fpc_interval";
- public static final String DEPENDENCY_GROUPS = "dependency_groups";
-
- @Getter
- private static Properties properties = null;
-
- /**
- * Initialize the parameter values from the feature-state-management.properties file values.
- *
- * <p>This is designed so that the Properties object is obtained from the
- * feature-state-management.properties file and then is passed to this method to initialize the
- * value of the parameters. This allows the flexibility of JUnit tests using
- * getProperties(filename) to get the properties while runtime methods can use
- * getPropertiesFromClassPath(filename).
- *
- * @param prop properties
- */
- public static void initProperties(Properties prop) {
- logger.info("StateManagementProperties.initProperties(Properties): entry");
- logger.info("\n\nStateManagementProperties.initProperties: Properties = \n{}\n\n", prop);
-
- properties = prop;
- }
-
- public static String getProperty(String key) {
- return properties.getProperty(key);
- }
-}
diff --git a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementPropertiesException.java b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementPropertiesException.java
deleted file mode 100644
index a88bcf25..00000000
--- a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementPropertiesException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Feature-State-Management
- * ================================================================================
- * Copyright (C) 2017-2018 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.drools.statemanagement;
-
-public class StateManagementPropertiesException extends Exception {
- private static final long serialVersionUID = 1L;
-
- public StateManagementPropertiesException() {
- super();
- }
-
- public StateManagementPropertiesException(String message) {
- super(message);
- }
-
- public StateManagementPropertiesException(Throwable cause) {
- super(cause);
- }
-
- public StateManagementPropertiesException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/feature-state-management/src/main/resources/META-INF/services/org.onap.policy.drools.core.PolicySessionFeatureApi b/feature-state-management/src/main/resources/META-INF/services/org.onap.policy.drools.core.PolicySessionFeatureApi
deleted file mode 100644
index 9ffef571..00000000
--- a/feature-state-management/src/main/resources/META-INF/services/org.onap.policy.drools.core.PolicySessionFeatureApi
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.drools.statemanagement.StateManagementFeature \ No newline at end of file
diff --git a/feature-state-management/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi b/feature-state-management/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi
deleted file mode 100644
index 74d0b995..00000000
--- a/feature-state-management/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.drools.statemanagement.StateManagementFeature
diff --git a/feature-state-management/src/main/resources/META-INF/services/org.onap.policy.drools.statemanagement.StateManagementFeatureApi b/feature-state-management/src/main/resources/META-INF/services/org.onap.policy.drools.statemanagement.StateManagementFeatureApi
deleted file mode 100644
index 74d0b995..00000000
--- a/feature-state-management/src/main/resources/META-INF/services/org.onap.policy.drools.statemanagement.StateManagementFeatureApi
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.drools.statemanagement.StateManagementFeature
diff --git a/feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/Audit.java b/feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/Audit.java
deleted file mode 100644
index 37d9d7b8..00000000
--- a/feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/Audit.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Integrity Monitor
- * ================================================================================
- * Copyright (C) 2017-2018 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.drools.statemanagement.test;
-
-import java.io.Serializable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "Audit")
-
-public class Audit implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Id
- @Column(name = "name", length = 64, unique = true)
- private String name;
-
- public Audit() {
- //default constructor
- }
-}
diff --git a/feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/StateManagementTest.java b/feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/StateManagementTest.java
deleted file mode 100644
index 578b6222..00000000
--- a/feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/StateManagementTest.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-persistence
- * ================================================================================
- * Copyright (C) 2017-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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.drools.statemanagement.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.Properties;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.EntityTransaction;
-import javax.persistence.Persistence;
-import javax.ws.rs.core.Response;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.common.im.IntegrityMonitorException;
-import org.onap.policy.common.im.StateManagement;
-import org.onap.policy.drools.core.PolicySessionFeatureApi;
-import org.onap.policy.drools.statemanagement.DbAudit;
-import org.onap.policy.drools.statemanagement.IntegrityMonitorRestManager;
-import org.onap.policy.drools.statemanagement.RepositoryAudit;
-import org.onap.policy.drools.statemanagement.StateManagementFeatureApi;
-import org.onap.policy.drools.statemanagement.StateManagementFeatureApiConstants;
-import org.onap.policy.drools.statemanagement.StateManagementProperties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class StateManagementTest {
-
- // get an instance of logger
- private static Logger logger = LoggerFactory.getLogger(StateManagementTest.class);
-
- private static EntityManagerFactory emf;
- private static EntityManager em;
-
- StateManagementFeatureApi stateManagementFeature;
-
- /**
- * Setup the class.
- * All you need to do here is create an instance of StateManagementFeature class. Then,
- * check it initial state and the state after diableFailed() and promote()
- *
- * @throws Exception exception
- */
- @BeforeClass
- public static void setUpClass() throws Exception {
-
- logger.info("setUpClass: Entering");
-
- String userDir = System.getProperty("user.dir");
- logger.debug("setUpClass: userDir=" + userDir);
- System.setProperty("com.sun.management.jmxremote.port", "9980");
- System.setProperty("com.sun.management.jmxremote.authenticate", "false");
-
- initializeDb();
-
- logger.info("setUpClass: Exiting");
- }
-
- @AfterClass
- public static void tearDownClass() throws Exception {
- em.close();
- emf.close();
- }
-
- @Before
- public void setUp() throws Exception {
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- /*
- * Verifies that StateManagementFeature starts and runs successfully.
- */
-
- //@Ignore
- @Test
- public void testStateManagementOperation() throws Exception {
-
- logger.debug("\n\ntestStateManagementOperation: Entering\n\n");
-
- logger.debug("testStateManagementOperation: Reading StateManagementProperties");
-
- String configDir = "src/test/resources";
-
- DbAudit.setJunit(true);
-
- Properties fsmProperties = new Properties();
- fsmProperties.load(new FileInputStream(new File(
- configDir + "/feature-state-management.properties")));
- String thisPdpId = fsmProperties
- .getProperty(StateManagementProperties.NODE_NAME);
-
- StateManagementFeatureApi stateManagementFeature = null;
- for (StateManagementFeatureApi feature : StateManagementFeatureApiConstants.getImpl().getList()) {
- ((PolicySessionFeatureApi) feature).globalInit(null, configDir);
- stateManagementFeature = feature;
- logger.debug("testStateManagementOperation stateManagementFeature.getResourceName(): "
- + stateManagementFeature.getResourceName());
- break;
- }
- if (stateManagementFeature == null) {
- String msg = "testStateManagementOperation failed to initialize. "
- + "Unable to get instance of StateManagementFeatureApi "
- + "with resourceID: " + thisPdpId;
- logger.error(msg);
- logger.debug(msg);
- }
-
- String admin = stateManagementFeature.getAdminState();
- String oper = stateManagementFeature.getOpState();
- String avail = stateManagementFeature.getAvailStatus();
- String standby = stateManagementFeature.getStandbyStatus();
-
- logger.debug("admin = {}", admin);
- logger.debug("oper = {}", oper);
- logger.debug("avail = {}", avail);
- logger.debug("standby = {}", standby);
-
- assertEquals("Admin state not unlocked after initialization", StateManagement.UNLOCKED, admin);
- assertEquals("Operational state not enabled after initialization", StateManagement.ENABLED, oper);
-
- try {
- stateManagementFeature.disableFailed();
- } catch (Exception e) {
- logger.error(e.getMessage());
- assertTrue(e.getMessage(), false);
- }
-
- admin = stateManagementFeature.getAdminState();
- oper = stateManagementFeature.getOpState();
- avail = stateManagementFeature.getAvailStatus();
- standby = stateManagementFeature.getStandbyStatus();
-
- logger.debug("after disableFailed()");
- logger.debug("admin = {}", admin);
- logger.debug("oper = {}", oper);
- logger.debug("avail = {}", avail);
- logger.debug("standby = {}", standby);
-
- assertEquals("Operational state not disabled after disableFailed()", StateManagement.DISABLED, oper);
- assertEquals("Availability status not failed after disableFailed()", StateManagement.FAILED, avail);
-
-
- try {
- stateManagementFeature.promote();
- } catch (Exception e) {
- logger.debug(e.getMessage());
- }
-
- admin = stateManagementFeature.getAdminState();
- oper = stateManagementFeature.getOpState();
- avail = stateManagementFeature.getAvailStatus();
- standby = stateManagementFeature.getStandbyStatus();
-
- logger.debug("after promote()");
- logger.debug("admin = {}", admin);
- logger.debug("oper = {}", oper);
- logger.debug("avail = {}", avail);
- logger.debug("standby = {}", standby);
-
- assertEquals("Standby status not coldstandby after promote()", StateManagement.COLD_STANDBY, standby);
-
- /* *************Repository Audit Test. ************* */
- logger.debug("\n\ntestStateManagementOperation: Repository Audit\n\n");
- try {
- StateManagementProperties.initProperties(fsmProperties);
- RepositoryAudit repositoryAudit = (RepositoryAudit) RepositoryAudit.getInstance();
- repositoryAudit.invoke(fsmProperties);
-
- //Should not throw an IOException in Linux Foundation env
-
- } catch (IntegrityMonitorException e) {
- //Note: this catch is here because in a local environment mvn will not run in
- //in the temp directory
- logger.debug("testSubsytemTest RepositoryAudit IOException", e);
- }
-
- /* ****************Db Audit Test. ************** */
- logger.debug("\n\ntestStateManagementOperation: DB Audit\n\n");
-
- DbAudit dbAudit = (DbAudit) DbAudit.getInstance();
- dbAudit.invoke(fsmProperties);
-
- /* ************IntegrityMonitorRestManager Test. ************ */
- logger.debug("\n\ntestStateManagementOperation: IntegrityMonitorRestManager\n\n");
- IntegrityMonitorRestManager integrityMonitorRestManager = new IntegrityMonitorRestManager();
-
- Response response = integrityMonitorRestManager.test();
- logger.debug("\n\nIntegrityMonitorRestManager response: " + response.toString());
-
- assertTrue(response.toString().contains("status=500"));
-
- //All done
- logger.debug("\n\ntestStateManagementOperation: Exiting\n\n");
- }
-
- /**
- * This method initializes and cleans the DB so that PDP-D will be able to
- * store fresh records in the DB.
- */
- public static void initializeDb() {
-
- logger.debug("initializeDb: Entering");
-
- Properties cleanProperties = new Properties();
- cleanProperties.put(StateManagementProperties.DB_DRIVER, "org.h2.Driver");
- cleanProperties.put(StateManagementProperties.DB_URL, "jdbc:h2:mem:statemanagement");
- cleanProperties.put(StateManagementProperties.DB_USER, "sa");
- cleanProperties.put(StateManagementProperties.DB_PWD, "");
-
- emf = Persistence.createEntityManagerFactory("junitPU", cleanProperties);
-
- em = emf.createEntityManager();
- // Start a transaction
- EntityTransaction et = em.getTransaction();
-
- et.begin();
-
- // Clean up the DB
- em.createQuery("Delete from StateManagementEntity").executeUpdate();
- em.createQuery("Delete from ForwardProgressEntity").executeUpdate();
- em.createQuery("Delete from ResourceRegistrationEntity").executeUpdate();
-
- // commit transaction
- et.commit();
-
- logger.debug("initializeDb: Exiting");
- }
-}
diff --git a/feature-state-management/src/test/resources/META-INF/persistence.xml b/feature-state-management/src/test/resources/META-INF/persistence.xml
deleted file mode 100644
index c96d8b64..00000000
--- a/feature-state-management/src/test/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- feature-state-management
- ================================================================================
- Copyright (C) 2017-2018, 2020 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.
- ============LICENSE_END=========================================================
- -->
-
-<persistence version="2.1"
- xmlns="http://xmlns.jcp.org/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
-
- <persistence-unit name="junitPU"
- transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.onap.policy.common.im.jpa.StateManagementEntity</class>
- <class>org.onap.policy.common.im.jpa.ForwardProgressEntity</class>
- <class>org.onap.policy.common.im.jpa.ResourceRegistrationEntity</class>
- <class>org.onap.policy.drools.statemanagement.test.Audit</class>
- <properties>
- <property
- name="javax.persistence.schema-generation.database.action"
- value="drop-and-create" />
- <property
- name="javax.persistence.schema-generation.scripts.action"
- value="drop-and-create" />
- <property
- name="javax.persistence.schema-generation.scripts.create-target"
- value="target/classes/META-INF/generatedCreateStateManagement.ddl" />
- <property
- name="javax.persistence.schema-generation.scripts.drop-target"
- value="target/classes/META-INF/generatedDropStateManagement.ddl" />
- </properties>
- </persistence-unit>
-
-</persistence>
diff --git a/feature-state-management/src/test/resources/feature-state-management.properties b/feature-state-management/src/test/resources/feature-state-management.properties
deleted file mode 100644
index ef7b805a..00000000
--- a/feature-state-management/src/test/resources/feature-state-management.properties
+++ /dev/null
@@ -1,87 +0,0 @@
-###
-# ============LICENSE_START=======================================================
-# feature-state-management
-# ================================================================================
-# Copyright (C) 2017, 2020-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.
-# ============LICENSE_END=========================================================
-###
-
-# DB properties
-eclipselink.target-database=Auto
-javax.persistence.jdbc.driver = org.h2.Driver
-javax.persistence.jdbc.url = jdbc:h2:mem:statemanagement
-javax.persistence.jdbc.user = sa
-javax.persistence.jdbc.password =
-
-# DroolsPDPIntegrityMonitor Properties
-#Test interface host and port defaults may be overwritten here
-http.server.services.TEST.host=0.0.0.0
-http.server.services.TEST.port=9981
-#These properties will default to the following if no other values are provided:
-# http.server.services.TEST.restClasses=org.onap.policy.drools.statemanagement.IntegrityMonitorRestManager
-# http.server.services.TEST.managed=false
-# http.server.services.TEST.swagger=true
-
-#IntegrityMonitor Properties
-
-# Must be unique across the system
-resource.name=pdp1
-# Name of the site in which this node is hosted
-site_name = pdp_1
-# Forward Progress Monitor update interval seconds
-fp_monitor_interval = 30
-# Failed counter threshold before failover
-failed_counter_threshold = 3
-# Interval between test transactions when no traffic seconds
-test_trans_interval = 10
-# Interval between writes of the FPC to the DB seconds
-write_fpc_interval = 5
-# Node type Note: Make sure you don't leave any trailing spaces, or you'll get an 'invalid node type' error!
-node_type = pdp_drools
-# Dependency groups are groups of resources upon which a node operational state is dependent upon.
-# Each group is a comma-separated list of resource names and groups are separated by a semicolon. For example:
-# dependency_groups=site_1.astra_1,site_1.astra_2;site_1.brms_1,site_1.brms_2;site_1.logparser_1;site_1.pypdp_1
-dependency_groups=
-# When set to true, dependent health checks are performed by using JMX to invoke test() on the dependent.
-# The default false is to use state checks for health.
-test_via_jmx=true
-# This is the max number of seconds beyond which a non incrementing FPC is considered a failure
-max_fpc_update_interval=120
-# Run the state audit every 60 seconds (60000 ms). The state audit finds stale DB entries in the
-# forwardprogressentity table and marks the node as disabled/failed in the statemanagemententity
-# table. NOTE! It will only run on nodes that have a standbystatus = providingservice.
-# A value of <= 0 will turn off the state audit.
-state_audit_interval_ms=-1000
-# The refresh state audit is run every (default) 10 minutes (600000 ms) to clean up any state corruption in the
-# DB statemanagemententity table. It only refreshes the DB state entry for the local node. That is, it does not
-# refresh the state of any other nodes. A value <= 0 will turn the audit off. Any other value will override
-# the default of 600000 ms.
-refresh_state_audit_interval_ms=-1000
-
-
-# Repository audit properties
-# Flag to control the execution of the subsystemTest for the Nexus Maven repository
-repository.audit.is.active=true
-repository.audit.ignore.errors=true
-# Timeout in seconds
-repository.audit.timeout=5
-repository.audit.id=statemanagement
-repository.audit.url=jdbc:h2:mem:statemanagement
-repository.audit.username=sa
-repository.audit.password=
-
-# DB Audit Properties
-# Flag to control the execution of the subsystemTest for the Database
-db.audit.is.active=true
diff --git a/feature-state-management/src/test/resources/logback-test.xml b/feature-state-management/src/test/resources/logback-test.xml
deleted file mode 100644
index 99cdaf9a..00000000
--- a/feature-state-management/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- feature-state-management
- ================================================================================
- Copyright (C) 2017-2018 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.
- ============LICENSE_END=========================================================
- -->
-
-<!-- Controls the output of logs for JUnit tests -->
-
-<configuration>
-
- <appender name="STDOUT"
- class="ch.qos.logback.core.ConsoleAppender">
- <encoder
- class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <Pattern>
- %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M\(%line\) - %msg%n
- </Pattern>
- </encoder>
- </appender>
- <appender name="FILE"
- class="ch.qos.logback.core.FileAppender">
- <file>logs/debug.log</file>
- <encoder>
- <Pattern>
- %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M\(%line\) - %msg%n
- </Pattern>
- </encoder>
- </appender>
-
- <root level="debug">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="FILE" />
- </root>
-
-</configuration>
-