Improve code coverage for aaf authz modules 61/17261/1
authorsg481n <sg481n@att.com>
Wed, 4 Oct 2017 17:29:37 +0000 (17:29 +0000)
committersg481n <sg481n@att.com>
Wed, 4 Oct 2017 17:30:42 +0000 (17:30 +0000)
Change-Id: Ie81597c6c94fea2224f1e3e847222bcc872b7c00
Issue-ID: AAF-79
Signed-off-by: sg481n <sg481n@att.com>
authz-batch/pom.xml
authz-cass/pom.xml
authz-certman/pom.xml
authz-client/pom.xml
authz-cmd/pom.xml
authz-cmd/src/test/java/org/onap/aaf/cmd/JU_AAFCli.java
authz-cmd/src/test/java/org/onap/aaf/cmd/JU_BaseCmd.java
authz-cmd/src/test/java/org/onap/aaf/cmd/JU_Help.java
authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Cred.java
authz-core/pom.xml
authz-defOrg/pom.xml

index 64b26ea..db72a35 100644 (file)
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <skipTests>false</skipTests>
                <project.dme2Version>3.1.200</project.dme2Version>
-               <sonar.language>java</sonar.language>
-               <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
-               <sonar.skip>true</sonar.skip>
-               <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>
-               <sonar.jacoco.reportPath>${project.build.directory}/coverage-reports/jacoco.exec</sonar.jacoco.reportPath>
-               <sonar.jacoco.itReportPath>${project.build.directory}/coverage-reports/jacoco-it.exec</sonar.jacoco.itReportPath>
-               <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>
-               <sonar.projectVersion>${project.version}</sonar.projectVersion>
+               
+               <!--  SONAR  -->
+                <jacoco.version>0.7.7.201606060606</jacoco.version>
+                <sonar.skip>true</sonar.skip>
+           <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
+           <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
+           <!-- Default Sonar configuration -->
+           <sonar.jacoco.reportPath>target/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>
+           <sonar.jacoco.itReportPath>target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>
+           <!-- Note: This list should match jacoco-maven-plugin's exclusion list below -->
+           <sonar.exclusions>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</sonar.exclusions>
                <nexusproxy>https://nexus.onap.org</nexusproxy>
                <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
                <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
                                        <stagingProfileId>176c31dfe190a</stagingProfileId>
                                        <serverId>ecomp-staging</serverId>
                                </configuration>
-                       </plugin>               
-                       <plugin>
-                               <groupId>org.jacoco</groupId>
-                               <artifactId>jacoco-maven-plugin</artifactId>
-                               <version>0.7.7.201606060606</version>
-                               <configuration>
-                                       <dumpOnExit>true</dumpOnExit>
-                                       <includes>
-                                               <include>org.onap.aaf.*</include>
-                                       </includes>
-                               </configuration>
-                               <executions>
-                                       <execution>
-                                               <id>pre-unit-test</id>
-                                               <goals>
-                                                       <goal>prepare-agent</goal>
-                                               </goals>
-                                               <configuration>
-                                                       <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>
-                                                       <!-- <append>true</append> -->
-                                               </configuration>
-                                       </execution>
-                                       <execution>
-                                               <id>pre-integration-test</id>
-                                               <phase>pre-integration-test</phase>
-                                               <goals>
-                                                       <goal>prepare-agent</goal>
-                                               </goals>
-                                               <configuration>
-                                                       <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
-                                                       <!-- <append>true</append> -->
-                                               </configuration>
-                                       </execution>
-                                       <execution>
-                        <goals>
-                            <goal>merge</goal>
-                        </goals>
-                        <phase>post-integration-test</phase>
-                        <configuration>
-                            <fileSets>
-                                <fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">
-                                    <directory>${project.build.directory}/coverage-reports</directory>
-                                    <includes>
-                                        <include>*.exec</include>
-                                    </includes>
-                                </fileSet>
-                            </fileSets>
-                            <destFile>${project.build.directory}/jacoco-dev.exec</destFile>
-                        </configuration>
-                    </execution>
-                               </executions>
                        </plugin>
+                       
+                       <plugin>
+          <groupId>org.jacoco</groupId>
+          <artifactId>jacoco-maven-plugin</artifactId>
+          <version>${jacoco.version}</version>
+          <configuration>
+            <excludes>
+              <exclude>**/gen/**</exclude>
+              <exclude>**/generated-sources/**</exclude>
+              <exclude>**/yang-gen/**</exclude>
+              <exclude>**/pax/**</exclude>
+            </excludes>
+          </configuration>
+          <executions>
+
+            <execution>
+              <id>pre-unit-test</id>
+              <goals>
+                <goal>prepare-agent</goal>
+              </goals>
+              <configuration>
+                <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>
+                <propertyName>surefireArgLine</propertyName>
+              </configuration>
+            </execution>
+            
+       
+            <execution>
+              <id>post-unit-test</id>
+              <phase>test</phase>
+              <goals>
+                <goal>report</goal>
+              </goals>
+              <configuration>
+                <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
+                <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
+              </configuration>
+            </execution>
+            <execution>
+              <id>pre-integration-test</id>
+              <phase>pre-integration-test</phase>
+              <goals>
+                <goal>prepare-agent</goal>
+              </goals>
+              <configuration>
+                <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>
+
+                <propertyName>failsafeArgLine</propertyName>
+              </configuration>
+            </execution>
+
+       
+            <execution>
+              <id>post-integration-test</id>
+              <phase>post-integration-test</phase>
+              <goals>
+                <goal>report</goal>
+              </goals>
+              <configuration>
+                <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>
+                <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
+              </configuration>
+            </execution>
+          </executions>
+        </plugin>      
 
                                
                
index b530458..ee9cf1e 100644 (file)
                <properties>\r
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r
                <project.cadiVersion>1.0.0-SNAPSHOT</project.cadiVersion>\r
-               <sonar.language>java</sonar.language>\r
-               <sonar.skip>true</sonar.skip>\r
-               <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>\r
-               <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>\r
-               <sonar.jacoco.reportPath>${project.build.directory}/coverage-reports/jacoco.exec</sonar.jacoco.reportPath>\r
-               <sonar.jacoco.itReportPath>${project.build.directory}/coverage-reports/jacoco-it.exec</sonar.jacoco.itReportPath>\r
-               <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>\r
-               <sonar.projectVersion>${project.version}</sonar.projectVersion>\r
+               \r
+               <!--  SONAR  -->\r
+                <jacoco.version>0.7.7.201606060606</jacoco.version>\r
+                <sonar.skip>true</sonar.skip>\r
+           <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>\r
+           <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>\r
+           <!-- Default Sonar configuration -->\r
+           <sonar.jacoco.reportPath>target/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>\r
+           <sonar.jacoco.itReportPath>target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>\r
+           <!-- Note: This list should match jacoco-maven-plugin's exclusion list below -->\r
+           <sonar.exclusions>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</sonar.exclusions>\r
         <nexusproxy>https://nexus.onap.org</nexusproxy>\r
                <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>\r
                <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>\r
                                </configuration>\r
                        </plugin>               \r
                        <plugin>\r
-                               <groupId>org.jacoco</groupId>\r
-                               <artifactId>jacoco-maven-plugin</artifactId>\r
-                               <version>0.7.7.201606060606</version>\r
-                               <configuration>\r
-                                       <dumpOnExit>true</dumpOnExit>\r
-                                       <includes>\r
-                                               <include>org.onap.aaf.*</include>\r
-                                       </includes>\r
-                               </configuration>\r
-                               <executions>\r
-                                       <execution>\r
-                                               <id>pre-unit-test</id>\r
-                                               <goals>\r
-                                                       <goal>prepare-agent</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>\r
-                                                       <!-- <append>true</append> -->\r
-                                               </configuration>\r
-                                       </execution>\r
-                                       <execution>\r
-                                               <id>pre-integration-test</id>\r
-                                               <phase>pre-integration-test</phase>\r
-                                               <goals>\r
-                                                       <goal>prepare-agent</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>\r
-                                                       <!-- <append>true</append> -->\r
-                                               </configuration>\r
-                                       </execution>\r
-                                       <execution>\r
-                        <goals>\r
-                            <goal>merge</goal>\r
-                        </goals>\r
-                        <phase>post-integration-test</phase>\r
-                        <configuration>\r
-                            <fileSets>\r
-                                <fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">\r
-                                    <directory>${project.build.directory}/coverage-reports</directory>\r
-                                    <includes>\r
-                                        <include>*.exec</include>\r
-                                    </includes>\r
-                                </fileSet>\r
-                            </fileSets>\r
-                            <destFile>${project.build.directory}/jacoco-dev.exec</destFile>\r
-                        </configuration>\r
-                    </execution>\r
-                               </executions>\r
-                       </plugin> \r
+          <groupId>org.jacoco</groupId>\r
+          <artifactId>jacoco-maven-plugin</artifactId>\r
+          <version>${jacoco.version}</version>\r
+          <configuration>\r
+            <excludes>\r
+              <exclude>**/gen/**</exclude>\r
+              <exclude>**/generated-sources/**</exclude>\r
+              <exclude>**/yang-gen/**</exclude>\r
+              <exclude>**/pax/**</exclude>\r
+            </excludes>\r
+          </configuration>\r
+          <executions>\r
+\r
+            <execution>\r
+              <id>pre-unit-test</id>\r
+              <goals>\r
+                <goal>prepare-agent</goal>\r
+              </goals>\r
+              <configuration>\r
+                <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>\r
+                <propertyName>surefireArgLine</propertyName>\r
+              </configuration>\r
+            </execution>\r
+            \r
+       \r
+            <execution>\r
+              <id>post-unit-test</id>\r
+              <phase>test</phase>\r
+              <goals>\r
+                <goal>report</goal>\r
+              </goals>\r
+              <configuration>\r
+                <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>\r
+                <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>\r
+              </configuration>\r
+            </execution>\r
+            <execution>\r
+              <id>pre-integration-test</id>\r
+              <phase>pre-integration-test</phase>\r
+              <goals>\r
+                <goal>prepare-agent</goal>\r
+              </goals>\r
+              <configuration>\r
+                <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>\r
+\r
+                <propertyName>failsafeArgLine</propertyName>\r
+              </configuration>\r
+            </execution>\r
+\r
+       \r
+            <execution>\r
+              <id>post-integration-test</id>\r
+              <phase>post-integration-test</phase>\r
+              <goals>\r
+                <goal>report</goal>\r
+              </goals>\r
+              <configuration>\r
+                <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>\r
+                <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>\r
+              </configuration>\r
+            </execution>\r
+          </executions>\r
+        </plugin>      \r
 \r
                </plugins>\r
        </build>\r
index 625bde9..fa787fb 100644 (file)
                <project.swmVersion>45</project.swmVersion>\r
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r
                <project.cadiVersion>1.0.0-SNAPSHOT</project.cadiVersion>\r
-               <sonar.language>java</sonar.language>\r
-               <sonar.skip>true</sonar.skip>\r
-               <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>\r
-               <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>\r
-               <sonar.jacoco.reportPath>${project.build.directory}/coverage-reports/jacoco.exec</sonar.jacoco.reportPath>\r
-               <sonar.jacoco.itReportPath>${project.build.directory}/coverage-reports/jacoco-it.exec</sonar.jacoco.itReportPath>\r
-               <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>\r
-               <sonar.projectVersion>${project.version}</sonar.projectVersion>\r
+               <!--  SONAR  -->\r
+                <jacoco.version>0.7.7.201606060606</jacoco.version>\r
+                <sonar.skip>true</sonar.skip>\r
+           <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>\r
+           <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>\r
+           <!-- Default Sonar configuration -->\r
+           <sonar.jacoco.reportPath>target/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>\r
+           <sonar.jacoco.itReportPath>target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>\r
+           <!-- Note: This list should match jacoco-maven-plugin's exclusion list below -->\r
+           <sonar.exclusions>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</sonar.exclusions>\r
         <nexusproxy>https://nexus.onap.org</nexusproxy>\r
                <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>\r
                <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>\r
                                </configuration>\r
                        </plugin>               \r
                        <plugin>\r
-                               <groupId>org.jacoco</groupId>\r
-                               <artifactId>jacoco-maven-plugin</artifactId>\r
-                               <version>0.7.7.201606060606</version>\r
-                               <configuration>\r
-                                       <dumpOnExit>true</dumpOnExit>\r
-                                       <includes>\r
-                                               <include>org.onap.aaf.*</include>\r
-                                       </includes>\r
-                               </configuration>\r
-                               <executions>\r
-                                       <execution>\r
-                                               <id>pre-unit-test</id>\r
-                                               <goals>\r
-                                                       <goal>prepare-agent</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>\r
-                                                       <!-- <append>true</append> -->\r
-                                               </configuration>\r
-                                       </execution>\r
-                                       <execution>\r
-                                               <id>pre-integration-test</id>\r
-                                               <phase>pre-integration-test</phase>\r
-                                               <goals>\r
-                                                       <goal>prepare-agent</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>\r
-                                                       <!-- <append>true</append> -->\r
-                                               </configuration>\r
-                                       </execution>\r
-                                       <execution>\r
-                        <goals>\r
-                            <goal>merge</goal>\r
-                        </goals>\r
-                        <phase>post-integration-test</phase>\r
-                        <configuration>\r
-                            <fileSets>\r
-                                <fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">\r
-                                    <directory>${project.build.directory}/coverage-reports</directory>\r
-                                    <includes>\r
-                                        <include>*.exec</include>\r
-                                    </includes>\r
-                                </fileSet>\r
-                            </fileSets>\r
-                            <destFile>${project.build.directory}/jacoco-dev.exec</destFile>\r
-                        </configuration>\r
-                    </execution>\r
-                               </executions>\r
-                       </plugin>\r
+          <groupId>org.jacoco</groupId>\r
+          <artifactId>jacoco-maven-plugin</artifactId>\r
+          <version>${jacoco.version}</version>\r
+          <configuration>\r
+            <excludes>\r
+              <exclude>**/gen/**</exclude>\r
+              <exclude>**/generated-sources/**</exclude>\r
+              <exclude>**/yang-gen/**</exclude>\r
+              <exclude>**/pax/**</exclude>\r
+            </excludes>\r
+          </configuration>\r
+          <executions>\r
+\r
+            <execution>\r
+              <id>pre-unit-test</id>\r
+              <goals>\r
+                <goal>prepare-agent</goal>\r
+              </goals>\r
+              <configuration>\r
+                <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>\r
+                <propertyName>surefireArgLine</propertyName>\r
+              </configuration>\r
+            </execution>\r
+            \r
+       \r
+            <execution>\r
+              <id>post-unit-test</id>\r
+              <phase>test</phase>\r
+              <goals>\r
+                <goal>report</goal>\r
+              </goals>\r
+              <configuration>\r
+                <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>\r
+                <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>\r
+              </configuration>\r
+            </execution>\r
+            <execution>\r
+              <id>pre-integration-test</id>\r
+              <phase>pre-integration-test</phase>\r
+              <goals>\r
+                <goal>prepare-agent</goal>\r
+              </goals>\r
+              <configuration>\r
+                <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>\r
+\r
+                <propertyName>failsafeArgLine</propertyName>\r
+              </configuration>\r
+            </execution>\r
 \r
+       \r
+            <execution>\r
+              <id>post-integration-test</id>\r
+              <phase>post-integration-test</phase>\r
+              <goals>\r
+                <goal>report</goal>\r
+              </goals>\r
+              <configuration>\r
+                <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>\r
+                <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>\r
+              </configuration>\r
+            </execution>\r
+          </executions>\r
+        </plugin>      \r
 \r
                        </plugins>\r
                <pluginManagement>\r
index 902e58d..2ff47be 100644 (file)
                <swm-distFiles-path>/opt/app/aft/${project.artifactId}/${project.version}</swm-distFiles-path>\r
                <maven.test.failure.ignore>true</maven.test.failure.ignore>\r
                <project.cadiVersion>1.0.0-SNAPSHOT</project.cadiVersion>\r
-               <sonar.language>java</sonar.language>\r
-               <sonar.skip>true</sonar.skip>\r
-               <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>\r
-               <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>\r
-               <sonar.jacoco.reportPath>${project.build.directory}/coverage-reports/jacoco.exec</sonar.jacoco.reportPath>\r
-               <sonar.jacoco.itReportPath>${project.build.directory}/coverage-reports/jacoco-it.exec</sonar.jacoco.itReportPath>\r
-               <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>\r
-               <sonar.projectVersion>${project.version}</sonar.projectVersion>\r
+               <!--  SONAR  -->\r
+                <jacoco.version>0.7.7.201606060606</jacoco.version>\r
+                <sonar.skip>true</sonar.skip>\r
+           <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>\r
+           <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>\r
+           <!-- Default Sonar configuration -->\r
+           <sonar.jacoco.reportPath>target/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>\r
+           <sonar.jacoco.itReportPath>target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>\r
+           <!-- Note: This list should match jacoco-maven-plugin's exclusion list below -->\r
+           <sonar.exclusions>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</sonar.exclusions>\r
         <nexusproxy>https://nexus.onap.org</nexusproxy>\r
                <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>\r
                <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>\r
                                </configuration>\r
                        </plugin>               \r
                        <plugin>\r
-                               <groupId>org.jacoco</groupId>\r
-                               <artifactId>jacoco-maven-plugin</artifactId>\r
-                               <version>0.7.7.201606060606</version>\r
-                               <configuration>\r
-                                       <dumpOnExit>true</dumpOnExit>\r
-                                       <includes>\r
-                                               <include>org.onap.aaf.*</include>\r
-                                       </includes>\r
-                               </configuration>\r
-                               <executions>\r
-                                       <execution>\r
-                                               <id>pre-unit-test</id>\r
-                                               <goals>\r
-                                                       <goal>prepare-agent</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>\r
-                                                       <!-- <append>true</append> -->\r
-                                               </configuration>\r
-                                       </execution>\r
-                                       <execution>\r
-                                               <id>pre-integration-test</id>\r
-                                               <phase>pre-integration-test</phase>\r
-                                               <goals>\r
-                                                       <goal>prepare-agent</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>\r
-                                                       <!-- <append>true</append> -->\r
-                                               </configuration>\r
-                                       </execution>\r
-                                       <execution>\r
-                        <goals>\r
-                            <goal>merge</goal>\r
-                        </goals>\r
-                        <phase>post-integration-test</phase>\r
-                        <configuration>\r
-                            <fileSets>\r
-                                <fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">\r
-                                    <directory>${project.build.directory}/coverage-reports</directory>\r
-                                    <includes>\r
-                                        <include>*.exec</include>\r
-                                    </includes>\r
-                                </fileSet>\r
-                            </fileSets>\r
-                            <destFile>${project.build.directory}/jacoco-dev.exec</destFile>\r
-                        </configuration>\r
-                    </execution>\r
-                               </executions>\r
-                       </plugin>    \r
+          <groupId>org.jacoco</groupId>\r
+          <artifactId>jacoco-maven-plugin</artifactId>\r
+          <version>${jacoco.version}</version>\r
+          <configuration>\r
+            <excludes>\r
+              <exclude>**/gen/**</exclude>\r
+              <exclude>**/generated-sources/**</exclude>\r
+              <exclude>**/yang-gen/**</exclude>\r
+              <exclude>**/pax/**</exclude>\r
+            </excludes>\r
+          </configuration>\r
+          <executions>\r
+\r
+            <execution>\r
+              <id>pre-unit-test</id>\r
+              <goals>\r
+                <goal>prepare-agent</goal>\r
+              </goals>\r
+              <configuration>\r
+                <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>\r
+                <propertyName>surefireArgLine</propertyName>\r
+              </configuration>\r
+            </execution>\r
+            \r
+       \r
+            <execution>\r
+              <id>post-unit-test</id>\r
+              <phase>test</phase>\r
+              <goals>\r
+                <goal>report</goal>\r
+              </goals>\r
+              <configuration>\r
+                <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>\r
+                <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>\r
+              </configuration>\r
+            </execution>\r
+            <execution>\r
+              <id>pre-integration-test</id>\r
+              <phase>pre-integration-test</phase>\r
+              <goals>\r
+                <goal>prepare-agent</goal>\r
+              </goals>\r
+              <configuration>\r
+                <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>\r
+\r
+                <propertyName>failsafeArgLine</propertyName>\r
+              </configuration>\r
+            </execution>\r
+\r
+       \r
+            <execution>\r
+              <id>post-integration-test</id>\r
+              <phase>post-integration-test</phase>\r
+              <goals>\r
+                <goal>report</goal>\r
+              </goals>\r
+              <configuration>\r
+                <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>\r
+                <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>\r
+              </configuration>\r
+            </execution>\r
+          </executions>\r
+        </plugin>      \r
 \r
                        </plugins>\r
        </build>\r
index 3696094..f42237d 100644 (file)
     <maven.test.failure.ignore>false</maven.test.failure.ignore>\r
     <project.swmVersion>21</project.swmVersion>\r
        <project.cadiVersion>1.0.0-SNAPSHOT</project.cadiVersion>\r
-               <sonar.language>java</sonar.language>\r
-               <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>\r
-               <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>\r
-               <sonar.jacoco.reportPath>${project.build.directory}/coverage-reports/jacoco.exec</sonar.jacoco.reportPath>\r
-               <sonar.jacoco.itReportPath>${project.build.directory}/coverage-reports/jacoco-it.exec</sonar.jacoco.itReportPath>\r
-               <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>\r
-               <sonar.projectVersion>${project.version}</sonar.projectVersion>\r
+               <!--  SONAR  -->\r
+                <jacoco.version>0.7.7.201606060606</jacoco.version>\r
+           <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>\r
+           <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>\r
+           <!-- Default Sonar configuration -->\r
+           <sonar.jacoco.reportPath>target/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>\r
+           <sonar.jacoco.itReportPath>target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>\r
+           <!-- Note: This list should match jacoco-maven-plugin's exclusion list below -->\r
+           <sonar.exclusions>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</sonar.exclusions>\r
         <nexusproxy>https://nexus.onap.org</nexusproxy>\r
                <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>\r
                <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>\r
                                </configuration>\r
                        </plugin>               \r
                        <plugin>\r
-                               <groupId>org.jacoco</groupId>\r
-                               <artifactId>jacoco-maven-plugin</artifactId>\r
-                               <version>0.7.7.201606060606</version>\r
-                               <configuration>\r
-                                       <dumpOnExit>true</dumpOnExit>\r
-                                       <includes>\r
-                                               <include>org.onap.aaf.*</include>\r
-                                       </includes>\r
-                               </configuration>\r
-                               <executions>\r
-                                       <execution>\r
-                                               <id>pre-unit-test</id>\r
-                                               <goals>\r
-                                                       <goal>prepare-agent</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>\r
-                                                       <!-- <append>true</append> -->\r
-                                               </configuration>\r
-                                       </execution>\r
-                                       <execution>\r
-                                               <id>pre-integration-test</id>\r
-                                               <phase>pre-integration-test</phase>\r
-                                               <goals>\r
-                                                       <goal>prepare-agent</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>\r
-                                                       <!-- <append>true</append> -->\r
-                                               </configuration>\r
-                                       </execution>\r
-                                       <execution>\r
-                        <goals>\r
-                            <goal>merge</goal>\r
-                        </goals>\r
-                        <phase>post-integration-test</phase>\r
-                        <configuration>\r
-                            <fileSets>\r
-                                <fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">\r
-                                    <directory>${project.build.directory}/coverage-reports</directory>\r
-                                    <includes>\r
-                                        <include>*.exec</include>\r
-                                    </includes>\r
-                                </fileSet>\r
-                            </fileSets>\r
-                            <destFile>${project.build.directory}/jacoco-dev.exec</destFile>\r
-                        </configuration>\r
-                    </execution>\r
-                               </executions>\r
-                       </plugin>\r
+          <groupId>org.jacoco</groupId>\r
+          <artifactId>jacoco-maven-plugin</artifactId>\r
+          <version>${jacoco.version}</version>\r
+          <configuration>\r
+            <excludes>\r
+              <exclude>**/gen/**</exclude>\r
+              <exclude>**/generated-sources/**</exclude>\r
+              <exclude>**/yang-gen/**</exclude>\r
+              <exclude>**/pax/**</exclude>\r
+            </excludes>\r
+          </configuration>\r
+          <executions>\r
+\r
+            <execution>\r
+              <id>pre-unit-test</id>\r
+              <goals>\r
+                <goal>prepare-agent</goal>\r
+              </goals>\r
+              <configuration>\r
+                <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>\r
+                <propertyName>surefireArgLine</propertyName>\r
+              </configuration>\r
+            </execution>\r
+            \r
+       \r
+            <execution>\r
+              <id>post-unit-test</id>\r
+              <phase>test</phase>\r
+              <goals>\r
+                <goal>report</goal>\r
+              </goals>\r
+              <configuration>\r
+                <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>\r
+                <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>\r
+              </configuration>\r
+            </execution>\r
+            <execution>\r
+              <id>pre-integration-test</id>\r
+              <phase>pre-integration-test</phase>\r
+              <goals>\r
+                <goal>prepare-agent</goal>\r
+              </goals>\r
+              <configuration>\r
+                <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>\r
+\r
+                <propertyName>failsafeArgLine</propertyName>\r
+              </configuration>\r
+            </execution>\r
+\r
+       \r
+            <execution>\r
+              <id>post-integration-test</id>\r
+              <phase>post-integration-test</phase>\r
+              <goals>\r
+                <goal>report</goal>\r
+              </goals>\r
+              <configuration>\r
+                <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>\r
+                <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>\r
+              </configuration>\r
+            </execution>\r
+          </executions>\r
+        </plugin>      \r
 \r
                \r
                        </plugins>\r
index 6a970ce..f005738 100644 (file)
@@ -22,6 +22,7 @@
  ******************************************************************************/\r
 package org.onap.aaf.cmd;\r
 \r
