You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ma...@apache.org on 2019/08/06 09:02:44 UTC

[servicecomb-toolkit] branch master updated: SCB-1412 some redudent folder generated after running test

This is an automated email from the ASF dual-hosted git repository.

mabin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git


The following commit(s) were added to refs/heads/master by this push:
     new f7a1745  SCB-1412 some redudent folder generated after running test
     new 6451878  Merge pull request #11 from MabinGo/typofix
f7a1745 is described below

commit f7a1745dae8ff1082dfdc02b49e8c0cf661a6852
Author: MabinGo <bi...@huawei.com>
AuthorDate: Thu Aug 1 16:06:16 2019 +0800

    SCB-1412 some redudent folder generated after running test
    
    Signed-off-by: MabinGo <bi...@huawei.com>
---
 .../toolkit/contractgen/DefaultContractsGenerator.java         |  2 ++
 scripts/test.sh                                                |  2 +-
 .../apache/servicecomb/toolkit/plugin/GenerateMojoTest.java    |  8 ++++----
 .../apache/servicecomb/toolkit/plugin/GenerateUtilTest.java    | 10 +++++-----
 .../servicecomb/toolkit/plugin/InvokeStaticMethodTest.java     |  2 ++
 5 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/contractgen/src/main/java/org/apache/servicecomb/toolkit/contractgen/DefaultContractsGenerator.java b/contractgen/src/main/java/org/apache/servicecomb/toolkit/contractgen/DefaultContractsGenerator.java
index 82b2970..00fcffe 100755
--- a/contractgen/src/main/java/org/apache/servicecomb/toolkit/contractgen/DefaultContractsGenerator.java
+++ b/contractgen/src/main/java/org/apache/servicecomb/toolkit/contractgen/DefaultContractsGenerator.java
@@ -63,6 +63,7 @@ public class DefaultContractsGenerator implements ContractsGenerator {
     return "default".equals(type);
   }
 
+  @SuppressWarnings("unchecked")
   @Override
   public void configure(Map<String, Object> config) {
     this.config = config;
@@ -87,6 +88,7 @@ public class DefaultContractsGenerator implements ContractsGenerator {
     }
   }
 
