mx4j/src/test/test/javax/management/modelmbean ModelMBeanConstructorInfoTest.java,1.2,1.3
Simone Bordet <[email protected]>
| Newsgroups | gmane.comp.java.mx4j.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/mx4j/mx4j/src/test/test/javax/management/modelmbean
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30262/src/test/test/javax/management/modelmbean
Modified Files:
ModelMBeanConstructorInfoTest.java
Log Message:
Added copyright notice and author information
Index: ModelMBeanConstructorInfoTest.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/test/test/javax/management/modelmbean/ModelMBeanConstructorInfoTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ModelMBeanConstructorInfoTest.java 7 Nov 2003 02:02:06 -0000 1.2
--- ModelMBeanConstructorInfoTest.java 10 Aug 2004 09:15:18 -0000 1.3
***************
*** 1,10 ****
/*
! * Created on Oct 21, 2003
*
*/
package test.javax.management.modelmbean;
import java.lang.reflect.Constructor;
-
import javax.management.Descriptor;
import javax.management.MBeanParameterInfo;
--- 1,13 ----
/*
! * Copyright (C) MX4J.
! * All rights reserved.
*
+ * This software is distributed under the terms of the MX4J License version 1.0.
+ * See the terms of the MX4J License in the documentation provided with this software.
*/
+
package test.javax.management.modelmbean;
import java.lang.reflect.Constructor;
import javax.management.Descriptor;
import javax.management.MBeanParameterInfo;
***************
*** 17,116 ****
/**
! * @author wharold
*/
public class ModelMBeanConstructorInfoTest extends TestCase
{
! public static class Bob
! {
! public Bob(String address)
! {}
! }
! public static void main(String[] args)
! {
! TestRunner.run(ModelMBeanConstructorInfoTest.class);
! }
! public ModelMBeanConstructorInfoTest(String name)
! {
! super(name);
! }
! public void testValid() throws Exception
! {
! Constructor bobctor =
! ModelMBeanConstructorInfoTest.Bob.class.getConstructor(
! new Class[] { String.class });
! String[] fields = { "name", "descriptorType", "displayName", "role" };
! String[] values =
! { bobctor.getName(), "operation", "bob maker", "constructor" };
! DescriptorSupport ds = new DescriptorSupport(fields, values);
! ModelMBeanConstructorInfo ctorinfo =
! new ModelMBeanConstructorInfo("BobBuilder", bobctor, ds);
! }
! public void testAddDefaultDisplayName() throws Exception
! {
! Constructor bobctor =
! ModelMBeanConstructorInfoTest.Bob.class.getConstructor(
! new Class[] { String.class });
! String[] fields = { "name", "descriptorType", "role" };
! String[] values = { bobctor.getName(), "operation", "constructor" };
! DescriptorSupport ds = new DescriptorSupport(fields, values);
! ModelMBeanConstructorInfo ctorinfo =
! new ModelMBeanConstructorInfo("BobBuilder", bobctor, ds);
! Descriptor d = ctorinfo.getDescriptor();
! String dispname = (String) d.getFieldValue("displayName");
! assertTrue(
! "Unexpected displayName",
! dispname.compareTo(bobctor.getName()) == 0);
! }
! public void testBadRole() throws Exception
! {
! try
! {
! Constructor bobctor =
! ModelMBeanConstructorInfoTest.Bob.class.getConstructor(
! new Class[] { String.class });
! String[] fields =
! { "name", "descriptorType", "displayName", "role" };
! String[] values =
! { bobctor.getName(), "operation", "bob maker", "getter" };
! DescriptorSupport ds = new DescriptorSupport(fields, values);
! ModelMBeanConstructorInfo ctorinfo =
! new ModelMBeanConstructorInfo("BobBuilder", bobctor, ds);
! fail("Expecting RuntimeOperationsException");
! }
! catch (RuntimeOperationsException x)
! {
! if (!(x.getTargetException() instanceof IllegalArgumentException))
! {
! fail("Target exception should be IllegalArgumentException");
! }
! assertTrue(true); // success
! }
! }
! public void testCaseInsensitiveDescriptorType()
! {
! DescriptorSupport ds =
! new DescriptorSupport(
! new String[] {
! "descriptorType=OPERATION",
! "role=constructor",
! "name=BobBuilder",
! "displayname=bob maker" });
! ModelMBeanConstructorInfo ctorinfo =
! new ModelMBeanConstructorInfo(
! "BobBuilder",
! "Default Bob Constructor",
! new MBeanParameterInfo[0],
! ds);
! }
! protected void setUp()
! {}
! protected void tearDown()
! {}
}
--- 20,118 ----
/**
! * @author <a href="mailto:[email protected]">Ward Harold</a>
! * @version $Revision$
*/
public class ModelMBeanConstructorInfoTest extends TestCase
{
! public static class Bob
! {
! public Bob(String address)
! {
! }
! }
! public static void main(String[] args)
! {
! TestRunner.run(ModelMBeanConstructorInfoTest.class);
! }
! public ModelMBeanConstructorInfoTest(String name)
! {
! super(name);
! }
! public void testValid() throws Exception
! {
! Constructor bobctor =
! ModelMBeanConstructorInfoTest.Bob.class.getConstructor(new Class[]{String.class});
! String[] fields = {"name", "descriptorType", "displayName", "role"};
! String[] values =
! {bobctor.getName(), "operation", "bob maker", "constructor"};
! DescriptorSupport ds = new DescriptorSupport(fields, values);
! ModelMBeanConstructorInfo ctorinfo =
! new ModelMBeanConstructorInfo("BobBuilder", bobctor, ds);
! }
! public void testAddDefaultDisplayName() throws Exception
! {
! Constructor bobctor =
! ModelMBeanConstructorInfoTest.Bob.class.getConstructor(new Class[]{String.class});
! String[] fields = {"name", "descriptorType", "role"};
! String[] values = {bobctor.getName(), "operation", "constructor"};
! DescriptorSupport ds = new DescriptorSupport(fields, values);
! ModelMBeanConstructorInfo ctorinfo =
! new ModelMBeanConstructorInfo("BobBuilder", bobctor, ds);
! Descriptor d = ctorinfo.getDescriptor();
! String dispname = (String)d.getFieldValue("displayName");
! assertTrue("Unexpected displayName",
! dispname.compareTo(bobctor.getName()) == 0);
! }
! public void testBadRole() throws Exception
! {
! try
! {
! Constructor bobctor =
! ModelMBeanConstructorInfoTest.Bob.class.getConstructor(new Class[]{String.class});
! String[] fields =
! {"name", "descriptorType", "displayName", "role"};
! String[] values =
! {bobctor.getName(), "operation", "bob maker", "getter"};
! DescriptorSupport ds = new DescriptorSupport(fields, values);
! ModelMBeanConstructorInfo ctorinfo =
! new ModelMBeanConstructorInfo("BobBuilder", bobctor, ds);
! fail("Expecting RuntimeOperationsException");
! }
! catch (RuntimeOperationsException x)
! {
! if (!(x.getTargetException() instanceof IllegalArgumentException))
! {
! fail("Target exception should be IllegalArgumentException");
! }
! assertTrue(true); // success
! }
! }
! public void testCaseInsensitiveDescriptorType()
! {
! DescriptorSupport ds =
! new DescriptorSupport(new String[]{
! "descriptorType=OPERATION",
! "role=constructor",
! "name=BobBuilder",
! "displayname=bob maker"});
! ModelMBeanConstructorInfo ctorinfo =
! new ModelMBeanConstructorInfo("BobBuilder",
! "Default Bob Constructor",
! new MBeanParameterInfo[0],
! ds);
! }
! protected void setUp()
! {
! }
!
! protected void tearDown()
! {
! }
}
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285