Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Single-file-java-launcher test and add module to CI #7887

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,9 @@ jobs:
- name: java.freeform
run: ant $OPTS -f java/java.freeform test

- name: java.file.launcher
run: ant $OPTS -f java/java.file.launcher test

# - name: java.kit
# run: ant $OPTS -f java/java.kit test

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.io.File;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.util.logging.Logger;
import static junit.framework.TestCase.assertEquals;
import org.netbeans.api.extexecution.base.ExplicitProcessParameters;
import org.netbeans.junit.NbTestCase;
Expand All @@ -36,32 +35,32 @@
*/
public class JavaFileTest extends NbTestCase {

private static final Logger LOG = Logger.getLogger(JavaFileTest.class.getName());

public JavaFileTest(String name) {
super(name);
}

public void testSingleJavaSourceRun() throws Exception {
clearWorkDir();
File f1 = new File(getWorkDir(), "TestSingleJavaFile.java");
FileWriter w = new FileWriter(f1);
w.write("public class TestSingleJavaFile {\n" +
" \n" +
" public static void main (String args[]) {\n" +
" System.out.print(\"hello world\");\n" +
" }\n" +
" \n" +
"}");
w.close();
try (FileWriter w = new FileWriter(f1)) {
w.write(
"""
public class TestSingleJavaFile {
public static void main (String args[]) {
System.out.print("hello world");
}
}
"""
);
}
FileObject javaFO = FileUtil.toFileObject(f1);
assertNotNull("FileObject found: " + f1, javaFO);
SingleJavaSourceRunActionProvider runActionProvider = new SingleJavaSourceRunActionProvider();
LaunchProcess process = runActionProvider.invokeActionHelper(null, "run.single", javaFO, ExplicitProcessParameters.empty());
LaunchProcess process = runActionProvider.invokeActionHelper("run.single", javaFO, ExplicitProcessParameters.empty());
BufferedReader reader
= new BufferedReader(new InputStreamReader(process.call().getInputStream()));
StringBuilder builder = new StringBuilder();
String line = null;
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
}
Expand Down
Loading