+  @SuppressWarnings("ResultOfMethodCallIgnored")
   @Override
   public void generate() throws RuntimeException {
 
diff --git a/scripts/test.sh b/scripts/test.sh
index a3b61cd..43a5b6f 100755
--- a/scripts/test.sh
+++ b/scripts/test.sh
@@ -36,7 +36,7 @@ else
 	fi
 	
 	echo "Running the unit tests and integration tests here!"
-	mvn clean install -Pjacoco coveralls:report
+	mvn clean install -DskipTests && mvn clean install -Pjacoco coveralls:report
 	
 if [ $? == 0 ]; then
 	echo "${green}Installation Success..${reset}"
diff --git a/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateMojoTest.java b/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateMojoTest.java
index d34a336..b3a6fdc 100755
--- a/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateMojoTest.java
+++ b/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateMojoTest.java
@@ -65,7 +65,7 @@ public class GenerateMojoTest {
     testResourcesEx.setVariableValueToObject("project", project);
     given(project.getRuntimeClasspathElements()).willReturn(testResourcesEx.getRuntimeUrlPath(testDirWithoutContract));
     try {
-      outputDirectory = "target";
+      outputDirectory = "target/GenerateMojoTest";
 
       testResourcesEx.setVariableValueToObject("sourceType", "code");
       testResourcesEx.setVariableValueToObject("outputDirectory", outputDirectory);
@@ -83,7 +83,7 @@ public class GenerateMojoTest {
     testResourcesEx.setVariableValueToObject("project", project);
     given(project.getRuntimeClasspathElements()).willReturn(testResourcesEx.getRuntimeUrlPath(testDirWithContract));
     try {
-      outputDirectory = "target";
+      outputDirectory = "target/GenerateMojoTest";
       contractOutput = outputDirectory + File.separator + "contract";
       projectOutput = outputDirectory + File.separator + "project";
       documentOutput = outputDirectory + File.separator + "document";
@@ -126,7 +126,7 @@ public class GenerateMojoTest {
     }
 
     try {
-      outputDirectory = "target";
+      outputDirectory = "target/GenerateMojoTest";
       projectOutput = outputDirectory + File.separator + "project";
       documentOutput = outputDirectory + File.separator + "document";
 
@@ -143,7 +143,7 @@ public class GenerateMojoTest {
       fail("Run 'testGenerateMojo' failed, unexpected to catch RuntimeException: " + e.getMessage());
     }
 
-    outputDirectory = "target";
+    outputDirectory = "target/GenerateMojoTest";
     projectOutput = outputDirectory + File.separator + "project";
     ServiceConfig service = new ServiceConfig();
 
diff --git a/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateUtilTest.java b/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateUtilTest.java
index edebece..39691fb 100755
--- a/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateUtilTest.java
+++ b/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateUtilTest.java
@@ -41,20 +41,20 @@ public class GenerateUtilTest {
   @Rule
   public TestResources resources = new TestResources();
 
-  TestResourcesEx testResourcesEx;
+  private TestResourcesEx testResourcesEx;
 
   @Before
   public void setUp() throws Exception {
     this.testResourcesEx = new TestResourcesEx(resources);
   }
 
+  @SuppressWarnings("unchecked")
   @Test
   public void testGenerateContract() throws DependencyResolutionRequiredException {
 
     MavenProject project = mock(MavenProject.class);
 
-    String contractOutput = "target/contract";
-    //noinspection unchecked
+    String contractOutput = "target/GenerateUtilTest/contract";
     when(project.getRuntimeClasspathElements()).thenThrow(DependencyResolutionRequiredException.class);
     try {
       generateContract(project, contractOutput, "yaml", "default");
@@ -70,7 +70,7 @@ public class GenerateUtilTest {
 
     String contractLocation = this.testResourcesEx.getContractLocation();
 
-    String projectOutput = "./target/project";
+    String projectOutput = "target/GenerateUtilTest/project";
     ServiceConfig service = new ServiceConfig();
     generateCode(service, contractLocation, projectOutput, "default");
     assertNotEquals(0, Objects.requireNonNull(new File(projectOutput).listFiles()).length);
@@ -89,7 +89,7 @@ public class GenerateUtilTest {
 
     String contractLocation = this.testResourcesEx.getContractLocation();
 
-    String codeOutput = "./target/document";
+    String codeOutput = "target/GenerateUtilTest/document";
     generateDocument(contractLocation, codeOutput, "default");
     assertNotEquals(0, Objects.requireNonNull(new File(codeOutput).listFiles()).length);
 
diff --git a/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/InvokeStaticMethodTest.java b/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/InvokeStaticMethodTest.java
index 053e33a..e3592f3 100755
--- a/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/InvokeStaticMethodTest.java
+++ b/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/InvokeStaticMethodTest.java
@@ -147,6 +147,7 @@ public class InvokeStaticMethodTest {
     GenerateUtil.generateCode(anyObject(), anyString(), anyString(), anyString());
 
     testGenerateMojoResources.setVariableValueToObject("sourceType", "contract");
+    testGenerateMojoResources.setVariableValueToObject("outputDirectory", "target/InvokeStaticMethodTest");
     testGenerateMojoResources
         .setVariableValueToObject("contractLocation", testGenerateMojoResources.getContractLocation());
     testGenerateMojoResources.setVariableValueToObject("service", new ServiceConfig());
@@ -181,6 +182,7 @@ public class InvokeStaticMethodTest {
     GenerateUtil.generateDocument(anyString(), anyString(), anyString());
 
     testGenerateMojoResources.setVariableValueToObject("sourceType", "contract");
+    testGenerateMojoResources.setVariableValueToObject("outputDirectory", "target/InvokeStaticMethodTest");
     testGenerateMojoResources
         .setVariableValueToObject("contractLocation", testGenerateMojoResources.getContractLocation());
     testGenerateMojoResources.setVariableValueToObject("service", new ServiceConfig());