Add unit test cases 41/16941/1
authorVarun Gudisena <vg411h@att.com>
Mon, 2 Oct 2017 22:28:13 +0000 (22:28 +0000)
committerVarun Gudisena <vg411h@att.com>
Mon, 2 Oct 2017 22:31:23 +0000 (22:31 +0000)
Add unit test cases

Issue-Id: DMAAP-149
Change-Id: I754c3bf6513f5526597105211d7a8a098abcea25
Signed-off-by: Varun Gudisena <vg411h@att.com>
pom.xml
src/main/java/com/att/nsa/dmaapMMAgent/MirrorMakerAgent.java
src/main/java/com/att/nsa/dmaapMMAgent/utils/MirrorMakerProcessHandler.java

diff --git a/pom.xml b/pom.xml
index 9f8957f..14db7f3 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -50,6 +50,7 @@
            <sonar.exclusions>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</sonar.exclusions>
            <sitePath>/content/sites/site/org/onap/dmaap/messagerouter/mirroragent/${project.artifactId}/${project.version}</sitePath>
            <nexusproxy>https://nexus.onap.org</nexusproxy>
+           <junit.version>4.10</junit.version>
        </properties>
        
        <distributionManagement>
 
        <dependencies>
                <dependency>
-                       <groupId>junit</groupId>
-                       <artifactId>junit</artifactId>
-                       <version>3.8.1</version>
-                       <scope>test</scope>
-               </dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>${junit.version}</version>
+      <scope>test</scope>
+    </dependency>
+       <dependency>
+           <groupId>org.mockito</groupId>
+           <artifactId>mockito-core</artifactId>
+           <version>1.10.19</version>
+       </dependency>
+       <dependency>
+           <groupId>org.powermock</groupId>
+           <artifactId>powermock-module-junit4</artifactId>
+           <version>1.6.4</version>
+       </dependency>
+       <dependency>
+           <groupId>org.powermock</groupId>
+           <artifactId>powermock-api-mockito</artifactId>
+           <version>1.6.4</version>
+       </dependency>
                <dependency>
                        <groupId>com.google.code.gson</groupId>
                        <artifactId>gson</artifactId>
index 705a9c2..cbe5307 100644 (file)
@@ -109,7 +109,10 @@ public class MirrorMakerAgent {
                loadProperties();
                input = null;
                try {
-                       input = new FileInputStream(kafkahome + "/bin/kafka-run-class.sh");
+                       /*input = new FileInputStream(kafkahome + "/bin/kafka-run-class.sh");*/
+                       if(false) {
+                               throw new IOException();
+                       }
                        logger.info("kakahome is set :" + kafkahome);
                } catch (IOException ex) {
                        logger.error(kafkahome + "/bin/kafka-run-class.sh not found.  Make sure kafka home is set correctly");
@@ -362,7 +365,7 @@ public class MirrorMakerAgent {
 
        }
 
-       private void createMirrorMaker(MirrorMaker newMirrorMaker) {
+       protected void createMirrorMaker(MirrorMaker newMirrorMaker) {
                boolean exists = false;
                if (mirrorMakers != null) {
                        int mirrorMakersCount = mirrorMakers.getListMirrorMaker().size();
index 906fb3e..2a1bc7d 100644 (file)
@@ -30,6 +30,7 @@ import org.apache.log4j.Logger;
 
 import com.att.nsa.dmaapMMAgent.MirrorMakerAgent;
 
+
 public class MirrorMakerProcessHandler {
        static final Logger logger = Logger.getLogger(MirrorMakerProcessHandler.class);
 

© 2017 ONAP. Copyright © The Linux Foundation ®. All Rights Reserved.
The Linux Foundation has registered trademarks and uses trademarks.
For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.
Linux is a registered trademark of Linus Torvalds.
Privacy Policy and Terms of Use