[DMAAP-BC] Fix failing jenkins 44/125944/1
authorefiacor <fiachra.corcoran@est.tech>
Fri, 26 Nov 2021 13:55:33 +0000 (13:55 +0000)
committerefiacor <fiachra.corcoran@est.tech>
Fri, 26 Nov 2021 13:56:58 +0000 (13:56 +0000)
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Change-Id: I5183451b4c86e7be5ddc2f38ad83de9658eafb82
Issue-ID: DMAAP-1682

46 files changed:
dmaap-bc/src/main/java/org/onap/dmaap/dbcapi/aaf/AafConnection.java
dmaap-bc/src/main/java/org/onap/dmaap/dbcapi/server/Main.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/aaf/AafServiceFactoryTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/aaf/AafServiceImplTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/authentication/ApiPermsTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/authentication/ApiPolicyTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/client/DrProvConnectionTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/client/MrProvConnectionTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/client/MrTopicConnectionTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/database/DBFieldHandlerTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/database/DBMapTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/database/DBSingletonTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/database/LoadSchemaTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/database/TableHandlerTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/model/MRClientTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/model/MR_ClusterTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/model/MirrorMakerTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/model/TopicTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/resources/AAFAuthenticationFilterTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/resources/AAFAuthorizationFilterTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/resources/DR_NodeResourceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/resources/DR_PubResourceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/resources/DR_SubResourceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/resources/DcaeLocationResourceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/resources/DmaapResourceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/resources/FeedResourceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/resources/InfoResourceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/resources/MR_ClientResourceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/resources/MR_ClusterResourceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/resources/TopicResourceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/server/JettyServerTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/server/MainTest.java [deleted file]
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/service/AafTopicSetupServiceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/service/ApiServiceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/service/DR_NodeServiceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/service/DmaapServiceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/service/Dr_PubServiceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/service/FeedServiceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/service/MR_ClientServiceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/service/MR_ClusterServiceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/service/MirrorMakerServiceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/service/MirrorMakerServiceTestMockito.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/service/TopicServiceTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/util/DmaapConfigTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/util/GraphTest.java
dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/util/PermissionBuilderTest.java

index 934e541..b476723 100644 (file)
 
 package org.onap.dmaap.dbcapi.aaf;
 
 
 package org.onap.dmaap.dbcapi.aaf;
 
-
-
-
-
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
+import java.net.ConnectException;
 import java.net.ProtocolException;
 import java.net.URL;
 import java.net.UnknownHostException;
 import java.net.ProtocolException;
 import java.net.URL;
 import java.net.UnknownHostException;
-import java.net.ConnectException;
-
 import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLHandshakeException;
 import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLHandshakeException;
-
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.X509TrustManager;
 import org.apache.commons.codec.binary.Base64;
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.X509TrustManager;
 import org.apache.commons.codec.binary.Base64;
