Skip to content

Commit

Permalink
Test updates for Graaljs 24.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sdedic committed Apr 15, 2024
1 parent 4b3d589 commit fc77e2a
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 24 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,7 @@ jobs:
- name: Commit Validation tests
run: .github/retry.sh ant $OPTS -Dcluster.config=$CLUSTER_CONFIG commit-validation

- name: Set up JDK 11 for core.network
uses: actions/setup-java@v4
if: matrix.java == 17 && success()
with:
java-version: 11
distribution: ${{ env.default_java_distribution }}

# TODO fails on 17+
- name: platform/core.network
if: matrix.java == 17 && success()
run: ant $OPTS -f platform/core.network test

- name: Create Test Summary
Expand Down Expand Up @@ -2632,9 +2623,9 @@ jobs:

- name: Setup GraalVM {{ matrix.graal }}
run: |
URL=https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${{ matrix.graal }}/graalvm-ce-java11-linux-amd64-${{ matrix.graal }}.tar.gz
URL=https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${{ matrix.graal }}/graalvm-ce-java17-linux-amd64-${{ matrix.graal }}.tar.gz
curl -L $URL | tar -xz
GRAALVM=`pwd`/graalvm-ce-java11-${{ matrix.graal }}
GRAALVM=`pwd`/graalvm-ce-java17-${{ matrix.graal }}
echo "JAVA_HOME=$GRAALVM" >> $GITHUB_ENV
- name: Setup GraalVM Languages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void testLoadAllGraalJsLibraries() throws Exception {
find.setAccessible(true);
final ClassPath cp = (ClassPath) find.invoke(null);
final FileObject[] roots = cp.getRoots();
assertEquals("Seven roots", 7, roots.length);
assertEquals("Fifteen roots", 15, roots.length);
for (FileObject fo : roots) {
assertTrue("valid: " + fo, fo.isValid());
assertTrue("folder: " + fo, fo.isFolder());
Expand Down
12 changes: 8 additions & 4 deletions platform/core.network/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@
<test-dependency>
<code-name-base>org.netbeans.core.startup</code-name-base>
<compile-dependency/>
<test/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.libs.graaljs</code-name-base>
<recursive/>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.libs.junit4</code-name-base>
Expand Down Expand Up @@ -179,12 +183,12 @@
<test/>
</test-dependency>
<test-dependency>
<code-name-base>org.openide.util.ui</code-name-base>
<compile-dependency/>
<code-name-base>org.openide.util.lookup</code-name-base>
<test/>
</test-dependency>
<test-dependency>
<code-name-base>org.openide.util.lookup</code-name-base>
<code-name-base>org.openide.util.ui</code-name-base>
<compile-dependency/>
<test/>
</test-dependency>
</test-type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Pattern;
import org.netbeans.junit.NbModuleSuite;
import org.netbeans.junit.NbTestCase;

public class ProxyAutoConfigDirectTest extends NbTestCase {
Expand All @@ -34,6 +35,15 @@ public class ProxyAutoConfigDirectTest extends NbTestCase {
public ProxyAutoConfigDirectTest(String name) {
super(name);
}

public static final junit.framework.Test suite() {
NbModuleSuite.Configuration cfg = NbModuleSuite.emptyConfiguration().
honorAutoloadEager(true).
enableClasspathModules(false).
gui(false);

return cfg.clusters("platform|webcommon|ide").addTest(ProxyAutoConfigDirectTest.class).suite();
}

public void testGetProxyAutoConfigWithLocalPAC() throws URISyntaxException {
List<String> pacFileLocations = new LinkedList<String>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.netbeans.core.network.proxy.pac.impl.NbPacScriptEvaluatorFactory;
import org.netbeans.junit.NbModuleSuite;
import org.netbeans.junit.NbTestCase;

/**
Expand Down Expand Up @@ -56,6 +57,14 @@ public void tearDown() {
}


public static final junit.framework.Test suite() {
NbModuleSuite.Configuration cfg = NbModuleSuite.emptyConfiguration().
honorAutoloadEager(true).
enableClasspathModules(false).
gui(false);

return cfg.clusters("platform|webcommon|ide").addTest(PacEngineTest.class).suite();
}


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,25 @@

import javax.script.ScriptEngine;
import org.junit.Assert;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import org.netbeans.junit.NbModuleSuite;
import org.netbeans.junit.NbTestCase;

public class NbPacScriptEvaluatorTest {
public class NbPacScriptEvaluatorTest extends NbTestCase {

@Test
public void findsAnEngineByDefault() {
public NbPacScriptEvaluatorTest(String name) {
super(name);
}

public static final junit.framework.Test suite() {
NbModuleSuite.Configuration cfg = NbModuleSuite.emptyConfiguration().
honorAutoloadEager(true).
enableClasspathModules(false).
gui(false);

return cfg.clusters("platform|webcommon|ide").addTest(NbPacScriptEvaluatorTest.class).suite();
}

public void testFindsAnEngineByDefault() {
StringBuilder err = new StringBuilder();
ScriptEngine eng = findDefaultEngineInTheSystem(err);
assertNotNull(err.toString(), eng);
Expand All @@ -37,8 +48,7 @@ public static ScriptEngine findDefaultEngineInTheSystem(StringBuilder err) {
return NbPacScriptEvaluator.newAllowedPacEngine(null, err);
}

@Test
public void reportsAnErrorForNonExistingEngine() {
public void testReportsAnErrorForNonExistingEngine() {
StringBuilder err = new StringBuilder();
ScriptEngine eng = NbPacScriptEvaluator.newAllowedPacEngine("NonExisting", err);
assertNull("No engine should be found: " + err.toString(), eng);
Expand Down

0 comments on commit fc77e2a

Please sign in to comment.