From e8b197315437cac84872752e2ea090d8fb233941 Mon Sep 17 00:00:00 2001 From: Parshad Patel Date: Tue, 20 Nov 2018 14:46:45 +0900 Subject: Rename test classes in apex-pdp Make test classes name consistence under auth, model, plugins, testsuits, tools projects Issue-ID: POLICY-1263 Change-Id: I49ec9a9f5b457d6381e693de2c04ec0268ad1b02 Signed-off-by: Parshad Patel --- .../policy/apex/tools/common/CliParserTest.java | 43 ++++++++ .../policy/apex/tools/common/TestCliParser.java | 43 -------- .../apex/tools/common/docs/ExampleAppVersion.java | 65 ----------- .../tools/common/docs/ExampleAppVersionTest.java | 65 +++++++++++ .../apex/tools/common/docs/ExampleCliParser.java | 122 --------------------- .../tools/common/docs/ExampleCliParserTest.java | 122 +++++++++++++++++++++ 6 files changed, 230 insertions(+), 230 deletions(-) create mode 100644 tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/CliParserTest.java delete mode 100644 tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/TestCliParser.java delete mode 100644 tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersion.java create mode 100644 tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java delete mode 100644 tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java create mode 100644 tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java (limited to 'tools/tools-common/src') diff --git a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/CliParserTest.java b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/CliParserTest.java new file mode 100644 index 000000000..9cd7b71e3 --- /dev/null +++ b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/CliParserTest.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.tools.common; + +import org.junit.Test; +import org.onap.policy.apex.tools.common.CliParser; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; + +/** + * Tests for {@link CliParser}. + * + * @author Sven van der Meer (sven.van.der.meer@ericsson.com) + */ +public class CliParserTest { + + private static final XLogger LOGGER = XLoggerFactory.getXLogger(CliParserTest.class); + + /** Testapp version. */ + @Test + public void testappVersion() { + final CliParser cli = new CliParser(); + LOGGER.info(cli.getAppVersion()); + } +} diff --git a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/TestCliParser.java b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/TestCliParser.java deleted file mode 100644 index bf14cfec0..000000000 --- a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/TestCliParser.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.apex.tools.common; - -import org.junit.Test; -import org.onap.policy.apex.tools.common.CliParser; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * Tests for {@link CliParser}. - * - * @author Sven van der Meer (sven.van.der.meer@ericsson.com) - */ -public class TestCliParser { - - private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestCliParser.class); - - /** Testapp version. */ - @Test - public void testappVersion() { - final CliParser cli = new CliParser(); - LOGGER.info(cli.getAppVersion()); - } -} diff --git a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersion.java b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersion.java deleted file mode 100644 index 6d6fa9c1d..000000000 --- a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersion.java +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.apex.tools.common.docs; - -//// -//// NOTE: This file contains tags for ASCIIDOC -//// DO NOT REMOVE any of those tag lines, e.g. -////// tag::** -////// end::** -//// - -import org.apache.commons.cli.CommandLine; -import org.junit.Test; -import org.onap.policy.apex.tools.common.CliOptions; -import org.onap.policy.apex.tools.common.CliParser; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * Examples for documentation using {@link CliParser#getAppVersion()}. - * - * @author Sven van der Meer (sven.van.der.meer@ericsson.com) - */ -public class ExampleAppVersion { - - private static final XLogger LOGGER = XLoggerFactory.getXLogger(ExampleAppVersion.class); - - /** Test example app version. */ - @Test - public void testExampleAppVersion() { - final String[] args = new String[] { "-v" }; - - // tag::setupParser[] - final CliParser cli = new CliParser(); - cli.addOption(CliOptions.VERSION); - final CommandLine cmd = cli.parseCli(args); - // end::setupParser[] - - // tag::processCliVersion[] - // version is an exit option, print version and exit - if (cmd.hasOption('v') || cmd.hasOption("version")) { - LOGGER.info("myApp" + " " + cli.getAppVersion()); - return; - } - // end::processCliVersion[] - } -} diff --git a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java new file mode 100644 index 000000000..2433e3c5c --- /dev/null +++ b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.tools.common.docs; + +//// +//// NOTE: This file contains tags for ASCIIDOC +//// DO NOT REMOVE any of those tag lines, e.g. +////// tag::** +////// end::** +//// + +import org.apache.commons.cli.CommandLine; +import org.junit.Test; +import org.onap.policy.apex.tools.common.CliOptions; +import org.onap.policy.apex.tools.common.CliParser; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; + +/** + * Examples for documentation using {@link CliParser#getAppVersion()}. + * + * @author Sven van der Meer (sven.van.der.meer@ericsson.com) + */ +public class ExampleAppVersionTest { + + private static final XLogger LOGGER = XLoggerFactory.getXLogger(ExampleAppVersionTest.class); + + /** Test example app version. */ + @Test + public void testExampleAppVersion() { + final String[] args = new String[] { "-v" }; + + // tag::setupParser[] + final CliParser cli = new CliParser(); + cli.addOption(CliOptions.VERSION); + final CommandLine cmd = cli.parseCli(args); + // end::setupParser[] + + // tag::processCliVersion[] + // version is an exit option, print version and exit + if (cmd.hasOption('v') || cmd.hasOption("version")) { + LOGGER.info("myApp" + " " + cli.getAppVersion()); + return; + } + // end::processCliVersion[] + } +} diff --git a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java deleted file mode 100644 index b93038604..000000000 --- a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java +++ /dev/null @@ -1,122 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.apex.tools.common.docs; - -//// -////NOTE: This file contains tags for ASCIIDOC -////DO NOT REMOVE any of those tag lines, e.g. -//////tag::** -//////end::** -//// -////DO NOT auto-refresh imports or organise imports! -//// - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.HelpFormatter; -import org.junit.Test; - -//tag::import[] -import org.onap.policy.apex.tools.common.CliOptions; -import org.onap.policy.apex.tools.common.CliParser; -//end::import[] - -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * Examples for documentation using {@link CliParser}. - * - * @author Sven van der Meer (sven.van.der.meer@ericsson.com) - */ -public class ExampleCliParser { - - private static final XLogger LOGGER = XLoggerFactory.getXLogger(ExampleCliParser.class); - - /** - * Test example parser. - */ - @Test - public void testExampleParser() { - final String[] args = new String[] { "-h" }; - - // tag::setApp[] - final String appName = "test-app"; - final String appDescription = "a test app for documenting how to use the CLI utilities"; - // end::setApp[] - - // tag::setCli[] - final CliParser cli = new CliParser(); - cli.addOption(CliOptions.HELP); - cli.addOption(CliOptions.VERSION); - cli.addOption(CliOptions.MODELFILE); - // end::setCli[] - - // tag::parseCli[] - final CommandLine cmd = cli.parseCli(args); - // end::parseCli[] - - // tag::processCliHelp[] - // help is an exit option, print usage and exit - if (cmd.hasOption('h') || cmd.hasOption("help")) { - final HelpFormatter formatter = new HelpFormatter(); - LOGGER.info(appName + " v" + cli.getAppVersion() + " - " + appDescription); - formatter.printHelp(appName, cli.getOptions()); - return; - } - // end::processCliHelp[] - - // tag::processCliVersion[] - // version is an exit option, print version and exit - if (cmd.hasOption('v') || cmd.hasOption("version")) { - LOGGER.info(appName + " " + cli.getAppVersion()); - return; - } - // end::processCliVersion[] - - // tag::processCliModel[] - String modelFile = cmd.getOptionValue('m'); - if (modelFile == null) { - modelFile = cmd.getOptionValue("model"); - } - if (modelFile == null) { - LOGGER.error(appName + ": no model file given, cannot proceed (try -h for help)"); - return; - } - // end::processCliModel[] - - // tag::someStartPrint[] - LOGGER.info(appName + ": starting"); - LOGGER.info(" --> model file: " + modelFile); - // end::someStartPrint[] - - // tag::yourApp[] - // your code for the application here - // e.g. - // try { - // Model2Cli app = new Model2Cli(modelFile, !cmd.hasOption("sv"), appName); - // app.runApp(); - // } - // catch(ApexException aex) { - // LOGGER.error(appName + ": caught APEX exception with message: " + aex.getMessage()); - // } - // end::yourApp[] - } -} diff --git a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java new file mode 100644 index 000000000..723ad8739 --- /dev/null +++ b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java @@ -0,0 +1,122 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.tools.common.docs; + +//// +////NOTE: This file contains tags for ASCIIDOC +////DO NOT REMOVE any of those tag lines, e.g. +//////tag::** +//////end::** +//// +////DO NOT auto-refresh imports or organise imports! +//// + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.HelpFormatter; +import org.junit.Test; + +//tag::import[] +import org.onap.policy.apex.tools.common.CliOptions; +import org.onap.policy.apex.tools.common.CliParser; +//end::import[] + +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; + +/** + * Examples for documentation using {@link CliParser}. + * + * @author Sven van der Meer (sven.van.der.meer@ericsson.com) + */ +public class ExampleCliParserTest { + + private static final XLogger LOGGER = XLoggerFactory.getXLogger(ExampleCliParserTest.class); + + /** + * Test example parser. + */ + @Test + public void testExampleParser() { + final String[] args = new String[] { "-h" }; + + // tag::setApp[] + final String appName = "test-app"; + final String appDescription = "a test app for documenting how to use the CLI utilities"; + // end::setApp[] + + // tag::setCli[] + final CliParser cli = new CliParser(); + cli.addOption(CliOptions.HELP); + cli.addOption(CliOptions.VERSION); + cli.addOption(CliOptions.MODELFILE); + // end::setCli[] + + // tag::parseCli[] + final CommandLine cmd = cli.parseCli(args); + // end::parseCli[] + + // tag::processCliHelp[] + // help is an exit option, print usage and exit + if (cmd.hasOption('h') || cmd.hasOption("help")) { + final HelpFormatter formatter = new HelpFormatter(); + LOGGER.info(appName + " v" + cli.getAppVersion() + " - " + appDescription); + formatter.printHelp(appName, cli.getOptions()); + return; + } + // end::processCliHelp[] + + // tag::processCliVersion[] + // version is an exit option, print version and exit + if (cmd.hasOption('v') || cmd.hasOption("version")) { + LOGGER.info(appName + " " + cli.getAppVersion()); + return; + } + // end::processCliVersion[] + + // tag::processCliModel[] + String modelFile = cmd.getOptionValue('m'); + if (modelFile == null) { + modelFile = cmd.getOptionValue("model"); + } + if (modelFile == null) { + LOGGER.error(appName + ": no model file given, cannot proceed (try -h for help)"); + return; + } + // end::processCliModel[] + + // tag::someStartPrint[] + LOGGER.info(appName + ": starting"); + LOGGER.info(" --> model file: " + modelFile); + // end::someStartPrint[] + + // tag::yourApp[] + // your code for the application here + // e.g. + // try { + // Model2Cli app = new Model2Cli(modelFile, !cmd.hasOption("sv"), appName); + // app.runApp(); + // } + // catch(ApexException aex) { + // LOGGER.error(appName + ": caught APEX exception with message: " + aex.getMessage()); + // } + // end::yourApp[] + } +} -- cgit 1.2.3-korg