Package javax.management.openmbean

Examples of javax.management.openmbean.ArrayType


   }

   public void testEquals()
      throws Exception
   {
      ArrayType arrayType = new ArrayType(3, SimpleType.STRING);
      assertTrue("null is not an array type", arrayType.equals(null) == false);
      assertTrue("object is not an array type", arrayType.equals(new Object()) == false);

      assertTrue("should be equal", arrayType.equals(arrayType));

      ArrayType arrayType2 = new ArrayType(3, SimpleType.STRING);
      assertTrue("should be equal, even though different instances", arrayType.equals(arrayType2));
      assertTrue("should be equal, even though different instances", arrayType2.equals(arrayType));

      arrayType2 = new ArrayType(2, SimpleType.STRING);
      assertTrue("should not be equal, wrong number of dimensions", arrayType.equals(arrayType2) == false);
      assertTrue("should not be equal, wrong number of dimensions", arrayType2.equals(arrayType) == false);

      arrayType2 = new ArrayType(3, SimpleType.INTEGER);
      assertTrue("should not be equal, wrong element type", arrayType.equals(arrayType2) == false);
      assertTrue("should not be equal, wrong element type", arrayType2.equals(arrayType) == false);
   }
View Full Code Here


   }

   public void testHashCode()
      throws Exception
   {
      ArrayType arrayType = new ArrayType(3, SimpleType.STRING);

      int myHashCode = 3 + SimpleType.STRING.hashCode();
      assertTrue("Wrong hash code generated", myHashCode == arrayType.hashCode());
   }
View Full Code Here

   }

   public void testToString()
      throws Exception
   {
      ArrayType arrayType = new ArrayType(3, SimpleType.STRING);

      String toString = arrayType.toString();

      assertTrue("toString() should contain the array type class name",
         toString.indexOf(ArrayType.class.getName()) != -1);
      assertTrue("toString() should contain the dimension",
         toString.indexOf("3") != -1);
View Full Code Here

   }

   public void testSerialization()
      throws Exception
   {
      ArrayType arrayType = new ArrayType(3, SimpleType.STRING);

      // Serialize it
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      oos.writeObject(arrayType);
View Full Code Here

      throws Exception
   {
      boolean caught = false;
      try
      {
         new ArrayType(-1, SimpleType.STRING);
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Excepted IllegalArgumentException for negative dimension");

      caught = false;
      try
      {
         new ArrayType(1, new ArrayType(2, SimpleType.STRING));
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
View Full Code Here

      throws Exception
   {
      boolean caught = false;
      try
      {
         new ArrayType(1, null);
      }
      catch (NullPointerException e)
      {
         fail("FAILS IN RI: expected IllegalArgumentException for null element type");
      }
View Full Code Here

        @Override
        protected void init() throws OpenDataException {
            super.init();
            addItem(CompositeDataConstants.BODY_LENGTH, "Body length", SimpleType.LONG);
            addItem(CompositeDataConstants.BODY_PREVIEW, "Body preview", new ArrayType(1, SimpleType.BYTE));
        }
View Full Code Here

    public TabularData getServices(long bundleId, boolean inUse) throws MBeanException {
        try {
            CompositeType serviceType = new CompositeType("Service", "OSGi Service",
                    new String[]{"Interfaces", "Properties"},
                    new String[]{"Interfaces class name of the service", "Properties of the service"},
                    new OpenType[]{new ArrayType(1, SimpleType.STRING), new ArrayType(1, SimpleType.STRING)});
            TabularType tableType = new TabularType("Services", "Table of OSGi Services", serviceType,
                    new String[]{"Interfaces", "Properties"});
            TabularData table = new TabularDataSupport(tableType);

            Bundle[] bundles;
View Full Code Here

            itemTypes[0] = SimpleType.STRING;
            itemTypes[1] = SimpleType.BOOLEAN;
            itemTypes[2] = SimpleType.STRING;
            itemTypes[3] = SimpleType.STRING;
            itemTypes[4] = SimpleType.STRING;
            itemTypes[5] = new ArrayType(1, SimpleType.STRING);

            itemDescriptions[0] = "The name of the reference";
            itemDescriptions[1] = "The state of the reference";
            itemDescriptions[2] = "The cardinality of the reference";
            itemDescriptions[3] = "The availability of the reference";
View Full Code Here

            OpenType[] itemTypes = new OpenType[itemNames.length];
            String[] itemDescriptions = new String[itemNames.length];
            itemTypes[0] = SimpleType.STRING;
            itemTypes[1] = SimpleType.STRING;
            itemTypes[2] = FEATURE_IDENTIFIER_TABLE;
            itemTypes[3] = new ArrayType(1, SimpleType.STRING);
            itemTypes[4] = FEATURE_CONFIG_TABLE;
            itemTypes[5] = FEATURE_CONFIG_FILES_TABLE;
            itemTypes[6] = SimpleType.BOOLEAN;

            itemDescriptions[0] = "The name of the feature";
View Full Code Here

TOP

Related Classes of javax.management.openmbean.ArrayType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.