+import static org.junit.Assert.assertFalse;\r
 import static org.junit.Assert.assertTrue;\r
 import static org.mockito.Mockito.mock;\r
 \r
@@ -36,7 +37,7 @@ import org.junit.runner.RunWith;
 import org.mockito.runners.MockitoJUnitRunner;\r
 import org.onap.aaf.authz.env.AuthzEnv;\r
 import org.onap.aaf.cmd.AAFcli;\r
-\r
+import org.onap.aaf.cadi.CadiException;\r
 import org.onap.aaf.cadi.Locator;\r
 import org.onap.aaf.cadi.LocatorException;\r
 import org.onap.aaf.cadi.client.PropertyLocator;\r
@@ -48,42 +49,144 @@ import org.onap.aaf.inno.env.APIException;
 \r
 @RunWith(MockitoJUnitRunner.class)\r
 public class JU_AAFCli {\r
-       \r
+\r
        private static AAFcli cli;\r
        private static int TIMEOUT = Integer.parseInt(Config.AAF_CONN_TIMEOUT_DEF);\r
-       \r
+\r
        @BeforeClass\r
        public static void setUp() throws Exception, Exception {\r
                cli = getAAfCli();\r
        }\r
-       \r
+\r
        @Test\r
        public void eval() throws Exception {\r
                assertTrue(cli.eval("#startswith"));\r
        }\r
-       \r
+\r
        @Test\r
-       public void eval_empty() throws Exception{\r
+       public void eval_empty() throws Exception {\r
                assertTrue(cli.eval(""));\r
        }\r
+\r
+       @Test\r
+       public void eval1() throws Exception {\r
+               assertTrue(cli.eval("@[123"));\r
+       }\r
+\r
+       @Test\r
+       public void eval2() throws Exception {\r
+               assertFalse(cli.eval("as @[ 123"));\r
+       }\r
+\r
+       @Test\r
+       public void eval3() throws Exception {\r
+               try {\r
+                       cli.eval("expect @[ 123");\r
+               } catch (Exception e) {\r
+                       // TODO Auto-generated catch block\r
+                       assertTrue(e instanceof CadiException);\r
+               }\r
+       }\r
+\r
+       public void eval31() throws Exception {\r
+               try {\r
+                       cli.eval("expect 1 @[ 123");\r
+               } catch (Exception e) {\r
+                       // TODO Auto-generated catch block\r
+                       assertTrue(e instanceof CadiException);\r
+               }\r
+       }\r
+\r
+       @Test\r
+       public void eval4() throws Exception {\r
+               try {\r
+                       cli.eval("sleep @[ 123");\r
+               } catch (Exception e) {\r
+                       assertTrue(e instanceof NumberFormatException);\r
+               }\r
+       }\r
+\r
+       @Test\r
+       public void eval41() throws Exception {\r
+               assertTrue(cli.eval("sleep 1 @[ 123"));\r
+       }\r
+\r
+       @Test\r
+       public void eval5() throws Exception {\r
+               try {\r
+                       cli.eval("delay @[ 123");\r
+               } catch (Exception e) {\r
+                       assertTrue(e instanceof NumberFormatException);\r
+               }\r
+       }\r
+\r
+       @Test\r
+       public void eval51() throws Exception {\r
+               assertTrue(cli.eval("delay 1 @[ 123"));\r
+       }\r
+\r
+       @Test\r
+       public void eval7() throws Exception {\r
+               assertFalse(cli.eval("exit @[ 123"));\r
+       }\r
+\r
+       @Test\r
+       public void eval8() throws Exception {\r
+               assertTrue(cli.eval("REQUEST @[ 123"));\r
+       }\r
+\r
+       @Test\r
+       public void eval9() throws Exception {\r
+               assertTrue(cli.eval("FORCE @[ 123"));\r
+       }\r
+\r
+       @Test\r
+       public void eval10() throws Exception {\r
+               assertTrue(cli.eval("set @[ 123"));\r
+       }\r
+\r
+       @Test\r
+       public void keyboardHelp() throws Exception {\r
+               boolean noError=true;\r
+               try {\r
+                       cli.keyboardHelp();\r
+               } catch (Exception e) {\r
+                       noError=false;\r
+               }\r
+               assertTrue(noError);\r
+       }\r
+       \r
+\r
+       \r
+       @Test\r
+       public void setProp() throws Exception {\r
+               boolean noError=true;\r
+               try {\r
+                       cli.keyboardHelp();\r
+               } catch (Exception e) {\r
+                       noError=false;\r
+               }\r
+               assertTrue(noError);\r
+       }\r
        \r
        @Test\r
        public void eval_randomString() throws Exception {\r
                assertTrue(cli.eval("Some random string @#&*& to check complete 100 coverage"));\r
        }\r
-       \r
+\r
        public static AAFcli getAAfCli() throws APIException, LocatorException, GeneralSecurityException, IOException {\r
                final AuthzEnv env = new AuthzEnv(System.getProperties());\r
                String aafUrl = "https://DME2RESOLVE";\r
                SecurityInfo si = new SecurityInfo(env);\r
                env.loadToSystemPropsStartsWith("AAF", "DME2");\r
                Locator loc;\r
-               loc = new PropertyLocator(aafUrl);                                              \r
+               loc = new PropertyLocator(aafUrl);\r
                TIMEOUT = Integer.parseInt(env.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF));\r
                HMangr hman = new HMangr(env, loc).readTimeout(TIMEOUT).apiVersion("2.0");\r
-               \r
-               //TODO: Consider requiring a default in properties\r
-               env.setProperty(Config.AAF_DEFAULT_REALM, System.getProperty(Config.AAF_DEFAULT_REALM,Config.getDefaultRealm()));\r
+\r
+               // TODO: Consider requiring a default in properties\r
+               env.setProperty(Config.AAF_DEFAULT_REALM,\r
+                               System.getProperty(Config.AAF_DEFAULT_REALM, Config.getDefaultRealm()));\r
                HBasicAuthSS ss = mock(HBasicAuthSS.class);\r
                return new AAFcli(env, new OutputStreamWriter(System.out), hman, si, ss);\r
        }\r
index a1d19dd..77243e9 100644 (file)
@@ -26,33 +26,204 @@ import static org.junit.Assert.assertEquals;
 \r
 import java.io.IOException;\r
 import java.security.GeneralSecurityException;\r
+import java.util.Date;\r
+import java.util.GregorianCalendar;\r
+\r
+import javax.xml.datatype.DatatypeConfigurationException;\r
+import javax.xml.datatype.DatatypeFactory;\r
+import javax.xml.datatype.XMLGregorianCalendar;\r
 \r
 import org.junit.BeforeClass;\r
 import org.junit.Test;\r
 import org.junit.runner.RunWith;\r
 import org.mockito.runners.MockitoJUnitRunner;\r
-import org.onap.aaf.cmd.AAFcli;\r
-import org.onap.aaf.cmd.BaseCmd;\r
-\r
 import org.onap.aaf.cadi.CadiException;\r
 import org.onap.aaf.cadi.LocatorException;\r
+import org.onap.aaf.cadi.client.Future;\r
 import org.onap.aaf.inno.env.APIException;\r
 \r
+import aaf.v2_0.History;\r
+\r
 @RunWith(MockitoJUnitRunner.class)\r
 public class JU_BaseCmd {\r
-       \r
+\r
        private static AAFcli cli;\r
        private static BaseCmd bCmd;\r
-       \r
+\r
        @BeforeClass\r
        public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException {\r
                cli = JU_AAFCli.getAAfCli();\r
                bCmd = new BaseCmd<>(cli, "testString");\r
        }\r
-       \r
+\r
        @Test\r
        public void exec() throws CadiException, APIException, LocatorException {\r
-               assertEquals(bCmd._exec(0, "add","del","reset","extend"), 0);\r
-               \r
+               assertEquals(bCmd._exec(0, "add", "del", "reset", "extend"), 0);\r
+\r
+       }\r
+\r
+       @Test\r
+       public void error() throws CadiException, APIException, LocatorException {\r
+               boolean noError = true;\r
+               Future<String> future = new Future<String>() {\r
+\r
+                       @Override\r
+                       public boolean get(int timeout) throws CadiException {\r
+                               // TODO Auto-generated method stub\r
+                               return false;\r
+                       }\r
+\r
+                       @Override\r
+                       public int code() {\r
+                               // TODO Auto-generated method stub\r
+                               return 0;\r
+                       }\r
+\r
+                       @Override\r
+                       public String body() {\r
+                               // TODO Auto-generated method stub\r
+                               return "{%}";\r
+                       }\r
+\r
+                       @Override\r
+                       public String header(String tag) {\r
+                               // TODO Auto-generated method stub\r
+                               return null;\r
+                       }\r
+               };\r
+               try {\r
+                       bCmd.error(future);\r
+               } catch (Exception e) {\r
+                       noError = false;\r
+               }\r
+               assertEquals(noError, true);\r
+\r
+       }\r
+\r
+\r
+\r
+       @Test\r
+       public void activity() throws DatatypeConfigurationException {\r
+               boolean noError = true;\r
+               History history = new History();\r
+               History.Item item = new History.Item();\r
+               item.setTarget("target");\r
+               item.setUser("user");\r
+               item.setMemo("memo");\r
+\r
+               GregorianCalendar c = new GregorianCalendar();\r
+               c.setTime(new Date());\r
+               XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);\r
+               item.setTimestamp(date);\r
+               history.getItem().add(item);\r
+               try {\r
+                       bCmd.activity(history, "history");\r
+               } catch (Exception e) {\r
+                       noError = false;\r
+               }\r
+               assertEquals(noError, true);\r
+\r
        }\r
+\r
+       @Test\r
+       public void activity1() throws DatatypeConfigurationException {\r
+               boolean noError = true;\r
+               History history = new History();\r
+               History.Item item = new History.Item();\r
+               item.setTarget("target");\r
+               item.setUser("user");\r
+               item.setMemo("memo");\r
+\r
+               GregorianCalendar c = new GregorianCalendar();\r
+               c.setTime(new Date());\r
+               XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);\r
+               item.setTimestamp(date);\r
+               history.getItem().add(item);\r
+               try {\r
+                       bCmd.activity(history, "1[]");\r
+               } catch (Exception e) {\r
+                       noError = false;\r
+               }\r
+               assertEquals(noError, true);\r
+\r
+       }\r
+       \r
+\r
+\r
+       @Test\r
+       public void error1() {\r
+               boolean noError = true;\r
+               Future<String> future = new Future<String>() {\r
+\r
+                       @Override\r
+                       public boolean get(int timeout) throws CadiException {\r
+                               // TODO Auto-generated method stub\r
+                               return false;\r
+                       }\r
+\r
+                       @Override\r
+                       public int code() {\r
+                               // TODO Auto-generated method stub\r
+                               return 0;\r
+                       }\r
+\r
+                       @Override\r
+                       public String body() {\r
+                               // TODO Auto-generated method stub\r
+                               return "{<html><code>1</code></html>";\r
+                       }\r
+\r
+                       @Override\r
+                       public String header(String tag) {\r
+                               // TODO Auto-generated method stub\r
+                               return null;\r
+                       }\r
+               };\r
+               try {\r
+                       bCmd.error(future);\r
+               } catch (Exception e) {\r
+                       noError = false;\r
+               }\r
+               assertEquals(noError, true);\r
+\r
+       }\r
+\r
+       @Test\r
+       public void error2() {\r
+               boolean noError = true;\r
+               Future<String> future = new Future<String>() {\r
+\r
+                       @Override\r
+                       public boolean get(int timeout) throws CadiException {\r
+                               // TODO Auto-generated method stub\r
+                               return false;\r
+                       }\r
+\r
+                       @Override\r
+                       public int code() {\r
+                               // TODO Auto-generated method stub\r
+                               return 0;\r
+                       }\r
+\r
+                       @Override\r
+                       public String body() {\r
+                               // TODO Auto-generated method stub\r
+                               return "other";\r
+                       }\r
+\r
+                       @Override\r
+                       public String header(String tag) {\r
+                               // TODO Auto-generated method stub\r
+                               return null;\r
+                       }\r
+               };\r
+               try {\r
+                       bCmd.error(future);\r
+               } catch (Exception e) {\r
+                       noError = false;\r
+               }\r
+               assertEquals(noError, true);\r
+\r
+       }\r
+\r
 }\r
