Java Code Examples for java.lang.management.MemoryNotificationInfo.from()

The following are Jave code examples for showing how to use from() of the java.lang.management.MemoryNotificationInfo class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: jdk8u-jdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 6 votes
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 2
Project: openjdk-jdk10   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 6 votes
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 3
Project: openjdk9   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 6 votes
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 4
Project: jdk8u_jdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 6 votes
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 5
Project: lookaside_java-1.8.0-openjdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 6 votes
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 6
Project: infobip-open-jdk-8   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 6 votes
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 7
Project: jdk8u-dev-jdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 6 votes
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 8
Project: jdk7-jdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 6 votes
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 9
Project: openjdk-source-code-learn   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 6 votes
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 10
Project: OLD-OpenJDK8   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 6 votes
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 11
Project: cn1   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from() {
    final MemoryUsage memoryUsage = new MemoryUsage(1, 2, 3, 4);
    final MemoryNotificationInfo memoryNotifyInfo = new MemoryNotificationInfo("Lloyd", memoryUsage, 42);
    
    CompositeData compositeData = ManagementUtils
            .toMemoryNotificationInfoCompositeData(memoryNotifyInfo);
    MemoryNotificationInfo fromInfo = MemoryNotificationInfo
            .from(compositeData);
    assertEquals(memoryNotifyInfo.getPoolName(), fromInfo.getPoolName());
    assertEquals(memoryNotifyInfo.getCount(), fromInfo.getCount());

    MemoryUsage fromUsage = fromInfo.getUsage();
    assertEquals(memoryUsage.getInit(), fromUsage.getInit());
    assertEquals(memoryUsage.getMax(), fromUsage.getMax());
    assertEquals(memoryUsage.getUsed(), fromUsage.getUsed());
    assertEquals(memoryUsage.getCommitted(), fromUsage.getCommitted());
}
 
Example 12
Project: cn1   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from_scenario12() throws Exception {
    String[] names = { "poolName", "usage", "count", "extention" };
    Object[] values = { "TestPoolName", memoryCompositeData, new Long(42),
            null };
    OpenType[] types = { SimpleType.STRING, memoryUsageCompositeType,
            SimpleType.LONG, SimpleType.LONG };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    MemoryNotificationInfo info = MemoryNotificationInfo.from(data);
    assertEquals(values[0], info.getPoolName());
    assertEquals(values[2], info.getCount());
    MemoryUsage usage = info.getUsage();
    assertEquals(1, usage.getInit());
    assertEquals(2, usage.getUsed());
    assertEquals(3, usage.getCommitted());
    assertEquals(4, usage.getMax());
}
 
Example 13
Project: cn1   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from_scenario4() throws Exception { // add
    String[] names = { "poolName", "usage", "count" };
    Object[] values = { "TestPoolName", memoryCompositeData, new Long(-42) };
    OpenType[] types = { SimpleType.STRING, memoryUsageCompositeType,
            SimpleType.LONG };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    MemoryNotificationInfo info = MemoryNotificationInfo.from(data);
    assertEquals(values[0], info.getPoolName());
    assertEquals(values[2], info.getCount());
    MemoryUsage usage = info.getUsage();
    assertEquals(1, usage.getInit());
    assertEquals(2, usage.getUsed());
    assertEquals(3, usage.getCommitted());
    assertEquals(4, usage.getMax());
}
 
