Search in sources :

Example 26 with JunitBootstrapProperties

use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.

the class ConfigurationPreProcessorFactoryTest method testNoConfiguredPreProcessors.

@Test
public void testNoConfiguredPreProcessors() throws Exception {
    ConfigPreProcessors loaded = preProcessorFactory.load(new JunitBootstrapProperties(new Properties()));
    assertEquals(0, loaded.size());
}
Also used : JunitBootstrapProperties(com.adaptris.core.stubs.JunitBootstrapProperties) Properties(java.util.Properties) JunitBootstrapProperties(com.adaptris.core.stubs.JunitBootstrapProperties) Test(org.junit.Test)

Example 27 with JunitBootstrapProperties

use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.

the class ConfigurationPreProcessorFactoryTest method testBootstrapProperties_MisConfiguredPreProcessorNoClassName.

@Test
public void testBootstrapProperties_MisConfiguredPreProcessorNoClassName() throws Exception {
    when(mockPropertyLoader.loadPropertyFile(anyString())).thenReturn(new Properties());
    preProcessorFactory.setPropertyLoader(mockPropertyLoader);
    Properties props = new Properties();
    props.put("preProcessors", "testPreProcessor");
    assertEquals(0, preProcessorFactory.load(new JunitBootstrapProperties(props)).size());
}
Also used : JunitBootstrapProperties(com.adaptris.core.stubs.JunitBootstrapProperties) Properties(java.util.Properties) JunitBootstrapProperties(com.adaptris.core.stubs.JunitBootstrapProperties) Test(org.junit.Test)

Example 28 with JunitBootstrapProperties

use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.

the class ConfigurationPreProcessorFactoryTest method testBootstrapProperties_MultipleExternalPropertyFiles2Configured.

@Test
public void testBootstrapProperties_MultipleExternalPropertyFiles2Configured() throws Exception {
    Properties sampleProperties2 = new Properties();
    sampleProperties2.put("name", "testPreProcessor2");
    sampleProperties2.put("class", DummyConfigurationPreProcessor2.class.getCanonicalName());
    when(mockPropertyLoader.loadPropertyFile("testPreProcessor")).thenReturn(sampleProperties);
    when(mockPropertyLoader.loadPropertyFile("testPreProcessor2")).thenReturn(sampleProperties2);
    preProcessorFactory.setPropertyLoader(mockPropertyLoader);
    Properties props = new Properties();
    props.put("preProcessors", "testPreProcessor:testPreProcessor2");
    ConfigPreProcessors processorsList = preProcessorFactory.load(new JunitBootstrapProperties(props));
    assertEquals(2, processorsList.size());
    assertEquals(DummyConfigurationPreProcessor.class.getCanonicalName(), processorsList.toArray()[0].getClass().getName());
    assertEquals(DummyConfigurationPreProcessor2.class.getCanonicalName(), processorsList.toArray()[1].getClass().getName());
}
Also used : JunitBootstrapProperties(com.adaptris.core.stubs.JunitBootstrapProperties) Properties(java.util.Properties) JunitBootstrapProperties(com.adaptris.core.stubs.JunitBootstrapProperties) Test(org.junit.Test)

Example 29 with JunitBootstrapProperties

use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.

the class ConfigurationPreProcessorFactoryTest method testBootstrapProperties_MultipleExternalPropertyFilesOnly1Configured.

@Test
public void testBootstrapProperties_MultipleExternalPropertyFilesOnly1Configured() throws Exception {
    Properties sampleProperties2 = new Properties();
    sampleProperties2.put("name", "testPreProcessor2");
    sampleProperties2.put("class", DummyConfigurationPreProcessor2.class.getCanonicalName());
    when(mockPropertyLoader.loadPropertyFile("testPreProcessor")).thenReturn(sampleProperties);
    when(mockPropertyLoader.loadPropertyFile("testPreProcessor2")).thenReturn(sampleProperties2);
    preProcessorFactory.setPropertyLoader(mockPropertyLoader);
    Properties props = new Properties();
    props.put("preProcessors", "testPreProcessor");
    ConfigPreProcessors processorsList = preProcessorFactory.load(new JunitBootstrapProperties(props));
    assertEquals(1, processorsList.size());
    assertEquals(DummyConfigurationPreProcessor.class.getCanonicalName(), processorsList.toArray()[0].getClass().getName());
}
Also used : JunitBootstrapProperties(com.adaptris.core.stubs.JunitBootstrapProperties) Properties(java.util.Properties) JunitBootstrapProperties(com.adaptris.core.stubs.JunitBootstrapProperties) Test(org.junit.Test)

Example 30 with JunitBootstrapProperties

use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.

the class ConfigurationPreProcessorFactoryTest method testBootstrapProperties_EmptyConfiguredPreProcessors.

@Test
public void testBootstrapProperties_EmptyConfiguredPreProcessors() throws Exception {
    Properties props = new Properties();
    props.put("preProcessors", "");
    ConfigPreProcessors loaded = preProcessorFactory.load(new JunitBootstrapProperties(props));
    assertEquals(0, loaded.size());
}
Also used : JunitBootstrapProperties(com.adaptris.core.stubs.JunitBootstrapProperties) Properties(java.util.Properties) JunitBootstrapProperties(com.adaptris.core.stubs.JunitBootstrapProperties) Test(org.junit.Test)

Aggregations

JunitBootstrapProperties (com.adaptris.core.stubs.JunitBootstrapProperties)55 Properties (java.util.Properties)55 Test (org.junit.Test)55 BootstrapProperties (com.adaptris.core.management.BootstrapProperties)49 URLString (com.adaptris.util.URLString)43 Adapter (com.adaptris.core.Adapter)39 ObjectName (javax.management.ObjectName)35 File (java.io.File)20 CoreException (com.adaptris.core.CoreException)4 DefaultEventHandler (com.adaptris.core.DefaultEventHandler)2 XStreamJsonMarshaller (com.adaptris.core.XStreamJsonMarshaller)2 ConfigPreProcessors (com.adaptris.core.config.ConfigPreProcessors)2 AdapterShutdownEvent (com.adaptris.core.event.AdapterShutdownEvent)2 StaticMockEventProducer (com.adaptris.core.stubs.StaticMockEventProducer)2 InstanceNotFoundException (javax.management.InstanceNotFoundException)2 NullConnection (com.adaptris.core.NullConnection)1 DummyConfigurationPreProcessor (com.adaptris.core.config.DummyConfigurationPreProcessor)1 ReformatMetadata (com.adaptris.core.services.metadata.ReformatMetadata)1 InitialContext (javax.naming.InitialContext)1 NamingException (javax.naming.NamingException)1