More code for testing SpringBootApp JMX client
This commit is contained in:
@@ -11,10 +11,13 @@
|
||||
package org.springframework.ide.vscode.commons.boot.app.cli;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
@@ -349,4 +352,27 @@ public class SpringBootApp {
|
||||
public String toString() {
|
||||
return "SpringBootApp [" +vmd.id() + ", "+vmd.displayName()+"]";
|
||||
}
|
||||
|
||||
/**
|
||||
* For testing / investigation purposes. Dumps out as much information as possible
|
||||
* that can be onbtained from the jvm, without accessing JMX.
|
||||
*/
|
||||
public void dumpJvmInfo() throws IOException {
|
||||
System.out.println("--- vm infos ----");
|
||||
System.out.println("id = "+vm.id());
|
||||
System.out.println("displayName = "+vmd.displayName());
|
||||
dump("agentProperties", vm.getAgentProperties());
|
||||
dump("systemProps", vm.getSystemProperties());
|
||||
System.out.println("-----------------");
|
||||
}
|
||||
|
||||
private void dump(String name, Properties props) {
|
||||
System.out.println(name + " = {");
|
||||
for (Entry<Object, Object> prop : props.entrySet()) {
|
||||
System.out.println(" "+prop.getKey()+" = "+prop.getValue());
|
||||
}
|
||||
System.out.println("}");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public class SpringBootAppTest {
|
||||
|
||||
// private static final String appName = "actuator-client-15-test-subject"; // Boot 1.5 test app
|
||||
private static final String appName = "actuator-client-20-test-subject"; //Boot 2.0 test app
|
||||
// private static final String appName = "actuator-client-20-thin-test-subject"; //Boot 2.0 test app with THIN launcher
|
||||
|
||||
private static final Duration TIMEOUT = Duration.ofSeconds(30); // in CI build starting the app takes longer than 10s sometimes.
|
||||
//Output from CI build: Started ActuatorClientTestSubjectApplication in 22.962 seconds (JVM running for 26.028)
|
||||
@@ -77,6 +78,14 @@ public class SpringBootAppTest {
|
||||
Optional<SpringBootApp> myProcess = allApps.values().stream().filter(app -> app.getProcessName().contains(appName)).findAny();
|
||||
assertTrue(myProcess.isPresent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dumpJvmInfo() throws Exception {
|
||||
ACondition.waitFor(TIMEOUT, this::getRequestMappings);
|
||||
testApp.dumpJvmInfo();
|
||||
// SpringBootApp app = getAppContaining("language-server.jar");
|
||||
// app.dumpJvmInfo();
|
||||
}
|
||||
|
||||
@Ignore //Failing... not sure how to fix.
|
||||
@Test public void getAllBootApps() throws Exception {
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user