import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("org.onap.dmaap.datarouter.node.NodeConfigManager")
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"})
public class NodeServerTest {
- private NodeConfigManager config = mock(NodeConfigManager.class);
+ private final NodeConfigManager config = mock(NodeConfigManager.class);
@Before
public void setUp() throws Exception {
setUpConfig();
setUpNodeMainDelivery();
createFilesAndDirectories();
- mock(Delivery.class);
}
@AfterClass
@Test
public void Verify_Node_Server_Is_Configured_Correctly() {
- Assert.assertNotNull(NodeServer.getServerInstance());
+ Assert.assertNotNull(NodeServer.getServerInstance(config));
}
private void setUpConfig() throws IllegalAccessException {
when(config.getEventLogInterval()).thenReturn("40");
when(config.isDeletePermitted("1")).thenReturn(true);
when(config.getAllDests()).thenReturn(new DestInfo[0]);
+ when(config.isTlsEnabled()).thenReturn(true);
when(config.getKSType()).thenReturn("PKCS12");
when(config.getKSFile()).thenReturn("src/test/resources/aaf/org.onap.dmaap-dr.p12");
when(config.getKSPass()).thenReturn("tVac2#@Stx%tIOE^x[c&2fgZ");
when(config.getTstype()).thenReturn("jks");
when(config.getTsfile()).thenReturn("src/test/resources/aaf/org.onap.dmaap-dr.trust.jks");
when(config.getTspass()).thenReturn("XHX$2Vl?Lk*2CB.i1+ZFAhZd");
- FieldUtils.writeDeclaredStaticField(NodeServlet.class, "config", config, true);
- FieldUtils.writeDeclaredStaticField(NodeRunner.class, "nodeConfigManager", config, true);
PowerMockito.when(NodeConfigManager.getInstance()).thenReturn(config);
}