diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2020-03-26 10:03:11 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2020-03-26 13:36:49 -0400 |
commit | dffa54c9a27bcd9524e2aa75684ff02d70507b59 (patch) | |
tree | 50bf1fe93e35a74d5ead879bea76aada4b4c04b5 /plugins/forwarding-plugins/src/test | |
parent | 7bec6ce98fd24275d31b9aafe5b2f9bd515faf2c (diff) |
Remove unused imports and clean logs
Unused imports and marked an unused variable.
Added m2e eclipse settings (other repos have this).
Added some test logback.xml to clear out jetty debug
messages.
Replaced deprecated newInstance with getDeclaredConstructor.
newInstance
Either log or throw Exception - chose throw
Added some assertions to JUnit test.
Issue-ID: POLICY-2305
Change-Id: Ia4e9ce62dc7fb45aea247d470ca7245e694fc26e
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'plugins/forwarding-plugins/src/test')
2 files changed, 55 insertions, 10 deletions
diff --git a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarderTest.java b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarderTest.java index 7d84657a..5fce708e 100644 --- a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarderTest.java +++ b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarderTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2020 AT&T Inc. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +21,7 @@ package org.onap.policy.distribution.forwarding.lifecycle.api; +import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.util.ArrayList; @@ -83,20 +85,22 @@ public class LifecycleApiPolicyForwarderTest { @Test public void testForwardPolicyUsingSimulator() throws Exception { + assertThatCode(() -> { + final ToscaServiceTemplate toscaServiceTemplate1 = + standardCoder.decode(ResourceUtils.getResourceAsString(POLICY_TYPE), ToscaServiceTemplate.class); + final ToscaServiceTemplate toscaServiceTemplate2 = + standardCoder.decode(ResourceUtils.getResourceAsString(POLICY), ToscaServiceTemplate.class); - final ToscaServiceTemplate toscaServiceTemplate1 = - standardCoder.decode(ResourceUtils.getResourceAsString(POLICY_TYPE), ToscaServiceTemplate.class); - final ToscaServiceTemplate toscaServiceTemplate2 = - standardCoder.decode(ResourceUtils.getResourceAsString(POLICY), ToscaServiceTemplate.class); + final LifecycleApiPolicyForwarder forwarder = new LifecycleApiPolicyForwarder(); + forwarder.configure(LifecycleApiForwarderParameters.class.getSimpleName()); - final LifecycleApiPolicyForwarder forwarder = new LifecycleApiPolicyForwarder(); - forwarder.configure(LifecycleApiForwarderParameters.class.getSimpleName()); + final Collection<ToscaEntity> policies = new ArrayList<>(); + policies.add(toscaServiceTemplate1); + policies.add(toscaServiceTemplate2); - final Collection<ToscaEntity> policies = new ArrayList<>(); - policies.add(toscaServiceTemplate1); - policies.add(toscaServiceTemplate2); + forwarder.forward(policies); - forwarder.forward(policies); + }).doesNotThrowAnyException(); } @Test diff --git a/plugins/forwarding-plugins/src/test/resources/logback-test.xml b/plugins/forwarding-plugins/src/test/resources/logback-test.xml new file mode 100644 index 00000000..29d86d48 --- /dev/null +++ b/plugins/forwarding-plugins/src/test/resources/logback-test.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2020 AT&T Inc. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<configuration> + + <contextName>policy-api</contextName> + <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> + + <!-- USE FOR STD OUT ONLY --> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern> + </encoder> + </appender> + + <root level="INFO"> + <appender-ref ref="STDOUT" /> + </root> + + <logger name="org.eclipse.jetty.server.RequestLog" level="WARN" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> +</configuration> |