diff options
author | Rodrigo Lima <rodrigo.lima@yoppworks.com> | 2020-08-21 15:45:31 -0400 |
---|---|---|
committer | Rodrigo Lima <rodrigo.lima@yoppworks.com> | 2020-08-21 17:40:01 -0400 |
commit | f05013b8e6fa64998a68547a6a7bac003ea2add3 (patch) | |
tree | 206f6d37b2b438cea4c909222daf112f7f252103 /src/test | |
parent | 3150c68512bc122dde455fae1e46cc3f66109330 (diff) |
Update apache camel from 2.x to 3.x
- Update apache camel lib
- Remove camel apt and add camel package plugin
Issue-ID: AAI-3119
Signed-off-by: Rodrigo Lima <rodrigo.lima@yoppworks.com>
Change-Id: Ib62e8d0807017895183eafce0a7e52018c9a1f3a
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/onap/aai/event/EventBusTest.java | 19 | ||||
-rw-r--r-- | src/test/java/org/onap/aai/event/TestCamelContext.java | 1022 | ||||
-rw-r--r-- | src/test/java/org/onap/aai/rest/RestClientTest.java | 17 |
3 files changed, 196 insertions, 862 deletions
diff --git a/src/test/java/org/onap/aai/event/EventBusTest.java b/src/test/java/org/onap/aai/event/EventBusTest.java index e535bf3..4fa9e91 100644 --- a/src/test/java/org/onap/aai/event/EventBusTest.java +++ b/src/test/java/org/onap/aai/event/EventBusTest.java @@ -20,6 +20,7 @@ */ package org.onap.aai.event; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -27,13 +28,12 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; +import org.apache.camel.ExtendedCamelContext; import org.apache.camel.Processor; -import org.apache.camel.impl.DefaultMessage; -import org.apache.camel.impl.MessageSupport; -import org.apache.kafka.clients.consumer.ConsumerRecords; +import org.apache.camel.support.DefaultMessage; +import org.apache.camel.support.MessageSupport; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -52,7 +52,7 @@ public class EventBusTest { public EventPublisher publisher; @Mock - public CamelContext context; + public ExtendedCamelContext context; @Mock public Processor processor; @@ -74,20 +74,23 @@ public class EventBusTest { @Test public void validateProducer() throws Exception { - EventBusComponent rc = new EventBusComponent(); + String clientName = "client name"; + EventBusComponent rc = new EventBusComponent(); EventBusEndPoint endpoint = new EventBusEndPoint("http://host.com:8443/endpoint", rc); + endpoint.setName(clientName); endpoint.setEventTopic("eventTopic"); endpoint.setPublisher(publisher); endpoint.setPoolSize(45); endpoint.setPollingDelay(10); - + + assertEquals(clientName, endpoint.getName()); assertTrue(endpoint.getEventTopic().compareTo("eventTopic") == 0); assertTrue(endpoint.getPoolSize() == 45); assertTrue(endpoint.getPollingDelay() == 10); assertFalse(endpoint.isSingleton()); EventBusProducer producer = (EventBusProducer)endpoint.createProducer(); assertTrue(producer.getEndpoint() != null); - endpoint.close(); + endpoint.end(); } @Test diff --git a/src/test/java/org/onap/aai/event/TestCamelContext.java b/src/test/java/org/onap/aai/event/TestCamelContext.java index 1315bd9..718e599 100644 --- a/src/test/java/org/onap/aai/event/TestCamelContext.java +++ b/src/test/java/org/onap/aai/event/TestCamelContext.java @@ -21,26 +21,20 @@ package org.onap.aai.event; -import java.io.IOException; -import java.io.InputStream; import java.util.Collection; +import java.util.Date; import java.util.List; import java.util.Map; -import java.util.Properties; import java.util.Set; -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.FluentProducerTemplate; -import org.apache.camel.NoFactoryAvailableException; -import org.apache.camel.PollingConsumer; +import org.apache.camel.GlobalEndpointConfiguration; +import org.apache.camel.NoSuchLanguageException; import org.apache.camel.Processor; -import org.apache.camel.Producer; import org.apache.camel.ProducerTemplate; import org.apache.camel.Route; import org.apache.camel.RoutesBuilder; @@ -49,312 +43,188 @@ import org.apache.camel.ShutdownRoute; import org.apache.camel.ShutdownRunningTask; import org.apache.camel.StartupListener; import org.apache.camel.TypeConverter; -import org.apache.camel.api.management.mbean.ManagedCamelContextMBean; -import org.apache.camel.api.management.mbean.ManagedProcessorMBean; -import org.apache.camel.api.management.mbean.ManagedRouteMBean; -import org.apache.camel.builder.ErrorHandlerBuilder; -import org.apache.camel.health.HealthCheckRegistry; -import org.apache.camel.impl.DefaultHeadersMapFactory; -import org.apache.camel.model.DataFormatDefinition; -import org.apache.camel.model.HystrixConfigurationDefinition; -import org.apache.camel.model.ProcessorDefinition; -import org.apache.camel.model.RouteDefinition; -import org.apache.camel.model.RoutesDefinition; -import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition; -import org.apache.camel.model.rest.RestDefinition; -import org.apache.camel.model.rest.RestsDefinition; -import org.apache.camel.model.transformer.TransformerDefinition; -import org.apache.camel.model.validator.ValidatorDefinition; -import org.apache.camel.runtimecatalog.RuntimeCamelCatalog; -import org.apache.camel.spi.AsyncProcessorAwaitManager; +import org.apache.camel.ValueHolder; 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.DataType; 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.HeadersMapFactory; 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.LogListener; -import org.apache.camel.spi.ManagementMBeanAssembler; import org.apache.camel.spi.ManagementNameStrategy; import org.apache.camel.spi.ManagementStrategy; import org.apache.camel.spi.MessageHistoryFactory; -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.PropertiesComponent; import org.apache.camel.spi.Registry; -import org.apache.camel.spi.ReloadStrategy; import org.apache.camel.spi.RestConfiguration; import org.apache.camel.spi.RestRegistry; import org.apache.camel.spi.RouteController; 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.Tracer; import org.apache.camel.spi.Transformer; import org.apache.camel.spi.TransformerRegistry; import org.apache.camel.spi.TypeConverterRegistry; -import org.apache.camel.spi.UnitOfWorkFactory; import org.apache.camel.spi.UuidGenerator; import org.apache.camel.spi.Validator; import org.apache.camel.spi.ValidatorRegistry; -import org.apache.camel.util.LoadPropertiesException; -import org.apache.camel.util.jsse.SSLContextParameters; - -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 +import org.apache.camel.support.jsse.SSLContextParameters; - } - - @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 +public class TestCamelContext implements CamelContext { - } @Override - public Boolean isTracing() { + public <T extends CamelContext> T adapt(Class<T> type) { // TODO Auto-generated method stub return null; } @Override - public void setMessageHistory(Boolean messageHistory) { - // TODO Auto-generated method stub - - } - - @Override - public Boolean isMessageHistory() { + public <T> T getExtension(Class<T> type) { // TODO Auto-generated method stub return null; } @Override - public void setHandleFault(Boolean handleFault) { + public <T> void setExtension(Class<T> type, T module) { // TODO Auto-generated method stub - } @Override - public Boolean isHandleFault() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void setDelayer(Long delay) { + public boolean isVetoStarted() { // TODO Auto-generated method stub - + return false; } @Override - public Long getDelayer() { + public String getName() { // TODO Auto-generated method stub return null; } @Override - public void setAutoStartup(Boolean autoStartup) { - // TODO Auto-generated method stub - - } - - @Override - public Boolean isAutoStartup() { + public CamelContextNameStrategy getNameStrategy() { // TODO Auto-generated method stub return null; } @Override - public void setShutdownRoute(ShutdownRoute shutdownRoute) { + public void setNameStrategy(CamelContextNameStrategy nameStrategy) { // TODO Auto-generated method stub - } @Override - public ShutdownRoute getShutdownRoute() { + public ManagementNameStrategy getManagementNameStrategy() { // TODO Auto-generated method stub return null; } @Override - public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask) { + public void setManagementNameStrategy(ManagementNameStrategy nameStrategy) { // TODO Auto-generated method stub - } @Override - public ShutdownRunningTask getShutdownRunningTask() { + public String getManagementName() { // TODO Auto-generated method stub return null; } @Override - public void setAllowUseOriginalMessage(Boolean allowUseOriginalMessage) { + public void setManagementName(String name) { // TODO Auto-generated method stub - } @Override - public Boolean isAllowUseOriginalMessage() { + public String getVersion() { // TODO Auto-generated method stub return null; } @Override - public <T extends CamelContext> T adapt(Class<T> type) { + public String getUptime() { // TODO Auto-generated method stub return null; } @Override - public void start() throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public void stop() throws Exception { + public long getUptimeMillis() { // TODO Auto-generated method stub - + return 0; } @Override - public String getName() { + public Date getStartDate() { // TODO Auto-generated method stub return null; } @Override - public CamelContextNameStrategy getNameStrategy() { + public void addService(Object object) throws Exception { // TODO Auto-generated method stub - return null; } @Override - public void setNameStrategy(CamelContextNameStrategy nameStrategy) { + public void addService(Object object, boolean stopOnShutdown) throws Exception { // TODO Auto-generated method stub - } @Override - public ManagementNameStrategy getManagementNameStrategy() { + public void addService(Object object, boolean stopOnShutdown, boolean forceStart) throws Exception { // TODO Auto-generated method stub - return null; } @Override - public void setManagementNameStrategy(ManagementNameStrategy nameStrategy) { + public void addPrototypeService(Object object) throws Exception { // TODO Auto-generated method stub - } @Override - public String getManagementName() { + public boolean removeService(Object object) throws Exception { // TODO Auto-generated method stub - return null; + return false; } @Override - public String getVersion() { + public boolean hasService(Object object) { // TODO Auto-generated method stub - return null; + return false; } @Override - public ServiceStatus getStatus() { + public <T> T hasService(Class<T> type) { // TODO Auto-generated method stub return null; } @Override - public String getUptime() { + public <T> Set<T> hasServices(Class<T> type) { // 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 { + public void deferStartService(Object object, boolean stopOnShutdown) 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 @@ -376,6 +246,12 @@ public class TestCamelContext implements CamelContext { } @Override + public Component getComponent(String name, boolean autoCreateComponents, boolean autoStart) { + // 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; @@ -394,7 +270,7 @@ public class TestCamelContext implements CamelContext { } @Override - public EndpointRegistry<String> getEndpointRegistry() { + public EndpointRegistry<? extends ValueHolder<String>> getEndpointRegistry() { // TODO Auto-generated method stub return null; } @@ -406,6 +282,12 @@ public class TestCamelContext implements CamelContext { } @Override + public Endpoint getEndpoint(String uri, Map<String, Object> parameters) { + // 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; @@ -438,1213 +320,655 @@ public class TestCamelContext implements CamelContext { @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 + public GlobalEndpointConfiguration getGlobalEndpointConfiguration() { return null; } @Override - public void addRestDefinitions(Collection<RestDefinition> restDefinitions) throws Exception { - // TODO Auto-generated method stub + public void setRouteController(RouteController routeController) { } @Override - public void setRestConfiguration(RestConfiguration restConfiguration) { - // TODO Auto-generated method stub - - } - - @Override - public RestConfiguration getRestConfiguration() { - // TODO Auto-generated method stub + public RouteController getRouteController() { return null; } @Override - public List<RouteStartupOrder> getRouteStartupOrder() { - // TODO Auto-generated method stub + public List<Route> getRoutes() { return null; } @Override - public List<Route> getRoutes() { - // TODO Auto-generated method stub - return null; + public int getRoutesSize() { + return 0; } @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 + public Processor getProcessor(String id) { 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 - + public <T extends Processor> T getProcessor(String id, Class<T> type) { + return null; } @Override - public void shutdownRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception { - // TODO Auto-generated method stub + public void addRoutes(RoutesBuilder builder) throws Exception { } @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 + public void addRoutePolicyFactory(RoutePolicyFactory routePolicyFactory) { } @Override - public void suspendRoute(String routeId) throws Exception { - // TODO Auto-generated method stub - + public List<RoutePolicyFactory> getRoutePolicyFactories() { + return null; } @Override - public void suspendRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception { - // TODO Auto-generated method stub + public void setRestConfiguration(RestConfiguration restConfiguration) { } @Override - public ServiceStatus getRouteStatus(String routeId) { - // TODO Auto-generated method stub + public RestConfiguration getRestConfiguration() { return null; } @Override - public boolean isStartingRoutes() { - // TODO Auto-generated method stub - return false; + public RestRegistry getRestRegistry() { + return null; } @Override - public boolean isSetupRoutes() { - // TODO Auto-generated method stub - return false; + public void setRestRegistry(RestRegistry restRegistry) { + } @Override public TypeConverter getTypeConverter() { - // TODO Auto-generated method stub return null; } @Override public TypeConverterRegistry getTypeConverterRegistry() { - // TODO Auto-generated method stub return null; } @Override + public void setTypeConverterRegistry(TypeConverterRegistry typeConverterRegistry) { + + } + + @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; + public void setInjector(Injector injector) { + } @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 + public Language resolveLanguage(String language) throws NoSuchLanguageException { return null; } @Override - public String resolvePropertyPlaceholders(String text) throws Exception { - // TODO Auto-generated method stub + public String resolvePropertyPlaceholders(String text) { return null; } @Override - public String getPropertyPrefixToken() { - // TODO Auto-generated method stub + public PropertiesComponent getPropertiesComponent() { return null; } @Override - public String getPropertySuffixToken() { - // TODO Auto-generated method stub - return null; + public void setPropertiesComponent(PropertiesComponent propertiesComponent) { + } @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 + public FluentProducerTemplate createFluentProducerTemplate() { return null; } @Override - public ErrorHandlerBuilder getErrorHandlerBuilder() { - // TODO Auto-generated method stub + public FluentProducerTemplate createFluentProducerTemplate(int maximumCacheSize) { return null; } @Override - public void setErrorHandlerBuilder(ErrorHandlerFactory errorHandlerBuilder) { - // TODO Auto-generated method stub - - } - - @Override - public ScheduledExecutorService getErrorHandlerExecutorService() { - // TODO Auto-generated method stub + public ConsumerTemplate createConsumerTemplate() { 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 + public ConsumerTemplate createConsumerTemplate(int maximumCacheSize) { 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 + public DataFormat createDataFormat(String name) { return null; } @Override - public DataFormatResolver getDataFormatResolver() { - // TODO Auto-generated method stub + public Transformer resolveTransformer(String model) { 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 - + public Transformer resolveTransformer(DataType from, DataType to) { + return null; } @Override - public Map<String, String> getProperties() { - // TODO Auto-generated method stub + public TransformerRegistry getTransformerRegistry() { return null; } @Override - public String getProperty(String name) { - // TODO Auto-generated method stub + public Validator resolveValidator(DataType type) { return null; } @Override - public FactoryFinder getDefaultFactoryFinder() { - // TODO Auto-generated method stub + public ValidatorRegistry getValidatorRegistry() { return null; } @Override - public void setFactoryFinderResolver(FactoryFinderResolver resolver) { - // TODO Auto-generated method stub + public void setGlobalOptions(Map<String, String> globalOptions) { } @Override - public FactoryFinder getFactoryFinder(String path) throws NoFactoryAvailableException { - // TODO Auto-generated method stub + public Map<String, String> getGlobalOptions() { return null; } @Override - public ClassResolver getClassResolver() { - // TODO Auto-generated method stub + public String getGlobalOption(String key) { return null; } @Override - public PackageScanClassResolver getPackageScanClassResolver() { - // TODO Auto-generated method stub + public ClassResolver getClassResolver() { 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 + public MessageHistoryFactory getMessageHistoryFactory() { return null; } @Override - public void setProcessorFactory(ProcessorFactory processorFactory) { - // TODO Auto-generated method stub + public void setMessageHistoryFactory(MessageHistoryFactory messageHistoryFactory) { } @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 + public Tracer getTracer() { return null; } @Override - public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters) { - // TODO Auto-generated method stub + public void setTracer(Tracer tracer) { } @Override - public Boolean isTypeConverterStatisticsEnabled() { - // TODO Auto-generated method stub + public UuidGenerator getUuidGenerator() { return null; } @Override - public void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled) { - // TODO Auto-generated method stub + public void setUuidGenerator(UuidGenerator uuidGenerator) { } @Override - public Boolean isUseMDCLogging() { - // TODO Auto-generated method stub + public Boolean isLoadTypeConverters() { return null; } @Override - public void setUseMDCLogging(Boolean useMDCLogging) { - // TODO Auto-generated method stub + public void setLoadTypeConverters(Boolean loadTypeConverters) { } @Override - public Boolean isUseBreadcrumb() { - // TODO Auto-generated method stub + public Boolean isTypeConverterStatisticsEnabled() { return null; } @Override - public void setUseBreadcrumb(Boolean useBreadcrumb) { - // TODO Auto-generated method stub - - } + public void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled) { - @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 + public Boolean isUseMDCLogging() { return null; } @Override - public Map<String, Properties> findEips() throws LoadPropertiesException, IOException { - // TODO Auto-generated method stub - return null; - } + public void setUseMDCLogging(Boolean useMDCLogging) { - @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 + public String getMDCLoggingKeysPattern() { return null; } @Override - public String getDataFormatParameterJsonSchema(String dataFormatName) throws IOException { - // TODO Auto-generated method stub - return null; - } + public void setMDCLoggingKeysPattern(String pattern) { - @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 + public Boolean isUseDataType() { return null; } @Override - public String explainEipJson(String nameOrId, boolean includeAllOptions) { - // TODO Auto-generated method stub - return null; - } + public void setUseDataType(Boolean useDataType) { - @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 + public Boolean isUseBreadcrumb() { return null; } @Override - public String createRouteStaticEndpointJson(String routeId) { - // TODO Auto-generated method stub - return null; - } + public void setUseBreadcrumb(Boolean useBreadcrumb) { - @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 + public void setSSLContextParameters(SSLContextParameters sslContextParameters) { } @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 + public SSLContextParameters getSSLContextParameters() { return null; } @Override - public void setModelJAXBContextFactory(ModelJAXBContextFactory modelJAXBContextFactory) { - // TODO Auto-generated method stub + public void start() { } @Override - public Boolean isLogExhaustedMessageBody() { - // TODO Auto-generated method stub - return null; - } + public void stop() { - @Override - public Boolean isLogMask() { - // TODO Auto-generated method stub - return null; } @Override - public void setLogExhaustedMessageBody(Boolean arg0) { - // TODO Auto-generated method stub - + public boolean isStarted() { + return false; } @Override - public void setLogMask(Boolean arg0) { - // TODO Auto-generated method stub - + public boolean isStarting() { + return false; } @Override - public void addHystrixConfiguration(String arg0, HystrixConfigurationDefinition arg1) { - // TODO Auto-generated method stub - + public boolean isStopping() { + return false; } @Override - public void addLogListener(LogListener arg0) { - // TODO Auto-generated method stub - + public boolean isStopped() { + return false; } @Override - public void addRestConfiguration(RestConfiguration arg0) { - // TODO Auto-generated method stub - + public boolean isSuspending() { + return false; } @Override - public void addService(Object arg0, boolean arg1, boolean arg2) throws Exception { - // TODO Auto-generated method stub - + public boolean isSuspended() { + return false; } @Override - public void addServiceCallConfiguration(String arg0, ServiceCallConfigurationDefinition arg1) { - // TODO Auto-generated method stub - + public boolean isRunAllowed() { + return false; } @Override - public DataFormat createDataFormat(String arg0) { - // TODO Auto-generated method stub - return null; - } + public void build() { - @Override - public FluentProducerTemplate createFluentProducerTemplate() { - // TODO Auto-generated method stub - return null; } @Override - public FluentProducerTemplate createFluentProducerTemplate(int arg0) { - // TODO Auto-generated method stub - return null; - } + public void init() { - @Override - public void deferStartService(Object arg0, boolean arg1) throws Exception { - // TODO Auto-generated method stub - } @Override - public String explainDataFormatJson(String arg0, DataFormat arg1, boolean arg2) { - // TODO Auto-generated method stub - return null; - } + public void suspend() { - @Override - public Component getComponent(String arg0, boolean arg1, boolean arg2) { - // TODO Auto-generated method stub - return null; } @Override - public String getGlobalOption(String arg0) { - // TODO Auto-generated method stub - return null; - } + public void resume() { - @Override - public Map<String, String> getGlobalOptions() { - // TODO Auto-generated method stub - return null; } @Override - public HeadersMapFactory getHeadersMapFactory() { - return new DefaultHeadersMapFactory(); - } + public void shutdown() { - @Override - public HealthCheckRegistry getHealthCheckRegistry() { - // TODO Auto-generated method stub - return null; } @Override - public HystrixConfigurationDefinition getHystrixConfiguration(String arg0) { - // TODO Auto-generated method stub - return null; - } + public void close() throws Exception { - @Override - public Set<LogListener> getLogListeners() { - // TODO Auto-generated method stub - return null; } @Override - public ManagedCamelContextMBean getManagedCamelContext() { - // TODO Auto-generated method stub + public ServiceStatus getStatus() { return null; } @Override - public <T extends ManagedProcessorMBean> T getManagedProcessor(String arg0, Class<T> arg1) { - // TODO Auto-generated method stub - return null; - } + public void setStreamCaching(Boolean cache) { - @Override - public <T extends ManagedRouteMBean> T getManagedRoute(String arg0, Class<T> arg1) { - // TODO Auto-generated method stub - return null; } @Override - public MessageHistoryFactory getMessageHistoryFactory() { - // TODO Auto-generated method stub + public Boolean isStreamCaching() { return null; } @Override - public Processor getProcessor(String arg0) { - // TODO Auto-generated method stub - return null; - } + public void setTracing(Boolean tracing) { - @Override - public <T extends Processor> T getProcessor(String arg0, Class<T> arg1) { - // TODO Auto-generated method stub - return null; } @Override - public ProcessorDefinition getProcessorDefinition(String arg0) { - // TODO Auto-generated method stub + public Boolean isTracing() { return null; } @Override - public <T extends ProcessorDefinition> T getProcessorDefinition(String arg0, Class<T> arg1) { - // TODO Auto-generated method stub + public String getTracingPattern() { return null; } @Override - public ReloadStrategy getReloadStrategy() { - // TODO Auto-generated method stub - return null; - } + public void setTracingPattern(String tracePattern) { - @Override - public RestConfiguration getRestConfiguration(String arg0, boolean arg1) { - // TODO Auto-generated method stub - return null; } @Override - public Collection<RestConfiguration> getRestConfigurations() { - // TODO Auto-generated method stub - return null; - } + public void setBacklogTracing(Boolean backlogTrace) { - @Override - public RouteController getRouteController() { - // TODO Auto-generated method stub - return null; } @Override - public RuntimeCamelCatalog getRuntimeCamelCatalog() { - // TODO Auto-generated method stub + public Boolean isBacklogTracing() { return null; } @Override - public SSLContextParameters getSSLContextParameters() { - // TODO Auto-generated method stub - return null; - } + public void setDebugging(Boolean debugging) { - @Override - public ServiceCallConfigurationDefinition getServiceCallConfiguration(String arg0) { - // TODO Auto-generated method stub - return null; } @Override - public TransformerRegistry getTransformerRegistry() { - // TODO Auto-generated method stub + public Boolean isDebugging() { return null; } @Override - public List<TransformerDefinition> getTransformers() { - // TODO Auto-generated method stub - return null; - } + public void setMessageHistory(Boolean messageHistory) { - @Override - public long getUptimeMillis() { - // TODO Auto-generated method stub - return 0; } @Override - public ValidatorRegistry getValidatorRegistry() { - // TODO Auto-generated method stub + public Boolean isMessageHistory() { return null; } @Override - public List<ValidatorDefinition> getValidators() { - // TODO Auto-generated method stub - return null; - } + public void setLogMask(Boolean logMask) { - @Override - public <T> Set<T> hasServices(Class<T> arg0) { - // TODO Auto-generated method stub - return null; } @Override - public Boolean isLoadTypeConverters() { - // TODO Auto-generated method stub + public Boolean isLogMask() { return null; } @Override - public Boolean isUseDataType() { - // TODO Auto-generated method stub - return null; - } + public void setLogExhaustedMessageBody(Boolean logExhaustedMessageBody) { - @Override - public boolean isVetoStarted() { - // TODO Auto-generated method stub - return false; } @Override - public RestsDefinition loadRestsDefinition(InputStream arg0) throws Exception { - // TODO Auto-generated method stub + public Boolean isLogExhaustedMessageBody() { return null; } @Override - public Transformer resolveTransformer(String arg0) { - // TODO Auto-generated method stub - return null; - } + public void setDelayer(Long delay) { - @Override - public Transformer resolveTransformer(DataType arg0, DataType arg1) { - // TODO Auto-generated method stub - return null; } @Override - public Validator resolveValidator(DataType arg0) { - // TODO Auto-generated method stub + public Long getDelayer() { return null; } @Override - public void setGlobalOptions(Map<String, String> arg0) { - // TODO Auto-generated method stub - - } + public void setAutoStartup(Boolean autoStartup) { - @Override - public void setHeadersMapFactory(HeadersMapFactory arg0) { - // TODO Auto-generated method stub - } @Override - public void setHealthCheckRegistry(HealthCheckRegistry arg0) { - // TODO Auto-generated method stub - + public Boolean isAutoStartup() { + return null; } @Override - public void setHystrixConfiguration(HystrixConfigurationDefinition arg0) { - // TODO Auto-generated method stub - - } + public void setShutdownRoute(ShutdownRoute shutdownRoute) { - @Override - public void setHystrixConfigurations(List<HystrixConfigurationDefinition> arg0) { - // TODO Auto-generated method stub - } @Override - public void setLoadTypeConverters(Boolean arg0) { - // TODO Auto-generated method stub - + public ShutdownRoute getShutdownRoute() { + return null; } @Override - public void setMessageHistoryFactory(MessageHistoryFactory arg0) { - // TODO Auto-generated method stub - - } + public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask) { - @Override - public void setReloadStrategy(ReloadStrategy arg0) { - // TODO Auto-generated method stub - } @Override - public void setRouteController(RouteController arg0) { - // TODO Auto-generated method stub - + public ShutdownRunningTask getShutdownRunningTask() { + return null; } @Override - public void setSSLContextParameters(SSLContextParameters arg0) { - // TODO Auto-generated method stub - - } + public void setAllowUseOriginalMessage(Boolean allowUseOriginalMessage) { - @Override - public void setServiceCallConfiguration(ServiceCallConfigurationDefinition arg0) { - // TODO Auto-generated method stub - } @Override - public void setServiceCallConfigurations(List<ServiceCallConfigurationDefinition> arg0) { - // TODO Auto-generated method stub - + public Boolean isAllowUseOriginalMessage() { + return null; } @Override - public void setTransformers(List<TransformerDefinition> arg0) { - // TODO Auto-generated method stub - + public Boolean isCaseInsensitiveHeaders() { + return null; } @Override - public void setUseDataType(Boolean arg0) { - // TODO Auto-generated method stub - - } + public void setCaseInsensitiveHeaders(Boolean caseInsensitiveHeaders) { - @Override - public void setValidators(List<ValidatorDefinition> arg0) { - // 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 66e7365..6c176d6 100644 --- a/src/test/java/org/onap/aai/rest/RestClientTest.java +++ b/src/test/java/org/onap/aai/rest/RestClientTest.java @@ -29,16 +29,23 @@ import java.util.List; import java.util.Map; import org.apache.camel.Exchange; -import org.apache.camel.Message; -import org.apache.camel.impl.DefaultMessage; +import org.apache.camel.ExtendedCamelContext; +import org.apache.camel.support.DefaultMessage; import org.junit.Before; import org.junit.Test; -import org.onap.aai.event.TestCamelContext; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; import org.onap.aai.logging.RouterCoreMsgs; import org.onap.aai.restclient.client.Headers; +@RunWith(MockitoJUnitRunner.class) public class RestClientTest { + + @Mock + public ExtendedCamelContext context; + /** * Test case initialization * @@ -52,7 +59,7 @@ public class RestClientTest { public void validate() throws Exception { try { - RestClientComponent rc = new RestClientComponent(); + RestClientComponent rc = new RestClientComponent(context); RestClientEndpoint endpoint = new RestClientEndpoint("http://host.com:8443/endpoint", rc); endpoint.setEcompClientCert("client-cert"); @@ -60,6 +67,7 @@ public class RestClientTest { 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); @@ -75,7 +83,6 @@ public class RestClientTest { Exchange exchange = endpoint.createExchange(); exchange.setProperty(Exchange.TO_ENDPOINT, "mock://get"); DefaultMessage in = (DefaultMessage)exchange.getIn(); - in.setCamelContext(new TestCamelContext()); in.setHeader(RestClientEndpoint.IN_HEADER_URL, "svc/endpoint"); in.setHeader(Headers.FROM_APP_ID, "val1"); |