index c51246b..f48d71e 100644 (file)
@@ -62,10 +62,31 @@ public class JU_Help {
        @Test\r
        public void exec_HTTP_200() {\r
                try {\r
-                       assertEquals(help._exec(0, "helps"), HttpStatus.OK_200);\r
+                       assertEquals(help._exec(1, "helps"), HttpStatus.OK_200);\r
                } catch (CadiException | APIException | LocatorException e) {\r
                        // TODO Auto-generated catch block\r
                        e.printStackTrace();\r
                }\r
        }\r
+       \r
+       @Test\r
+       public void exec_HTTP_200_1() {\r
+               try {\r
+                       assertEquals(help._exec(1, "helps","help"), HttpStatus.OK_200);\r
+               } catch (CadiException | APIException | LocatorException e) {\r
+                       // TODO Auto-generated catch block\r
+                       e.printStackTrace();\r
+               }\r
+       }\r
+       \r
+       @Test\r
+       public void detailhelp() {\r
+               boolean hasError=false;\r
+               try {\r
+                       help.detailedHelp(2, new StringBuilder("detail help test"));\r
+               } catch (Exception e) {\r
+                       hasError=true;\r
+               }\r
+               assertEquals(hasError,false);\r
+       }\r
 }\r
index 77c05a9..aa97593 100644 (file)
@@ -27,13 +27,19 @@ import static org.junit.Assert.assertNotNull;
 import static org.mockito.Mockito.mock;\r
 import static org.mockito.Mockito.when;\r
 \r
