< prev index next >

application/tests/org.openjdk.jmc.rjmx.test/src/test/java/org/openjdk/jmc/rjmx/test/subscription/AttributeDescriptorTest.java

Print this page

        

*** 123,164 **** assertTrue(createDescriptor1().toString() == createDescriptor1().toString()); } @Test public void testCreateFromQualifiedName1() throws Exception { ! MRI descriptor = MRI.createFromQualifiedName("attribute://java.lang:type=OperatingSystem/Arch"); //$NON-NLS-1$ assertEquals(createDescriptor1(), descriptor); } @Test public void testCreateFromQualifiedName2() throws Exception { ! MRI descriptor = MRI.createFromQualifiedName("attribute://java.lang:type=OperatingSystem/Arch/Sub"); //$NON-NLS-1$ assertEquals(Type.ATTRIBUTE, descriptor.getType()); ! assertEquals("java.lang:type=OperatingSystem", descriptor.getObjectName().getCanonicalName()); //$NON-NLS-1$ ! assertEquals("Arch/Sub", descriptor.getDataPath()); //$NON-NLS-1$ } @Test public void testMalformedQualifiedName1() throws Exception { try { ! MRI.createFromQualifiedName("smurf://java.lang:type=OperatingSystem/Arch"); //$NON-NLS-1$ } catch (IllegalArgumentException iae) { return; } ! assertTrue("Should not be possible to create an attribute with the type smurf!", false); //$NON-NLS-1$ } @Test public void testMalformedQualifiedName2() throws Exception { try { ! MRI.createFromQualifiedName("java.lang:type=OperatingSystem/Arch"); //$NON-NLS-1$ } catch (IllegalArgumentException iae) { return; } ! assertTrue("Should not be possible to create an attribute name without specifying a type!", false); //$NON-NLS-1$ } private MRI createDescriptor1() throws Exception { ! return new MRI(Type.ATTRIBUTE, new ObjectName("java.lang:type=OperatingSystem"), "Arch"); //$NON-NLS-1$ //$NON-NLS-2$ } } --- 123,164 ---- assertTrue(createDescriptor1().toString() == createDescriptor1().toString()); } @Test public void testCreateFromQualifiedName1() throws Exception { ! MRI descriptor = MRI.createFromQualifiedName("attribute://java.lang:type=OperatingSystem/Arch"); assertEquals(createDescriptor1(), descriptor); } @Test public void testCreateFromQualifiedName2() throws Exception { ! MRI descriptor = MRI.createFromQualifiedName("attribute://java.lang:type=OperatingSystem/Arch/Sub"); assertEquals(Type.ATTRIBUTE, descriptor.getType()); ! assertEquals("java.lang:type=OperatingSystem", descriptor.getObjectName().getCanonicalName()); ! assertEquals("Arch/Sub", descriptor.getDataPath()); } @Test public void testMalformedQualifiedName1() throws Exception { try { ! MRI.createFromQualifiedName("smurf://java.lang:type=OperatingSystem/Arch"); } catch (IllegalArgumentException iae) { return; } ! assertTrue("Should not be possible to create an attribute with the type smurf!", false); } @Test public void testMalformedQualifiedName2() throws Exception { try { ! MRI.createFromQualifiedName("java.lang:type=OperatingSystem/Arch"); } catch (IllegalArgumentException iae) { return; } ! assertTrue("Should not be possible to create an attribute name without specifying a type!", false); } private MRI createDescriptor1() throws Exception { ! return new MRI(Type.ATTRIBUTE, new ObjectName("java.lang:type=OperatingSystem"), "Arch"); } }
< prev index next >