This is an automated email from the ASF dual-hosted git repository. matthiasblaesing pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push: new b2fcefe Fix tests in ide/versioning and ide/versioning.core modules b2fcefe is described below commit b2fcefeded51def479d65800172500c75643010b Author: Hector Espert <hectorespertpa...@gmail.com> AuthorDate: Sun Aug 18 17:04:49 2019 +0200 Fix tests in ide/versioning and ide/versioning.core modules --- .gitignore | 2 ++ .travis.yml | 28 +++++++++++++++ ide/versioning.core/nbproject/project.xml | 8 +++++ .../test/versioning/VersioningSystemTest.java | 27 ++++++++++----- .../versioning/core/ConnectDisconnectTest.java | 1 - ide/versioning/nbproject/project.xml | 8 +++-- .../test/versioning/VersioningSystemTest.java | 40 ++++++++++++++-------- 7 files changed, 87 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 73fa5b6..2e92916 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,8 @@ /java.source.nbjavac/test/test-nb-javac/nbproject/private/ /harness/apisupport.harness/windows-launcher-src/*.exe /harness/apisupport.harness/windows-launcher-src/*.res +/ide/versioning/test/qa-functional/data/tck.properties +/ide/versioning.core/test/qa-functional/data/tck.properties /nb/ide.launcher/windows/*.exe /nb/ide.launcher/windows/*.res /platform/o.n.bootstrap/launcher/windows/*.dll diff --git a/.travis.yml b/.travis.yml index cbf99a2..351e6fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -180,3 +180,31 @@ matrix: ide/xml.xdm ide/xsl" jdk: openjdk8 + + - name: "Versioning modules (ide/versioning and ide/versioning.core) tests" + jdk: openjdk8 + env: + - OPTS="-quiet -Dcluster.config=minimal -Djavac.compilerargs=-nowarn -Dbuild.compiler.deprecation=false" + - OPTS_TEST="-Dtest-unit-sys-prop.ignore.random.failures=true -Dvanilla.javac.exists=true" + - GIT_TEST_REPO="$HOME/git_test_repo" + script: + # Build sources + - ant $OPTS clean + - ant $OPTS build + # Run unit tests + - ant $OPTS $OPTS_TEST -f ide/versioning.core test-unit + - ant $OPTS $OPTS_TEST -f ide/versioning test-unit + #Prepare git repo for tests + - git init $GIT_TEST_REPO + # Prepare config file for ide/versioning.core module + - touch ide/versioning.core/test/qa-functional/data/tck.properties + - echo "test.root = $GIT_TEST_REPO" > ide/versioning.core/test/qa-functional/data/tck.properties + - echo "test.vcs = org.netbeans.modules.versioning.DelegatingVCS" >> ide/versioning.core/test/qa-functional/data/tck.properties + # Run functional tests for ide/versioning.core module + - ant $OPTS $OPTS_TEST -f ide/versioning.core test-qa-functional + # Prepare config file for ide/versioning module + - touch ide/versioning/test/qa-functional/data/tck.properties + - echo "test.root = $GIT_TEST_REPO" > ide/versioning/test/qa-functional/data/tck.properties + - echo "test.vcs = org.netbeans.modules.git.GitVCS" >> ide/versioning/test/qa-functional/data/tck.properties + # Run functional tests for ide/versioning module + - ant $OPTS $OPTS_TEST -f ide/versioning test-qa-functional diff --git a/ide/versioning.core/nbproject/project.xml b/ide/versioning.core/nbproject/project.xml index e5f8606..d330fc4 100644 --- a/ide/versioning.core/nbproject/project.xml +++ b/ide/versioning.core/nbproject/project.xml @@ -154,6 +154,10 @@ <test-type> <name>qa-functional</name> <test-dependency> + <code-name-base>org.netbeans.libs.junit4</code-name-base> + <compile-dependency/> + </test-dependency> + <test-dependency> <code-name-base>org.netbeans.modules.jellytools.platform</code-name-base> <compile-dependency/> </test-dependency> @@ -224,6 +228,10 @@ <compile-dependency/> </test-dependency> <test-dependency> + <code-name-base>org.netbeans.modules.versioning.util</code-name-base> + <compile-dependency/> + </test-dependency> + <test-dependency> <code-name-base>org.openide.filesystems</code-name-base> <compile-dependency/> </test-dependency> diff --git a/ide/versioning.core/test/qa-functional/src/org/netbeans/test/versioning/VersioningSystemTest.java b/ide/versioning.core/test/qa-functional/src/org/netbeans/test/versioning/VersioningSystemTest.java index 929d298..a86967e 100644 --- a/ide/versioning.core/test/qa-functional/src/org/netbeans/test/versioning/VersioningSystemTest.java +++ b/ide/versioning.core/test/qa-functional/src/org/netbeans/test/versioning/VersioningSystemTest.java @@ -44,7 +44,8 @@ import org.openide.filesystems.FileUtil; */ public class VersioningSystemTest extends JellyTestCase { - private File propertiesFile; + private static final String CONFIG_FILE = "tck.properties"; + private String versioningSystemClassName; private File rootDir; private VersioningSystem testedSystem; @@ -58,20 +59,24 @@ public class VersioningSystemTest extends JellyTestCase { } public static Test suite() { -// NbTestSuite suite = new NbTestSuite(); -// suite.addTest(new VersioningSystemTest("testOwnership")); -// suite.addTest(new VersioningSystemTest("testInterceptor")); -// return suite; - return NbModuleSuite.create(NbModuleSuite.emptyConfiguration() + return NbModuleSuite.emptyConfiguration() .addTest(VersioningSystemTest.class, "testOwnership", "testInterceptor") - .enableModules(".*").clusters(".*")); + .enableModules(".*") + .clusters(".*") + .suite(); + } + + @Override + public boolean canRun() { + return super.canRun() && getConfigFile().exists(); } + @Override protected void setUp() throws Exception { super.setUp(); - propertiesFile = new File(getDataDir(), "tck.properties"); + File propertiesFile = getConfigFile(); Properties props = new Properties(); FileInputStream fis = new FileInputStream(propertiesFile); props.load(fis); @@ -80,7 +85,7 @@ public class VersioningSystemTest extends JellyTestCase { testedSystem = VersioningManager.getInstance().getOwner(VCSFileProxy.createFileProxy(rootDir)); assertNotNull(testedSystem); - assertEquals(testedSystem.getClass().getName(), versioningSystemClassName); + assertEquals(versioningSystemClassName, testedSystem.getClass().getName()); } public void testInterceptor() throws IOException { @@ -123,4 +128,8 @@ public class VersioningSystemTest extends JellyTestCase { testOwnershipRecursively(child); } } + + private File getConfigFile() { + return new File(getDataDir(), CONFIG_FILE); + } } diff --git a/ide/versioning.core/test/unit/src/org/netbeans/modules/versioning/core/ConnectDisconnectTest.java b/ide/versioning.core/test/unit/src/org/netbeans/modules/versioning/core/ConnectDisconnectTest.java index 697c92e..2e83b53 100644 --- a/ide/versioning.core/test/unit/src/org/netbeans/modules/versioning/core/ConnectDisconnectTest.java +++ b/ide/versioning.core/test/unit/src/org/netbeans/modules/versioning/core/ConnectDisconnectTest.java @@ -303,6 +303,5 @@ public class ConnectDisconnectTest extends NbTestCase { ((DelegatingVCS) vs).getDelegate(); } } -// return null; } } diff --git a/ide/versioning/nbproject/project.xml b/ide/versioning/nbproject/project.xml index e615c98..491f587 100644 --- a/ide/versioning/nbproject/project.xml +++ b/ide/versioning/nbproject/project.xml @@ -104,8 +104,7 @@ <test-type> <name>qa-functional</name> <test-dependency> - <code-name-base>org.netbeans.modules.nbjunit</code-name-base> - <recursive/> + <code-name-base>org.netbeans.libs.junit4</code-name-base> <compile-dependency/> </test-dependency> <test-dependency> @@ -116,6 +115,11 @@ <code-name-base>org.netbeans.modules.jemmy</code-name-base> <compile-dependency/> </test-dependency> + <test-dependency> + <code-name-base>org.netbeans.modules.nbjunit</code-name-base> + <recursive/> + <compile-dependency/> + </test-dependency> </test-type> <test-type> <name>unit</name> diff --git a/ide/versioning/test/qa-functional/src/org/netbeans/test/versioning/VersioningSystemTest.java b/ide/versioning/test/qa-functional/src/org/netbeans/test/versioning/VersioningSystemTest.java index 7098bee..8e98f82 100644 --- a/ide/versioning/test/qa-functional/src/org/netbeans/test/versioning/VersioningSystemTest.java +++ b/ide/versioning/test/qa-functional/src/org/netbeans/test/versioning/VersioningSystemTest.java @@ -42,8 +42,11 @@ import org.openide.filesystems.FileUtil; * @author Maros Sandor */ public class VersioningSystemTest extends JellyTestCase { + + private static final Logger LOG = Logger.getLogger(VersioningSystemTest.class.getName()); + + private static final String CONFIG_FILE = "tck.properties"; - private File propertiesFile; private String versioningSystemClassName; private File rootDir; private VersioningSystem testedSystem; @@ -57,29 +60,33 @@ public class VersioningSystemTest extends JellyTestCase { } public static Test suite() { -// NbTestSuite suite = new NbTestSuite(); -// suite.addTest(new VersioningSystemTest("testOwnership")); -// suite.addTest(new VersioningSystemTest("testInterceptor")); -// return suite; - return NbModuleSuite.create(NbModuleSuite.emptyConfiguration() + return NbModuleSuite.emptyConfiguration() .addTest(VersioningSystemTest.class, - "testOwnership", + "testOwnership", "testInterceptor") - .enableModules(".*").clusters(".*")); + .enableModules(".*") + .clusters(".*") + .suite(); } + @Override + public boolean canRun() { + return super.canRun() && getConfigFile().exists(); + } + + @Override protected void setUp() throws Exception { super.setUp(); - propertiesFile = new File(getDataDir(), "tck.properties"); + File propertiesFile = getConfigFile(); Properties props = new Properties(); FileInputStream fis = new FileInputStream(propertiesFile); props.load(fis); versioningSystemClassName = props.getProperty("test.vcs"); rootDir = new File(props.getProperty("test.root")); - testedSystem = VersioningSupport.getOwner(rootDir); + assertNotNull(testedSystem); - assertEquals(testedSystem.getClass().getName(), versioningSystemClassName); + assertEquals(versioningSystemClassName, testedSystem.getClass().getName()); } public void testInterceptor() throws IOException { @@ -97,9 +104,7 @@ public class VersioningSystemTest extends JellyTestCase { } public void testOwnership() throws IOException { - VersioningSystem vs; - - vs = VersioningSupport.getOwner(rootDir.getParentFile()); + VersioningSystem vs = VersioningSupport.getOwner(rootDir.getParentFile()); assertNull(vs); testOwnershipRecursively(rootDir); @@ -109,7 +114,7 @@ public class VersioningSystemTest extends JellyTestCase { try { Thread.sleep(millis); } catch (InterruptedException ex) { - Logger.getLogger(VersioningSystemTest.class.getName()).log(Level.SEVERE, null, ex); + LOG.log(Level.SEVERE, null, ex); } } @@ -122,4 +127,9 @@ public class VersioningSystemTest extends JellyTestCase { testOwnershipRecursively(child); } } + + private File getConfigFile() { + return new File(getDataDir(), CONFIG_FILE); + } + } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists