diff options
45 files changed, 371 insertions, 308 deletions
diff --git a/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestMain.java b/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestMain.java index b7d566ccf..6ba8d832c 100644 --- a/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestMain.java +++ b/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestMain.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +40,10 @@ public class ApexDeploymentRestMain { // Services state public enum ServicesState { - STOPPED, READY, INITIALIZING, RUNNING + STOPPED, + READY, + INITIALIZING, + RUNNING } private ServicesState state = ServicesState.STOPPED; @@ -72,12 +76,12 @@ public class ApexDeploymentRestMain { } catch (final ApexDeploymentRestParameterException e) { throw new ApexDeploymentRestParameterException( REST_ENDPOINT_PREFIX + this.toString() + ") parameter error, " + e.getMessage() + '\n' - + parser.getHelp(ApexDeploymentRestMain.class.getCanonicalName()), e); + + parser.getHelp(ApexDeploymentRestMain.class.getName()), + e); } if (parameters.isHelpSet()) { - throw new ApexDeploymentRestParameterException( - parser.getHelp(ApexDeploymentRestMain.class.getCanonicalName())); + throw new ApexDeploymentRestParameterException(parser.getHelp(ApexDeploymentRestMain.class.getName())); } // Validate the parameters @@ -85,7 +89,7 @@ public class ApexDeploymentRestMain { if (validationMessage.length() > 0) { throw new ApexDeploymentRestParameterException( REST_ENDPOINT_PREFIX + this.toString() + ") parameters invalid, " + validationMessage + '\n' - + parser.getHelp(ApexDeploymentRestMain.class.getCanonicalName())); + + parser.getHelp(ApexDeploymentRestMain.class.getName())); } state = ServicesState.READY; @@ -131,7 +135,8 @@ public class ApexDeploymentRestMain { String message = REST_ENDPOINT_PREFIX + this.toString() + ") failed at with error: " + e.getMessage(); outStream.println(message); LOGGER.warn(message, e); - } finally { + } + finally { if (apexDeploymentRest != null) { apexDeploymentRest.shutdown(); apexDeploymentRest = null; diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java index b7e1f97c6..558cbadc7 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,18 +83,18 @@ public class ApexEditorMain { parameters = parser.parse(args); } catch (final ApexEditorParameterException e) { throw new ApexEditorParameterException(REST_ENDPOINT_PREFIX + this.toString() + ") parameter error, " - + e.getMessage() + '\n' + parser.getHelp(ApexEditorMain.class.getCanonicalName()), e); + + e.getMessage() + '\n' + parser.getHelp(ApexEditorMain.class.getName()), e); } if (parameters.isHelpSet()) { - throw new ApexEditorParameterException(parser.getHelp(ApexEditorMain.class.getCanonicalName())); + throw new ApexEditorParameterException(parser.getHelp(ApexEditorMain.class.getName())); } // Validate the parameters final String validationMessage = parameters.validate(); if (validationMessage.length() > 0) { throw new ApexEditorParameterException(REST_ENDPOINT_PREFIX + this.toString() + ") parameters invalid, " - + validationMessage + '\n' + parser.getHelp(ApexEditorMain.class.getCanonicalName())); + + validationMessage + '\n' + parser.getHelp(ApexEditorMain.class.getName())); } state = EditorState.READY; @@ -139,7 +140,8 @@ public class ApexEditorMain { String message = REST_ENDPOINT_PREFIX + this.toString() + ") failed at with error: " + e.getMessage(); outStream.println(message); LOGGER.warn(message, e); - } finally { + } + finally { if (apexEditor != null) { apexEditor.shutdown(); apexEditor = null; diff --git a/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestMain.java b/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestMain.java index df877baff..856aa6b0c 100644 --- a/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestMain.java +++ b/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestMain.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,11 +83,11 @@ public class ApexServicesRestMain { parameters = parser.parse(args); } catch (final ApexServicesRestParameterException e) { throw new ApexServicesRestParameterException(REST_ENDPOINT_PREFIX + this.toString() + ") parameter error, " - + e.getMessage() + '\n' + parser.getHelp(ApexServicesRestMain.class.getCanonicalName()), e); + + e.getMessage() + '\n' + parser.getHelp(ApexServicesRestMain.class.getName()), e); } if (parameters.isHelpSet()) { - throw new ApexServicesRestParameterException(parser.getHelp(ApexServicesRestMain.class.getCanonicalName())); + throw new ApexServicesRestParameterException(parser.getHelp(ApexServicesRestMain.class.getName())); } // Validate the parameters @@ -94,7 +95,7 @@ public class ApexServicesRestMain { if (validationMessage.length() > 0) { throw new ApexServicesRestParameterException( REST_ENDPOINT_PREFIX + this.toString() + ") parameters invalid, " + validationMessage + '\n' - + parser.getHelp(ApexServicesRestMain.class.getCanonicalName())); + + parser.getHelp(ApexServicesRestMain.class.getName())); } state = EditorState.READY; @@ -140,7 +141,8 @@ public class ApexServicesRestMain { String message = REST_ENDPOINT_PREFIX + this.toString() + ") failed at with error: " + e.getMessage(); outStream.println(message); LOGGER.warn(message, e); - } finally { + } + finally { if (apexServices != null) { apexServices.shutdown(); apexServices = null; @@ -195,7 +197,7 @@ public class ApexServicesRestMain { } } } - + /** * Main method, main entry point for command. * diff --git a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestMain.java b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestMain.java index 468fd5aa7..abc30ce8f 100644 --- a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestMain.java +++ b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestMain.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +40,10 @@ public class ApexMonitoringRestMain { // Services state public enum ServicesState { - STOPPED, READY, INITIALIZING, RUNNING + STOPPED, + READY, + INITIALIZING, + RUNNING } private ServicesState state = ServicesState.STOPPED; @@ -72,12 +76,12 @@ public class ApexMonitoringRestMain { } catch (final ApexMonitoringRestParameterException e) { throw new ApexMonitoringRestParameterException( REST_ENDPOINT_PREFIX + this.toString() + ") parameter error, " + e.getMessage() + '\n' - + parser.getHelp(ApexMonitoringRestMain.class.getCanonicalName()), e); + + parser.getHelp(ApexMonitoringRestMain.class.getName()), + e); } if (parameters.isHelpSet()) { - throw new ApexMonitoringRestParameterException( - parser.getHelp(ApexMonitoringRestMain.class.getCanonicalName())); + throw new ApexMonitoringRestParameterException(parser.getHelp(ApexMonitoringRestMain.class.getName())); } // Validate the parameters @@ -85,7 +89,7 @@ public class ApexMonitoringRestMain { if (validationMessage.length() > 0) { throw new ApexMonitoringRestParameterException( REST_ENDPOINT_PREFIX + this.toString() + ") parameters invalid, " + validationMessage + '\n' - + parser.getHelp(ApexMonitoringRestMain.class.getCanonicalName())); + + parser.getHelp(ApexMonitoringRestMain.class.getName())); } state = ServicesState.READY; @@ -131,7 +135,8 @@ public class ApexMonitoringRestMain { String message = REST_ENDPOINT_PREFIX + this.toString() + ") failed at with error: " + e.getMessage(); outStream.println(message); LOGGER.warn(message, e); - } finally { + } + finally { if (apexMonitoringRest != null) { apexMonitoringRest.shutdown(); apexMonitoringRest = null; diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java index c4b1a0254..ca1fa78f4 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java @@ -123,7 +123,7 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { return schemaClass.newInstance(); } catch (final Exception e) { final String returnString = userKey.getId() + ": could not create an instance of class \"" - + schemaClass.getCanonicalName() + "\" using the default constructor \"" + + schemaClass.getName() + "\" using the default constructor \"" + schemaClass.getSimpleName() + "()\""; LOGGER.warn(returnString, e); throw new ContextRuntimeException(returnString, e); @@ -150,7 +150,7 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { return stringConstructor.newInstance(stringValue); } catch (final Exception e) { final String returnString = userKey.getId() + ": could not create an instance of class \"" - + schemaClass.getCanonicalName() + "\" using the string constructor \"" + + schemaClass.getName() + "\" using the string constructor \"" + schemaClass.getSimpleName() + "(String)\""; LOGGER.warn(returnString, e); throw new ContextRuntimeException(returnString); diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java index a8fedf24a..b36e00899 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -119,9 +120,9 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { } final String returnString = getUserKey().getId() + ": the object \"" + incomingObject + "\" of type \"" - + incomingObject.getClass().getCanonicalName() - + "\" is not an instance of JsonObject and is not assignable to \"" - + getSchemaClass().getCanonicalName() + "\""; + + incomingObject.getClass().getName() + + "\" is not an instance of JsonObject and is not assignable to \"" + getSchemaClass().getName() + + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -167,8 +168,8 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { return getGson().toJson(schemaObject); } else { final String returnString = getUserKey().getId() + ": object \"" + schemaObject.toString() - + "\" of class \"" + schemaObject.getClass().getCanonicalName() - + "\" not compatible with class \"" + getSchemaClass().getCanonicalName() + "\""; + + "\" of class \"" + schemaObject.getClass().getName() + "\" not compatible with class \"" + + getSchemaClass().getName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -224,8 +225,8 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { return stringConstructor.newInstance(object.toString()); } catch (final Exception e) { final String returnString = getUserKey().getId() + ": object \"" + object.toString() + "\" of class \"" - + object.getClass().getCanonicalName() + "\" not compatible with class \"" - + getSchemaClass().getCanonicalName() + "\""; + + object.getClass().getName() + "\" not compatible with class \"" + + getSchemaClass().getName() + "\""; LOGGER.warn(returnString, e); throw new ContextRuntimeException(returnString); } @@ -233,7 +234,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { /** * Get a GSON instance that has the correct adaptation included. - * + * * @return the GSON instance */ private Gson getGson() { @@ -244,11 +245,11 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { JavaSchemaHelperParameters javaSchemaHelperParmeters = (JavaSchemaHelperParameters) schemaParameters .getSchemaHelperParameterMap().get("Java"); - + if (javaSchemaHelperParmeters == null) { javaSchemaHelperParmeters = new JavaSchemaHelperParameters(); } - + for (JavaSchemaHelperJsonAdapterParameters jsonAdapterEntry : javaSchemaHelperParmeters.getJsonAdapters() .values()) { diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java index 6565060c1..ca80db938 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java @@ -193,7 +193,7 @@ public class ExecutorFactoryImpl implements ExecutorFactory { // executor class if (executorClass == null) { final String errorMessage = "Executor plugin class not defined for \"" + logicFlavour - + "\" executor of type \"" + executorSuperClass.getCanonicalName() + "\""; + + "\" executor of type \"" + executorSuperClass.getName() + "\""; LOGGER.error(errorMessage); throw new StateMachineRuntimeException(errorMessage); } @@ -204,7 +204,7 @@ public class ExecutorFactoryImpl implements ExecutorFactory { executorObject = executorClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { final String errorMessage = "Instantiation error on \"" + logicFlavour + "\" executor of type \"" - + executorClass.getCanonicalName() + "\""; + + executorClass.getName() + "\""; LOGGER.error(errorMessage, e); throw new StateMachineRuntimeException(errorMessage, e); } @@ -212,7 +212,7 @@ public class ExecutorFactoryImpl implements ExecutorFactory { // Check the class is the correct type of executor if (!(executorSuperClass.isAssignableFrom(executorObject.getClass()))) { final String errorMessage = "Executor on \"" + logicFlavour + "\" of type \"" + executorClass - + "\" is not an instance of \"" + executorSuperClass.getCanonicalName() + "\""; + + "\" is not an instance of \"" + executorSuperClass.getName() + "\""; LOGGER.error(errorMessage); throw new StateMachineRuntimeException(errorMessage); diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java index 60eee455c..492769dad 100644 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +39,8 @@ public final class AadmDomainModelSaver { /** * Private default constructor to prevent subclassing. */ - private AadmDomainModelSaver() {} + private AadmDomainModelSaver() { + } /** * Write the AADM model to args[0]. @@ -48,14 +50,14 @@ public final class AadmDomainModelSaver { */ public static void main(final String[] args) throws ApexException { if (args.length != 1) { - LOGGER.error("usage: " + AadmDomainModelSaver.class.getCanonicalName() + " modelDirectory"); + LOGGER.error("usage: " + AadmDomainModelSaver.class.getName() + " modelDirectory"); return; } // Save Java model final AxPolicyModel aadmPolicyModel = new AadmDomainModelFactory().getAadmPolicyModel(); - final ApexModelSaver<AxPolicyModel> aadmModelSaver = - new ApexModelSaver<>(AxPolicyModel.class, aadmPolicyModel, args[0]); + final ApexModelSaver<AxPolicyModel> aadmModelSaver = new ApexModelSaver<>(AxPolicyModel.class, aadmPolicyModel, + args[0]); aadmModelSaver.apexModelWriteJson(); aadmModelSaver.apexModelWriteXml(); } diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java index 4949edd30..83a42ac8d 100644 --- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,21 +51,21 @@ public final class AdaptiveDomainModelSaver { */ public static void main(final String[] args) throws ApexException { if (args.length != 1) { - LOGGER.error("usage: " + AdaptiveDomainModelSaver.class.getCanonicalName() + " modelDirectory"); + LOGGER.error("usage: " + AdaptiveDomainModelSaver.class.getName() + " modelDirectory"); return; } // Save Anomaly Detection model final AxPolicyModel adPolicyModel = new AdaptiveDomainModelFactory().getAnomalyDetectionPolicyModel(); - final ApexModelSaver<AxPolicyModel> adModelSaver = - new ApexModelSaver<>(AxPolicyModel.class, adPolicyModel, args[0]); + final ApexModelSaver<AxPolicyModel> adModelSaver = new ApexModelSaver<>(AxPolicyModel.class, adPolicyModel, + args[0]); adModelSaver.apexModelWriteJson(); adModelSaver.apexModelWriteXml(); // Save Auto Learn model final AxPolicyModel alPolicyModel = new AdaptiveDomainModelFactory().getAutoLearnPolicyModel(); - final ApexModelSaver<AxPolicyModel> alModelSaver = - new ApexModelSaver<>(AxPolicyModel.class, alPolicyModel, args[0]); + final ApexModelSaver<AxPolicyModel> alModelSaver = new ApexModelSaver<>(AxPolicyModel.class, alPolicyModel, + args[0]); alModelSaver.apexModelWriteJson(); alModelSaver.apexModelWriteXml(); } diff --git a/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MfpDomainModelSaver.java b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MfpDomainModelSaver.java index 1a18a7e3a..d2469f209 100644 --- a/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MfpDomainModelSaver.java +++ b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MfpDomainModelSaver.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +37,8 @@ public final class MfpDomainModelSaver { private static final XLogger LOGGER = XLoggerFactory.getXLogger(MfpDomainModelSaver.class); /** Private constructor to prevent instantiation. */ - private MfpDomainModelSaver() {} + private MfpDomainModelSaver() { + } /** * Write the MyFirstPolicy model to args[0]. @@ -46,14 +48,14 @@ public final class MfpDomainModelSaver { */ public static void main(final String[] args) throws ApexException { if (args.length != 1) { - LOGGER.error("usage: " + MfpDomainModelSaver.class.getCanonicalName() + " modelDirectory"); + LOGGER.error("usage: " + MfpDomainModelSaver.class.getName() + " modelDirectory"); return; } // Save Java model AxPolicyModel mfpPolicyModel = new MfpDomainModelFactory().getMfp1PolicyModel(); - ApexModelSaver<AxPolicyModel> mfpModelSaver = - new ApexModelSaver<>(AxPolicyModel.class, mfpPolicyModel, args[0] + "/1/"); + ApexModelSaver<AxPolicyModel> mfpModelSaver = new ApexModelSaver<>(AxPolicyModel.class, mfpPolicyModel, + args[0] + "/1/"); mfpModelSaver.apexModelWriteJson(); mfpModelSaver.apexModelWriteXml(); diff --git a/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PcvsDomainModelSaver.java b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PcvsDomainModelSaver.java index 1d8381acd..02b107767 100644 --- a/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PcvsDomainModelSaver.java +++ b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PcvsDomainModelSaver.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,8 +48,7 @@ public final class PcvsDomainModelSaver { */ public static void main(final String[] args) throws ApexException { if (args.length != 2) { - LOGGER.error("usage: " + PcvsDomainModelSaver.class.getCanonicalName() - + " workingDirectory modelDirectory"); + LOGGER.error("usage: " + PcvsDomainModelSaver.class.getName() + " workingDirectory modelDirectory"); return; } diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java index 693284dd0..375d7f0bf 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -119,7 +120,8 @@ public class DefaultApexDao implements ApexDao { mg.getTransaction().begin(); mg.merge(obj); mg.getTransaction().commit(); - } finally { + } + finally { mg.close(); } } @@ -137,7 +139,8 @@ public class DefaultApexDao implements ApexDao { mg.getTransaction().begin(); mg.remove(mg.contains(obj) ? obj : mg.merge(obj)); mg.getTransaction().commit(); - } finally { + } + finally { mg.close(); } } @@ -156,7 +159,8 @@ public class DefaultApexDao implements ApexDao { mg.createQuery(DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName() + AND_C_KEY_VERSION + key.getVersion() + "'", someClass).executeUpdate(); mg.getTransaction().commit(); - } finally { + } + finally { mg.close(); } } @@ -176,7 +180,8 @@ public class DefaultApexDao implements ApexDao { + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion() + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'", someClass).executeUpdate(); mg.getTransaction().commit(); - } finally { + } + finally { mg.close(); } } @@ -196,7 +201,8 @@ public class DefaultApexDao implements ApexDao { mg.merge(t); } mg.getTransaction().commit(); - } finally { + } + finally { mg.close(); } } @@ -216,7 +222,8 @@ public class DefaultApexDao implements ApexDao { mg.remove(mg.contains(t) ? t : mg.merge(t)); } mg.getTransaction().commit(); - } finally { + } + finally { mg.close(); } } @@ -241,7 +248,8 @@ public class DefaultApexDao implements ApexDao { .executeUpdate(); } mg.getTransaction().commit(); - } finally { + } + finally { mg.close(); } return deletedCount; @@ -266,7 +274,8 @@ public class DefaultApexDao implements ApexDao { + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'", someClass).executeUpdate(); } mg.getTransaction().commit(); - } finally { + } + finally { mg.close(); } return deletedCount; @@ -282,7 +291,8 @@ public class DefaultApexDao implements ApexDao { mg.getTransaction().begin(); mg.createQuery(DELETE_FROM + someClass.getSimpleName() + " c ", someClass).executeUpdate(); mg.getTransaction().commit(); - } finally { + } + finally { mg.close(); } } @@ -305,13 +315,14 @@ public class DefaultApexDao implements ApexDao { t.copyTo(clonedT); return clonedT; } catch (final Exception e) { - LOGGER.warn("Could not clone object of class \"" + someClass.getCanonicalName() + "\"", e); + LOGGER.warn("Could not clone object of class \"" + someClass.getName() + "\"", e); return null; } } else { return null; } - } finally { + } + finally { mg.close(); } } @@ -333,13 +344,14 @@ public class DefaultApexDao implements ApexDao { t.copyTo(clonedT); return clonedT; } catch (final Exception e) { - LOGGER.warn("Could not clone object of class \"" + someClass.getCanonicalName() + "\"", e); + LOGGER.warn("Could not clone object of class \"" + someClass.getName() + "\"", e); return null; } } else { return null; } - } finally { + } + finally { mg.close(); } } @@ -355,7 +367,8 @@ public class DefaultApexDao implements ApexDao { final EntityManager mg = getEntityManager(); try { return mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + " c", someClass).getResultList(); - } finally { + } + finally { mg.close(); } } @@ -373,7 +386,8 @@ public class DefaultApexDao implements ApexDao { return mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME + parentKey.getName() + AND_C_KEY_PARENT_KEY_VERSION + parentKey.getVersion() + "'", someClass).getResultList(); - } finally { + } + finally { mg.close(); } } @@ -391,7 +405,8 @@ public class DefaultApexDao implements ApexDao { try { ret = mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName() + AND_C_KEY_VERSION + key.getVersion() + "'", someClass).getResultList(); - } finally { + } + finally { mg.close(); } if (ret == null || ret.isEmpty()) { @@ -418,7 +433,8 @@ public class DefaultApexDao implements ApexDao { ret = mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion() + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'", someClass).getResultList(); - } finally { + } + finally { mg.close(); } if (ret == null || ret.isEmpty()) { @@ -443,7 +459,8 @@ public class DefaultApexDao implements ApexDao { ret = mg.merge(obj); mg.flush(); mg.getTransaction().commit(); - } finally { + } + finally { mg.close(); } return ret; @@ -462,7 +479,8 @@ public class DefaultApexDao implements ApexDao { try { size = mg.createQuery("SELECT COUNT(c) FROM " + someClass.getSimpleName() + " c", Long.class) .getSingleResult(); - } finally { + } + finally { mg.close(); } return size; diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/ModelService.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/ModelService.java index 1e922b89a..251d92af5 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/ModelService.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/ModelService.java @@ -1,19 +1,20 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -33,9 +34,9 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; * chains in modules such as the Apex engine and editor. The model service makes the model and concept definitions * available statically. * - * <p>Note that the use of the model service means that only a single Apex model of a particular type may exist in - * Apex (particularly the engine) at any time. Of course the model in a JVM can be changed at any time provided all - * users of the model are stopped and restarted in an orderly manner. + * <p>Note that the use of the model service means that only a single Apex model of a particular type may exist in Apex + * (particularly the engine) at any time. Of course the model in a JVM can be changed at any time provided all users of + * the model are stopped and restarted in an orderly manner. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -82,8 +83,7 @@ public abstract class ModelService { final M model = (M) modelMap.get(modelClass); if (model == null) { - throw new ApexRuntimeException( - "Model for " + modelClass.getCanonicalName() + " not found in model service"); + throw new ApexRuntimeException("Model for " + modelClass.getName() + " not found in model service"); } return model; diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/TypeBuilder.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/TypeBuilder.java index ecda86f59..5f75bca1c 100644 --- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/TypeBuilder.java +++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/TypeBuilder.java @@ -1,19 +1,20 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -47,8 +48,8 @@ public final class TypeBuilder { */ public static Type build(final String type) { if (type == null || type.length() == 0) { - throw new IllegalArgumentException("Blank type string passed to " + TypeBuilder.class.getCanonicalName() - + ".build(String type)"); + throw new IllegalArgumentException( + "Blank type string passed to " + TypeBuilder.class.getName() + ".build(String type)"); } try { diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java index d8d0d8c19..fa17a22c2 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -87,9 +88,9 @@ public class AvroBytesObjectMapper implements AvroObjectMapper { public Object mapFromAvro(final Object avroObject) { // The Avro object should be a Utf8 object if (!(avroObject instanceof ByteBuffer)) { - final String returnString = - userKey.getId() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() - + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; + final String returnString = userKey.getId() + ": object \"" + avroObject + "\" of class \"" + + avroObject.getClass() + "\" cannot be decoded to an object of class \"" + + schemaClass.getName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -111,7 +112,7 @@ public class AvroBytesObjectMapper implements AvroObjectMapper { public Object mapToAvro(final Object object) { if (object == null) { final String returnString = userKey.getId() + ": cannot encode a null object of class \"" - + schemaClass.getCanonicalName() + "\""; + + schemaClass.getName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -119,7 +120,7 @@ public class AvroBytesObjectMapper implements AvroObjectMapper { // The incoming object should be a byte array if (!(object instanceof byte[])) { final String returnString = userKey.getId() + ": object \"" + object + "\" of class \"" + object.getClass() - + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; + + "\" cannot be decoded to an object of class \"" + schemaClass.getName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java index f627651fa..f9ec4ed85 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -33,8 +34,8 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * This class does direct mapping from Avro classes to Java classes, used for Avro primitive types - * that directly produce Java objects. + * This class does direct mapping from Avro classes to Java classes, used for Avro primitive types that directly produce + * Java objects. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -117,9 +118,9 @@ public class AvroDirectObjectMapper implements AvroObjectMapper { // It is legal for the schema class to be null, if the Avro schema has a "null" type then // the decoded object is always returned as a null if (!schemaClass.isAssignableFrom(avroObject.getClass())) { - final String returnString = - userKey.getId() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() - + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; + final String returnString = userKey.getId() + ": object \"" + avroObject + "\" of class \"" + + avroObject.getClass() + "\" cannot be decoded to an object of class \"" + + schemaClass.getName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -135,7 +136,7 @@ public class AvroDirectObjectMapper implements AvroObjectMapper { // Null values are only allowed if the schema class is null if (object == null && schemaClass != null) { final String returnString = userKey.getId() + ": cannot encode a null object of class \"" - + schemaClass.getCanonicalName() + "\""; + + schemaClass.getName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java index 723aefdc5..94841301d 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -152,7 +153,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { /** * Create an instance of a sub type of this type. - * + * * @param schema the Avro schema of the the type * @param subInstanceType the sub type * @param foundTypes types we have already found @@ -188,7 +189,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { /** * Instantiate a sub instance of a type. - * + * * @param subInstanceType the type of the sub instance to create * @param subSchema the sub schema we have received * @param foundTypes types we have already found @@ -245,7 +246,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { /** * Check that the incoming object is a string, the incoming object must be a string containing Json. - * + * * @param object incoming object * @return object as String */ @@ -258,8 +259,8 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { } } catch (final ClassCastException e) { final String returnString = getUserKey().getId() + OBJECT_TAG + object + "\" of type \"" - + (object != null ? object.getClass().getCanonicalName() : "null") - + "\" must be assignable to \"" + getSchemaClass().getCanonicalName() + + (object != null ? object.getClass().getName() : "null") + "\" must be assignable to \"" + + getSchemaClass().getName() + "\" or be a Json string representation of it for Avro unmarshalling"; LOGGER.warn(returnString, e); throw new ContextRuntimeException(returnString); @@ -268,7 +269,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { /** * Get a string object. - * + * * @param object the string object * @return the string */ diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperParameters.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperParameters.java index 5a8fac404..4f3fe0cae 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperParameters.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperParameters.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -29,10 +30,9 @@ import org.onap.policy.apex.context.parameters.SchemaHelperParameters; */ public class AvroSchemaHelperParameters extends SchemaHelperParameters { /** - * The Default Constructor sets the {@link AvroSchemaHelper} as the schema helper class for Avro - * schemas. + * The Default Constructor sets the {@link AvroSchemaHelper} as the schema helper class for Avro schemas. */ public AvroSchemaHelperParameters() { - this.setSchemaHelperPluginClass(AvroSchemaHelper.class.getCanonicalName()); + this.setSchemaHelperPluginClass(AvroSchemaHelper.class.getName()); } } diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java index 46e6c43ef..f664006e2 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -86,9 +87,9 @@ public class AvroStringObjectMapper implements AvroObjectMapper { public Object mapFromAvro(final Object avroObject) { // The Avro object should be a Utf8 object if (!(avroObject instanceof Utf8)) { - final String returnString = - userKey.getId() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() - + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; + final String returnString = userKey.getId() + ": object \"" + avroObject + "\" of class \"" + + avroObject.getClass() + "\" cannot be decoded to an object of class \"" + + schemaClass.getName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -103,7 +104,7 @@ public class AvroStringObjectMapper implements AvroObjectMapper { public Object mapToAvro(final Object object) { if (object == null) { final String returnString = userKey.getId() + ": cannot encode a null object of class \"" - + schemaClass.getCanonicalName() + "\""; + + schemaClass.getName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaFixedTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaFixedTest.java index 7fb417c78..ee742a8be 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaFixedTest.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaFixedTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -103,7 +104,7 @@ public class AvroSchemaFixedTest { fail("Test should throw an exception here"); } catch (final Exception e) { assertEquals("AvroTest:0.0.1: could not create an instance " - + "of class \"org.apache.avro.generic.GenericData.Fixed\" " + + "of class \"org.apache.avro.generic.GenericData$Fixed\" " + "using the default constructor \"Fixed()\"", e.getMessage()); } diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperMarshalTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperMarshalTest.java index 6d3ebb30a..778573939 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperMarshalTest.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperMarshalTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -320,7 +321,7 @@ public class AvroSchemaHelperMarshalTest { fail("Test should throw an exception here"); } catch (final Exception e) { assertTrue(e.getMessage() - .startsWith("AvroTest:0.0.1: cannot encode a null object of class \"java.lang.Byte[]\"")); + .startsWith("AvroTest:0.0.1: cannot encode a null object of class \"[Ljava.lang.Byte;\"")); } } } diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperUnmarshalTest.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperUnmarshalTest.java index a8711e06d..fee21ae2a 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperUnmarshalTest.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelperUnmarshalTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -395,7 +396,7 @@ public class AvroSchemaHelperUnmarshalTest { schemaHelper.createNewInstance(); fail("test should throw an exception here"); } catch (final Exception e) { - assertEquals("AvroTest:0.0.1: could not create an instance of class \"java.lang.Byte[]\" " + assertEquals("AvroTest:0.0.1: could not create an instance of class \"[Ljava.lang.Byte;\" " + "using the default constructor \"Byte[]()\"", e.getMessage()); } final byte[] newBytes = (byte[]) schemaHelper.createNewInstance("\"hello\""); diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java index d23e52f5e..cbabab3b8 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java @@ -87,7 +87,7 @@ public class ApexJmsConsumer implements MessageListener, ApexEventConsumer, Runn // Check and get the JMS Properties if (!(consumerParameters.getCarrierTechnologyParameters() instanceof JmsCarrierTechnologyParameters)) { final String errorMessage = "specified consumer properties of type \"" - + consumerParameters.getCarrierTechnologyParameters().getClass().getCanonicalName() + + consumerParameters.getCarrierTechnologyParameters().getClass().getName() + "\" are not applicable to a JMS consumer"; LOGGER.warn(errorMessage); throw new ApexEventException(errorMessage); diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java index 4bd7be586..46b503e04 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,13 +81,13 @@ public class ApexJmsProducer implements ApexEventProducer { */ @Override public void init(final String producerName, final EventHandlerParameters producerParameters) - throws ApexEventException { + throws ApexEventException { this.name = producerName; // Check and get the JMS Properties if (!(producerParameters.getCarrierTechnologyParameters() instanceof JmsCarrierTechnologyParameters)) { - final String errorMessage = - "specified producer properties are not applicable to a JMS producer (" + this.name + ")"; + final String errorMessage = "specified producer properties are not applicable to a JMS producer (" + + this.name + ")"; LOGGER.warn(errorMessage); throw new ApexEventException(errorMessage); } @@ -102,13 +103,13 @@ public class ApexJmsProducer implements ApexEventProducer { // Check if we actually got a connection factory if (connectionFactory == null) { throw new IllegalArgumentException( - "JMS context lookup of \"" + jmsProducerProperties.getConnectionFactory() - + "\" returned null for producer (" + this.name + ")"); + "JMS context lookup of \"" + jmsProducerProperties.getConnectionFactory() + + "\" returned null for producer (" + this.name + ")"); } } catch (final Exception e) { final String errorMessage = "lookup of JMS connection factory \"" - + jmsProducerProperties.getConnectionFactory() + "\" failed for JMS producer properties \"" - + jmsProducerProperties.getJmsConsumerProperties() + FOR_PRODUCER_TAG + this.name + ")"; + + jmsProducerProperties.getConnectionFactory() + "\" failed for JMS producer properties \"" + + jmsProducerProperties.getJmsConsumerProperties() + FOR_PRODUCER_TAG + this.name + ")"; LOGGER.warn(errorMessage, e); throw new ApexEventException(errorMessage, e); } @@ -121,12 +122,12 @@ public class ApexJmsProducer implements ApexEventProducer { // Check if we actually got a topic if (jmsOutgoingTopic == null) { throw new IllegalArgumentException("JMS context lookup of \"" + jmsProducerProperties.getProducerTopic() - + "\" returned null for producer (" + this.name + ")"); + + "\" returned null for producer (" + this.name + ")"); } } catch (final Exception e) { final String errorMessage = "lookup of JMS topic \"" + jmsProducerProperties.getProducerTopic() - + "\" failed for JMS producer properties \"" + jmsProducerProperties.getJmsProducerProperties() - + FOR_PRODUCER_TAG + this.name + ")"; + + "\" failed for JMS producer properties \"" + + jmsProducerProperties.getJmsProducerProperties() + FOR_PRODUCER_TAG + this.name + ")"; LOGGER.warn(errorMessage, e); throw new ApexEventException(errorMessage, e); } @@ -134,11 +135,11 @@ public class ApexJmsProducer implements ApexEventProducer { // Create and start a connection to the JMS server try { connection = connectionFactory.createConnection(jmsProducerProperties.getSecurityPrincipal(), - jmsProducerProperties.getSecurityCredentials()); + jmsProducerProperties.getSecurityCredentials()); connection.start(); } catch (final Exception e) { final String errorMessage = "connection to JMS server failed for JMS properties \"" - + jmsProducerProperties.getJmsConsumerProperties() + FOR_PRODUCER_TAG + this.name + ")"; + + jmsProducerProperties.getJmsConsumerProperties() + FOR_PRODUCER_TAG + this.name + ")"; LOGGER.warn(errorMessage, e); throw new ApexEventException(errorMessage, e); } @@ -148,7 +149,7 @@ public class ApexJmsProducer implements ApexEventProducer { jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); } catch (final Exception e) { final String errorMessage = "creation of session to JMS server failed for JMS properties \"" - + jmsProducerProperties.getJmsConsumerProperties() + FOR_PRODUCER_TAG + this.name + ")"; + + jmsProducerProperties.getJmsConsumerProperties() + FOR_PRODUCER_TAG + this.name + ")"; LOGGER.warn(errorMessage, e); throw new ApexEventException(errorMessage, e); } @@ -157,8 +158,8 @@ public class ApexJmsProducer implements ApexEventProducer { try { messageProducer = jmsSession.createProducer(jmsOutgoingTopic); } catch (final Exception e) { - final String errorMessage = - "creation of producer for sending events " + "to JMS server failed for JMS properties \"" + final String errorMessage = "creation of producer for sending events " + + "to JMS server failed for JMS properties \"" + jmsProducerProperties.getJmsConsumerProperties() + "\""; LOGGER.warn(errorMessage, e); throw new ApexEventException(errorMessage, e); @@ -194,10 +195,10 @@ public class ApexJmsProducer implements ApexEventProducer { */ @Override public void sendEvent(final long executionId, final Properties executionProperties, final String eventname, - final Object eventObject) { + final Object eventObject) { // Check if this is a synchronized event, if so we have received a reply - final SynchronousEventCache synchronousEventCache = - (SynchronousEventCache) peerReferenceMap.get(EventHandlerPeeredMode.SYNCHRONOUS); + final SynchronousEventCache synchronousEventCache = (SynchronousEventCache) peerReferenceMap + .get(EventHandlerPeeredMode.SYNCHRONOUS); if (synchronousEventCache != null) { synchronousEventCache.removeCachedEventToApexIfExists(executionId); } @@ -205,7 +206,7 @@ public class ApexJmsProducer implements ApexEventProducer { // Check if the object to be sent is serializable if (!Serializable.class.isAssignableFrom(eventObject.getClass())) { final String errorMessage = COULD_NOT_SEND_PREFIX + eventname + JMS_MESSAGE_PRODUCER_TAG + this.name - + ", object of type \"" + eventObject.getClass().getCanonicalName() + "\" is not serializable"; + + ", object of type \"" + eventObject.getClass().getName() + "\" is not serializable"; LOGGER.warn(errorMessage); throw new ApexEventRuntimeException(errorMessage); } @@ -220,7 +221,7 @@ public class ApexJmsProducer implements ApexEventProducer { jmsMessage = jmsSession.createObjectMessage((Serializable) eventObject); } catch (final Exception e) { final String errorMessage = COULD_NOT_SEND_PREFIX + eventname + JMS_MESSAGE_PRODUCER_TAG + this.name - + ", could not create JMS Object Message for object \"" + eventObject; + + ", could not create JMS Object Message for object \"" + eventObject; LOGGER.warn(errorMessage, e); throw new ApexEventRuntimeException(errorMessage); } @@ -230,7 +231,7 @@ public class ApexJmsProducer implements ApexEventProducer { jmsMessage = jmsSession.createTextMessage(eventObject.toString()); } catch (final Exception e) { final String errorMessage = COULD_NOT_SEND_PREFIX + eventname + JMS_MESSAGE_PRODUCER_TAG + this.name - + ", could not create JMS Text Message for object \"" + eventObject; + + ", could not create JMS Text Message for object \"" + eventObject; LOGGER.warn(errorMessage, e); throw new ApexEventRuntimeException(errorMessage); } @@ -240,7 +241,7 @@ public class ApexJmsProducer implements ApexEventProducer { messageProducer.send(jmsMessage); } catch (final Exception e) { final String errorMessage = COULD_NOT_SEND_PREFIX + eventname + JMS_MESSAGE_PRODUCER_TAG + this.name - + ", send failed for object \"" + eventObject; + + ", send failed for object \"" + eventObject; LOGGER.warn(errorMessage, e); throw new ApexEventRuntimeException(errorMessage); } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java index 17738f194..a99258a48 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,28 +72,28 @@ public class ApexKafkaConsumer implements ApexEventConsumer, Runnable { */ @Override public void init(final String consumerName, final EventHandlerParameters consumerParameters, - final ApexEventReceiver incomingEventReceiver) throws ApexEventException { + final ApexEventReceiver incomingEventReceiver) throws ApexEventException { this.eventReceiver = incomingEventReceiver; this.name = consumerName; // Check and get the Kafka Properties if (!(consumerParameters.getCarrierTechnologyParameters() instanceof KafkaCarrierTechnologyParameters)) { LOGGER.warn("specified consumer properties of type \"" - + consumerParameters.getCarrierTechnologyParameters().getClass().getCanonicalName() - + "\" are not applicable to a Kafka consumer"); + + consumerParameters.getCarrierTechnologyParameters().getClass().getName() + + "\" are not applicable to a Kafka consumer"); throw new ApexEventException("specified consumer properties of type \"" - + consumerParameters.getCarrierTechnologyParameters().getClass().getCanonicalName() - + "\" are not applicable to a Kafka consumer"); + + consumerParameters.getCarrierTechnologyParameters().getClass().getName() + + "\" are not applicable to a Kafka consumer"); } - kafkaConsumerProperties = - (KafkaCarrierTechnologyParameters) consumerParameters.getCarrierTechnologyParameters(); + kafkaConsumerProperties = (KafkaCarrierTechnologyParameters) consumerParameters + .getCarrierTechnologyParameters(); // Kick off the Kafka consumer kafkaConsumer = new KafkaConsumer<>(kafkaConsumerProperties.getKafkaConsumerProperties()); kafkaConsumer.subscribe(kafkaConsumerProperties.getConsumerTopicListAsCollection()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("event receiver for " + this.getClass().getName() + ":" + this.name + " subscribed to topics: " - + kafkaConsumerProperties.getConsumerTopicList()); + + kafkaConsumerProperties.getConsumerTopicList()); } } @@ -142,14 +143,14 @@ public class ApexKafkaConsumer implements ApexEventConsumer, Runnable { kafkaConsumer.subscribe(kafkaConsumerProperties.getConsumerTopicListAsCollection()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("event receiver for " + this.getClass().getName() + ":" + this.name + " subscribed to topics: " - + kafkaConsumerProperties.getConsumerTopicList()); + + kafkaConsumerProperties.getConsumerTopicList()); } // The endless loop that receives events over Kafka while (consumerThread.isAlive() && !stopOrderedFlag) { try { - final ConsumerRecords<String, String> records = - kafkaConsumer.poll(kafkaConsumerProperties.getConsumerPollDuration()); + final ConsumerRecords<String, String> records = kafkaConsumer + .poll(kafkaConsumerProperties.getConsumerPollDuration()); for (final ConsumerRecord<String, String> record : records) { traceIfTraceEnabled(record); eventReceiver.receiveEvent(new Properties(), record.value()); @@ -172,7 +173,7 @@ public class ApexKafkaConsumer implements ApexEventConsumer, Runnable { private void traceIfTraceEnabled(final ConsumerRecord<String, String> record) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("event received for {} for forwarding to Apex engine : {} {}", - this.getClass().getName() + ":" + this.name, record.key(), record.value()); + this.getClass().getName() + ":" + this.name, record.key(), record.value()); } } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java index 81aa1a74a..e66ff608a 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java @@ -77,11 +77,11 @@ public class RestRequestorCarrierTechnologyParameters extends CarrierTechnologyP /** The producer plugin class for the REST carrier technology. */ public static final String RESTREQUSTOR_EVENT_PRODUCER_PLUGIN_CLASS = - ApexRestRequestorProducer.class.getCanonicalName(); + ApexRestRequestorProducer.class.getName(); /** The consumer plugin class for the REST carrier technology. */ public static final String RESTREQUSTOR_EVENT_CONSUMER_PLUGIN_CLASS = - ApexRestRequestorConsumer.class.getCanonicalName(); + ApexRestRequestorConsumer.class.getName(); /** The default HTTP method for request events. */ public static final HttpMethod DEFAULT_REQUESTOR_HTTP_METHOD = HttpMethod.GET; diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java index fe11cdca3..958a25dde 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +61,7 @@ public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConv // on both sides of Apex if (!(parameters instanceof JmsObjectEventProtocolParameters)) { final String errormessage = "specified Event Protocol Parameters properties of type \"" - + parameters.getClass().getCanonicalName() + "\" are not applicable to a " + + parameters.getClass().getName() + "\" are not applicable to a " + Apex2JmsObjectEventConverter.class.getName() + " converter"; LOGGER.error(errormessage); } else { diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java index 17c535990..d4c25196d 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -270,7 +271,7 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter { /** * Get the event header name space. - * + * * @param yamlMap the YAML map to read from * @param eventDefinition the event definition * @return the event header name space @@ -293,7 +294,7 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter { /** * Get the event header source. - * + * * @param yamlMap the YAML map to read from * @param eventDefinition the event definition * @return the event header source @@ -310,7 +311,7 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter { /** * Get the event header target. - * + * * @param yamlMap the YAML map to read from * @param eventDefinition the event definition * @return the event header target @@ -349,7 +350,7 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter { if (!(yamlField instanceof String)) { // The element is not a string so throw an error throw new ApexEventRuntimeException("field \"" + fieldName + "\" with type \"" - + yamlField.getClass().getCanonicalName() + "\" is not a string value"); + + yamlField.getClass().getName() + "\" is not a string value"); } final String fieldValueString = (String) yamlField; diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java index 5c44f2d7d..30a44e024 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -40,13 +41,12 @@ public class EventConsumerFactory { * Create an event consumer of the required type for the specified consumer technology. * * @param name the name of the consumer - * @param consumerParameters The parameters for the Apex engine, we use the technology type of - * the required consumer + * @param consumerParameters The parameters for the Apex engine, we use the technology type of the required consumer * @return the event consumer * @throws ApexEventException on errors creating the Apex event consumer */ public ApexEventConsumer createConsumer(final String name, final EventHandlerParameters consumerParameters) - throws ApexEventException { + throws ApexEventException { // Get the carrier technology parameters final CarrierTechnologyParameters technologyParameters = consumerParameters.getCarrierTechnologyParameters(); @@ -57,8 +57,8 @@ public class EventConsumerFactory { consumerPluginObject = Class.forName(consumerPluginClass).newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { final String errorMessage = "could not create an Apex event consumer for \"" + name - + "\" for the carrier technology \"" + technologyParameters.getLabel() - + "\", specified event consumer plugin class \"" + consumerPluginClass + "\" not found"; + + "\" for the carrier technology \"" + technologyParameters.getLabel() + + "\", specified event consumer plugin class \"" + consumerPluginClass + "\" not found"; LOGGER.error(errorMessage, e); throw new ApexEventException(errorMessage, e); } @@ -66,9 +66,9 @@ public class EventConsumerFactory { // Check the class is an event consumer if (!(consumerPluginObject instanceof ApexEventConsumer)) { final String errorMessage = "could not create an Apex event consumer \"" + name - + "\" for the carrier technology \"" + technologyParameters.getLabel() - + "\", specified event consumer plugin class \"" + consumerPluginClass - + "\" is not an instance of \"" + ApexEventConsumer.class.getCanonicalName() + "\""; + + "\" for the carrier technology \"" + technologyParameters.getLabel() + + "\", specified event consumer plugin class \"" + consumerPluginClass + + "\" is not an instance of \"" + ApexEventConsumer.class.getName() + "\""; LOGGER.error(errorMessage); throw new ApexEventException(errorMessage); } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProducerFactory.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProducerFactory.java index 727f77995..349a6e38f 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProducerFactory.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProducerFactory.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -45,7 +46,7 @@ public class EventProducerFactory { * @throws ApexEventException on errors creating the Apex event producer */ public ApexEventProducer createProducer(final String name, final EventHandlerParameters producerParameters) - throws ApexEventException { + throws ApexEventException { // Get the carrier technology parameters final CarrierTechnologyParameters technologyParameters = producerParameters.getCarrierTechnologyParameters(); @@ -56,8 +57,8 @@ public class EventProducerFactory { producerPluginObject = Class.forName(producerPluginClass).newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { final String errorMessage = "could not create an Apex event producer for Producer \"" + name - + "\" for the carrier technology \"" + technologyParameters.getLabel() - + "\", specified event producer plugin class \"" + producerPluginClass + "\" not found"; + + "\" for the carrier technology \"" + technologyParameters.getLabel() + + "\", specified event producer plugin class \"" + producerPluginClass + "\" not found"; LOGGER.error(errorMessage, e); throw new ApexEventException(errorMessage, e); } @@ -65,9 +66,9 @@ public class EventProducerFactory { // Check the class is an event producer if (!(producerPluginObject instanceof ApexEventProducer)) { final String errorMessage = "could not create an Apex event producer for Producer \"" + name - + "\" for the carrier technology \"" + technologyParameters.getLabel() - + "\", specified event producer plugin class \"" + producerPluginClass - + "\" is not an instance of \"" + ApexEventProducer.class.getCanonicalName() + "\""; + + "\" for the carrier technology \"" + technologyParameters.getLabel() + + "\", specified event producer plugin class \"" + producerPluginClass + + "\" is not an instance of \"" + ApexEventProducer.class.getName() + "\""; LOGGER.error(errorMessage); throw new ApexEventException(errorMessage); } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProtocolFactory.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProtocolFactory.java index 85c5bf03f..b2a6f4754 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProtocolFactory.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProtocolFactory.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -27,8 +28,8 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * This factory class uses the Apex event protocol parameters to create and return an instance of - * the correct Apex event protocol converter plugin for the specified event protocol. + * This factory class uses the Apex event protocol parameters to create and return an instance of the correct Apex event + * protocol converter plugin for the specified event protocol. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -37,16 +38,15 @@ public class EventProtocolFactory { private static final XLogger LOGGER = XLoggerFactory.getXLogger(EventProtocolFactory.class); /** - * Create an event converter that converts between an - * {@link org.onap.policy.apex.service.engine.event.ApexEvent} and the specified event protocol. + * Create an event converter that converts between an {@link org.onap.policy.apex.service.engine.event.ApexEvent} + * and the specified event protocol. * * @param name the name of the event protocol - * @param eventProtocolParameters the event protocol parameters defining what to convert from - * and to + * @param eventProtocolParameters the event protocol parameters defining what to convert from and to * @return The event converter for converting events to and from Apex format */ public ApexEventProtocolConverter createConverter(final String name, - final EventProtocolParameters eventProtocolParameters) { + final EventProtocolParameters eventProtocolParameters) { // Get the class for the event protocol plugin using reflection final String eventProtocolPluginClass = eventProtocolParameters.getEventProtocolPluginClass(); Object eventProtocolPluginObject = null; @@ -54,9 +54,9 @@ public class EventProtocolFactory { eventProtocolPluginObject = Class.forName(eventProtocolPluginClass).newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { final String errorMessage = "could not create an Apex event protocol converter for \"" + name - + "\" for the protocol \"" + eventProtocolParameters.getLabel() - + "\", specified event protocol converter plugin class \"" + eventProtocolPluginClass - + "\" not found"; + + "\" for the protocol \"" + eventProtocolParameters.getLabel() + + "\", specified event protocol converter plugin class \"" + eventProtocolPluginClass + + "\" not found"; LOGGER.error(errorMessage, e); throw new ApexEventRuntimeException(errorMessage, e); } @@ -64,9 +64,9 @@ public class EventProtocolFactory { // Check the class is an event consumer if (!(eventProtocolPluginObject instanceof ApexEventProtocolConverter)) { final String errorMessage = "could not create an Apex event protocol converter for \"" + name - + "\" for the protocol \"" + eventProtocolParameters.getLabel() - + "\", specified event protocol converter plugin class \"" + eventProtocolPluginClass - + "\" is not an instance of \"" + ApexEventProtocolConverter.class.getCanonicalName() + "\""; + + "\" for the protocol \"" + eventProtocolParameters.getLabel() + + "\", specified event protocol converter plugin class \"" + eventProtocolPluginClass + + "\" is not an instance of \"" + ApexEventProtocolConverter.class.getName() + "\""; LOGGER.error(errorMessage); throw new ApexEventRuntimeException(errorMessage); } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java index b1c62b298..ad0508078 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -124,7 +125,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { /** * Decode a list of Apex events. - * + * * @param eventName the name of the incoming events * @param jsonEventString the JSON representation of the event list * @param decodedJsonObject The JSON list object @@ -176,9 +177,8 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { } /** - /** * Serialise an Apex event to a JSON string field by field. - * + * * @param apexEvent the event to Serialise * @return the Serialise event as JSON * @throws ApexEventException exceptions on marshaling to JSON @@ -207,8 +207,8 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { if (!apexEvent.containsKey(fieldName)) { if (!eventField.getOptional()) { - final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json. " - + "Field \"" + fieldName + "\" is missing, but is mandatory. Fields: " + apexEvent; + final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json. " + "Field \"" + + fieldName + "\" is missing, but is mandatory. Fields: " + apexEvent; LOGGER.debug(errorMessage); throw new ApexEventRuntimeException(errorMessage); } @@ -229,7 +229,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { /** * Serialise an Apex event to a JSON string as a single POJO. - * + * * @param apexEvent the event to Serialise * @return the Serialise event as JSON * @throws ApexEventException exceptions on marshaling to JSON @@ -268,7 +268,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { // Get the schema helper final SchemaHelper fieldSchemaHelper = new SchemaHelperFactory() .createSchemaHelper(pojoFieldDefinition.getKey(), pojoFieldDefinition.getSchema()); - + return fieldSchemaHelper.marshal2String(fieldValue); } @@ -322,7 +322,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { /** * Decode an Apex event field by field. - * + * * @param jsonObject the JSON representation of the event * @param apexEvent the incoming event header * @param eventDefinition the definition of the event from the model @@ -358,7 +358,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { /** * Decode an Apex event as a single POJO. - * + * * @param jsonObject the JSON representation of the event * @param apexEvent the incoming event header * @param eventDefinition the definition of the event from the model @@ -439,7 +439,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { /** * Determine the name field of the event header. - * + * * @param jsonObject the event in JSON format * @param parameterEventName the configured event name from the parameters * @return the event name to use on the event header @@ -468,7 +468,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { /** * Determine the version field of the event header. - * + * * @param jsonObject the event in JSON format * @return the event version */ @@ -481,7 +481,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { /** * Determine the name space field of the event header. - * + * * @param jsonObject the event in JSON format * @param eventName the name of the event * @param eventDefinition the definition of the event structure @@ -505,7 +505,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { /** * Determine the source field of the event header. - * + * * @param jsonObject the event in JSON format * @param eventDefinition the definition of the event structure * @return the event version @@ -522,7 +522,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { /** * Determine the target field of the event header. - * + * * @param jsonObject the event in JSON format * @param eventDefinition the definition of the event structure * @return the event version @@ -565,7 +565,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { } catch (final Exception e) { // The element is not a string so throw an error throw new ApexEventRuntimeException("field \"" + fieldName + "\" with type \"" - + jsonField.getClass().getCanonicalName() + "\" is not a string value", e); + + jsonField.getClass().getName() + "\" is not a string value", e); } // Is regular expression checking required diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParametersJsonAdapter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParametersJsonAdapter.java index 902322ca1..1b8dacad4 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParametersJsonAdapter.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParametersJsonAdapter.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -266,8 +267,8 @@ public class EngineServiceParametersJsonAdapter parameters = context.deserialize(parametersObject, Class.forName(parameterClassName)); } catch (JsonParseException | ClassNotFoundException e) { final String returnMessage = "failed to deserialize the parameters for \"" + parametersLabel + "\" " - + "to parameter class \"" + parameterClassName + "\"\n" + e.getClass().getCanonicalName() - + ": " + e.getMessage(); + + "to parameter class \"" + parameterClassName + "\"\n" + e.getClass().getName() + ": " + + e.getMessage(); LOGGER.error(returnMessage, e); throw new ParameterRuntimeException(returnMessage, e); } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java index a188901f3..a87f94201 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java @@ -80,7 +80,7 @@ public class SuperDooperEventProducer implements ApexEventProducer { @Override public void sendEvent(final long executionId, final Properties executionProperties, final String eventName, final Object event) { - LOGGER.info("Sending Event: " + this.getClass().getCanonicalName() + ":" + this.name + " ... event (" + LOGGER.info("Sending Event: " + this.getClass().getName() + ":" + this.name + " ... event (" + eventName + ") : " + event); } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java index 6c5d55183..c945480d4 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -35,13 +36,14 @@ public class SuperDooperEventSubscriber implements ApexEventConsumer { private String name; - public SuperDooperEventSubscriber() {} + public SuperDooperEventSubscriber() { + } @Override public void init(final String name, final EventHandlerParameters consumerParameters, - final ApexEventReceiver apexEventReceiver) throws ApexEventException { + final ApexEventReceiver apexEventReceiver) throws ApexEventException { this.name = name; - LOGGER.info("Initialising Apex Consumer: " + this.getClass().getCanonicalName() + ":" + this.name); + LOGGER.info("Initialising Apex Consumer: " + this.getClass().getName() + ":" + this.name); } @Override @@ -61,7 +63,8 @@ public class SuperDooperEventSubscriber implements ApexEventConsumer { * {@inheritDoc}. */ @Override - public void setPeeredReference(final EventHandlerPeeredMode peeredMode, final PeeredReference peeredReference) {} + public void setPeeredReference(final EventHandlerPeeredMode peeredMode, final PeeredReference peeredReference) { + } @Override public void start() { @@ -70,6 +73,7 @@ public class SuperDooperEventSubscriber implements ApexEventConsumer { } @Override - public void stop() {} + public void stop() { + } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaver.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaver.java index 8eb885759..d7aba2d3c 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaver.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaver.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -49,21 +50,21 @@ public final class SampleDomainModelSaver { */ public static void main(final String[] args) throws ApexException { if (args.length != 1) { - LOGGER.error("usage: " + SampleDomainModelSaver.class.getCanonicalName() + " modelDirectory"); + LOGGER.error("usage: " + SampleDomainModelSaver.class.getName() + " modelDirectory"); return; } // Save Java model final AxPolicyModel javaPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("JAVA"); - final ApexModelSaver<AxPolicyModel> javaModelSaver = new ApexModelSaver<>(AxPolicyModel.class, - javaPolicyModel, args[0]); + final ApexModelSaver<AxPolicyModel> javaModelSaver = new ApexModelSaver<>(AxPolicyModel.class, javaPolicyModel, + args[0]); javaModelSaver.apexModelWriteJson(); javaModelSaver.apexModelWriteXml(); // Save Javascript model final AxPolicyModel javascriptPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("JAVASCRIPT"); - final ApexModelSaver<AxPolicyModel> javascriptModelSaver = new ApexModelSaver<>( - AxPolicyModel.class, javascriptPolicyModel, args[0]); + final ApexModelSaver<AxPolicyModel> javascriptModelSaver = new ApexModelSaver<>(AxPolicyModel.class, + javascriptPolicyModel, args[0]); javascriptModelSaver.apexModelWriteJson(); javascriptModelSaver.apexModelWriteXml(); @@ -83,8 +84,8 @@ public final class SampleDomainModelSaver { // Save MVEL model final AxPolicyModel mvelPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("MVEL"); - final ApexModelSaver<AxPolicyModel> mvelModelSaver = new ApexModelSaver<>(AxPolicyModel.class, - mvelPolicyModel, args[0]); + final ApexModelSaver<AxPolicyModel> mvelModelSaver = new ApexModelSaver<>(AxPolicyModel.class, mvelPolicyModel, + args[0]); mvelModelSaver.apexModelWriteJson(); mvelModelSaver.apexModelWriteXml(); } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java index 7367b0220..3baa14714 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -120,8 +121,7 @@ public class JmsEventProducer implements Runnable { */ private void sendEventsToTopic(final Session jmsSession, final MessageProducer jmsProducer) throws JMSException { - LOGGER.debug("{} : sending events to JMS server, event count {}", this.getClass().getCanonicalName(), - eventCount); + LOGGER.debug("{} : sending events to JMS server, event count {}", this.getClass().getName(), eventCount); for (int i = 0; i < eventCount; i++) { ThreadUtilities.sleep(eventInterval); @@ -135,7 +135,7 @@ public class JmsEventProducer implements Runnable { jmsProducer.send(jmsMessage); eventsSentCount++; } - LOGGER.debug("{} : completed, number of events sent", this.getClass().getCanonicalName(), eventsSentCount); + LOGGER.debug("{} : completed, number of events sent", this.getClass().getName(), eventsSentCount); } /** @@ -151,13 +151,13 @@ public class JmsEventProducer implements Runnable { * Shutdown. */ public void shutdown() { - LOGGER.debug("{} : stopping", this.getClass().getCanonicalName()); + LOGGER.debug("{} : stopping", this.getClass().getName()); stopFlag = true; while (producerThread.isAlive()) { ThreadUtilities.sleep(10); } - LOGGER.debug("{} : stopped", this.getClass().getCanonicalName()); + LOGGER.debug("{} : stopped", this.getClass().getName()); } } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java index 2fd174651..5140d71cd 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -94,7 +95,7 @@ public class JmsEventSubscriber implements Runnable { ((TextMessage) message).getText(); } else { throw new ApexEventException("unknowm message \"" + message + "\" of type \"" - + message.getClass().getCanonicalName() + "\" received"); + + message.getClass().getName() + "\" received"); } eventsReceivedCount++; } catch (final Exception e) { @@ -106,7 +107,7 @@ public class JmsEventSubscriber implements Runnable { throw new ApexEventRuntimeException("JMS event consumption failed", e); } - LOGGER.debug("{} : event reception completed", this.getClass().getCanonicalName()); + LOGGER.debug("{} : event reception completed", this.getClass().getName()); } /** @@ -131,7 +132,7 @@ public class JmsEventSubscriber implements Runnable { } connection.close(); - LOGGER.debug("{} : stopped", this.getClass().getCanonicalName()); + LOGGER.debug("{} : stopped", this.getClass().getName()); } } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java index e0f5c23c4..c214b72a8 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -107,11 +108,11 @@ public class KafkaEventProducer implements Runnable { */ private void sendEventsToTopic(final Producer<String, String> producer) { LOGGER.debug("{} : sending events to Kafka server, event count {}, xmlEvents {}", - KafkaEventProducer.class.getCanonicalName(), eventCount, xmlEvents); + KafkaEventProducer.class.getName(), eventCount, xmlEvents); for (int i = 0; i < eventCount; i++) { - LOGGER.debug("{} : waiting {} milliseconds before sending next event", - KafkaEventProducer.class.getCanonicalName(), eventInterval); + LOGGER.debug("{} : waiting {} milliseconds before sending next event", KafkaEventProducer.class.getName(), + eventInterval); ThreadUtilities.sleep(eventInterval); String eventString = null; @@ -125,7 +126,7 @@ public class KafkaEventProducer implements Runnable { eventsSentCount++; LOGGER.debug("****** Sent event No. {} ******", eventsSentCount); } - LOGGER.debug("{}: completed", KafkaEventProducer.class.getCanonicalName()); + LOGGER.debug("{}: completed", KafkaEventProducer.class.getName()); } /** @@ -141,7 +142,7 @@ public class KafkaEventProducer implements Runnable { * Shutdown. */ public void shutdown() { - LOGGER.debug("{} : stopping", KafkaEventProducer.class.getCanonicalName()); + LOGGER.debug("{} : stopping", KafkaEventProducer.class.getName()); stopFlag = true; @@ -149,6 +150,6 @@ public class KafkaEventProducer implements Runnable { ThreadUtilities.sleep(10); } - LOGGER.debug("{} : stopped", KafkaEventProducer.class.getCanonicalName()); + LOGGER.debug("{} : stopped", KafkaEventProducer.class.getName()); } } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java index da2cc3344..1bb2e8021 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,8 +81,8 @@ public class KafkaEventSubscriber implements Runnable { */ @Override public void run() { - LOGGER.debug("{}: receiving events from Kafka server on topic {}", - KafkaEventSubscriber.class.getCanonicalName(), topic); + LOGGER.debug("{}: receiving events from Kafka server on topic {}", KafkaEventSubscriber.class.getName(), + topic); while (subscriberThread.isAlive() && !subscriberThread.isInterrupted()) { try { @@ -97,7 +98,7 @@ public class KafkaEventSubscriber implements Runnable { } } - LOGGER.debug("{}: event reception completed", KafkaEventSubscriber.class.getCanonicalName()); + LOGGER.debug("{}: event reception completed", KafkaEventSubscriber.class.getName()); } /** @@ -120,6 +121,6 @@ public class KafkaEventSubscriber implements Runnable { } consumer.close(); - LOGGER.debug("{} : stopped", KafkaEventSubscriber.class.getCanonicalName()); + LOGGER.debug("{} : stopped", KafkaEventSubscriber.class.getName()); } } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java index 023ff9998..ffb8f1e1b 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,8 +65,8 @@ public class WebSocketEventProducerClient implements WsStringMessageListener { client = new WsStringMessageClient(host, port); client.start(this); - LOGGER.debug("{}: host {}, port {}, event count {}, xmlEvents {}", - WebSocketEventProducerClient.class.getCanonicalName(), host, port, eventCount, xmlEvents); + LOGGER.debug("{}: host {}, port {}, event count {}, xmlEvents {}", WebSocketEventProducerClient.class.getName(), + host, port, eventCount, xmlEvents); } /** @@ -73,11 +74,11 @@ public class WebSocketEventProducerClient implements WsStringMessageListener { */ public void sendEvents() { LOGGER.debug("{}: sending events on host {}, port {}, event count {}, xmlEvents {}", - WebSocketEventProducerClient.class.getCanonicalName(), host, port, eventCount, xmlEvents); + WebSocketEventProducerClient.class.getName(), host, port, eventCount, xmlEvents); for (int i = 0; i < eventCount; i++) { LOGGER.debug("{}: waiting {} milliseconds before sending next event", - WebSocketEventProducerClient.class.getCanonicalName(), eventInterval); + WebSocketEventProducerClient.class.getName(), eventInterval); ThreadUtilities.sleep(eventInterval); String eventString = null; @@ -88,10 +89,10 @@ public class WebSocketEventProducerClient implements WsStringMessageListener { } client.sendString(eventString); eventsSentCount++; - LOGGER.debug("{}: host {}, port {}, sent event {}", WebSocketEventProducerClient.class.getCanonicalName(), - host, port, eventString); + LOGGER.debug("{}: host {}, port {}, sent event {}", WebSocketEventProducerClient.class.getName(), host, + port, eventString); } - LOGGER.debug("{}: completed", WebSocketEventProducerClient.class.getCanonicalName()); + LOGGER.debug("{}: completed", WebSocketEventProducerClient.class.getName()); } /** @@ -108,7 +109,7 @@ public class WebSocketEventProducerClient implements WsStringMessageListener { */ public void shutdown() { client.stop(); - LOGGER.debug("{}: stopped", WebSocketEventProducerClient.class.getCanonicalName()); + LOGGER.debug("{}: stopped", WebSocketEventProducerClient.class.getName()); } /** @@ -116,8 +117,8 @@ public class WebSocketEventProducerClient implements WsStringMessageListener { */ @Override public void receiveString(final String eventString) { - LOGGER.debug("{}: host {}, port {}, received event {}", WebSocketEventProducerServer.class.getCanonicalName(), - host, port, eventString); + LOGGER.debug("{}: host {}, port {}, received event {}", WebSocketEventProducerServer.class.getName(), host, + port, eventString); } /** diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java index 11438d952..ec3112c39 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,8 +62,8 @@ public class WebSocketEventProducerServer implements WsStringMessageListener { server = new WsStringMessageServer(port); server.start(this); - LOGGER.debug("{}: port {}, event count {}, xmlEvents {}", WebSocketEventProducerServer.class.getCanonicalName(), - port, eventCount, xmlEvents); + LOGGER.debug("{}: port {}, event count {}, xmlEvents {}", WebSocketEventProducerServer.class.getName(), port, + eventCount, xmlEvents); } /** @@ -70,11 +71,11 @@ public class WebSocketEventProducerServer implements WsStringMessageListener { */ public void sendEvents() { LOGGER.debug("{}: sending events on port {}, event count {}, xmlEvents {}", - WebSocketEventProducerServer.class.getCanonicalName(), port, eventCount, xmlEvents); + WebSocketEventProducerServer.class.getName(), port, eventCount, xmlEvents); for (int i = 0; i < eventCount; i++) { LOGGER.debug("{}: waiting {} milliseconds before sending next event", - WebSocketEventProducerServer.class.getCanonicalName(), eventInterval); + WebSocketEventProducerServer.class.getName(), eventInterval); ThreadUtilities.sleep(eventInterval); String eventString = null; @@ -85,11 +86,10 @@ public class WebSocketEventProducerServer implements WsStringMessageListener { } server.sendString(eventString); eventsSentCount++; - LOGGER.debug("{}: port {}, sent event {}", WebSocketEventProducerServer.class.getCanonicalName(), port, - eventString); + LOGGER.debug("{}: port {}, sent event {}", WebSocketEventProducerServer.class.getName(), port, eventString); } - LOGGER.debug("{}: event sending completed", WebSocketEventProducerServer.class.getCanonicalName()); + LOGGER.debug("{}: event sending completed", WebSocketEventProducerServer.class.getName()); } /** @@ -106,7 +106,7 @@ public class WebSocketEventProducerServer implements WsStringMessageListener { */ public void shutdown() { server.stop(); - LOGGER.debug("{}: stopped", WebSocketEventProducerServer.class.getCanonicalName()); + LOGGER.debug("{}: stopped", WebSocketEventProducerServer.class.getName()); } /** @@ -114,8 +114,7 @@ public class WebSocketEventProducerServer implements WsStringMessageListener { */ @Override public void receiveString(final String eventString) { - LOGGER.debug("{}: port {}, received event {}", WebSocketEventProducerServer.class.getCanonicalName(), port, - eventString); + LOGGER.debug("{}: port {}, received event {}", WebSocketEventProducerServer.class.getName(), port, eventString); } /** diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java index 5cd871225..7fe2d4306 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +57,7 @@ public class WebSocketEventSubscriberClient implements WsStringMessageListener { */ @Override public void receiveString(final String eventString) { - LOGGER.debug("{}: port {}, received event {}", WebSocketEventSubscriberClient.class.getCanonicalName(), port, + LOGGER.debug("{}: port {}, received event {}", WebSocketEventSubscriberClient.class.getName(), port, eventString); eventsReceivedCount++; } @@ -75,7 +76,7 @@ public class WebSocketEventSubscriberClient implements WsStringMessageListener { */ public void shutdown() { client.stop(); - LOGGER.debug("{}: stopped", WebSocketEventSubscriberServer.class.getCanonicalName()); + LOGGER.debug("{}: stopped", WebSocketEventSubscriberServer.class.getName()); } /** diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java index 48d221791..d36ce9638 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +50,7 @@ public class WebSocketEventSubscriberServer implements WsStringMessageListener { server = new WsStringMessageServer(port); server.start(this); - LOGGER.debug("{}: port {}, waiting for events", WebSocketEventSubscriberServer.class.getCanonicalName(), port); + LOGGER.debug("{}: port {}, waiting for events", WebSocketEventSubscriberServer.class.getName(), port); } /** @@ -57,7 +58,7 @@ public class WebSocketEventSubscriberServer implements WsStringMessageListener { */ @Override public void receiveString(final String eventString) { - LOGGER.debug("{}: port {}, received event {}", WebSocketEventSubscriberServer.class.getCanonicalName(), port, + LOGGER.debug("{}: port {}, received event {}", WebSocketEventSubscriberServer.class.getName(), port, eventString); eventsReceivedCount++; } @@ -76,7 +77,7 @@ public class WebSocketEventSubscriberServer implements WsStringMessageListener { */ public void shutdown() { server.stop(); - LOGGER.debug("{} : stopped", WebSocketEventSubscriberServer.class.getCanonicalName()); + LOGGER.debug("{} : stopped", WebSocketEventSubscriberServer.class.getName()); } /** diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventConsumer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventConsumer.java index e5a88a365..dc5cce8c6 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventConsumer.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventConsumer.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,22 +60,21 @@ public class DummyApexEventConsumer implements ApexEventConsumer { @Override public void init(final String consumerName, final EventHandlerParameters consumerParameters, - final ApexEventReceiver incomingEventReceiver) throws ApexEventException { + final ApexEventReceiver incomingEventReceiver) throws ApexEventException { this.eventReceiver = incomingEventReceiver; this.name = consumerName; - // Check and get the properties if (!(consumerParameters.getCarrierTechnologyParameters() instanceof DummyCarrierTechnologyParameters)) { String message = "specified consumer properties of type \"" - + consumerParameters.getCarrierTechnologyParameters().getClass().getCanonicalName() - + "\" are not applicable to a dummy consumer"; + + consumerParameters.getCarrierTechnologyParameters().getClass().getName() + + "\" are not applicable to a dummy consumer"; LOGGER.warn(message); throw new ApexEventException(message); } - dummyConsumerProperties = - (DummyCarrierTechnologyParameters) consumerParameters.getCarrierTechnologyParameters(); + dummyConsumerProperties = (DummyCarrierTechnologyParameters) consumerParameters + .getCarrierTechnologyParameters(); } @Override @@ -107,7 +107,8 @@ public class DummyApexEventConsumer implements ApexEventConsumer { } @Override - public void stop() {} + public void stop() { + } private class RunTestEventSender implements Runnable { @Override @@ -117,7 +118,7 @@ public class DummyApexEventConsumer implements ApexEventConsumer { executionProperties.load(new FileInputStream(new File(dummyConsumerProperties.getPropertyFileName()))); } catch (IOException e1) { String message = "reading of executor properties for testing failed from file: " - + dummyConsumerProperties.getPropertyFileName(); + + dummyConsumerProperties.getPropertyFileName(); LOGGER.warn(message); throw new ApexEventRuntimeException(message); } |