diff options
author | Jim Hahn <jrh3@att.com> | 2018-09-28 09:53:14 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2018-09-28 16:52:08 -0400 |
commit | 53f06d93dc2c4d292ea1c7dad24df0d72cc01dc5 (patch) | |
tree | df98f63e1410b3eb0224cbb79fe4d45f754f9a9b /policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicTestBase.java | |
parent | b2cbec29c685f6aef49a5828761045acee17224b (diff) |
Add junit coverage to rest of policy-endpoint bus
Also extracted out common code from tests.
Fix checkstyle issues.
Be consistent in returning IllegalStateException when topic is not
found by any Topic Factory.
Added/updated some comments.
Use better name for "validate" argument.
Renamed test() to testDestroy().
Added NoopTopicPropertyBuilder.
Renamed BusTopicTestBase to TopicTestBase.
Change-Id: Id4c7ab9f2b5572dc5195b0da116e285c5e9b6f06
Issue-ID: POLICY-1148
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicTestBase.java')
-rw-r--r-- | policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicTestBase.java | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicTestBase.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicTestBase.java deleted file mode 100644 index ba52f191..00000000 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicTestBase.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * policy-endpoints - * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.common.endpoints.event.comm.bus; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams.TopicParamsBuilder; - -/** - * Base class for BusTopicXxxTest classes. - */ -public class BusTopicTestBase { - - public static final String MY_AFT_ENV = "my-aft-env"; - public static final String MY_API_KEY = "my-api-key"; - public static final String MY_API_SECRET = "my-api-secret"; - public static final String MY_BASE_PATH = "my-base"; - public static final String MY_CLIENT_NAME = "my-client"; - public static final String MY_CONS_GROUP = "my-cons-group"; - public static final String MY_CONS_INST = "my-cons-inst"; - public static final String MY_ENV = "my-env"; - public static final int MY_FETCH_LIMIT = 100; - public static final int MY_FETCH_TIMEOUT = 101; - public static final String MY_HOST = "my-host"; - public static final String MY_LAT = "my-lat"; - public static final String MY_LONG = "my-long"; - public static final String MY_PARTNER = "my-partner"; - public static final String MY_PASSWD = "my-pass"; - public static final int MY_PORT = 102; - public static final String MY_TOPIC = "my-topic"; - public static final String MY_USERNAME = "my-user"; - - public static final String MY_MESSAGE = "my-message"; - public static final String MY_PARTITION = "my-partition"; - public static final String MY_MESSAGE2 = "my-message-2"; - public static final String MY_PARTITION2 = "my-partition-2"; - - public static final String ROUTE_PROP = "routeOffer"; - public static final String MY_ROUTE = "my-route"; - - /** - * Message used within exceptions that are expected. - */ - public static final String EXPECTED = "expected exception"; - - /** - * Additional properties to be added to the parameter builder. - */ - protected Map<String, String> addProps; - - /** - * Servers to be added to the parameter builder. - */ - protected List<String> servers; - - /** - * Parameter builder used to build topic parameters. - */ - protected TopicParamsBuilder builder; - - /** - * Initializes {@link #addProps}, {@link #servers}, and {@link #builder}. - */ - public void setUp() { - addProps = new TreeMap<>(); - addProps.put("my-key-A", "my-value-A"); - addProps.put("my-key-B", "my-value-B"); - - servers = Arrays.asList("svra", "svrb"); - - builder = makeBuilder(); - } - - /** - * Makes a fully populated parameter builder. - * - * @return a new parameter builder - */ - public TopicParamsBuilder makeBuilder() { - return makeBuilder(addProps, servers); - } - - /** - * Makes a fully populated parameter builder. - * - * @param addProps additional properties to be added to the builder - * @param servers servers to be added to the builder - * @return a new parameter builder - */ - public TopicParamsBuilder makeBuilder(Map<String, String> addProps, List<String> servers) { - - return BusTopicParams.builder().additionalProps(addProps).aftEnvironment(MY_AFT_ENV).allowSelfSignedCerts(true) - .apiKey(MY_API_KEY).apiSecret(MY_API_SECRET).basePath(MY_BASE_PATH).clientName(MY_CLIENT_NAME) - .consumerGroup(MY_CONS_GROUP).consumerInstance(MY_CONS_INST).environment(MY_ENV) - .fetchLimit(MY_FETCH_LIMIT).fetchTimeout(MY_FETCH_TIMEOUT).hostname(MY_HOST).latitude(MY_LAT) - .longitude(MY_LONG).managed(true).partitionId(MY_PARTITION).partner(MY_PARTNER) - .password(MY_PASSWD).port(MY_PORT).servers(servers).topic(MY_TOPIC).useHttps(true) - .userName(MY_USERNAME); - } -} |