+import java.io.FileNotFoundException;\r
+import java.io.PrintWriter;\r
+\r
 import org.junit.BeforeClass;\r
 import org.junit.Test;\r
 import org.junit.runner.RunWith;\r
+import org.mockito.Mockito;\r
 import org.mockito.runners.MockitoJUnitRunner;\r
+import org.onap.aaf.cmd.AAFcli;\r
+import org.onap.aaf.cmd.Cmd;\r
 import org.onap.aaf.cmd.user.Cred;\r
 import org.onap.aaf.cmd.user.User;\r
-\r
+import org.onap.aaf.authz.env.AuthzEnv;\r
 import org.onap.aaf.cadi.CadiException;\r
 import org.onap.aaf.cadi.LocatorException;\r
 import org.onap.aaf.inno.env.APIException;\r
@@ -43,29 +49,32 @@ public class JU_Cred {
 \r
        private static Cred testCred;\r
        private static User testUser;\r
+       private static AuthzEnv env;\r
 \r
 \r
        @BeforeClass\r
-       public static void setUp() {\r
+       public static void setUp() throws FileNotFoundException, APIException {\r
+               \r
                testCred = mock(Cred.class);\r
                testUser = mock(User.class);\r
-               try {\r
-                       when(testCred._exec(4, "String1","String2","String3","String4")).thenReturn(10);\r
-               } catch (CadiException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               } catch (APIException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               } catch (LocatorException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
+               env = mock(AuthzEnv.class);\r
+               Mockito.when(env.getProperty(Cmd.STARTDATE,null)).thenReturn(null);\r
+               Mockito.when(env.getProperty(Cmd.ENDDATE,null)).thenReturn(null);\r
+               \r
        }\r
 \r
        @Test\r
-       public void exec() throws CadiException, APIException, LocatorException {\r
-               assertEquals(testCred._exec(4, "String1","String2","String3","String4"), 10);\r
+       public void exec() throws CadiException, APIException, LocatorException, FileNotFoundException {\r
+               boolean isNullpointer=false;\r
+               AAFcli aaFcli=  new AAFcli(env, new PrintWriter("temp"), null, null, null);\r
+       User user= new User(aaFcli);\r
+        Cred testCred= new Cred(user);\r
+       try {\r
+               testCred._exec(0, "add", "del", "reset", "extend");\r
+       } catch (Exception e) {\r
+               isNullpointer=true;\r
+       } \r
+       assertEquals(isNullpointer, true);\r
        }\r
 \r
 \r
index ef361b4..b779e3e 100644 (file)
 <properties>\r
        <project.cadiVersion>1.0.0-SNAPSHOT</project.cadiVersion>\r
        <project.innoVersion>1.0.0-SNAPSHOT</project.innoVersion>\r
-       <sonar.language>java</sonar.language>\r
-               <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>\r
-               <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>\r
-               <sonar.jacoco.reportPath>${project.build.directory}/coverage-reports/jacoco.exec</sonar.jacoco.reportPath>\r
-               <sonar.jacoco.itReportPath>${project.build.directory}/coverage-reports/jacoco-it.exec</sonar.jacoco.itReportPath>\r
-               <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>\r
-               <sonar.projectVersion>${project.version}</sonar.projectVersion>\r
+       <!--  SONAR  -->\r
+                <jacoco.version>0.7.7.201606060606</jacoco.version>\r
+                <sonar.skip>true</sonar.skip>\r
+           <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>\r
+           <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>\r
+           <!-- Default Sonar configuration -->\r
+           <sonar.jacoco.reportPath>target/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>\r
+           <sonar.jacoco.itReportPath>target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>\r
+           <!-- Note: This list should match jacoco-maven-plugin's exclusion list below -->\r
+           <sonar.exclusions>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</sonar.exclusions>\r
         <nexusproxy>https://nexus.onap.org</nexusproxy>\r
                <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>\r
                <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>\r
                                </configuration>\r
                        </plugin>               \r
                        <plugin>\r
-                               <groupId>org.jacoco</groupId>\r
-                               <artifactId>jacoco-maven-plugin</artifactId>\r
-                               <version>0.7.7.201606060606</version>\r
-                               <configuration>\r
-                                       <dumpOnExit>true</dumpOnExit>\r
-                                       <includes>\r
-                                               <include>org.onap.aaf.*</include>\r
-                                       </includes>\r
-                               </configuration>\r
-                               <executions>\r
-                                       <execution>\r
-                                               <id>pre-unit-test</id>\r
-                                               <goals>\r
-                                                       <goal>prepare-agent</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>\r
-                                                       <!-- <append>true</append> -->\r
-                                               </configuration>\r
-                                       </execution>\r
-                                       <execution>\r
-                                               <id>pre-integration-test</id>\r
-                                               <phase>pre-integration-test</phase>\r
-                                               <goals>\r
-                                                       <goal>prepare-agent</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>\r
-                                                       <!-- <append>true</append> -->\r
-                                               </configuration>\r
-                                       </execution>\r
-                                       <execution>\r
-                        <goals>\r
-                            <goal>merge</goal>\r
-                        </goals>\r
-                        <phase>post-integration-test</phase>\r
-                        <configuration>\r
-                            <fileSets>\r
-                                <fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">\r
-                                    <directory>${project.build.directory}/coverage-reports</directory>\r
-                                    <includes>\r
-                                        <include>*.exec</include>\r
-                                    </includes>\r
-                                </fileSet>\r
-                            </fileSets>\r
-                            <destFile>${project.build.directory}/jacoco-dev.exec</destFile>\r
-                        </configuration>\r
-                    </execution>\r
-                               </executions>\r
-                       </plugin>\r
+          <groupId>org.jacoco</groupId>\r
+          <artifactId>jacoco-maven-plugin</artifactId>\r
+          <version>${jacoco.version}</version>\r
+          <configuration>\r
+            <excludes>\r
+              <exclude>**/gen/**</exclude>\r
+              <exclude>**/generated-sources/**</exclude>\r
+              <exclude>**/yang-gen/**</exclude>\r
+              <exclude>**/pax/**</exclude>\r
+            </excludes>\r
+          </configuration>\r
+          <executions>\r
+\r
+            <execution>\r
+              <id>pre-unit-test</id>\r
+              <goals>\r
+                <goal>prepare-agent</goal>\r
+              </goals>\r
+              <configuration>\r
+                <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>\r
+                <propertyName>surefireArgLine</propertyName>\r
+              </configuration>\r
+            </execution>\r
+            \r
+       \r
+            <execution>\r
+              <id>post-unit-test</id>\r
+              <phase>test</phase>\r
+              <goals>\r
+                <goal>report</goal>\r
+              </goals>\r
+              <configuration>\r
+                <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>\r
+                <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>\r
+              </configuration>\r
+            </execution>\r
+            <execution>\r
+              <id>pre-integration-test</id>\r
+              <phase>pre-integration-test</phase>\r
+              <goals>\r
+                <goal>prepare-agent</goal>\r
+              </goals>\r
+              <configuration>\r
+                <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>\r
+\r
+                <propertyName>failsafeArgLine</propertyName>\r
+              </configuration>\r
+            </execution>\r
+\r
+       \r
+            <execution>\r
+              <id>post-integration-test</id>\r
+              <phase>post-integration-test</phase>\r
+              <goals>\r
+                <goal>report</goal>\r
+              </goals>\r
+              <configuration>\r
+                <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>\r
+                <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>\r
+              </configuration>\r
+            </execution>\r
+          </executions>\r
+        </plugin>      \r
                \r
                        </plugins>\r
                </pluginManagement>\r
index e34484d..f6dd79f 100644 (file)
     <project.swmVersion>0</project.swmVersion>\r
        <project.cadiVersion>1.0.0-SNAPSHOT</project.cadiVersion>\r
        <project.innoVersion>1.0.0-SNAPSHOT</project.innoVersion>\r
-       <sonar.language>java</sonar.language>\r
-       <sonar.skip>true</sonar.skip>\r
-               <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>\r
-               <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>\r
-               <sonar.jacoco.reportPath>${project.build.directory}/coverage-reports/jacoco.exec</sonar.jacoco.reportPath>\r
-               <sonar.jacoco.itReportPath>${project.build.directory}/coverage-reports/jacoco-it.exec</sonar.jacoco.itReportPath>\r
-               <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>\r
-               <sonar.projectVersion>${project.version}</sonar.projectVersion>\r
+       <!--  SONAR  -->\r
+                <jacoco.version>0.7.7.201606060606</jacoco.version>\r
+                <sonar.skip>true</sonar.skip>\r
+           <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>\r
+           <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>\r
+           <!-- Default Sonar configuration -->\r
+           <sonar.jacoco.reportPath>target/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>\r
+           <sonar.jacoco.itReportPath>target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>\r
+           <!-- Note: This list should match jacoco-maven-plugin's exclusion list below -->\r
+           <sonar.exclusions>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</sonar.exclusions>\r
         <nexusproxy>https://nexus.onap.org</nexusproxy>\r
                <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>\r
                <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>\r
                                </configuration>\r
                        </plugin>               \r
                        <plugin>\r
-                               <groupId>org.jacoco</groupId>\r
-                               <artifactId>jacoco-maven-plugin</artifactId>\r
-                               <version>0.7.7.201606060606</version>\r
-                               <configuration>\r
-                                       <dumpOnExit>true</dumpOnExit>\r
-                                       <includes>\r
-                                               <include>org.onap.aaf.*</include>\r
-                                       </includes>\r
-                               </configuration>\r
-                               <executions>\r
-                                       <execution>\r
-                                               <id>pre-unit-test</id>\r
-                                               <goals>\r
-                                                       <goal>prepare-agent</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>\r
-                                                       <!-- <append>true</append> -->\r
-                                               </configuration>\r
-                                       </execution>\r
-                                       <execution>\r
-                                               <id>pre-integration-test</id>\r
-                                               <phase>pre-integration-test</phase>\r
-                                               <goals>\r
-                                                       <goal>prepare-agent</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>\r
-                                                       <!-- <append>true</append> -->\r
-                                               </configuration>\r
-                                       </execution>\r
-                                       <execution>\r
-                        <goals>\r
-                            <goal>merge</goal>\r
-                        </goals>\r
-                        <phase>post-integration-test</phase>\r
-                        <configuration>\r
-                            <fileSets>\r
-                                <fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">\r
-                                    <directory>${project.build.directory}/coverage-reports</directory>\r
-                                    <includes>\r
-                                        <include>*.exec</include>\r
-                                    </includes>\r
-                                </fileSet>\r
-                            </fileSets>\r
-                            <destFile>${project.build.directory}/jacoco-dev.exec</destFile>\r
-                        </configuration>\r
-                    </execution>\r
-                               </executions>\r
-                       </plugin>\r
+          <groupId>org.jacoco</groupId>\r
+          <artifactId>jacoco-maven-plugin</artifactId>\r
+          <version>${jacoco.version}</version>\r
+          <configuration>\r
+            <excludes>\r
+              <exclude>**/gen/**</exclude>\r
+              <exclude>**/generated-sources/**</exclude>\r
+              <exclude>**/yang-gen/**</exclude>\r
+              <exclude>**/pax/**</exclude>\r
+            </excludes>\r
+          </configuration>\r
+          <executions>\r
+\r
+            <execution>\r
+              <id>pre-unit-test</id>\r
+              <goals>\r
+                <goal>prepare-agent</goal>\r
+              </goals>\r
+              <configuration>\r
+                <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>\r
+                <propertyName>surefireArgLine</propertyName>\r
+              </configuration>\r
+            </execution>\r
+            \r
+       \r
+            <execution>\r
+              <id>post-unit-test</id>\r
+              <phase>test</phase>\r
+              <goals>\r
+                <goal>report</goal>\r
+              </goals>\r
+              <configuration>\r
+                <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>\r
+                <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>\r
+              </configuration>\r
+            </execution>\r
+            <execution>\r
+              <id>pre-integration-test</id>\r
+              <phase>pre-integration-test</phase>\r
+              <goals>\r
+                <goal>prepare-agent</goal>\r
+              </goals>\r
+              <configuration>\r
+                <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>\r
+\r
+                <propertyName>failsafeArgLine</propertyName>\r
+              </configuration>\r
+            </execution>\r
+\r
+       \r
+            <execution>\r
+              <id>post-integration-test</id>\r
+              <phase>post-integration-test</phase>\r
+              <goals>\r
+                <goal>report</goal>\r
+              </goals>\r
+              <configuration>\r
+                <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>\r
+                <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>\r
+              </configuration>\r
+            </execution>\r
+          </executions>\r
+        </plugin>      \r
 \r
                </plugins>\r
                </pluginManagement>\r