@@ -50,25 +44,16 @@ import org.onap.dmaap.dbcapi.util.DmaapConfig;
 
 public class AafConnection extends BaseLoggingClass {
 
 
 public class AafConnection extends BaseLoggingClass {
 
-
-
-
-
        private String aafCred;
        private String unit_test;
        private String aafCred;
        private String unit_test;
-
-
        private HttpsURLConnection uc;
 
        private HttpsURLConnection uc;
 
-
        public AafConnection( String cred ) {
                aafCred = cred;
                DmaapConfig p = (DmaapConfig)DmaapConfig.getConfig();
         unit_test = p.getProperty( "UnitTest", "No" );
        public AafConnection( String cred ) {
                aafCred = cred;
                DmaapConfig p = (DmaapConfig)DmaapConfig.getConfig();
         unit_test = p.getProperty( "UnitTest", "No" );
-
        }
 
        }
 
-
        private boolean makeConnection( String pURL ) {
 
                try {
        private boolean makeConnection( String pURL ) {
 
                try {
@@ -103,8 +88,6 @@ public class AafConnection extends BaseLoggingClass {
 
                return sb.toString();
        }
 
                return sb.toString();
        }
-       
-
 
        public int postAaf( AafObject obj, String pURL ) {
                logger.info( "entry: postAaf() to  " + pURL  );
 
        public int postAaf( AafObject obj, String pURL ) {
                logger.info( "entry: postAaf() to  " + pURL  );
index 942fe6c..91f7df4 100644 (file)
@@ -47,7 +47,7 @@ public class Main extends BaseLoggingClass {
        public void setProvFQDN(String provFQDN) {
                Main.provFQDN = provFQDN;
        }
        public void setProvFQDN(String provFQDN) {
                Main.provFQDN = provFQDN;
        }
-       private Main() {
+       Main() {
     }
     public static void main(String[] args) {
         (new Main()).main();
     }
     public static void main(String[] args) {
         (new Main()).main();
index 45ff2b1..633742f 100644 (file)
 
 package org.onap.dmaap.dbcapi.aaf;
 
 
 package org.onap.dmaap.dbcapi.aaf;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.BDDMockito.given;
+
 import org.junit.Before;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -28,10 +33,6 @@ import org.mockito.runners.MockitoJUnitRunner;
 import org.onap.dmaap.dbcapi.aaf.AafService.ServiceType;
 import org.onap.dmaap.dbcapi.util.DmaapConfig;
 
 import org.onap.dmaap.dbcapi.aaf.AafService.ServiceType;
 import org.onap.dmaap.dbcapi.util.DmaapConfig;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.BDDMockito.given;
-
 @RunWith(MockitoJUnitRunner.class)
 public class AafServiceFactoryTest {
 
 @RunWith(MockitoJUnitRunner.class)
 public class AafServiceFactoryTest {
 
@@ -45,6 +46,11 @@ public class AafServiceFactoryTest {
     private DmaapConfig dmaapConfig;
     private AafServiceFactory aafServiceFactory;
 
     private DmaapConfig dmaapConfig;
     private AafServiceFactory aafServiceFactory;
 
+    @BeforeClass
+    public static void setUpClass() {
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
+    }
+
     @Before
     public void setUp() throws Exception {
         aafServiceFactory = new AafServiceFactory(dmaapConfig);
     @Before
     public void setUp() throws Exception {
         aafServiceFactory = new AafServiceFactory(dmaapConfig);
index ffd130e..03d19cb 100644 (file)
@@ -50,6 +50,7 @@ public class AafServiceImplTest {
 
     @Before
     public void setUp() throws Exception {
 
     @Before
     public void setUp() throws Exception {
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
         MockitoAnnotations.initMocks(this);
         given(aafConnection.postAaf(any(AafObject.class), anyString())).willReturn(CREATED);
         given(aafConnection.delAaf(any(AafObject.class), anyString())).willReturn(OK);
         MockitoAnnotations.initMocks(this);
         given(aafConnection.postAaf(any(AafObject.class), anyString())).willReturn(CREATED);
         given(aafConnection.delAaf(any(AafObject.class), anyString())).willReturn(OK);
@@ -58,7 +59,6 @@ public class AafServiceImplTest {
 
     @Test
     public void shouldReturnCorrectIdentity() {
 
     @Test
     public void shouldReturnCorrectIdentity() {
-
         assertEquals(IDENTITY, aafService.getIdentity());
     }
 
         assertEquals(IDENTITY, aafService.getIdentity());
     }
 
index ea749ce..0c905fe 100644 (file)
@@ -25,13 +25,17 @@ import static org.junit.Assert.assertTrue;
 import javax.ws.rs.core.Application;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
 import javax.ws.rs.core.Application;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
+import org.junit.Before;
 import org.junit.Test;
 
 import org.junit.Test;
 
-import org.onap.dmaap.dbcapi.authentication.ApiPerms;
-
 
 public class ApiPermsTest extends JerseyTest {
 
 
 public class ApiPermsTest extends JerseyTest {
 
+       @Before
+       public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
+       }
+
        @Override
        protected Application configure() {
                return new ResourceConfig()
        @Override
        protected Application configure() {
                return new ResourceConfig()
index 7b9fbb3..19a8efa 100644 (file)
 
 package org.onap.dmaap.dbcapi.authentication;
 
 
 package org.onap.dmaap.dbcapi.authentication;
 
-import org.junit.Test;
-import org.onap.dmaap.dbcapi.aaf.DmaapPerm;
-
-import java.util.Properties;
-
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.util.Properties;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.dmaap.dbcapi.aaf.DmaapPerm;
+
 public class ApiPolicyTest {
 
     private Properties properties = new Properties();
     private ApiPolicy apiPolicy;
 
 public class ApiPolicyTest {
 
     private Properties properties = new Properties();
     private ApiPolicy apiPolicy;
 
+    @Before
+    public void setUp() throws Exception {
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
+    }
+
     @Test
     public void check_shouldExecuteAuthorizationApi() throws Exception {
         properties.put("ApiPermission.Class", "org.onap.dmaap.dbcapi.authentication.ApiPolicyTest$DummyApiAuthorization");
     @Test
     public void check_shouldExecuteAuthorizationApi() throws Exception {
         properties.put("ApiPermission.Class", "org.onap.dmaap.dbcapi.authentication.ApiPolicyTest$DummyApiAuthorization");
index 4c44e0a..1b38838 100644 (file)
@@ -53,6 +53,7 @@ public class DrProvConnectionTest {
 
        @Before
        public void setUp() throws Exception {
 
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
                ns = new DrProvConnection();
        }
 
                ns = new DrProvConnection();
        }
 
@@ -63,16 +64,13 @@ public class DrProvConnectionTest {
 
        @Test
        public void test1() {
 
        @Test
        public void test1() {
-
-
-               rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.DrProvConnection", "get", "idNotSet@namespaceNotSet:pwdNotSet" ); 
-       
+               rh.reflect( "org.onap.dmaap.dbcapi.client.DrProvConnection", "get", "idNotSet@namespaceNotSet:pwdNotSet" );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
        }
 
        @Test
        public void test2() {
                String v = "Validate";
-               rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.DrProvConnection", "set", v );
+               rh.reflect( "org.onap.dmaap.dbcapi.client.DrProvConnection", "set", v );
 
        }
 
 
        }
 
index 0614cf9..121a3d7 100644 (file)
@@ -47,6 +47,7 @@ public class MrProvConnectionTest {
 
        @Before
        public void setUp() throws Exception {
 
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
                ns = new MrProvConnection();
                ts = new TopicService();
                mcs = new MR_ClusterService();
                ns = new MrProvConnection();
                ts = new TopicService();
                mcs = new MR_ClusterService();
@@ -61,14 +62,14 @@ public class MrProvConnectionTest {
        public void test1() {
 
 
        public void test1() {
 
 
-               rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrProvConnection", "get", "idNotSet@namespaceNotSet:pwdNotSet" ); 
+               rh.reflect( "org.onap.dmaap.dbcapi.client.MrProvConnection", "get", "idNotSet@namespaceNotSet:pwdNotSet" );
        
        }
 
        @Test
        public void test2() {
                String v = "Validate";
        
        }
 
        @Test
        public void test2() {
                String v = "Validate";
-               rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrProvConnection", "set", v );
+               rh.reflect( "org.onap.dmaap.dbcapi.client.MrProvConnection", "set", v );
 
        }
 
 
        }
 
index af33ec6..f235feb 100644 (file)
@@ -46,6 +46,7 @@ public class MrTopicConnectionTest {
 
        @Before
        public void setUp() throws Exception {
 
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
                ns = new MrTopicConnection( "aUser", "aPwd" );
                ts = new TopicService();
                mcs = new MR_ClusterService();
                ns = new MrTopicConnection( "aUser", "aPwd" );
                ts = new TopicService();
                mcs = new MR_ClusterService();
@@ -60,14 +61,14 @@ public class MrTopicConnectionTest {
        public void test1() {
 
 
        public void test1() {
 
 
-               rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrTopicConnection", "get", "idNotSet@namespaceNotSet:pwdNotSet" );        
+               rh.reflect( "org.onap.dmaap.dbcapi.client.MrTopicConnection", "get", "idNotSet@namespaceNotSet:pwdNotSet" );
        
        }
 
        @Test
        public void test2() {
                String v = "Validate";
        
        }
 
        @Test
        public void test2() {
                String v = "Validate";
-               rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrTopicConnection", "set", v );
+               rh.reflect( "org.onap.dmaap.dbcapi.client.MrTopicConnection", "set", v );
 
        }
 
 
        }
 
index f68b9ed..547c3b6 100644 (file)
@@ -25,49 +25,11 @@ package org.onap.dmaap.dbcapi.database;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.logging.BaseLoggingClass;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.logging.BaseLoggingClass;
-import org.onap.dmaap.dbcapi.model.ReplicationType;
-import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class DBFieldHandlerTest extends BaseLoggingClass {
 
 
 public class DBFieldHandlerTest extends BaseLoggingClass {
 
-    private static final String fmt = "%24s: %s%n";
-
-    ReflectionHarness rh = new ReflectionHarness();
-
-    private static class TopicReplicationTypeHandler implements DBFieldHandler.SqlOp {
-        public Object get(ResultSet rs, int index) throws Exception {
-            int val = rs.getInt(index);
-
-            return (ReplicationType.valueOf(val));
-        }
-
-        public void set(PreparedStatement ps, int index, Object val) throws Exception {
-            if (val == null) {
-                ps.setInt(index, 0);
-                return;
-            }
-            @SuppressWarnings("unchecked")
-            ReplicationType rep = (ReplicationType) val;
-            ps.setInt(index, rep.getValue());
-        }
-    }
-
-    @Test
-    public void test1() {
-        // rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrTopicConnection", "get",
-        // "idNotSet@namespaceNotSet:pwdNotSet" );
-    }
-
-    @Test
-    public void test2() {
-        String v = "Validate";
-        // rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrTopicConnection", "set", v );
-    }
-
     @Test
     public void test3() {
         try {
     @Test
     public void test3() {
         try {
index abd4aee..968a48c 100644 (file)
  */
 package org.onap.dmaap.dbcapi.database;
 
  */
 package org.onap.dmaap.dbcapi.database;
 
-import org.onap.dmaap.dbcapi.model.*;
-import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
-import org.onap.dmaap.dbcapi.util.Singleton;
-
-import org.junit.After;
+import java.util.Map;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.Before;
 import org.junit.Test;
-import java.util.*;
+import org.onap.dmaap.dbcapi.model.DcaeLocation;
+import org.onap.dmaap.dbcapi.model.Dmaap;
+import org.onap.dmaap.dbcapi.util.Singleton;
 
 public class DBMapTest {
 
 
 public class DBMapTest {
 
-       private static final String  fmt = "%24s: %s%n";
-
-       ReflectionHarness rh = new ReflectionHarness();
-
-
     private static Singleton<Dmaap> dmaap;
     private static Map<String, DcaeLocation> dcaeLocations;
 
     private static Singleton<Dmaap> dmaap;
     private static Map<String, DcaeLocation> dcaeLocations;
 
-
        @Before
        public void setUp() throws Exception {
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
        }
 
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-
-
        @Test
        public void test1() {
        @Test
        public void test1() {
-
-
-               //rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrTopicConnection", "get", "idNotSet@namespaceNotSet:pwdNotSet" );      
-       
-       }
-
-       @Test
-       public void test2() {
-               String v = "Validate";
-               //rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrTopicConnection", "set", v );
-
-       }
-
-       @Test
-       public void test3() {
                try {
                try {
-                dmaap = new DBSingleton<Dmaap>(Dmaap.class, "dmaap");
+                dmaap = new DBSingleton<>(Dmaap.class, "dmaap");
                                Dmaap nd = new Dmaap.DmaapBuilder().createDmaap();
                                dmaap.update(nd);
                } catch (Exception e ) {
                }
                try {
                                Dmaap nd = new Dmaap.DmaapBuilder().createDmaap();
                                dmaap.update(nd);
                } catch (Exception e ) {
                }
                try {
-                dcaeLocations = new DBMap<DcaeLocation>(DcaeLocation.class, "dcae_location", "dcae_location_name");
+                dcaeLocations = new DBMap<>(DcaeLocation.class, "dcae_location", "dcae_location_name");
                } catch (Exception e ) {
                }
                } catch (Exception e ) {
                }
-
        }
        }
-
-
-
 }
 
 }
 
index 003f250..ce2a848 100644 (file)
  */
 package org.onap.dmaap.dbcapi.database;
 
  */
 package org.onap.dmaap.dbcapi.database;
 
-import org.onap.dmaap.dbcapi.model.*;
-import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
-
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.Before;
 import org.junit.Test;
+import org.onap.dmaap.dbcapi.model.Dmaap;
 
 public class DBSingletonTest {
 
 public class DBSingletonTest {
-
-       private static final String  fmt = "%24s: %s%n";
-
-       ReflectionHarness rh = new ReflectionHarness();
-
-
        @Before
        public void setUp() throws Exception {
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
        }
 
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-
-
-
        @Test
        public void test3() {
 
                try {
        @Test
        public void test3() {
 
                try {
-                       DBSingleton<Dmaap> dmaap = new DBSingleton<Dmaap>(Dmaap.class, "dmaap");
+                       DBSingleton<Dmaap> dmaap = new DBSingleton<>(Dmaap.class, "dmaap");
                        Dmaap d = new Dmaap.DmaapBuilder().createDmaap();
                        dmaap.init( d );
                        d = dmaap.get();
                        Dmaap d = new Dmaap.DmaapBuilder().createDmaap();
                        dmaap.init( d );
                        d = dmaap.get();
@@ -57,11 +43,6 @@ public class DBSingletonTest {
                        dmaap.remove();
                } catch (Exception e ) {
                }
                        dmaap.remove();
                } catch (Exception e ) {
                }
-
        }
        }
-
-
-
-
 }
 
 }
 
index 99065d3..14ad2af 100644 (file)
  */
 package org.onap.dmaap.dbcapi.database;
 
  */
 package org.onap.dmaap.dbcapi.database;
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class LoadSchemaTest {
 
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class LoadSchemaTest {
 
-       private static final String  fmt = "%24s: %s%n";
-
        ReflectionHarness rh = new ReflectionHarness();
 
        ReflectionHarness rh = new ReflectionHarness();
 
-       LoadSchema ls;
-
-
        @Before
        public void setUp() throws Exception {
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
        }
 
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-
-
        @Test
        public void test1() {
        @Test
        public void test1() {
-
-
                rh.reflect( "org.onap.dmaap.dbcapi.database.LoadSchema", "get", "idNotSet@namespaceNotSet:pwdNotSet" );
                rh.reflect( "org.onap.dmaap.dbcapi.database.LoadSchema", "get", "idNotSet@namespaceNotSet:pwdNotSet" );
-       
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.database.LoadSchema", "set", v );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.database.LoadSchema", "set", v );
-
        }
 
        @Test
        }
 
        @Test
index 978f3ad..b497547 100644 (file)
  */
 package org.onap.dmaap.dbcapi.database;
 
  */
 package org.onap.dmaap.dbcapi.database;
 
-import org.onap.dmaap.dbcapi.model.*;
-import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.Before;
 import org.junit.Test;
-import java.sql.*;
+import org.onap.dmaap.dbcapi.model.ReplicationType;
+import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class TableHandlerTest {
 
 
 public class TableHandlerTest {
 
-       private static final String  fmt = "%24s: %s%n";
-
        ReflectionHarness rh = new ReflectionHarness();
 
    private static class TopicReplicationTypeHandler implements DBFieldHandler.SqlOp {
        ReflectionHarness rh = new ReflectionHarness();
 
    private static class TopicReplicationTypeHandler implements DBFieldHandler.SqlOp {
@@ -52,30 +47,20 @@ public class TableHandlerTest {
         }
     }
 
         }
     }
 
-
-
        @Before
        public void setUp() throws Exception {
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
        }
 
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-
-
        @Test
        public void test1() {
        @Test
        public void test1() {
-
-
-               rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrTopicConnection", "get", "idNotSet@namespaceNotSet:pwdNotSet" );        
-       
+               rh.reflect( "org.onap.dmaap.dbcapi.client.MrTopicConnection", "get", "idNotSet@namespaceNotSet:pwdNotSet" );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
        }
 
        @Test
        public void test2() {
                String v = "Validate";
-               //rh.reflect( "org.onap.dmaap.dbcapi.aaf.client.MrTopicConnection", "set", v );
-
+               rh.reflect( "org.onap.dmaap.dbcapi.client.MrTopicConnection", "set", v );
        }
 
        @Test
        }
 
        @Test
@@ -99,8 +84,5 @@ public class TableHandlerTest {
                }
 
        }
                }
 
        }
-
-
-
 }
 
 }
 
index ba95a85..f6027a8 100644 (file)
 
 package org.onap.dmaap.dbcapi.model;
 
 
 package org.onap.dmaap.dbcapi.model;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class MRClientTest {
 
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class MRClientTest {
 
-    private static final String fmt = "%24s: %s%n";
-
     ReflectionHarness rh = new ReflectionHarness();
 
     String d, t, f, c, m;
 
     @Before
     public void setUp() throws Exception {
     ReflectionHarness rh = new ReflectionHarness();
 
     String d, t, f, c, m;
 
     @Before
     public void setUp() throws Exception {
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
         d = "central-onap";
         t = "org.onap.dmaap.interestingTopic";
         f = "mrc.onap.org:3904/events/org.onap.dmaap.interestingTopic";
         d = "central-onap";
         t = "org.onap.dmaap.interestingTopic";
         f = "mrc.onap.org:3904/events/org.onap.dmaap.interestingTopic";
@@ -46,13 +45,8 @@ public class MRClientTest {
         m = "m12345";
     }
 
         m = "m12345";
     }
 
-    @After
-    public void tearDown() throws Exception {
-    }
-
     @Test
     public void test1() {
     @Test
     public void test1() {
-
         // can't use simple reflection to test for null since null constructor
         // initializes some fields.
         // rh.reflect( "org.onap.dmaap.dbcapi.model.MR_Client", "get", null );
         // can't use simple reflection to test for null since null constructor
         // initializes some fields.
         // rh.reflect( "org.onap.dmaap.dbcapi.model.MR_Client", "get", null );
@@ -84,7 +78,6 @@ public class MRClientTest {
 
     @Test
     public void test3() {
 
     @Test
     public void test3() {
-
         String v = "Validate";
         rh.reflect("org.onap.dmaap.dbcapi.model.MR_Client", "set", v);
     }
         String v = "Validate";
         rh.reflect("org.onap.dmaap.dbcapi.model.MR_Client", "set", v);
     }
@@ -105,7 +98,6 @@ public class MRClientTest {
         assertEquals(false, mrClient.isPublisher());
         assertEquals(false, mrClient.isSubscriber());
         assertEquals("test", mrClient.getAction()[0]);
         assertEquals(false, mrClient.isPublisher());
         assertEquals(false, mrClient.isSubscriber());
         assertEquals("test", mrClient.getAction()[0]);
-
     }
 
 }
     }
 
 }
index 2200627..fe0ca85 100644 (file)
@@ -19,9 +19,8 @@
  */
 package org.onap.dmaap.dbcapi.model;
 
  */
 package org.onap.dmaap.dbcapi.model;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
 
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
@@ -32,6 +31,7 @@ public class MR_ClusterTest {
 
        @Before
        public void setUp() throws Exception {
 
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
                d = "central-onap";
                fqdn = "mr.onap.org";
                repGrp = "zeppelin";
                d = "central-onap";
                fqdn = "mr.onap.org";
                repGrp = "zeppelin";
@@ -44,14 +44,8 @@ public class MR_ClusterTest {
                
        }
 
                
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-
-
        @Test
        public void testMR_ClusterClassDefaultConstructor() {
        @Test
        public void testMR_ClusterClassDefaultConstructor() {
-
                MR_Cluster t = new MR_Cluster();
        
                assertTrue( t.getDcaeLocationName() == null  );
                MR_Cluster t = new MR_Cluster();
        
                assertTrue( t.getDcaeLocationName() == null  );
@@ -120,16 +114,10 @@ public class MR_ClusterTest {
                assertTrue(fqtn.contains(topic2));
        }
 
                assertTrue(fqtn.contains(topic2));
        }
 
-
-
        @Test
        public void testsetter() {
        @Test
        public void testsetter() {
-
                String v = "validate";
                String v = "validate";
-
-
-               rh.reflect( "org.onap.dmaap.dbcapi.model.MR_Cluster", "set", v );       
-       
+               rh.reflect( "org.onap.dmaap.dbcapi.model.MR_Cluster", "set", v );
        }
 
 }
        }
 
 }
index 39de2be..872c4b7 100644 (file)
  */
 package org.onap.dmaap.dbcapi.model;
 
  */
 package org.onap.dmaap.dbcapi.model;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
 
 
-import org.junit.After;
+import java.util.ArrayList;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
-import java.util.ArrayList;
-
 
 public class MirrorMakerTest {
 
 
 public class MirrorMakerTest {
 
-       private static final String  fmt = "%24s: %s%n";
-
        ReflectionHarness rh = new ReflectionHarness();
 
        ReflectionHarness rh = new ReflectionHarness();
 
-
        @Before
        public void setUp() throws Exception {
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
        }
 
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-
-
        @Test
        public void test1() {
        @Test
        public void test1() {
-
-
-               rh.reflect( "org.onap.dmaap.dbcapi.model.MirrorMaker", "get", null );   
-       
+               rh.reflect( "org.onap.dmaap.dbcapi.model.MirrorMaker", "get", null );
        }
        @Test
        public void test2() {
        }
        @Test
        public void test2() {
-
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.model.MirrorMaker", "set", v );
        }
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.model.MirrorMaker", "set", v );
        }
index 5da3aed..d7598b0 100644 (file)
@@ -24,7 +24,6 @@ package org.onap.dmaap.dbcapi.model;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.model.DmaapObject.DmaapObject_Status;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.model.DmaapObject.DmaapObject_Status;
@@ -38,6 +37,7 @@ public class TopicTest {
 
     @Before
     public void setUp() throws Exception {
 
     @Before
     public void setUp() throws Exception {
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
         f = "org.onap.dmaap.interestingTopic";
         t = "interestingTopic";
         d = "A so very interesting topic";
         f = "org.onap.dmaap.interestingTopic";
         t = "interestingTopic";
         d = "A so very interesting topic";
@@ -45,10 +45,6 @@ public class TopicTest {
         o = "m12345";
     }
 
         o = "m12345";
     }
 
-    @After
-    public void tearDown() throws Exception {
-    }
-
     @Test
     public void test1() {
         rh.reflect("org.onap.dmaap.dbcapi.model.Topic", "get", null);
     @Test
     public void test1() {
         rh.reflect("org.onap.dmaap.dbcapi.model.Topic", "get", null);
index 76fe914..e3f61c7 100644 (file)
  */
 package org.onap.dmaap.dbcapi.resources;
 
  */
 package org.onap.dmaap.dbcapi.resources;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
 import static org.mockito.Mockito.verifyZeroInteractions;
 
 import static org.mockito.Mockito.verifyZeroInteractions;
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import org.junit.Before;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -70,6 +65,11 @@ public class AAFAuthenticationFilterTest {
     @Rule
     public ExpectedException thrown = ExpectedException.none();
 
     @Rule
     public ExpectedException thrown = ExpectedException.none();
 
+    @BeforeClass
+    public static void setUpClass(){
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
+    }
+
     @Before
     public void setUp() throws Exception {
         doReturn(dmaapConfig).when(filter).getConfig();
     @Before
     public void setUp() throws Exception {
         doReturn(dmaapConfig).when(filter).getConfig();
@@ -131,65 +131,4 @@ public class AAFAuthenticationFilterTest {
         //when
         filter.init(filterConfig);
     }
         //when
         filter.init(filterConfig);
     }
-
-  /*
-   * See https://jira.onap.org/browse/DMAAP-1361  for why this is commented out
-    @Test
-    public void init_shouldInitializeCADI_whenAafIsUsed_andValidCadiPropertiesSet() throws Exception {
-        //given
-        doReturn("true").when(dmaapConfig).getProperty(eq(AAFAuthenticationFilter.CADI_AUTHN_FLAG), anyString());
-        doReturn("src/test/resources/cadi.properties").when(dmaapConfig).getProperty(AAFAuthenticationFilter.CADI_PROPERTIES);
-
-        //when
-        filter.init(filterConfig);
-
-        //then
-        assertTrue(filter.isCadiEnabled());
-        assertNotNull(filter.getCadiFilter());
-    }
-
-    @Test
-    public void doFilter_shouldUseCADIfilter_andAuthenticateUser_whenAAFisUsed_andUserIsValid() throws Exception{
-        //given
-        initCADIFilter();
-        doReturn(200).when(servletResponse).getStatus();
-
-        //when
-        filter.doFilter(servletRequest,servletResponse,filterChain);
-
-        //then
-        verify(cadiFilterMock).doFilter(servletRequest,servletResponse,filterChain);
-        verify(servletResponse).getStatus();
-        verifyNoMoreInteractions(servletResponse);
-        verifyZeroInteractions(filterChain, servletRequest);
-    }
-
-    @Test
-    public void doFilter_shouldUseCADIfilter_andReturnAuthenticationError_whenAAFisUsed_andUserInvalid() throws Exception{
-        //given
-        String errorResponseJson = "{\"code\":401,\"message\":\"invalid or no credentials provided\",\"fields\":\"Authentication\",\"2xx\":false}";
-        initCADIFilter();
-        doReturn(401).when(servletResponse).getStatus();
-        StringWriter sw = new StringWriter();
-        PrintWriter pw = new PrintWriter(sw);
-        doReturn(pw).when(servletResponse).getWriter();
-
-        //when
-        filter.doFilter(servletRequest,servletResponse,filterChain);
-
-        //then
-        verify(cadiFilterMock).doFilter(servletRequest,servletResponse,filterChain);
-        verify(servletResponse).getStatus();
-        verify(servletResponse).setContentType("application/json");
-        verifyZeroInteractions(filterChain, servletRequest);
-        assertEquals(errorResponseJson, sw.toString());
-    }
-
-    private void initCADIFilter() throws Exception{
-        doReturn("true").when(dmaapConfig).getProperty(eq(AAFAuthenticationFilter.CADI_AUTHN_FLAG), anyString());
-        doReturn("src/test/resources/cadi.properties").when(dmaapConfig).getProperty(AAFAuthenticationFilter.CADI_PROPERTIES);
-        filter.init(filterConfig);
-        filter.setCadiFilter(cadiFilterMock);
-    }
-*/
 }
\ No newline at end of file
 }
\ No newline at end of file
index ba11b01..c58c6fe 100644 (file)
@@ -39,6 +39,7 @@ import javax.servlet.FilterConfig;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import org.junit.Before;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -69,6 +70,10 @@ public class AAFAuthorizationFilterTest {
     @Mock
     private DmaapService dmaapService;
 
     @Mock
     private DmaapService dmaapService;
 
+    @BeforeClass
+    public static void setUpClass(){
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
+    }
     @Before
     public void setUp() throws Exception {
         filter.setPermissionBuilder(permissionBuilder);
     @Before
     public void setUp() throws Exception {
         filter.setPermissionBuilder(permissionBuilder);
index f131d8f..ed3d087 100644 (file)
  */
 package org.onap.dmaap.dbcapi.resources;
 
  */
 package org.onap.dmaap.dbcapi.resources;
 
+import static javax.ws.rs.client.Entity.entity;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Response;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -29,15 +37,6 @@ import org.onap.dmaap.dbcapi.model.ApiError;
 import org.onap.dmaap.dbcapi.model.DR_Node;
 import org.onap.dmaap.dbcapi.testframework.DmaapObjectFactory;
 
 import org.onap.dmaap.dbcapi.model.DR_Node;
 import org.onap.dmaap.dbcapi.testframework.DmaapObjectFactory;
 
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.Response;
-
-import static javax.ws.rs.client.Entity.entity;
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 
 public class DR_NodeResourceTest {
 
 
 public class DR_NodeResourceTest {
 
@@ -46,6 +45,7 @@ public class DR_NodeResourceTest {
 
     @BeforeClass
     public static void setUpClass() throws Exception {
 
     @BeforeClass
     public static void setUpClass() throws Exception {
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
         DatabaseClass.getDmaap().init(DMAAP_OBJECT_FACTORY.genDmaap());
 
         testContainer = new FastJerseyTestContainer(new ResourceConfig()
         DatabaseClass.getDmaap().init(DMAAP_OBJECT_FACTORY.genDmaap());
 
         testContainer = new FastJerseyTestContainer(new ResourceConfig()
index 340f362..f0f55d8 100644 (file)
@@ -53,6 +53,7 @@ public class DR_PubResourceTest {
 
     @BeforeClass
     public static void setUpClass() throws Exception {
 
     @BeforeClass
     public static void setUpClass() throws Exception {
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
         //TODO: init is still needed here to assure that dmaap is not null
         DatabaseClass.getDmaap().init(DMAAP_OBJECT_FACTORY.genDmaap());
 
         //TODO: init is still needed here to assure that dmaap is not null
         DatabaseClass.getDmaap().init(DMAAP_OBJECT_FACTORY.genDmaap());
 
index 13b89ea..319e952 100644 (file)
@@ -54,6 +54,7 @@ public class DR_SubResourceTest {
 
     @BeforeClass
     public static void setUpClass() throws Exception {
 
     @BeforeClass
     public static void setUpClass() throws Exception {
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
         //TODO: init is still needed here to assure that dmaap is not null
         DatabaseClass.getDmaap().init(DMAAP_OBJECT_FACTORY.genDmaap());
 
         //TODO: init is still needed here to assure that dmaap is not null
         DatabaseClass.getDmaap().init(DMAAP_OBJECT_FACTORY.genDmaap());
 
index ff07927..20023e4 100644 (file)
  */
 package org.onap.dmaap.dbcapi.resources;
 
  */
 package org.onap.dmaap.dbcapi.resources;
 
-import org.onap.dmaap.dbcapi.model.*;
-import org.onap.dmaap.dbcapi.testframework.DmaapObjectFactory;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.Assert.assertTrue;
 
 
-import org.glassfish.jersey.test.JerseyTest;
-import org.glassfish.jersey.server.ResourceConfig;
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.Application;
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.Application;
-import javax.ws.rs.core.Response;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.Path;
-import javax.ws.rs.GET;
+import javax.ws.rs.core.Response;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.test.JerseyTest;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.dmaap.dbcapi.model.DcaeLocation;
+import org.onap.dmaap.dbcapi.testframework.DmaapObjectFactory;
 
 
 public class DcaeLocationResourceTest extends JerseyTest {
 
 
 public class DcaeLocationResourceTest extends JerseyTest {
@@ -47,21 +42,10 @@ public class DcaeLocationResourceTest extends JerseyTest {
                return new ResourceConfig( DcaeLocationResource.class );
        }
 
                return new ResourceConfig( DcaeLocationResource.class );
        }
 
-       private static final String  fmt = "%24s: %s%n";
-
-
-
-/*  may conflict with test framework! 
-       @Before
-       public void setUp() throws Exception {
-       }
-
-       @After
-       public void tearDown() throws Exception {
+       @BeforeClass
+       public static void setUpClass(){
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
        }
        }
-*/
-
-
 
        @Test
        public void GetTest() {
 
        @Test
        public void GetTest() {
@@ -122,8 +106,5 @@ public class DcaeLocationResourceTest extends JerseyTest {
                System.out.println( "DELETE dcaeLocation resp=" + resp.getStatus() + " " + resp.readEntity( String.class ) );
                assertTrue( resp.getStatus() == 204 );
        }
                System.out.println( "DELETE dcaeLocation resp=" + resp.getStatus() + " " + resp.readEntity( String.class ) );
                assertTrue( resp.getStatus() == 204 );
        }
-
-
-
 }
 
 }
 
index 29ccb40..70acac3 100644 (file)
@@ -27,6 +27,7 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
 import javax.ws.rs.core.Response;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.model.Dmaap;
 import org.onap.dmaap.dbcapi.testframework.DmaapObjectFactory;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.model.Dmaap;
 import org.onap.dmaap.dbcapi.testframework.DmaapObjectFactory;
@@ -36,28 +37,16 @@ public class DmaapResourceTest extends JerseyTest {
 
        static DmaapObjectFactory factory = new DmaapObjectFactory();
 
 
        static DmaapObjectFactory factory = new DmaapObjectFactory();
 
+       @BeforeClass
+       public static void setUpClass(){
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
+       }
+
        @Override
        protected Application configure() {
                return new ResourceConfig( DmaapResource.class );
        @Override
        protected Application configure() {
                return new ResourceConfig( DmaapResource.class );
-               //return new ResourceConfig( HelloResource.class );
        }
 
        }
 
-       private static final String  fmt = "%24s: %s%n";
-
-
-
-/*  may conflict with test framework! 
-       @Before
-       public void setUp() throws Exception {
-       }
-
-       @After
-       public void tearDown() throws Exception {
-       }
-*/
-
-
-
        @Test
        public void GetTest() {
                Response resp = target( "dmaap").request().get( Response.class );
        @Test
        public void GetTest() {
                Response resp = target( "dmaap").request().get( Response.class );
index 89dca8a..c15d8ae 100644 (file)
  * ============LICENSE_END=========================================================
  */
 package org.onap.dmaap.dbcapi.resources;
  * ============LICENSE_END=========================================================
  */
 package org.onap.dmaap.dbcapi.resources;
-import org.onap.dmaap.dbcapi.model.*;
-import org.onap.dmaap.dbcapi.service.*;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
 
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import java.util.*;
-import java.sql.*;
-
-import org.glassfish.jersey.test.JerseyTest;
-import org.glassfish.jersey.server.ResourceConfig;
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.Application;
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.Application;
-import javax.ws.rs.core.Response;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.Path;
-import javax.ws.rs.GET;
+import javax.ws.rs.core.Response;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.test.JerseyTest;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.dmaap.dbcapi.model.Feed;
 
 
 public class FeedResourceTest extends JerseyTest {
 
 
 
 public class FeedResourceTest extends JerseyTest {
 
+       @BeforeClass
+       public static void setUpClass(){
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
+       }
        @Override
        protected Application configure() {
                return new ResourceConfig( FeedResource.class );
        }
 
        @Override
        protected Application configure() {
                return new ResourceConfig( FeedResource.class );
        }
 
-       private static final String  fmt = "%24s: %s%n";
-
-
-
-/*  may conflict with test framework! 
-       @Before
-       public void setUp() throws Exception {
-       }
-
-       @After
-       public void tearDown() throws Exception {
-       }
-*/
-
-
-
        @Test
        public void GetTest() {
                Response resp = target( "feeds").request().get( Response.class );
        @Test
        public void GetTest() {
                Response resp = target( "feeds").request().get( Response.class );
@@ -77,28 +58,5 @@ public class FeedResourceTest extends JerseyTest {
                assertTrue( resp.getStatus() == 200 );
        }
 
                assertTrue( resp.getStatus() == 200 );
        }
 
-/*
-       @Test
-       public void PutTest() {
-               
-               Feed feed = new Feed( "aPutTest", "1.0", "a unit test", "dgl", "unrestricted" );
-               Entity<Feed> reqEntity = Entity.entity( feed, MediaType.APPLICATION_JSON );
-               Response resp = target( "feeds").request().post( reqEntity, Response.class );
-               System.out.println( "POST feed resp=" + resp.getStatus() );
-               String postResp = resp.readEntity( String.class );
-               System.out.println( "postResp=" + postResp );
-               Feed rFeed = new Feed( postResp );  getting a null pointer here
-               rFeed.setSuspended( true );
-               String target = new String ("feeds/" + rFeed.getFeedId() );
-               System.out.println( "PUT feed target=" + target );
-               reqEntity = Entity.entity( rFeed, MediaType.APPLICATION_JSON );
-               resp = target( target ).request().put( reqEntity, Response.class );
-               System.out.println( "PUT feed resp=" + resp.getStatus() );
-               assertTrue( resp.getStatus() == 200 );
-       }
-*/
-
-
-
 }
 
 }
 
index 3f57f58..57a9699 100644 (file)
  * ============LICENSE_END=========================================================
  */
 package org.onap.dmaap.dbcapi.resources;
  * ============LICENSE_END=========================================================
  */
 package org.onap.dmaap.dbcapi.resources;
-import org.onap.dmaap.dbcapi.model.*;
-import org.onap.dmaap.dbcapi.service.*;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
 
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import java.util.*;
-import java.sql.*;
-
-import org.glassfish.jersey.test.JerseyTest;
-import org.glassfish.jersey.server.ResourceConfig;
-import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.Application;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Application;
 import javax.ws.rs.core.Response;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.Path;
-import javax.ws.rs.GET;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.test.JerseyTest;
+import org.junit.BeforeClass;
+import org.junit.Test;
 
 
 public class InfoResourceTest extends JerseyTest {
 
 
 public class InfoResourceTest extends JerseyTest {
@@ -44,23 +34,11 @@ public class InfoResourceTest extends JerseyTest {
        protected Application configure() {
                return new ResourceConfig( InfoResource.class );
        }
        protected Application configure() {
                return new ResourceConfig( InfoResource.class );
        }
-
-       private static final String  fmt = "%24s: %s%n";
-
-
-
-/*  may conflict with test framework! 
-       @Before
-       public void setUp() throws Exception {
+       @BeforeClass
+       public static void setUpClass(){
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
        }
 
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-*/
-
-
-
        @Test
        public void GetTest() {
                Response resp = target( "info").request().get( Response.class );
        @Test
        public void GetTest() {
                Response resp = target( "info").request().get( Response.class );
index abe2e45..bbd4dd0 100644 (file)
 
 package org.onap.dmaap.dbcapi.resources;
 
 
 package org.onap.dmaap.dbcapi.resources;
 
+import static javax.ws.rs.client.Entity.entity;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Response;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -31,15 +39,6 @@ import org.onap.dmaap.dbcapi.model.MR_Cluster;
 import org.onap.dmaap.dbcapi.model.Topic;
 import org.onap.dmaap.dbcapi.testframework.DmaapObjectFactory;
 
 import org.onap.dmaap.dbcapi.model.Topic;
 import org.onap.dmaap.dbcapi.testframework.DmaapObjectFactory;
 
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.Response;
-
-import static javax.ws.rs.client.Entity.entity;
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 public class MR_ClientResourceTest {
 
     private static final DmaapObjectFactory DMAAP_OBJECT_FACTORY = new DmaapObjectFactory();
 public class MR_ClientResourceTest {
 
     private static final DmaapObjectFactory DMAAP_OBJECT_FACTORY = new DmaapObjectFactory();
@@ -47,6 +46,7 @@ public class MR_ClientResourceTest {
 
     @BeforeClass
     public static void setUpClass() throws Exception {
 
     @BeforeClass
     public static void setUpClass() throws Exception {
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
         DatabaseClass.getDmaap().init(DMAAP_OBJECT_FACTORY.genDmaap());
 
         testContainer = new FastJerseyTestContainer(new ResourceConfig()
         DatabaseClass.getDmaap().init(DMAAP_OBJECT_FACTORY.genDmaap());
 
         testContainer = new FastJerseyTestContainer(new ResourceConfig()
index 9027f13..b97d3a1 100644 (file)
@@ -50,6 +50,7 @@ public class MR_ClusterResourceTest {
 
        @BeforeClass
        public static void setUpClass() throws Exception {
 
        @BeforeClass
        public static void setUpClass() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
                DatabaseClass.getDmaap().init(DMAAP_OBJECT_FACTORY.genDmaap());
 
                testContainer = new FastJerseyTestContainer(new ResourceConfig()
                DatabaseClass.getDmaap().init(DMAAP_OBJECT_FACTORY.genDmaap());
 
                testContainer = new FastJerseyTestContainer(new ResourceConfig()
index 5b7c46d..7c82711 100644 (file)
@@ -54,6 +54,7 @@ public class TopicResourceTest {
 
     @BeforeClass
     public static void setUpClass() throws Exception {
 
     @BeforeClass
     public static void setUpClass() throws Exception {
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
         //TODO: init is still needed here to assure that dmaap is not null
         DatabaseClass.getDmaap().init(DMAAP_OBJECT_FACTORY.genDmaap());
 
         //TODO: init is still needed here to assure that dmaap is not null
         DatabaseClass.getDmaap().init(DMAAP_OBJECT_FACTORY.genDmaap());
 
index 35c9243..0582b32 100644 (file)
  */
 package org.onap.dmaap.dbcapi.server;
 
  */
 package org.onap.dmaap.dbcapi.server;
 
-import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
-import org.onap.dmaap.dbcapi.util.DmaapConfig;
-import static org.junit.Assert.*;
-
+import java.util.Properties;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import java.util.Properties;
+import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
+import org.onap.dmaap.dbcapi.util.DmaapConfig;
 
 public class JettyServerTest {
 
 
 public class JettyServerTest {
 
-       private static final String  fmt = "%24s: %s%n";
-
        ReflectionHarness rh = new ReflectionHarness();
        ReflectionHarness rh = new ReflectionHarness();
-
-
-               JettyServer m = null;
+       JettyServer m = null;
 
        @Before
        public void setUp() throws Exception {
 
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
                Properties p = DmaapConfig.getConfig();
                try {
                        m = new JettyServer(p);
                Properties p = DmaapConfig.getConfig();
                try {
                        m = new JettyServer(p);
@@ -54,26 +49,15 @@ public class JettyServerTest {
                }
        }
 
                }
        }
 
-
        @Test
        public void test1() {
        @Test
        public void test1() {
-
-
-               rh.reflect( "org.onap.dmaap.dbcapi.server.JettyServer", "get", null );  
-       
+               rh.reflect( "org.onap.dmaap.dbcapi.server.JettyServer", "get", null );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.server.JettyServer", "set", v );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.server.JettyServer", "set", v );
-
        }
 
        }
 
-       @Test
-       public void test3() {
-       }
-
-
-
 }
 }
diff --git a/dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/server/MainTest.java b/dmaap-bc/src/test/java/org/onap/dmaap/dbcapi/server/MainTest.java
deleted file mode 100644 (file)
index 0e74f45..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.dmaap.dbcapi.server;
-
-import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class MainTest {
-
-       private static final String  fmt = "%24s: %s%n";
-
-       ReflectionHarness rh = new ReflectionHarness();
-
-       Main m;
-
-
-       @Before
-       public void setUp() throws Exception {
-               //m = new Main();
-       }
-
-       @After
-       public void tearDown() throws Exception {
-       }
-
-
-       @Test
-       public void test1() {
-
-
-               rh.reflect( "org.onap.dmaap.dbcapi.server.Main", "get", null ); 
-       
-       }
-
-       @Test
-       public void test2() {
-               String v = "Validate";
-               rh.reflect( "org.onap.dmaap.dbcapi.server.Main", "set", v );
-
-       }
-
-/*
-       @Test
-       public void test3() {
-               String[] args = { "--help", "--version" };
-
-               try {
-                       m.main( args );
-               } catch (Exception e ) {
-               }
-
-       }
-*/
-
-
-
-}
index 0ca406a..aaac537 100644 (file)
  */
 package org.onap.dmaap.dbcapi.service;
 
  */
 package org.onap.dmaap.dbcapi.service;
 
+import static com.google.common.collect.Lists.newArrayList;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.BDDMockito.given;
+
+import java.util.List;
 import junitparams.JUnitParamsRunner;
 import junitparams.Parameters;
 import org.junit.Before;
 import junitparams.JUnitParamsRunner;
 import junitparams.Parameters;
 import org.junit.Before;
@@ -37,14 +44,6 @@ import org.onap.dmaap.dbcapi.model.Dmaap;
 import org.onap.dmaap.dbcapi.model.Topic;
 import org.onap.dmaap.dbcapi.util.DmaapConfig;
 
 import org.onap.dmaap.dbcapi.model.Topic;
 import org.onap.dmaap.dbcapi.util.DmaapConfig;
 
-import java.util.List;
-
-import static com.google.common.collect.Lists.newArrayList;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.BDDMockito.given;
-
 @RunWith(JUnitParamsRunner.class)
 public class AafTopicSetupServiceTest {
 
 @RunWith(JUnitParamsRunner.class)
 public class AafTopicSetupServiceTest {
 
@@ -65,6 +64,7 @@ public class AafTopicSetupServiceTest {
 
     @Before
     public void setUp() throws Exception {
 
     @Before
     public void setUp() throws Exception {
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
         MockitoAnnotations.initMocks(this);
         Dmaap dmaap = new Dmaap();
         dmaap.setTopicNsRoot(TOPIC_NS_ROOT);
         MockitoAnnotations.initMocks(this);
         Dmaap dmaap = new Dmaap();
         dmaap.setTopicNsRoot(TOPIC_NS_ROOT);
index c860e55..ae1e427 100644 (file)
@@ -27,14 +27,13 @@ import org.junit.Test;
 
 public class ApiServiceTest {
 
 
 public class ApiServiceTest {
 
-       private static final String  fmt = "%24s: %s%n";
-
        ReflectionHarness rh = new ReflectionHarness();
 
        ApiService ds;
 
        @Before
        public void setUp() throws Exception {
        ReflectionHarness rh = new ReflectionHarness();
 
        ApiService ds;
 
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
                ds = new ApiService();
        }
 
                ds = new ApiService();
        }
 
@@ -42,15 +41,6 @@ public class ApiServiceTest {
        public void tearDown() throws Exception {
        }
 
        public void tearDown() throws Exception {
        }
 
-
-       @Test
-       public void test1() {
-
-
-               //rh.reflect( "org.onap.dmaap.dbcapi.service.ApiService", "get", null );
-
-       }
-
        @Test
        public void test2() {
                String v = "Validate";
        @Test
        public void test2() {
                String v = "Validate";
index 307d5b5..512365e 100644 (file)
  */
 package org.onap.dmaap.dbcapi.service;
 
  */
 package org.onap.dmaap.dbcapi.service;
 
-import  org.onap.dmaap.dbcapi.model.*;
-import org.onap.dmaap.dbcapi.testframework.DmaapObjectFactory;
-import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
-
-import static org.junit.Assert.*;
-
+import java.util.List;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import java.util.List;
+import org.onap.dmaap.dbcapi.model.ApiError;
+import org.onap.dmaap.dbcapi.model.DR_Node;
+import org.onap.dmaap.dbcapi.model.DcaeLocation;
+import org.onap.dmaap.dbcapi.testframework.DmaapObjectFactory;
+import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class DR_NodeServiceTest {
 
 
 public class DR_NodeServiceTest {
 
-       private static final String  fmt = "%24s: %s%n";
-
        ReflectionHarness rh = new ReflectionHarness();
        static DmaapObjectFactory factory = new DmaapObjectFactory();
 
        ReflectionHarness rh = new ReflectionHarness();
        static DmaapObjectFactory factory = new DmaapObjectFactory();
 
@@ -41,6 +38,7 @@ public class DR_NodeServiceTest {
 
        @Before
        public void setUp() throws Exception {
 
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
                ns = new DR_NodeService();
        }
 
                ns = new DR_NodeService();
        }
 
@@ -51,17 +49,13 @@ public class DR_NodeServiceTest {
 
        @Test
        public void test1() {
 
        @Test
        public void test1() {
-
-
-               rh.reflect( "org.onap.dmaap.dbcapi.service.DR_NodeService", "get", null );      
-       
+               rh.reflect( "org.onap.dmaap.dbcapi.service.DR_NodeService", "get", null );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.service.DR_NodeService", "set", v );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.service.DR_NodeService", "set", v );
-
        }
 
        @Test
        }
 
        @Test
@@ -88,9 +82,6 @@ public class DR_NodeServiceTest {
                }
 
                n2 = ns.removeDr_Node( f,  err );
                }
 
                n2 = ns.removeDr_Node( f,  err );
-                               
 
        }
 
        }
-
-
 }
 }
index b8b660f..5b96f29 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.onap.dmaap.dbcapi.service;
 
  */
 package org.onap.dmaap.dbcapi.service;
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.model.Dmaap;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.model.Dmaap;
@@ -27,35 +26,20 @@ import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class DmaapServiceTest {
 
 
 public class DmaapServiceTest {
 
-       private static final String  fmt = "%24s: %s%n";
-
        ReflectionHarness rh = new ReflectionHarness();
 
        DmaapService ds;
 
        @Before
        public void setUp() throws Exception {
        ReflectionHarness rh = new ReflectionHarness();
 
        DmaapService ds;
 
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
                ds = new DmaapService();
        }
 
                ds = new DmaapService();
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-
-
-       @Test
-       public void test1() {
-
-
-               //rh.reflect( "org.onap.dmaap.dbcapi.service.DmaapService", "get", null );      
-       
-       }
-
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.service.DmaapService", "set", v );
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.service.DmaapService", "set", v );
-
        }
 
        @Test
        }
 
        @Test
index 2cfe475..90e1024 100644 (file)
  */
 package org.onap.dmaap.dbcapi.service;
 
  */
 package org.onap.dmaap.dbcapi.service;
 
-import  org.onap.dmaap.dbcapi.model.*;
-import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
-
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
 
 
-import org.junit.After;
+import java.util.ArrayList;
+import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.Before;
 import org.junit.Test;
-import java.util.List;
-import java.util.ArrayList;
+import org.onap.dmaap.dbcapi.model.ApiError;
+import org.onap.dmaap.dbcapi.model.DR_Pub;
+import org.onap.dmaap.dbcapi.model.DcaeLocation;
+import org.onap.dmaap.dbcapi.model.Feed;
+import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class Dr_PubServiceTest {
 
 
 public class Dr_PubServiceTest {
 
-       private static final String  fmt = "%24s: %s%n";
-
        ReflectionHarness rh = new ReflectionHarness();
 
        DR_PubService ns;
        ReflectionHarness rh = new ReflectionHarness();
 
        DR_PubService ns;
@@ -41,28 +40,21 @@ public class Dr_PubServiceTest {
 
        @Before
        public void setUp() throws Exception {
 
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
                ns = new DR_PubService();
                fs = new FeedService();
        }
 
                ns = new DR_PubService();
                fs = new FeedService();
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-
 
        @Test
        public void test1() {
 
        @Test
        public void test1() {
-
-
-               rh.reflect( "org.onap.dmaap.dbcapi.service.DR_PubService", "get", null );       
-       
+               rh.reflect( "org.onap.dmaap.dbcapi.service.DR_PubService", "get", null );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.service.DR_PubService", "set", v );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.service.DR_PubService", "set", v );
-
        }
 
        @Test
        }
 
        @Test
@@ -93,16 +85,10 @@ public class Dr_PubServiceTest {
                }
 
                n2 = ns.removeDr_Pub( n2.getPubId(),  err );
                }
 
                n2 = ns.removeDr_Pub( n2.getPubId(),  err );
-                       
-
        }
 
        @Test
        public void test4() {
                ArrayList<DR_Pub> l = ns.getDr_PubsByFeedId( "1" );
        }
 
        @Test
        public void test4() {
                ArrayList<DR_Pub> l = ns.getDr_PubsByFeedId( "1" );
-
-
        }
        }
-
-
 }
 }
index 478647b..9f169ef 100644 (file)
@@ -20,7 +20,6 @@
 package org.onap.dmaap.dbcapi.service;
 
 import java.util.List;
 package org.onap.dmaap.dbcapi.service;
 
 import java.util.List;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.model.ApiError;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.model.ApiError;
@@ -29,35 +28,26 @@ import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class FeedServiceTest {
 
 
 public class FeedServiceTest {
 
-       private static final String  fmt = "%24s: %s%n";
-
        ReflectionHarness rh = new ReflectionHarness();
 
        FeedService ds;
 
        @Before
        public void setUp() throws Exception {
        ReflectionHarness rh = new ReflectionHarness();
 
        FeedService ds;
 
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
                ds = new FeedService();
        }
 
                ds = new FeedService();
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-
 
        @Test
        public void test1() {
 
        @Test
        public void test1() {
-
-
-               rh.reflect( "org.onap.dmaap.dbcapi.service.FeedService", "get", null ); 
-       
+               rh.reflect( "org.onap.dmaap.dbcapi.service.FeedService", "get", null );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.service.FeedService", "set", v );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.service.FeedService", "set", v );
-
        }
 
        @Test
        }
 
        @Test
@@ -86,7 +76,6 @@ public class FeedServiceTest {
        @Test
        public void test5() {
                List<Feed> f = ds.getAllFeeds( "aName", "1.0", "startsWith" );
        @Test
        public void test5() {
                List<Feed> f = ds.getAllFeeds( "aName", "1.0", "startsWith" );
-
        }
 
        
        }
 
        
@@ -97,6 +86,4 @@ public class FeedServiceTest {
                
                assert( 200 == err.getCode());
        }
                
                assert( 200 == err.getCode());
        }
-
-
 }
 }
index e80697a..aa5dd6d 100644 (file)
@@ -22,8 +22,6 @@ package org.onap.dmaap.dbcapi.service;
 import static org.junit.Assert.assertTrue;
 
 import java.util.List;
 import static org.junit.Assert.assertTrue;
 
 import java.util.List;
-
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.model.ApiError;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.dmaap.dbcapi.model.ApiError;
@@ -36,8 +34,6 @@ import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class MR_ClientServiceTest {
 
 
 public class MR_ClientServiceTest {
 
-       private static final String  fmt = "%24s: %s%n";
-       
        private static DmaapObjectFactory factory = new DmaapObjectFactory();
 
        ReflectionHarness rh = new ReflectionHarness();
        private static DmaapObjectFactory factory = new DmaapObjectFactory();
 
        ReflectionHarness rh = new ReflectionHarness();
@@ -52,6 +48,7 @@ public class MR_ClientServiceTest {
 
        @Before
        public void setUp() throws Exception {
 
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
                ts = new TopicService();
                mcs = new MR_ClusterService();
                cls = new MR_ClientService();
                ts = new TopicService();
                mcs = new MR_ClusterService();
                cls = new MR_ClientService();
@@ -68,24 +65,15 @@ public class MR_ClientServiceTest {
                MR_Cluster n2 = mcs.addMr_Cluster( node, err ); 
        }
 
                MR_Cluster n2 = mcs.addMr_Cluster( node, err ); 
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-
-
        @Test
        public void test1() {
        @Test
        public void test1() {
-
-
-               rh.reflect( "org.onap.dmaap.dbcapi.service.MR_ClientService", "get", null );    
-       
+               rh.reflect( "org.onap.dmaap.dbcapi.service.MR_ClientService", "get", null );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.service.MR_ClientService", "set", v );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.service.MR_ClientService", "set", v );
-
        }
 
        @Test
        }
 
        @Test
@@ -129,7 +117,5 @@ public class MR_ClientServiceTest {
                c = cls.addMr_Client( c, topic, err );
                assertTrue( err.getCode() == 200 );
 
                c = cls.addMr_Client( c, topic, err );
                assertTrue( err.getCode() == 200 );
 
-               
        }
        }
-       
 }
 }
index 8ae2667..7a35de3 100644 (file)
  */
 package org.onap.dmaap.dbcapi.service;
 
  */
 package org.onap.dmaap.dbcapi.service;
 
-import  org.onap.dmaap.dbcapi.model.*;
-import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
+import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.Before;
 import org.junit.Test;
-import java.util.List;
+import org.onap.dmaap.dbcapi.model.ApiError;
+import org.onap.dmaap.dbcapi.model.DcaeLocation;
+import org.onap.dmaap.dbcapi.model.MR_Cluster;
+import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class MR_ClusterServiceTest {
 
 
 public class MR_ClusterServiceTest {
 
-       private static final String  fmt = "%24s: %s%n";
-
        ReflectionHarness rh = new ReflectionHarness();
 
        MR_ClusterService ns;
 
        @Before
        public void setUp() throws Exception {
        ReflectionHarness rh = new ReflectionHarness();
 
        MR_ClusterService ns;
 
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
                ns = new MR_ClusterService();
        }
 
                ns = new MR_ClusterService();
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-
-
        @Test
        public void test1() {
        @Test
        public void test1() {
-
-
-               rh.reflect( "org.onap.dmaap.dbcapi.service.MR_ClusterService", "get", null );   
-       
+               rh.reflect( "org.onap.dmaap.dbcapi.service.MR_ClusterService", "get", null );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.service.MR_ClusterService", "set", v );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.service.MR_ClusterService", "set", v );
-
        }
 
        @Test
        }
 
        @Test
@@ -84,44 +72,7 @@ public class MR_ClusterServiceTest {
                if ( n2 != null ) {
                        n2 = ns.updateMr_Cluster( n2, err );
                }
                if ( n2 != null ) {
                        n2 = ns.updateMr_Cluster( n2, err );
                }
-
                n2 = ns.removeMr_Cluster( f,  err );
                n2 = ns.removeMr_Cluster( f,  err );
-                               
-
-       }
-
-/*
-       @Test
-       public void test4() {
-               List<MR_Client> l = cls.getAllMr_Clients();
-
-               ArrayList<MR_Client> al = cls.getAllMrClients( "foo" );
-
-               ArrayList<MR_Client> al2 = cls.getClientsByLocation( "central" );
-       }
-
-       @Test
-       public void test5() {
-               Topic topic = new Topic();
-               ApiError err = new ApiError();
-               topic.setTopicName( "test3" );
-               topic.setFqtnStyle( FqtnType.Validator("none") );
-               topic.getFqtn();
-               Topic nTopic = ts.addTopic( topic, err );
-               if ( nTopic != null ) {
-                       assertTrue( nTopic.getTopicName().equals( topic.getTopicName() ));
-               }
-               String[] actions = { "pub", "view" };
-               MR_Client c = new MR_Client( "central-onap", "org.onap.dmaap.demo.interestingTopic2", "org.onap.clientApp.publisher", actions );
-
-               c = cls.addMr_Client( c, topic, err );
-               if ( c != null ) {
-                               actions[0] = "sub";
-                               c.setAction( actions );
-                               c = cls.updateMr_Client( c, err );
-                               assertTrue( err.getCode() == 200 );
-               }
        }
        }
-*/
 
 }
 
 }
index f247bad..efe6b41 100644 (file)
  */
 package org.onap.dmaap.dbcapi.service;
 
  */
 package org.onap.dmaap.dbcapi.service;
 
-import  org.onap.dmaap.dbcapi.model.*;
-import org.onap.dmaap.dbcapi.testframework.DmaapObjectFactory;
-import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
-
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
 
 
-import org.junit.After;
+import java.util.ArrayList;
+import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.Before;
 import org.junit.Test;
-import java.util.List;
-import java.util.ArrayList;
+import org.onap.dmaap.dbcapi.model.ApiError;
+import org.onap.dmaap.dbcapi.model.DcaeLocation;
+import org.onap.dmaap.dbcapi.model.Dmaap;
+import org.onap.dmaap.dbcapi.model.MR_Client;
+import org.onap.dmaap.dbcapi.model.MR_Cluster;
+import org.onap.dmaap.dbcapi.model.MirrorMaker;
+import org.onap.dmaap.dbcapi.model.ReplicationType;
+import org.onap.dmaap.dbcapi.model.Topic;
+import org.onap.dmaap.dbcapi.testframework.DmaapObjectFactory;
+import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class MirrorMakerServiceTest {
 
 
 public class MirrorMakerServiceTest {
 
-       private static final String  fmt = "%24s: %s%n";
        private static DmaapObjectFactory factory = new DmaapObjectFactory();
        ReflectionHarness rh = new ReflectionHarness();
 
        private static DmaapObjectFactory factory = new DmaapObjectFactory();
        ReflectionHarness rh = new ReflectionHarness();
 
@@ -45,12 +49,12 @@ public class MirrorMakerServiceTest {
        
        private Topic replicationTopic;
 
        
        private Topic replicationTopic;
 
-
        DmaapService ds;
        String locname;
 
        @Before
        public void setUp() throws Exception {
        DmaapService ds;
        String locname;
 
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
                mms = new MirrorMakerService();
                ts = new TopicService();
                assert( ts != null );
                mms = new MirrorMakerService();
                ts = new TopicService();
                assert( ts != null );
@@ -93,36 +97,17 @@ public class MirrorMakerServiceTest {
                clients.add( pub );
 
                replicationTopic.setClients( clients );
                clients.add( pub );
 
                replicationTopic.setClients( clients );
-
        }
 
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-
-
-//     @Test
-//     public void test_getters() {
-//
-//
-//             rh.reflect( "org.onap.dmaap.dbcapi.service.MirrorMakerService", "get", null );  
-//     
-//     }
-
        @Test
        public void test_setters() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.service.MirrorMakerService", "set", v );
        @Test
        public void test_setters() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.service.MirrorMakerService", "set", v );
-
        }
        }
-
-       
        
        @Test
        public void CreateMirrorMakerWithSingleTopic() {
                ApiError err = new ApiError();
        
        @Test
        public void CreateMirrorMakerWithSingleTopic() {
                ApiError err = new ApiError();
-
-
                Topic nTopic = ts.addTopic(replicationTopic, err, true );
 
                assertTrue( err.getCode() == 200 );
                Topic nTopic = ts.addTopic(replicationTopic, err, true );
 
                assertTrue( err.getCode() == 200 );
@@ -178,8 +163,7 @@ public class MirrorMakerServiceTest {
                
                MirrorMaker mm = mms.getMirrorMaker(name);
                
                
                MirrorMaker mm = mms.getMirrorMaker(name);
                
-               MirrorMaker mm2 = mms.splitMM(mm);      
-
+               MirrorMaker mm2 = mms.splitMM(mm);
        }
 
 }
        }
 
 }
index 5beadc6..b0199bc 100644 (file)
 package org.onap.dmaap.dbcapi.service;
 
 import static org.junit.Assert.assertEquals;
 package org.onap.dmaap.dbcapi.service;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-import static org.mockito.Mockito.verifyZeroInteractions;
 
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -72,26 +57,16 @@ public class MirrorMakerServiceTestMockito {
     @Rule
     public ExpectedException thrown = ExpectedException.none();
 
     @Rule
     public ExpectedException thrown = ExpectedException.none();
 
-    @Before
-    public void setUp() throws Exception {
-   
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
     }
 
     @Test
     }
 
     @Test
-    public void init_normalConstructor() throws Exception {
-        //given
-        
-
-        //when
-        
-
-        //then
+    public void init_normalConstructor() {
         assertEquals( MirrorMakerService.getProvUserPwd(), MirrorMakerService.PROV_PWD_DEFAULT);
         assertEquals( MirrorMakerService.getDefaultConsumerPort(), MirrorMakerService.TARGET_REPLICATION_PORT_DEFAULT);
         assertEquals( MirrorMakerService.getDefaultProducerPort(), MirrorMakerService.SOURCE_REPLICATION_PORT_DEFAULT);
     }
 
         assertEquals( MirrorMakerService.getProvUserPwd(), MirrorMakerService.PROV_PWD_DEFAULT);
         assertEquals( MirrorMakerService.getDefaultConsumerPort(), MirrorMakerService.TARGET_REPLICATION_PORT_DEFAULT);
         assertEquals( MirrorMakerService.getDefaultProducerPort(), MirrorMakerService.SOURCE_REPLICATION_PORT_DEFAULT);
     }
 
-  // Todo: learn how to make more tests in Mockito
-
-
 }
 }
index a37ce02..8d57496 100644 (file)
 
 package org.onap.dmaap.dbcapi.service;
 
 
 package org.onap.dmaap.dbcapi.service;
 
-import com.google.common.collect.ImmutableMap;
-import org.hamcrest.BaseMatcher;
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.dmaap.dbcapi.model.ApiError;
-import org.onap.dmaap.dbcapi.model.MR_Client;
-import org.onap.dmaap.dbcapi.model.Topic;
-import org.onap.dmaap.dbcapi.util.DmaapConfig;
-
-import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import static com.google.common.collect.Iterables.getOnlyElement;
 import static com.google.common.collect.Lists.newArrayList;
 import static javax.ws.rs.core.Response.Status.NOT_FOUND;
 import static com.google.common.collect.Iterables.getOnlyElement;
 import static com.google.common.collect.Lists.newArrayList;
 import static javax.ws.rs.core.Response.Status.NOT_FOUND;
@@ -56,6 +36,26 @@ import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.verifyZeroInteractions;
 import static org.onap.dmaap.dbcapi.model.ReplicationType.REPLICATION_GLOBAL_TO_FQDN;
 
 import static org.mockito.Mockito.verifyZeroInteractions;
 import static org.onap.dmaap.dbcapi.model.ReplicationType.REPLICATION_GLOBAL_TO_FQDN;
 
+import com.google.common.collect.ImmutableMap;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.core.Response;
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.dmaap.dbcapi.model.ApiError;
+import org.onap.dmaap.dbcapi.model.MR_Client;
+import org.onap.dmaap.dbcapi.model.Topic;
+import org.onap.dmaap.dbcapi.util.DmaapConfig;
+
 @RunWith(MockitoJUnitRunner.class)
 public class TopicServiceTest {
 
 @RunWith(MockitoJUnitRunner.class)
 public class TopicServiceTest {
 
@@ -75,6 +75,12 @@ public class TopicServiceTest {
     @Mock
     private AafTopicSetupService aafTopicSetupService;
 
     @Mock
     private AafTopicSetupService aafTopicSetupService;
 
+    @BeforeClass
+    public static void setUpClass(){
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
+
+    }
+
     @Before
     public void setUp() throws Exception {
         given(dmaapConfig.getProperty("MR.globalHost", "global.host.not.set")).willReturn(GLOBAL_MR_HOST);
     @Before
     public void setUp() throws Exception {
         given(dmaapConfig.getProperty("MR.globalHost", "global.host.not.set")).willReturn(GLOBAL_MR_HOST);
index 6ef05c0..9b097e7 100644 (file)
  */
 package org.onap.dmaap.dbcapi.util;
 
  */
 package org.onap.dmaap.dbcapi.util;
 
-import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.Before;
 import org.junit.Test;
+import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class DmaapConfigTest {
 
 
 public class DmaapConfigTest {
 
-       private static final String  fmt = "%24s: %s%n";
-
        ReflectionHarness rh = new ReflectionHarness();
 
        ReflectionHarness rh = new ReflectionHarness();
 
-       DmaapConfig g;
-
-
        @Before
        public void setUp() throws Exception {
        @Before
        public void setUp() throws Exception {
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
        }
 
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-
-
        @Test
        public void test1() {
        @Test
        public void test1() {
-
-
-               rh.reflect( "org.onap.dmaap.dbcapi.util.DmaapConfig", "get", "" );      
-       
+               rh.reflect( "org.onap.dmaap.dbcapi.util.DmaapConfig", "get", "" );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.util.DmaapConfig", "set", v );
        }
 
        @Test
        public void test2() {
                String v = "Validate";
                rh.reflect( "org.onap.dmaap.dbcapi.util.DmaapConfig", "set", v );
-
        }
 
        @Test
        public void test3() {
        }
 
        @Test
        public void test3() {
-
-               String f = g.getConfigFileName();
+               DmaapConfig.getConfigFileName();
+               DmaapConfig.getSSLSocketFactory();
        }
        }
-
-
-
 }
 
 }
 
index 770ee65..903d73b 100644 (file)
  */
 package org.onap.dmaap.dbcapi.util;
 
  */
 package org.onap.dmaap.dbcapi.util;
 
-import org.onap.dmaap.dbcapi.model.*;
-import org.onap.dmaap.dbcapi.service.*;
-import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.Before;
 import org.junit.Test;
-import java.util.*;
+import org.onap.dmaap.dbcapi.model.DcaeLocation;
+import org.onap.dmaap.dbcapi.model.MR_Client;
+import org.onap.dmaap.dbcapi.service.DcaeLocationService;
+import org.onap.dmaap.dbcapi.testframework.ReflectionHarness;
 
 public class GraphTest {
 
 
 public class GraphTest {
 
-       private static final String  fmt = "%24s: %s%n";
-
        ReflectionHarness rh = new ReflectionHarness();
 
        Graph g;
 
        ReflectionHarness rh = new ReflectionHarness();
 
        Graph g;
 
-
        @Before
        public void setUp() throws Exception {
        @Before
        public void setUp() throws Exception {
-               HashMap<String, String> hm = new HashMap<String,String>();
+               System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
+               HashMap<String, String> hm = new HashMap<>();
                g = new Graph( hm );
        }
 
                g = new Graph( hm );
        }
 
-       @After
-       public void tearDown() throws Exception {
-       }
-
-
        @Test
        public void test1() {
        @Test
        public void test1() {
-
-
-               rh.reflect( "org.onap.dmaap.dbcapi.util.Graph", "get", "idNotSet@namespaceNotSet:pwdNotSet" );  
-       
-       }
-
-       @Test
-       public void test2() {
-               String v = "Validate";
-               //rh.reflect( "org.onap.dmaap.dbcapi.util.Graph", "set", v );
-
+               rh.reflect( "org.onap.dmaap.dbcapi.util.Graph", "get", "idNotSet@namespaceNotSet:pwdNotSet" );
        }
 
        @Test
        }
 
        @Test
@@ -82,7 +65,6 @@ public class GraphTest {
 
                HashMap<String, String> hm = new HashMap<String, String>();
 
 
                HashMap<String, String> hm = new HashMap<String, String>();
 
-
                String s = g.put( "aKey", "aVal" );
                s = g.get( "aKey" );
 
                String s = g.put( "aKey", "aVal" );
                s = g.get( "aKey" );
 
@@ -93,10 +75,7 @@ public class GraphTest {
                hm = g.getGraph();
 
                Collection<String> k = g.getKeys();
                hm = g.getGraph();
 
                Collection<String> k = g.getKeys();
-
        }
 
        }
 
-
-
 }
 
 }
 
index 8db9d2e..310497f 100644 (file)
@@ -24,7 +24,9 @@ import static org.mockito.Mockito.atMost;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -45,6 +47,10 @@ public class PermissionBuilderTest {
     @Mock
     private HttpServletRequest request;
 
     @Mock
     private HttpServletRequest request;
 
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+        System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
+    }
 
     @Test
     public void updateDmaapInstance_shouldSetBootInstance_whenDmaapIsNotInitialized() {
 
     @Test
     public void updateDmaapInstance_shouldSetBootInstance_whenDmaapIsNotInitialized() {