Java Code Examples for jdk.jfr.Configuration#getSettings()

The following examples show how to use jdk.jfr.Configuration#getSettings() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestCreateConfigFromPath.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void testOkConfig() throws Exception {
    Path settingsPath = DIR.resolve("settings.jfc");
    if(!settingsPath.toFile().exists()) throw new RuntimeException("File " + settingsPath.toFile().getAbsolutePath() +  " not found ");

    Configuration config = Configuration.create(settingsPath);
    Map<String, String> settings = config.getSettings();

    Asserts.assertEquals(4, settings.size(), "Settings size differes from the expected size");
    String[] keys = {"enabled", "stackTrace", "threshold", "custom"};
    String[] vals = {"true", "true", "1 ms", "5"};
    for(int i=0; i<keys.length; ++i) {
        String fullKey = "com.oracle.jdk.JavaMonitorWait#" + keys[i];
        Asserts.assertEquals(vals[i], settings.get(fullKey), "Settings value differs from the expected: " + keys[i]);
    }
    Asserts.assertEquals(null, settings.get("doesNotExists"), "Error getting on-existent setting");

    Asserts.assertEquals("Oracle", config.getProvider(), "Configuration provider differs from the expected");
    Asserts.assertEquals("TestSettings", config.getLabel(), "Configuration label differs from the expected");
    Asserts.assertEquals("SampleConfiguration", config.getDescription(), "Configuration description differs from the expected");
    Asserts.assertEquals("settings", config.getName(), "Configuration name differs from the expected");
}
 
Example 2
Source File: TestCreateConfigFromReader.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void testOkConfig() throws Exception {
    File settingsFile = new File(DIR, "settings.jfc");
    if(!settingsFile.exists()) throw new RuntimeException("File " + settingsFile.getAbsolutePath() +  " not found ");

        FileReader reader = new FileReader(settingsFile);

        Configuration config = Configuration.create(reader);
        Map<String, String> settings = config.getSettings();

        Asserts.assertEquals(4, settings.size(), "Settings size differes from the expected size");
        String[] keys = {"enabled", "stackTrace", "threshold", "custom"};
        String[] vals = {"true", "true", "1 ms", "5"};
        for(int i=0; i<keys.length; ++i) {
            String fullKey = "com.oracle.jdk.JavaMonitorWait#" + keys[i];
            Asserts.assertEquals(vals[i], settings.get(fullKey), "Settings value differs from the expected: " + keys[i]);
        }
        Asserts.assertEquals(null, settings.get("doesNotExists"), "Error getting on-existent setting");

        Asserts.assertEquals("Oracle", config.getProvider(), "Configuration provider differs from the expected");
        Asserts.assertEquals("TestSettings", config.getLabel(), "Configuration label differs from the expected");
        Asserts.assertEquals("SampleConfiguration", config.getDescription(), "Configuration description differs from the expected");
        Asserts.assertNull(config.getName(), "Name should be null if created from reader");
}
 
Example 3
Source File: TestCreateConfigFromPath.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void testOkConfig() throws Exception {
    Path settingsPath = DIR.resolve("settings.jfc");
    if(!settingsPath.toFile().exists()) throw new RuntimeException("File " + settingsPath.toFile().getAbsolutePath() +  " not found ");

    Configuration config = Configuration.create(settingsPath);
    Map<String, String> settings = config.getSettings();

    Asserts.assertEquals(4, settings.size(), "Settings size differes from the expected size");
    String[] keys = {"enabled", "stackTrace", "threshold", "custom"};
    String[] vals = {"true", "true", "1 ms", "5"};
    for(int i=0; i<keys.length; ++i) {
        String fullKey = EventNames.JavaMonitorWait + "#" + keys[i];
        Asserts.assertEquals(vals[i], settings.get(fullKey), "Settings value differs from the expected: " + keys[i]);
    }
    Asserts.assertEquals(null, settings.get("doesNotExists"), "Error getting on-existent setting");

    Asserts.assertEquals("Oracle", config.getProvider(), "Configuration provider differs from the expected");
    Asserts.assertEquals("TestSettings", config.getLabel(), "Configuration label differs from the expected");
    Asserts.assertEquals("SampleConfiguration", config.getDescription(), "Configuration description differs from the expected");
    Asserts.assertEquals("settings", config.getName(), "Configuration name differs from the expected");
}
 
