summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsblimkie <steven.blimkie@amdocs.com>2018-03-20 13:20:04 -0400
committersblimkie <steven.blimkie@amdocs.com>2018-03-20 13:27:49 -0400
commitf53dfdc79185d0a45ed2b8d6e6efdaee6a624284 (patch)
tree23635345c7a3b8a0eb962d5d4b9c0b15dc74d47e
parentd321aaa66a6b6511b04b92b9c8fd88c2864bcebf (diff)
Improve sonar test coverage
Improve sonar test coverage Change-Id: I43b7fab68a8a070d585edd202d5005f4a3b5d486 Issue-ID: AAI-502 Signed-off-by: sblimkie <steven.blimkie@amdocs.com>
-rw-r--r--src/test/java/org/onap/aai/event/EventBusTest.java127
-rw-r--r--src/test/java/org/onap/aai/event/TestCamelContext.java1241
-rw-r--r--src/test/java/org/onap/aai/event/TestProcessor.java35
-rw-r--r--src/test/java/org/onap/aai/rest/RestClientTest.java124
4 files changed, 1421 insertions, 106 deletions
diff --git a/src/test/java/org/onap/aai/event/EventBusTest.java b/src/test/java/org/onap/aai/event/EventBusTest.java
index 159d02e..8d294cd 100644
--- a/src/test/java/org/onap/aai/event/EventBusTest.java
+++ b/src/test/java/org/onap/aai/event/EventBusTest.java
@@ -17,8 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.event;
@@ -27,60 +25,97 @@ import static org.junit.Assert.assertTrue;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.camel.Endpoint;
import org.junit.Before;
import org.junit.Test;
public class EventBusTest {
- /**
- * Test case initialization
- *
- * @throws Exception the exception
- */
- @Before
- public void init() throws Exception {
- }
-
- @Test
- public void validate() throws Exception {
+ /**
+ * Test case initialization
+ *
+ * @throws Exception the exception
+ */
+ @Before
+ public void init() throws Exception {
+ }
- try {
- EventBusComponent rc = new EventBusComponent();
- EventBusEndpoint endpoint = new EventBusEndpoint("http://host.com:8443/endpoint", rc);
+ @Test
+ public void validateProducer() throws Exception {
+ try {
+ EventBusComponent rc = new EventBusComponent();
+ EventBusEndpoint endpoint = new EventBusEndpoint("http://host.com:8443/endpoint", rc);
+ endpoint.setApiSecret("OBF:1y0q1uvc1uum1uvg1pil1pjl1uuq1uvk1uuu1y10");
+ endpoint.setApiKey("OBF:1y0q1uvc1uum1uvg1pil1pjl1uuq1uvk1uuu1y10");
+ endpoint.setEventTopic("eventTopic");
+ endpoint.setGroupId("groupId");
+ endpoint.setGroupName("gn");
+ endpoint.setName("name");
+ endpoint.setPoolSize(45);
+ endpoint.setPollingDelay(10);
+ endpoint.setUrl("url");
- endpoint.setApiSecret("OBF:1y0q1uvc1uum1uvg1pil1pjl1uuq1uvk1uuu1y10");
- endpoint.setApiKey("OBF:1y0q1uvc1uum1uvg1pil1pjl1uuq1uvk1uuu1y10");
- endpoint.setEventTopic("eventTopic");
- endpoint.setGroupId("groupId");
- endpoint.setGroupName("gn");
- endpoint.setName("name");
- endpoint.setPoolSize(45);
- endpoint.setPollingDelay(10);
- endpoint.setUrl("url");
+ assertTrue(endpoint.getApiSecret().compareTo("onapSecret") == 0);
+ assertTrue(endpoint.getApiKey().compareTo("onapSecret") == 0);
+ assertTrue(endpoint.getEventTopic().compareTo("eventTopic") == 0);
+ assertTrue(endpoint.getGroupId().compareTo("groupId") == 0);
+ assertTrue(endpoint.getGroupName().compareTo("gn") == 0);
+ assertTrue(endpoint.getName().compareTo("name") == 0);
+ assertTrue(endpoint.getPoolSize() == 45);
+ assertTrue(endpoint.getPollingDelay() == 10);
+ assertTrue(endpoint.getUrl().compareTo("url") == 0);
+ assertFalse(endpoint.isSingleton());
- assertTrue(endpoint.getApiSecret().compareTo("onapSecret") == 0);
- assertTrue(endpoint.getApiKey().compareTo("onapSecret") == 0);
- assertTrue(endpoint.getEventTopic().compareTo("eventTopic") == 0);
- assertTrue(endpoint.getGroupId().compareTo("groupId") == 0);
- assertTrue(endpoint.getGroupName().compareTo("gn") == 0);
- assertTrue(endpoint.getName().compareTo("name") == 0);
- assertTrue(endpoint.getPoolSize() == 45);
- assertTrue(endpoint.getPollingDelay() == 10);
- assertTrue(endpoint.getUrl().compareTo("url") == 0);
- assertFalse(endpoint.isSingleton());
-
- EventBusProducer producer = (EventBusProducer)endpoint.createProducer();
- assertTrue(producer.getEndpoint() != null);
+ EventBusProducer producer = (EventBusProducer)endpoint.createProducer();
+ assertTrue(producer.getEndpoint() != null);
+ }
+ catch (Exception ex) {
+ StringWriter writer = new StringWriter();
+ PrintWriter printWriter = new PrintWriter( writer );
+ ex.printStackTrace( printWriter );
+ printWriter.flush();
+ System.out.println(writer.toString());
+ throw ex;
+ }
}
- catch (Exception ex) {
- StringWriter writer = new StringWriter();
- PrintWriter printWriter = new PrintWriter( writer );
- ex.printStackTrace( printWriter );
- printWriter.flush();
- System.out.println(writer.toString());
- throw ex;
+
+ @Test
+ public void validateEventBusComponent() throws Exception {
+ EventBusComponent rc = new EventBusComponent(new TestCamelContext());
+ Endpoint endpoint = rc.createEndpoint("http://host.com:8443/endpoint", null, new HashMap<String, Object>());
+ assertTrue(endpoint.getEndpointUri().equals("http://host.com:8443/endpoint"));
}
- }
+ @Test
+ public void validateConsumer() throws Exception {
+ try {
+ EventBusComponent rc = new EventBusComponent();
+ EventBusEndpoint endpoint = new EventBusEndpoint("http://host.com:8443/endpoint", rc);
+
+ endpoint.setApiSecret("OBF:1y0q1uvc1uum1uvg1pil1pjl1uuq1uvk1uuu1y10");
+ endpoint.setApiKey("OBF:1y0q1uvc1uum1uvg1pil1pjl1uuq1uvk1uuu1y10");
+ endpoint.setEventTopic("eventTopic");
+ endpoint.setGroupId("groupId");
+ endpoint.setGroupName("gn");
+ endpoint.setName("name");
+ endpoint.setPoolSize(45);
+ endpoint.setPollingDelay(10);
+ endpoint.setUrl("url");
+
+ TestProcessor processor = new TestProcessor();
+ EventBusConsumer consumer = new EventBusConsumer(endpoint, processor);
+
+ }
+ catch (Exception ex) {
+ StringWriter writer = new StringWriter();
+ PrintWriter printWriter = new PrintWriter( writer );
+ ex.printStackTrace( printWriter );
+ printWriter.flush();
+ System.out.println(writer.toString());
+ throw ex;
+ }
+ }
}
diff --git a/src/test/java/org/onap/aai/event/TestCamelContext.java b/src/test/java/org/onap/aai/event/TestCamelContext.java
new file mode 100644
index 0000000..254ff45
--- /dev/null
+++ b/src/test/java/org/onap/aai/event/TestCamelContext.java
@@ -0,0 +1,1241 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
+ * ================================================================================
+ * 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.aai.event;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Component;
+import org.apache.camel.ConsumerTemplate;
+import org.apache.camel.Endpoint;
+import org.apache.camel.ErrorHandlerFactory;
+import org.apache.camel.NoFactoryAvailableException;
+import org.apache.camel.PollingConsumer;
+import org.apache.camel.Producer;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.Route;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.ServiceStatus;
+import org.apache.camel.ShutdownRoute;
+import org.apache.camel.ShutdownRunningTask;
+import org.apache.camel.StartupListener;
+import org.apache.camel.TypeConverter;
+import org.apache.camel.builder.ErrorHandlerBuilder;
+import org.apache.camel.model.DataFormatDefinition;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.model.RoutesDefinition;
+import org.apache.camel.model.rest.RestDefinition;
+import org.apache.camel.spi.AsyncProcessorAwaitManager;
+import org.apache.camel.spi.CamelContextNameStrategy;
+import org.apache.camel.spi.ClassResolver;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatResolver;
+import org.apache.camel.spi.Debugger;
+import org.apache.camel.spi.EndpointRegistry;
+import org.apache.camel.spi.EndpointStrategy;
+import org.apache.camel.spi.ExecutorServiceManager;
+import org.apache.camel.spi.ExecutorServiceStrategy;
+import org.apache.camel.spi.FactoryFinder;
+import org.apache.camel.spi.FactoryFinderResolver;
+import org.apache.camel.spi.InflightRepository;
+import org.apache.camel.spi.Injector;
+import org.apache.camel.spi.InterceptStrategy;
+import org.apache.camel.spi.Language;
+import org.apache.camel.spi.LifecycleStrategy;
+import org.apache.camel.spi.ManagementMBeanAssembler;
+import org.apache.camel.spi.ManagementNameStrategy;
+import org.apache.camel.spi.ManagementStrategy;
+import org.apache.camel.spi.ModelJAXBContextFactory;
+import org.apache.camel.spi.NodeIdFactory;
+import org.apache.camel.spi.PackageScanClassResolver;
+import org.apache.camel.spi.ProcessorFactory;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.spi.RestConfiguration;
+import org.apache.camel.spi.RestRegistry;
+import org.apache.camel.spi.RoutePolicyFactory;
+import org.apache.camel.spi.RouteStartupOrder;
+import org.apache.camel.spi.RuntimeEndpointRegistry;
+import org.apache.camel.spi.ServicePool;
+import org.apache.camel.spi.ShutdownStrategy;
+import org.apache.camel.spi.StreamCachingStrategy;
+import org.apache.camel.spi.TypeConverterRegistry;
+import org.apache.camel.spi.UnitOfWorkFactory;
+import org.apache.camel.spi.UuidGenerator;
+import org.apache.camel.util.LoadPropertiesException;
+
+public class TestCamelContext implements CamelContext {
+
+ @Override
+ public void suspend() throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void resume() throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isSuspended() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void setStreamCaching(Boolean cache) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Boolean isStreamCaching() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setTracing(Boolean tracing) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Boolean isTracing() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setMessageHistory(Boolean messageHistory) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Boolean isMessageHistory() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setHandleFault(Boolean handleFault) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Boolean isHandleFault() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setDelayer(Long delay) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Long getDelayer() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setAutoStartup(Boolean autoStartup) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Boolean isAutoStartup() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setShutdownRoute(ShutdownRoute shutdownRoute) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public ShutdownRoute getShutdownRoute() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public ShutdownRunningTask getShutdownRunningTask() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setAllowUseOriginalMessage(Boolean allowUseOriginalMessage) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Boolean isAllowUseOriginalMessage() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T extends CamelContext> T adapt(Class<T> type) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void start() throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void stop() throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CamelContextNameStrategy getNameStrategy() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setNameStrategy(CamelContextNameStrategy nameStrategy) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public ManagementNameStrategy getManagementNameStrategy() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setManagementNameStrategy(ManagementNameStrategy nameStrategy) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getManagementName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getVersion() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ServiceStatus getStatus() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getUptime() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addService(Object object) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void addService(Object object, boolean closeOnShutdown) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean removeService(Object object) throws Exception {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean hasService(Object object) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public <T> T hasService(Class<T> type) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addStartupListener(StartupListener listener) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void addComponent(String componentName, Component component) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Component hasComponent(String componentName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Component getComponent(String componentName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Component getComponent(String name, boolean autoCreateComponents) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T extends Component> T getComponent(String name, Class<T> componentType) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<String> getComponentNames() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Component removeComponent(String componentName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public EndpointRegistry<String> getEndpointRegistry() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Endpoint getEndpoint(String uri) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T extends Endpoint> T getEndpoint(String name, Class<T> endpointType) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<Endpoint> getEndpoints() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map<String, Endpoint> getEndpointMap() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Endpoint hasEndpoint(String uri) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Endpoint addEndpoint(String uri, Endpoint endpoint) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void removeEndpoint(Endpoint endpoint) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Collection<Endpoint> removeEndpoints(String pattern) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addRegisterEndpointCallback(EndpointStrategy strategy) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setupRoutes(boolean done) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public List<RouteDefinition> getRouteDefinitions() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public RouteDefinition getRouteDefinition(String id) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<RestDefinition> getRestDefinitions() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addRestDefinitions(Collection<RestDefinition> restDefinitions) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setRestConfiguration(RestConfiguration restConfiguration) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public RestConfiguration getRestConfiguration() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<RouteStartupOrder> getRouteStartupOrder() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<Route> getRoutes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Route getRoute(String id) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addRoutes(RoutesBuilder builder) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public RoutesDefinition loadRoutesDefinition(InputStream is) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void addRouteDefinition(RouteDefinition routeDefinition) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeRouteDefinition(RouteDefinition routeDefinition) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void startRoute(RouteDefinition route) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void startAllRoutes() throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void startRoute(String routeId) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void stopRoute(RouteDefinition route) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void stopRoute(String routeId) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void stopRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean stopRoute(String routeId, long timeout, TimeUnit timeUnit, boolean abortAfterTimeout)
+ throws Exception {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void shutdownRoute(String routeId) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void shutdownRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean removeRoute(String routeId) throws Exception {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void resumeRoute(String routeId) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void suspendRoute(String routeId) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void suspendRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public ServiceStatus getRouteStatus(String routeId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isStartingRoutes() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isSetupRoutes() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public TypeConverter getTypeConverter() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public TypeConverterRegistry getTypeConverterRegistry() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Registry getRegistry() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T> T getRegistry(Class<T> type) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Injector getInjector() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ManagementMBeanAssembler getManagementMBeanAssembler() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<LifecycleStrategy> getLifecycleStrategies() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addLifecycleStrategy(LifecycleStrategy lifecycleStrategy) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Language resolveLanguage(String language) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String resolvePropertyPlaceholders(String text) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getPropertyPrefixToken() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getPropertySuffixToken() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<String> getLanguageNames() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ProducerTemplate createProducerTemplate() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ProducerTemplate createProducerTemplate(int maximumCacheSize) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ConsumerTemplate createConsumerTemplate() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ConsumerTemplate createConsumerTemplate(int maximumCacheSize) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addInterceptStrategy(InterceptStrategy interceptStrategy) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public List<InterceptStrategy> getInterceptStrategies() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ErrorHandlerBuilder getErrorHandlerBuilder() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setErrorHandlerBuilder(ErrorHandlerFactory errorHandlerBuilder) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public ScheduledExecutorService getErrorHandlerExecutorService() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setDataFormats(Map<String, DataFormatDefinition> dataFormats) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Map<String, DataFormatDefinition> getDataFormats() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public DataFormat resolveDataFormat(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public DataFormatDefinition resolveDataFormatDefinition(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public DataFormatResolver getDataFormatResolver() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setDataFormatResolver(DataFormatResolver dataFormatResolver) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setProperties(Map<String, String> properties) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Map<String, String> getProperties() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getProperty(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public FactoryFinder getDefaultFactoryFinder() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setFactoryFinderResolver(FactoryFinderResolver resolver) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public FactoryFinder getFactoryFinder(String path) throws NoFactoryAvailableException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ClassResolver getClassResolver() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public PackageScanClassResolver getPackageScanClassResolver() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setClassResolver(ClassResolver resolver) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setPackageScanClassResolver(PackageScanClassResolver resolver) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setProducerServicePool(ServicePool<Endpoint, Producer> servicePool) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public ServicePool<Endpoint, Producer> getProducerServicePool() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setPollingConsumerServicePool(ServicePool<Endpoint, PollingConsumer> servicePool) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public ServicePool<Endpoint, PollingConsumer> getPollingConsumerServicePool() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setNodeIdFactory(NodeIdFactory factory) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public NodeIdFactory getNodeIdFactory() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ManagementStrategy getManagementStrategy() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setManagementStrategy(ManagementStrategy strategy) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public InterceptStrategy getDefaultTracer() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setDefaultTracer(InterceptStrategy tracer) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public InterceptStrategy getDefaultBacklogTracer() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setDefaultBacklogTracer(InterceptStrategy backlogTracer) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public InterceptStrategy getDefaultBacklogDebugger() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setDefaultBacklogDebugger(InterceptStrategy backlogDebugger) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void disableJMX() throws IllegalStateException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public InflightRepository getInflightRepository() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setInflightRepository(InflightRepository repository) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public AsyncProcessorAwaitManager getAsyncProcessorAwaitManager() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setAsyncProcessorAwaitManager(AsyncProcessorAwaitManager manager) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public ClassLoader getApplicationContextClassLoader() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setApplicationContextClassLoader(ClassLoader classLoader) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public ShutdownStrategy getShutdownStrategy() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setShutdownStrategy(ShutdownStrategy shutdownStrategy) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public ExecutorServiceManager getExecutorServiceManager() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ExecutorServiceStrategy getExecutorServiceStrategy() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setExecutorServiceManager(ExecutorServiceManager executorServiceManager) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public ProcessorFactory getProcessorFactory() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setProcessorFactory(ProcessorFactory processorFactory) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Debugger getDebugger() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setDebugger(Debugger debugger) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public UuidGenerator getUuidGenerator() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setUuidGenerator(UuidGenerator uuidGenerator) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Boolean isLazyLoadTypeConverters() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Boolean isTypeConverterStatisticsEnabled() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Boolean isUseMDCLogging() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setUseMDCLogging(Boolean useMDCLogging) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Boolean isUseBreadcrumb() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setUseBreadcrumb(Boolean useBreadcrumb) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String resolveComponentDefaultName(String javaType) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map<String, Properties> findComponents() throws LoadPropertiesException, IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map<String, Properties> findEips() throws LoadPropertiesException, IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getComponentDocumentation(String componentName) throws IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getComponentParameterJsonSchema(String componentName) throws IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getDataFormatParameterJsonSchema(String dataFormatName) throws IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getLanguageParameterJsonSchema(String languageName) throws IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getEipParameterJsonSchema(String eipName) throws IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String explainEipJson(String nameOrId, boolean includeAllOptions) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String explainComponentJson(String componentName, boolean includeAllOptions) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String explainEndpointJson(String uri, boolean includeAllOptions) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String createRouteStaticEndpointJson(String routeId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String createRouteStaticEndpointJson(String routeId, boolean includeDynamic) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public StreamCachingStrategy getStreamCachingStrategy() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setStreamCachingStrategy(StreamCachingStrategy streamCachingStrategy) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public UnitOfWorkFactory getUnitOfWorkFactory() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setUnitOfWorkFactory(UnitOfWorkFactory unitOfWorkFactory) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public RuntimeEndpointRegistry getRuntimeEndpointRegistry() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setRuntimeEndpointRegistry(RuntimeEndpointRegistry runtimeEndpointRegistry) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public RestRegistry getRestRegistry() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setRestRegistry(RestRegistry restRegistry) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void addRoutePolicyFactory(RoutePolicyFactory routePolicyFactory) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public List<RoutePolicyFactory> getRoutePolicyFactories() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ModelJAXBContextFactory getModelJAXBContextFactory() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setModelJAXBContextFactory(ModelJAXBContextFactory modelJAXBContextFactory) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/test/java/org/onap/aai/event/TestProcessor.java b/src/test/java/org/onap/aai/event/TestProcessor.java
new file mode 100644
index 0000000..e0f2d27
--- /dev/null
+++ b/src/test/java/org/onap/aai/event/TestProcessor.java
@@ -0,0 +1,35 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
+ * ================================================================================
+ * 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.aai.event;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+
+public class TestProcessor implements Processor {
+
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/test/java/org/onap/aai/rest/RestClientTest.java b/src/test/java/org/onap/aai/rest/RestClientTest.java
index 4ee7e58..cdddc58 100644
--- a/src/test/java/org/onap/aai/rest/RestClientTest.java
+++ b/src/test/java/org/onap/aai/rest/RestClientTest.java
@@ -2,8 +2,8 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,8 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.rest;
@@ -34,66 +32,72 @@ import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.junit.Before;
import org.junit.Test;
+import org.onap.aai.logging.RouterCoreMsgs;
import org.onap.aai.restclient.client.Headers;
public class RestClientTest {
- /**
- * Test case initialization
- *
- * @throws Exception the exception
- */
- @Before
- public void init() throws Exception {
- }
-
- @Test
- public void validate() throws Exception {
-
- try {
- RestClientComponent rc = new RestClientComponent();
- RestClientEndpoint endpoint = new RestClientEndpoint("http://host.com:8443/endpoint", rc);
-
- endpoint.setEcompClientCert("client-cert");
- endpoint.setEcompKeystore("keystore");
- endpoint.setEcompKeystorePassword("pwd");
- endpoint.setOp("operation");
-
- assertTrue(endpoint.getEcompClientCert().compareTo("client-cert") == 0);
- assertTrue(endpoint.getEcompKeystore().compareTo("keystore") == 0);
- assertTrue(endpoint.getEcompKeystorePassword().compareTo("pwd") == 0);
- assertTrue(endpoint.getOp().compareTo("operation") == 0);
- assertTrue(endpoint.isSingleton());
-
- RestClientProducer producer = (RestClientProducer)endpoint.createProducer();
- assertTrue(producer != null);
-
- Method method = RestClientProducer.class.getDeclaredMethod("populateRestHeaders", Exchange.class);
- method.setAccessible(true);
-
- Exchange exchange = endpoint.createExchange();
- Message in = exchange.getIn();
- in.setHeader(RestClientEndpoint.IN_HEADER_URL, "svc/endpoint");
- in.setHeader(Headers.FROM_APP_ID, "val1");
- in.setHeader(Headers.TRANSACTION_ID, "val2");
- in.setHeader(Headers.RESOURCE_VERSION, "val2");
- in.setHeader(Headers.ETAG, "val2");
- in.setHeader(Headers.IF_MATCH, "val2");
- in.setHeader(Headers.IF_NONE_MATCH, "val2");
- in.setHeader(Headers.ACCEPT, "val2");
- in.setHeader("Content-Type", "val2");
-
- Map<String, List<String>> headers = (Map<String, List<String>>)method.invoke(producer, exchange);
- assertTrue(headers.size() == 8);
+ /**
+ * Test case initialization
+ *
+ * @throws Exception the exception
+ */
+ @Before
+ public void init() throws Exception {
}
- catch (Exception ex) {
- StringWriter writer = new StringWriter();
- PrintWriter printWriter = new PrintWriter( writer );
- ex.printStackTrace( printWriter );
- printWriter.flush();
- System.out.println(writer.toString());
- throw ex;
+
+ @Test
+ public void validate() throws Exception {
+
+ try {
+ RestClientComponent rc = new RestClientComponent();
+ RestClientEndpoint endpoint = new RestClientEndpoint("http://host.com:8443/endpoint", rc);
+
+ endpoint.setEcompClientCert("client-cert");
+ endpoint.setEcompKeystore("keystore");
+ endpoint.setEcompKeystorePassword("OBF:1y0q1uvc1uum1uvg1pil1pjl1uuq1uvk1uuu1y10");
+ endpoint.setOp("GET");
+
+ assertTrue(endpoint.getEcompClientCert().compareTo("client-cert") == 0);
+ assertTrue(endpoint.getEcompKeystore().compareTo("keystore") == 0);
+ assertTrue(endpoint.getEcompKeystorePassword().compareTo("OBF:1y0q1uvc1uum1uvg1pil1pjl1uuq1uvk1uuu1y10") == 0);
+ assertTrue(endpoint.getOp().compareTo("GET") == 0);
+ assertTrue(endpoint.isSingleton());
+
+ RestClientProducer producer = (RestClientProducer)endpoint.createProducer();
+ assertTrue(producer != null);
+
+ Method method = RestClientProducer.class.getDeclaredMethod("populateRestHeaders", Exchange.class);
+ method.setAccessible(true);
+
+ Exchange exchange = endpoint.createExchange();
+ exchange.setProperty(Exchange.TO_ENDPOINT, "mock://get");
+ Message in = exchange.getIn();
+ in.setHeader(RestClientEndpoint.IN_HEADER_URL, "svc/endpoint");
+ in.setHeader(Headers.FROM_APP_ID, "val1");
+ in.setHeader(Headers.TRANSACTION_ID, "val2");
+ in.setHeader(Headers.RESOURCE_VERSION, "val2");
+ in.setHeader(Headers.ETAG, "val2");
+ in.setHeader(Headers.IF_MATCH, "val2");
+ in.setHeader(Headers.IF_NONE_MATCH, "val2");
+ in.setHeader(Headers.ACCEPT, "val2");
+ in.setHeader("Content-Type", "val2");
+
+ Map<String, List<String>> headers = (Map<String, List<String>>)method.invoke(producer, exchange);
+ assertTrue(headers.size() == 8);
+
+ producer.process(exchange);
+
+ System.out.println(RouterCoreMsgs.EVENT_CONSUMER_CREATION_EXCEPTION);
+ }
+ catch (Exception ex) {
+ StringWriter writer = new StringWriter();
+ PrintWriter printWriter = new PrintWriter( writer );
+ ex.printStackTrace( printWriter );
+ printWriter.flush();
+ System.out.println(writer.toString());
+ throw ex;
+ }
}
- }
-
+
}