Skip to content

Commit

Permalink
Fix tests in ide/versioning and ide/versioning.core modules
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorespert authored and matthiasblaesing committed Aug 26, 2019
1 parent 3efc6cf commit b2fcefe
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 27 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 28 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions ide/versioning.core/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@
<test-dependencies>
<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/>
Expand Down Expand Up @@ -223,6 +227,10 @@
<code-name-base>org.netbeans.modules.versioning.masterfs</code-name-base>
<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/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
*/
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;
Expand All @@ -58,20 +59,24 @@ public static void main(String[] args) {
}

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);
Expand All @@ -80,7 +85,7 @@ protected void setUp() throws Exception {

testedSystem = VersioningManager.getInstance().getOwner(VCSFileProxy.createFileProxy(rootDir));
assertNotNull(testedSystem);
assertEquals(testedSystem.getClass().getName(), versioningSystemClassName);
assertEquals(versioningSystemClassName, testedSystem.getClass().getName());
}

public void testInterceptor() throws IOException {
Expand Down Expand Up @@ -123,4 +128,8 @@ private void testOwnershipRecursively(VCSFileProxy dir) {
testOwnershipRecursively(child);
}
}

private File getConfigFile() {
return new File(getDataDir(), CONFIG_FILE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,5 @@ private static void awakeDelegates() {
((DelegatingVCS) vs).getDelegate();
}
}
// return null;
}
}
8 changes: 6 additions & 2 deletions ide/versioning/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@
* @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;
Expand All @@ -57,29 +60,33 @@ public static void main(String[] args) {
}

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 {
Expand All @@ -97,9 +104,7 @@ public void testInterceptor() throws IOException {
}

public void testOwnership() throws IOException {
VersioningSystem vs;

vs = VersioningSupport.getOwner(rootDir.getParentFile());
VersioningSystem vs = VersioningSupport.getOwner(rootDir.getParentFile());
assertNull(vs);

testOwnershipRecursively(rootDir);
Expand All @@ -109,7 +114,7 @@ private void sleep(int millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException ex) {
Logger.getLogger(VersioningSystemTest.class.getName()).log(Level.SEVERE, null, ex);
LOG.log(Level.SEVERE, null, ex);
}
}

Expand All @@ -122,4 +127,9 @@ private void testOwnershipRecursively(File dir) {
testOwnershipRecursively(child);
}
}

private File getConfigFile() {
return new File(getDataDir(), CONFIG_FILE);
}

}

0 comments on commit b2fcefe

Please sign in to comment.