Example 14
Project: cn1   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from_scenario5() throws Exception {
    String[] names = { "poolName", "usage", "count" };
    Object[] values = { new Long(1), memoryCompositeData, new Long(42) };
    OpenType[] types = { SimpleType.LONG, memoryUsageCompositeType,
            SimpleType.LONG };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    try {
        MemoryNotificationInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
Example 15
Project: openjdk-jdk7u-jdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 6 votes
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 16
Project: cn1   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from_scenario7() throws Exception {
    String[] names = { "poolName", "usage", "count" };
    Object[] values = { "TestPoolName", memoryCompositeData, "42" };
    OpenType[] types = { SimpleType.STRING, memoryUsageCompositeType,
            SimpleType.STRING };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    try {
        MemoryNotificationInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
Example 17
Project: cn1   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from_scenario13() throws Exception {
    String[] names = { "poolName", "usage", "count", "extention" };
    Object[] values = { "TestPoolName", memoryCompositeData, new Long(42),
            "Extention" };
    OpenType[] types = { SimpleType.STRING, memoryUsageCompositeType,
            SimpleType.LONG, SimpleType.STRING };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    MemoryNotificationInfo info = MemoryNotificationInfo.from(data);
    assertEquals(values[0], info.getPoolName());
    assertEquals(values[2], info.getCount());
    MemoryUsage usage = info.getUsage();
    assertEquals(1, usage.getInit());
    assertEquals(2, usage.getUsed());
    assertEquals(3, usage.getCommitted());
    assertEquals(4, usage.getMax());
}
 
Example 18
Project: freeVM   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from() {
    final MemoryUsage memoryUsage = new MemoryUsage(1, 2, 3, 4);
    final MemoryNotificationInfo memoryNotifyInfo = new MemoryNotificationInfo("Lloyd", memoryUsage, 42);
    
    CompositeData compositeData = ManagementUtils
            .toMemoryNotificationInfoCompositeData(memoryNotifyInfo);
    MemoryNotificationInfo fromInfo = MemoryNotificationInfo
            .from(compositeData);
    assertEquals(memoryNotifyInfo.getPoolName(), fromInfo.getPoolName());
    assertEquals(memoryNotifyInfo.getCount(), fromInfo.getCount());

    MemoryUsage fromUsage = fromInfo.getUsage();
    assertEquals(memoryUsage.getInit(), fromUsage.getInit());
    assertEquals(memoryUsage.getMax(), fromUsage.getMax());
    assertEquals(memoryUsage.getUsed(), fromUsage.getUsed());
    assertEquals(memoryUsage.getCommitted(), fromUsage.getCommitted());
}
 
Example 19
Project: freeVM   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from_scenario3() throws Exception {
    String[] names = { "poolName", "usage", "count" };
    Object[] values = { "TestPoolName", null, null };
    OpenType[] types = { SimpleType.STRING, memoryUsageCompositeType,
            SimpleType.LONG };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    try {
        MemoryNotificationInfo.from(data);
        fail("should throw NullPointerException");
    } catch (NullPointerException e) {
        // Expected
    }
}
 
Example 20
Project: freeVM   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from_scenario4() throws Exception { // add
    String[] names = { "poolName", "usage", "count" };
    Object[] values = { "TestPoolName", memoryCompositeData, new Long(-42) };
    OpenType[] types = { SimpleType.STRING, memoryUsageCompositeType,
            SimpleType.LONG };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    MemoryNotificationInfo info = MemoryNotificationInfo.from(data);
    assertEquals(values[0], info.getPoolName());
    assertEquals(values[2], info.getCount());
    MemoryUsage usage = info.getUsage();
    assertEquals(1, usage.getInit());
    assertEquals(2, usage.getUsed());
    assertEquals(3, usage.getCommitted());
    assertEquals(4, usage.getMax());
}
 
Example 21
Project: freeVM   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from_scenario5() throws Exception {
    String[] names = { "poolName", "usage", "count" };
    Object[] values = { new Long(1), memoryCompositeData, new Long(42) };
    OpenType[] types = { SimpleType.LONG, memoryUsageCompositeType,
            SimpleType.LONG };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    try {
        MemoryNotificationInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
Example 22
Project: freeVM   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from_scenario6() throws Exception {
    String[] names = { "poolName", "usage", "count" };
    Object[] values = { "TestPoolName", new Long(1), new Long(42) };
    OpenType[] types = { SimpleType.STRING, SimpleType.LONG,
            SimpleType.LONG };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    try {
        MemoryNotificationInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
Example 23
Project: freeVM   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from_scenario7() throws Exception {
    String[] names = { "poolName", "usage", "count" };
    Object[] values = { "TestPoolName", memoryCompositeData, "42" };
    OpenType[] types = { SimpleType.STRING, memoryUsageCompositeType,
            SimpleType.STRING };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    try {
        MemoryNotificationInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
Example 24
Project: freeVM   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from_scenario11() throws Exception {
    String[] names = { "notPoolName", "usage", "count" };
    Object[] values = { "TestNotPoolName", memoryCompositeData,
            new Long(42) };
    OpenType[] types = { SimpleType.STRING, memoryUsageCompositeType,
            SimpleType.LONG };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    try {
        MemoryNotificationInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
Example 25
Project: freeVM   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from_scenario12() throws Exception {
    String[] names = { "poolName", "usage", "count", "extention" };
    Object[] values = { "TestPoolName", memoryCompositeData, new Long(42),
            null };
    OpenType[] types = { SimpleType.STRING, memoryUsageCompositeType,
            SimpleType.LONG, SimpleType.LONG };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    MemoryNotificationInfo info = MemoryNotificationInfo.from(data);
    assertEquals(values[0], info.getPoolName());
    assertEquals(values[2], info.getCount());
    MemoryUsage usage = info.getUsage();
    assertEquals(1, usage.getInit());
    assertEquals(2, usage.getUsed());
    assertEquals(3, usage.getCommitted());
    assertEquals(4, usage.getMax());
}
 
Example 26
Project: freeVM   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 6 votes
public void test_from_scenario13() throws Exception {
    String[] names = { "poolName", "usage", "count", "extention" };
    Object[] values = { "TestPoolName", memoryCompositeData, new Long(42),
            "Extention" };
    OpenType[] types = { SimpleType.STRING, memoryUsageCompositeType,
            SimpleType.LONG, SimpleType.STRING };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    MemoryNotificationInfo info = MemoryNotificationInfo.from(data);
    assertEquals(values[0], info.getPoolName());
    assertEquals(values[2], info.getCount());
    MemoryUsage usage = info.getUsage();
    assertEquals(1, usage.getInit());
    assertEquals(2, usage.getUsed());
    assertEquals(3, usage.getCommitted());
    assertEquals(4, usage.getMax());
}
 
Example 27
Project: openjdk-icedtea7   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 6 votes
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 28
Project: jdk8u-jdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 5 votes
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 29
Project: openjdk-jdk10   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 5 votes
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 30
Project: openjdk9   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 5 votes
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 31
Project: jdk8u_jdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 5 votes
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 32
Project: lookaside_java-1.8.0-openjdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 5 votes
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 33
Project: infobip-open-jdk-8   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 5 votes
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 34
Project: jdk8u-dev-jdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 5 votes
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 35
Project: JAVA_UNIT   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 5 votes
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 36
Project: jdk7-jdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 5 votes
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 37
Project: openjdk-source-code-learn   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 5 votes
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 38
Project: OLD-OpenJDK8   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 5 votes
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 39
Project: cn1   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 5 votes
public void test_from_scenario1() throws Exception {
    String[] names = { "poolName", "usage", "count" };
    Object[] values = { null, null, null };
    OpenType[] types = { SimpleType.STRING, memoryUsageCompositeType,
            SimpleType.LONG };
    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    try {
        MemoryNotificationInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
Example 40
Project: pitest   File: MutationTestMinion.java   Source Code and License Vote up 5 votes
private static void addMemoryWatchDog(final Reporter r) {
  final NotificationListener listener = new NotificationListener() {

    @Override
    public void handleNotification(final Notification notification,
        final Object handback) {
      final String type = notification.getType();
      if (type.equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED)) {
        final CompositeData cd = (CompositeData) notification.getUserData();
        final MemoryNotificationInfo memInfo = MemoryNotificationInfo
            .from(cd);
        CommandLineMessage.report(memInfo.getPoolName()
            + " has exceeded the shutdown threshold : " + memInfo.getCount()
            + " times.\n" + memInfo.getUsage());

        r.done(ExitCode.OUT_OF_MEMORY);

      } else {
        LOG.warning("Unknown notification: " + notification);
      }
    }

  };

  MemoryWatchdog.addWatchDogToAllPools(90, listener);

}
 
Example 41
Project: cn1   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 5 votes
public void test_from_scenario8() throws Exception {
    String[] names = { "poolName" };
    Object[] values = { "TestPoolName" };
    OpenType[] types = { SimpleType.STRING };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    try {
        MemoryNotificationInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
Example 42
Project: cn1   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 5 votes
public void test_from_scenario9() throws Exception {
    String[] names = { "usage" };
    Object[] values = { memoryCompositeData };
    OpenType[] types = { memoryUsageCompositeType };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    try {
        MemoryNotificationInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
Example 43
Project: freeVM   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 5 votes
public void test_from_scenario1() throws Exception {
    String[] names = { "poolName", "usage", "count" };
    Object[] values = { null, null, null };
    OpenType[] types = { SimpleType.STRING, memoryUsageCompositeType,
            SimpleType.LONG };
    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    try {
        MemoryNotificationInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
Example 44
Project: freeVM   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 5 votes
public void test_from_scenario2() throws Exception {
    String[] names = { "poolName", "usage", "count" };
    Object[] values = { "TestPoolName", null, new Long(-42) };
    OpenType[] types = { SimpleType.STRING, memoryUsageCompositeType,
            SimpleType.LONG };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    MemoryNotificationInfo info = MemoryNotificationInfo.from(data);
    assertEquals(values[0], info.getPoolName());
    assertEquals(values[2], info.getCount());
    assertNull(info.getUsage());
}
 
Example 45
Project: freeVM   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 5 votes
public void test_from_scenario8() throws Exception {
    String[] names = { "poolName" };
    Object[] values = { "TestPoolName" };
    OpenType[] types = { SimpleType.STRING };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    try {
        MemoryNotificationInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
Example 46
Project: freeVM   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 5 votes
public void test_from_scenario9() throws Exception {
    String[] names = { "usage" };
    Object[] values = { memoryCompositeData };
    OpenType[] types = { memoryUsageCompositeType };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    try {
        MemoryNotificationInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
Example 47
Project: freeVM   File: MemoryNotificationInfoTest.java   Source Code and License Vote up 5 votes
public void test_from_scenario10() throws Exception {
    String[] names = { "count" };
    Object[] values = { new Long(42) };
    OpenType[] types = { SimpleType.LONG };

    CompositeType compositeType = getCompositeType(names, types);
    CompositeData data = new CompositeDataSupport(compositeType, names,
            values);
    try {
        MemoryNotificationInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
Example 48
Project: openjdk-icedtea7   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 5 votes
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 49
Project: btrace   File: BTraceRuntime.java   Source Code and License Vote up 5 votes
private void initMemoryListener() {
    initThreadPool();
    memoryListener = new NotificationListener() {
            public void handleNotification(Notification notif, Object handback)  {
                String notifType = notif.getType();
                if (notifType.equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED)) {
                    CompositeData cd = (CompositeData) notif.getUserData();
                    final MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
                    String name = info.getPoolName();
                    final Method handler = lowMemHandlers.get(name);
                    if (handler != null) {
                        threadPool.submit(new Runnable() {
                            public void run() {
                                try {
                                    if (handler.getParameterTypes().length == 1) {
                                        handler.invoke(null, info.getUsage());
                                    } else {
                                        handler.invoke(null, (Object[])null);
                                    }
                                } catch (Throwable th) { }
                            }
                        });
                    }
                }
            }
        };
}
 
Example 50
Project: jdk8u-jdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 4 votes
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }
 
Example 51
Project: openjdk-jdk10   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 4 votes
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }
 
Example 52
Project: openjdk9   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 4 votes
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }
 
Example 53
Project: jdk8u_jdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 4 votes
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }
 
Example 54
Project: lookaside_java-1.8.0-openjdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 4 votes
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }
 
Example 55
Project: infobip-open-jdk-8   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 4 votes
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }
 
Example 56
Project: jdk8u-dev-jdk   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 4 votes
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }
 
Example 57
Project: openjdk-source-code-learn   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 4 votes
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }
 
Example 58
Project: OLD-OpenJDK8   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 4 votes
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }
 
Example 59
Project: openjdk-icedtea7   File: MemoryNotifInfoCompositeData.java   Source Code and License Vote up 4 votes
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }