-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check if external process is started in java code (#995)
* Add new runtime springboot and add JPA as supported * 1) Add Spring App and War 2) Add label for Springboot * Update the test jar file * use simple test data * Add more spring framework to runtime springboot change spring boot war to spring war * Divided 'Spring Boot Application' into 3 relevant technologies * Fixed 'technology-tag's cases * Changed consistently labels definitions * Changed 'SpringBootApplication' annotation technologies' placement * Rule '3rd-party-spring-03001': removed useless 'or' condition * Added new technologies to README * Update the jni to check if call local command/process directly * Update the jni to check if call local command/process directly * Update the test case * numbering tests to match the associated rule it's testing --------- Co-authored-by: PhilipCattanach <31246010+PhilipCattanach@users.noreply.github.com> Co-authored-by: mrizzi <mrizzi@redhat.com> Co-authored-by: Mark Brophy <36955467+m-brophy@users.noreply.github.com>
- Loading branch information
1 parent
91e8302
commit 2e0ed9b
Showing
3 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
rules/rules-reviewed/cloud-readiness/tests/data/JavaNativeProcess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import java.io.IOException; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class JavaNativeProcess { | ||
|
||
public static void main(String[] args) throws IOException { | ||
Runtime rt = Runtime.getRuntime(); | ||
Process p = rt.exec("notepad.exe"); | ||
ProcessBuilder pb = new ProcessBuilder("javac hello.java"); | ||
ProcessHandle ph = p.toHandle(); | ||
System.out.println("Process is Running: " + ph.isAlive()); | ||
|
||
ProcessHandle.Info info = ph.info(); | ||
|
||
System.out.println("Process Command:" + info.command()); | ||
System.out.println("Process Argument:" + info.arguments()); | ||
CompletableFuture<ProcessHandle> cf = ph.onExit(); | ||
|
||
cf.thenRunAsync(() -> System.out.println("Process Exit")); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters