18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package jdk.jfr.api.recording.settings;
27
28
29 import java.io.Reader;
30 import java.nio.file.Path;
31 import java.nio.file.Paths;
32 import java.util.Map;
33
34 import jdk.jfr.Configuration;
35 import jdk.test.lib.Asserts;
36 import jdk.test.lib.jfr.EventNames;
37
38 /*
39 * @test
40 * @summary Test setName().
41 * @key jfr
42 * @library /test/lib
43 * @run main/othervm jdk.jfr.api.recording.settings.TestCreateConfigFromPath
44 */
45 public class TestCreateConfigFromPath {
46
47 private static final Path DIR = Paths.get(System.getProperty("test.src", "."));
48
49 public static void main(String[] args) throws Throwable {
50 testOkConfig();
51 testNullReader();
52 }
53
54 private static void testOkConfig() throws Exception {
55 Path settingsPath = DIR.resolve("settings.jfc");
56 if(!settingsPath.toFile().exists()) throw new RuntimeException("File " + settingsPath.toFile().getAbsolutePath() + " not found ");
57
58 Configuration config = Configuration.create(settingsPath);
59 Map<String, String> settings = config.getSettings();
60
61 Asserts.assertEquals(4, settings.size(), "Settings size differes from the expected size");
|
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package jdk.jfr.api.recording.settings;
27
28
29 import java.io.Reader;
30 import java.nio.file.Path;
31 import java.nio.file.Paths;
32 import java.util.Map;
33
34 import jdk.jfr.Configuration;
35 import jdk.test.lib.Asserts;
36 import jdk.test.lib.jfr.EventNames;
37
38 /**
39 * @test
40 * @summary Test setName().
41 * @key jfr
42 * @requires vm.hasJFR
43 * @library /test/lib
44 * @run main/othervm jdk.jfr.api.recording.settings.TestCreateConfigFromPath
45 */
46 public class TestCreateConfigFromPath {
47
48 private static final Path DIR = Paths.get(System.getProperty("test.src", "."));
49
50 public static void main(String[] args) throws Throwable {
51 testOkConfig();
52 testNullReader();
53 }
54
55 private static void testOkConfig() throws Exception {
56 Path settingsPath = DIR.resolve("settings.jfc");
57 if(!settingsPath.toFile().exists()) throw new RuntimeException("File " + settingsPath.toFile().getAbsolutePath() + " not found ");
58
59 Configuration config = Configuration.create(settingsPath);
60 Map<String, String> settings = config.getSettings();
61
62 Asserts.assertEquals(4, settings.size(), "Settings size differes from the expected size");
|