Example 4
Source File: TestCreateConfigFromReader.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void testOkConfig() throws Exception {
    File settingsFile = new File(DIR, "settings.jfc");
    if(!settingsFile.exists()) throw new RuntimeException("File " + settingsFile.getAbsolutePath() +  " not found ");

        FileReader reader = new FileReader(settingsFile);

        Configuration config = Configuration.create(reader);
        Map<String, String> settings = config.getSettings();

        Asserts.assertEquals(4, settings.size(), "Settings size differes from the expected size");
        String[] keys = {"enabled", "stackTrace", "threshold", "custom"};
        String[] vals = {"true", "true", "1 ms", "5"};
        for(int i=0; i<keys.length; ++i) {
            String fullKey = EventNames.JavaMonitorWait + "#" + keys[i];
            Asserts.assertEquals(vals[i], settings.get(fullKey), "Settings value differs from the expected: " + keys[i]);
        }
        Asserts.assertEquals(null, settings.get("doesNotExists"), "Error getting on-existent setting");

        Asserts.assertEquals("Oracle", config.getProvider(), "Configuration provider differs from the expected");
        Asserts.assertEquals("TestSettings", config.getLabel(), "Configuration label differs from the expected");
        Asserts.assertEquals("SampleConfiguration", config.getDescription(), "Configuration description differs from the expected");
        Asserts.assertNull(config.getName(), "Name should be null if created from reader");
}
 
Example 5
Source File: TestCreateConfigFromPath.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static void testOkConfig() throws Exception {
    Path settingsPath = DIR.resolve("settings.jfc");
    if(!settingsPath.toFile().exists()) throw new RuntimeException("File " + settingsPath.toFile().getAbsolutePath() +  " not found ");

    Configuration config = Configuration.create(settingsPath);
    Map<String, String> settings = config.getSettings();

    Asserts.assertEquals(4, settings.size(), "Settings size differes from the expected size");
    String[] keys = {"enabled", "stackTrace", "threshold", "custom"};
    String[] vals = {"true", "true", "1 ms", "5"};
    for(int i=0; i<keys.length; ++i) {
        String fullKey = EventNames.JavaMonitorWait + "#" + keys[i];
        Asserts.assertEquals(vals[i], settings.get(fullKey), "Settings value differs from the expected: " + keys[i]);
    }
    Asserts.assertEquals(null, settings.get("doesNotExists"), "Error getting on-existent setting");

    Asserts.assertEquals("Oracle", config.getProvider(), "Configuration provider differs from the expected");
    Asserts.assertEquals("TestSettings", config.getLabel(), "Configuration label differs from the expected");
    Asserts.assertEquals("SampleConfiguration", config.getDescription(), "Configuration description differs from the expected");
    Asserts.assertEquals("settings", config.getName(), "Configuration name differs from the expected");
}
 
Example 6
Source File: TestCreateConfigFromReader.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static void testOkConfig() throws Exception {
    File settingsFile = new File(DIR, "settings.jfc");
    if(!settingsFile.exists()) throw new RuntimeException("File " + settingsFile.getAbsolutePath() +  " not found ");

        FileReader reader = new FileReader(settingsFile);

        Configuration config = Configuration.create(reader);
        Map<String, String> settings = config.getSettings();

        Asserts.assertEquals(4, settings.size(), "Settings size differes from the expected size");
        String[] keys = {"enabled", "stackTrace", "threshold", "custom"};
        String[] vals = {"true", "true", "1 ms", "5"};
        for(int i=0; i<keys.length; ++i) {
            String fullKey = EventNames.JavaMonitorWait + "#" + keys[i];
            Asserts.assertEquals(vals[i], settings.get(fullKey), "Settings value differs from the expected: " + keys[i]);
        }
        Asserts.assertEquals(null, settings.get("doesNotExists"), "Error getting on-existent setting");

        Asserts.assertEquals("Oracle", config.getProvider(), "Configuration provider differs from the expected");
        Asserts.assertEquals("TestSettings", config.getLabel(), "Configuration label differs from the expected");
        Asserts.assertEquals("SampleConfiguration", config.getDescription(), "Configuration description differs from the expected");
        Asserts.assertNull(config.getName(), "Name should be null if created from reader");
}
 
Example 7
Source File: ConfigurationInfo.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
ConfigurationInfo(Configuration config) {
    this.settings = config.getSettings();
    this.name = config.getName();
    this.label = config.getLabel();
    this.description = config.getDescription();
    this.provider = config.getProvider();
    this.contents = config.getContents();
}
 
Example 8
Source File: ConfigurationInfo.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
ConfigurationInfo(Configuration config) {
    this.settings = config.getSettings();
    this.name = config.getName();
    this.label = config.getLabel();
    this.description = config.getDescription();
    this.provider = config.getProvider();
    this.contents = config.getContents();
}
 
Example 9
Source File: ConfigurationInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
ConfigurationInfo(Configuration config) {
    this.settings = config.getSettings();
    this.name = config.getName();
    this.label = config.getLabel();
    this.description = config.getDescription();
    this.provider = config.getProvider();
    this.contents = config.getContents();
}