Package org.jboss.metatype.api.values

Examples of org.jboss.metatype.api.values.MetaValue


   private void serviceBindingSetTest(MetaValue metaValue, Map<String, Integer> offsets) throws Exception
   {
      assertTrue(metaValue instanceof CompositeValue);
      CompositeValue bindingSet = (CompositeValue) metaValue;
     
      MetaValue val =  bindingSet.get("name");
      assertNotNull("property name has no value", val);
      assertTrue("property name value is SimpleValue", val instanceof SimpleValue);
      Object simpleVal = ((SimpleValue) val).getValue();
      assertTrue(simpleVal instanceof String);
      String name = (String) simpleVal;
     
      val =  bindingSet.get("defaultHostName");
      assertNotNull(name + " -- property defaultHostName has no value", val);
      assertEquals(name + " -- type of defaultHostName value isn't String", String.class.getName(), val.getMetaType().getClassName());
      assertTrue(name + " -- property defaultHostName value is SimpleValue", val instanceof SimpleValue);
      // Only do further validation of the binding sets that the AS normally ships;
      // ignore any earlier ones that other tests may have added since we don't
      // know the correct assertions
      if ("ports-default".equals(name) || "ports-01".equals(name) || "ports-02".equals(name) || "ports-03".equals(name))
View Full Code Here


      assertTrue(metaValue instanceof CompositeValue);
      CompositeValue bindingMetadata = (CompositeValue) metaValue;
     
      Checked result = new Checked();
     
      MetaValue val =  bindingMetadata.get("fullyQualifiedName");
      assertNotNull("property fullyQualifiedName has no value", val);
      assertTrue("property fullyQualifiedName value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property fullyQualifiedName value is not null", ((SimpleValue) val).getValue());
     
      val =  bindingMetadata.get("serviceName");
      assertNotNull("property serviceName has no value", val);
      assertTrue("property serviceName value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property serviceName value is not null", ((SimpleValue) val).getValue());
     
      val =  bindingMetadata.get("bindingName");
      if (val != null)
      {
         result.bindingName = true;
         assertNotNull("property bindingName has no value", val);
         assertTrue("property bindingName value is SimpleValue", val instanceof SimpleValue);
         assertEquals("type of bindingName value isn't String", String.class.getName(), val.getMetaType().getClassName());
      }
     
      val =  bindingMetadata.get("bindingSetName");
      if (val != null)
      {
         assertNotNull("property bindingSetName has no value", val);
         assertTrue("property bindingSetName value is SimpleValue", val instanceof SimpleValue);
         assertEquals("type of bindingSetName value isn't String", String.class.getName(), val.getMetaType().getClassName());
      }
     
      val =  bindingMetadata.get("hostName");
      if (val != null)
      {
         result.hostname = true;
         assertTrue("property hostName value is SimpleValue", val instanceof SimpleValue);
         assertEquals("type of hostName value isn't String", String.class.getName(), val.getMetaType().getClassName());
      }
     
      val =  bindingMetadata.get("port");
      assertNotNull("property port has no value", val);
      assertTrue("property port value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property port value is not null", ((SimpleValue) val).getValue());
      assertEquals("type of port value isn't int", int.class.getName(), val.getMetaType().getClassName());
      assertNotNull("property port value is not null", ((SimpleValue) val).getValue());
     
      val =  bindingMetadata.get("description");
      if (val != null)
      {
         result.hostname = true;
         assertNotNull("property hostName has no value", val);
         assertTrue("property description value is SimpleValue", val instanceof SimpleValue);
         assertEquals("type of description value isn't String", String.class.getName(), val.getMetaType().getClassName());
      }
     
      val =  bindingMetadata.get("fixedPort");
      assertNotNull("property bindingName has no value", val);
      assertTrue("property bindingName value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property bindingName value is not null", ((SimpleValue) val).getValue());
      assertEquals("type of bindingName value isn't boolean", boolean.class.getName(), val.getMetaType().getClassName());
      assertNotNull("property bindingName value is not null", ((SimpleValue) val).getValue());
     
      val =  bindingMetadata.get("fixedHostName");
      assertNotNull("property bindingName has no value", val);
      assertTrue("property bindingName value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property bindingName value is not null", ((SimpleValue) val).getValue());
      assertEquals("type of bindingName value isn't boolean", boolean.class.getName(), val.getMetaType().getClassName());
      assertNotNull("property bindingName value is not null", ((SimpleValue) val).getValue());
     
      return result;
   }
View Full Code Here

     
      // First confirm the expected binding set is there
     
      ManagedProperty prop = properties.get("bindingSets");
      assertNotNull("Missing property bindingSets", prop);
      MetaValue val =  prop.getValue();
      assertNotNull("property bindingSets has no value", val);
      assertTrue("property bindingSets value is CollectionValue", val instanceof CollectionValue);
      MetaValue[] elements = ((CollectionValue) val).getElements();
      assertNotNull(elements);
      assertEquals(numSets, elements.length);
      result.array = elements;
      boolean sawAdded = false;
      for (int i = 0; i < elements.length; i++)
      {
         MetaValue mv = elements[i];
         if ("ports-test".equals(getSimpleValue(mv, "name")))
         {
            sawAdded = true;
            assertEquals("added binding set has correct defaultHostName",
                  "localhost", getSimpleValue(mv, "defaultHostName"));
            assertEquals("added binding set has correct portOffset",
                  portOffset, getSimpleValue(mv, "portOffset", Integer.class).intValue());
            MetaValue overVal = ((CompositeValue) mv).get("overrideBindings");
            assertTrue(overVal instanceof CollectionValue);
            MetaValue[] overrides = ((CollectionValue) overVal).getElements();
            assertNotNull("added binding set has overrides", overrides);
            assertEquals("added binding set has correct # of overrides", 1, overrides.length);
            mv = overrides[0];
            assertEquals("added binding set has AddedOverrideBinding",
                  "AddedOverrideBinding", getSimpleValue(mv, "serviceName"));
            assertNull("AddedOverrideBinding has null bindingName",
                       getSimpleValue(mv, "bindingName"));
            assertEquals("AddedOverrideBinding has correct description",
                       "description", getSimpleValue(mv, "description"));
            assertNull("AddedOverrideBinding has null hostName",
                  getSimpleValue(mv, "hostName"));
            assertEquals("AddedOverrideBinding has correct port",
                  overrideBindingPort, getSimpleValue(mv, "port", Integer.class).intValue());
            assertFalse("AddedOverrideBinding has correct fixedHostName",
                  getSimpleValue(mv, "fixedHostName", Boolean.class).booleanValue());
            assertFalse("AddedOverrideBinding has correct fixedPort",
                  getSimpleValue(mv, "fixedPort", Boolean.class).booleanValue());
            result.index = i;
            break;
         }
      }
      assertTrue(sawAdded);
     
      // Next validate the expected actual bindings are there
      prop = properties.get("serviceBindings");
      assertNotNull("Missing property serviceBindings", prop);
      val =  prop.getValue();
      assertNotNull("property serviceBindings has no value", val);
      assertTrue("property serviceBindings value is Composite", val instanceof CompositeValue);
      val = ((CompositeValue) val).get("ports-test");
      assertNotNull(val);
      assertTrue("property serviceBindings value is CollectionValue", val instanceof CollectionValue);
      elements = ((CollectionValue) val).getElements();
      assertNotNull("property serviceBindings value has elements", elements);
      assertEquals("property serviceBindings value has correct # of elements",
            standardBindings.size() + 1, elements.length);
      for (MetaValue mv : elements)
      {
         String fqn = getSimpleValue(mv, "fullyQualifiedName", String.class);
         if ("AddedOverrideBinding".equals(fqn))
         {
            assertEquals("actual AddedOverrideBinding has correct serviceName",
                  "AddedOverrideBinding", getSimpleValue(mv, "serviceName"));
            assertNull("actual AddedOverrideBinding has null bindingName",
                  getSimpleValue(mv, "bindingName"));
            assertEquals("actual AddedOverrideBinding has correct description",
                  "description", getSimpleValue(mv, "description"));
            assertEquals("actual AddedOverrideBinding has correct port",
                  overrideBindingPort + portOffset, getSimpleValue(mv, "port", Integer.class).intValue());
            assertEquals("actual AddedOverrideBinding has correct hostName",
                  "localhost", getSimpleValue(mv, "hostName"));
         }
         else
         {
            MetaValue standard = standardBindings.get(fqn);
            assertNotNull(standard);
            assertEquals("standardBinding " + fqn + " has correct serviceName",
                  getSimpleValue(standard, "serviceName"), getSimpleValue(mv, "serviceName"));
            assertEquals("standardBinding " + fqn + " has correct bindingName",
                  getSimpleValue(standard, "bindingName"), getSimpleValue(mv, "bindingName"));
View Full Code Here

   private <T> T getSimpleValue(MetaValue val, String key, Class<T> type)
   {
      T result = null;
      assertTrue(val instanceof CompositeValue);
      CompositeValue cval = (CompositeValue) val;
      MetaValue mv = cval.get(key);
      if (mv != null)
      {
         assertTrue(mv instanceof SimpleValue);
         Object obj = ((SimpleValue) mv).getValue();
         result = type.cast(obj);
View Full Code Here

      {
         System.out.println(comp.getName());
         ManagedProperty property = comp.getProperty("DetypedInvocationStatistics");
         if ("jboss.j2ee:jndiName=ejb/StatefulCounterEjb,service=EJB".equals(comp.getName()))
         {
            MetaValue value = property.getValue();
            System.out.println("Value = " + value);
            CompositeValue methodStatsMap = (CompositeValue)((CompositeValue) value).get("methodStats");
            CompositeValue methodStats = (CompositeValue)methodStatsMap.get("count");
            assertEquals(2L, ((SimpleValue)methodStats.get("count")).getValue());
            return;
View Full Code Here

      assertNotNull(useJavaCtx);
      assertEquals(SimpleValueSupport.wrap(Boolean.TRUE), useJavaCtx.getValue());
     
      // Update the use-java-context value
      ManagedProperty minPoolSize = dsMC.getProperty("min-pool-size");
      MetaValue oldValue = minPoolSize.getValue();
      minPoolSize.setValue(SimpleValueSupport.wrap(1));
      minPoolSize.setRemoved(true);
      ManagedProperty maxPoolSize = dsMC.getProperty("max-pool-size");
      maxPoolSize.setValue(SimpleValueSupport.wrap(999));
      activeView.updateComponent(dsMC);
View Full Code Here

     
      assertTrue(element instanceof CompositeValue);
     
      CompositeValue compValue = (CompositeValue) element;
     
      MetaValue metaval = compValue.get("serviceName");
      assertNotNull("has serviceName", metaval);
      assertTrue(metaval instanceof SimpleValue);
      assertTrue(((SimpleValue) metaval).getValue() instanceof String);
     
      metaval = compValue.get("bindingName");
      if (metaval != null)
      {
         assertTrue(metaval instanceof SimpleValue);
         Object val = ((SimpleValue) metaval).getValue();
         assertTrue(val instanceof String);
      }
     
      metaval = compValue.get("fullyQualifiedName");
      assertNotNull("has fullyQualifiedName", metaval);
      assertTrue(metaval instanceof SimpleValue);
      assertTrue(((SimpleValue) metaval).getValue() instanceof String);
     
      metaval = compValue.get("description");
      if (metaval != null)
      {
         assertTrue(metaval instanceof SimpleValue);
         Object val = ((SimpleValue) metaval).getValue();
         assertTrue(val instanceof String);
      }
     
      metaval = compValue.get("hostName");
      assertNotNull("has hostName", metaval);
      assertTrue(metaval instanceof SimpleValue);
      assertTrue(((SimpleValue) metaval).getValue() instanceof String);
     
      metaval = compValue.get("bindAddress");
      assertNotNull("has bindAddress", metaval);
      assertTrue(metaval instanceof ArrayValue);
      Object val = ((ArrayValue) metaval).getValue();
      assertTrue(val instanceof byte[]);
     
      metaval = compValue.get("port");
      assertNotNull("has port", metaval);
      assertTrue(metaval instanceof SimpleValue);
      assertEquals("type of port value isn't int", int.class.getName(), metaval.getMetaType().getClassName());
   }
View Full Code Here

   private void serviceBindingSetTest(MetaValue metaValue, Map<String, Integer> offsets) throws Exception
   {
      assertTrue(metaValue instanceof CompositeValue);
      CompositeValue bindingSet = (CompositeValue) metaValue;
     
      MetaValue val =  bindingSet.get("name");
      assertNotNull("property name has no value", val);
      assertTrue("property name value is SimpleValue", val instanceof SimpleValue);
      Object simpleVal = ((SimpleValue) val).getValue();
      assertTrue(simpleVal instanceof String);
      String name = (String) simpleVal;
     
      val =  bindingSet.get("defaultHostName");
      assertNotNull("property defaultHostName has no value", val);
      assertEquals("type of defaultHostName value isn't String", String.class.getName(), val.getMetaType().getClassName());
      assertTrue("property defaultHostName value is SimpleValue", val instanceof SimpleValue);
      assertEquals(InetAddress.getByName(getServerHost()), InetAddress.getByName((String) ((SimpleValue) val).getValue()));
     
      val =  bindingSet.get("portOffset");
      assertNotNull("property portOffset has no value", val);
View Full Code Here

      assertTrue(metaValue instanceof CompositeValue);
      CompositeValue bindingMetadata = (CompositeValue) metaValue;
     
      Checked result = new Checked();
     
      MetaValue val =  bindingMetadata.get("fullyQualifiedName");
      assertNotNull("property fullyQualifiedName has no value", val);
      assertTrue("property fullyQualifiedName value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property fullyQualifiedName value is not null", ((SimpleValue) val).getValue());
     
      val =  bindingMetadata.get("serviceName");
      assertNotNull("property serviceName has no value", val);
      assertTrue("property serviceName value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property serviceName value is not null", ((SimpleValue) val).getValue());
     
      val =  bindingMetadata.get("bindingName");
      if (val != null)
      {
         result.bindingName = true;
         assertNotNull("property bindingName has no value", val);
         assertTrue("property bindingName value is SimpleValue", val instanceof SimpleValue);
         assertEquals("type of bindingName value isn't String", String.class.getName(), val.getMetaType().getClassName());
      }
     
      val =  bindingMetadata.get("bindingSetName");
      if (val != null)
      {
         assertNotNull("property bindingSetName has no value", val);
         assertTrue("property bindingSetName value is SimpleValue", val instanceof SimpleValue);
         assertEquals("type of bindingSetName value isn't String", String.class.getName(), val.getMetaType().getClassName());
      }
     
      val =  bindingMetadata.get("hostName");
      if (val != null)
      {
         result.hostname = true;
         assertTrue("property hostName value is SimpleValue", val instanceof SimpleValue);
         assertEquals("type of hostName value isn't String", String.class.getName(), val.getMetaType().getClassName());
      }
     
      val =  bindingMetadata.get("port");
      assertNotNull("property port has no value", val);
      assertTrue("property port value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property port value is not null", ((SimpleValue) val).getValue());
      assertEquals("type of port value isn't int", int.class.getName(), val.getMetaType().getClassName());
      assertNotNull("property port value is not null", ((SimpleValue) val).getValue());
     
      val =  bindingMetadata.get("description");
      if (val != null)
      {
         result.hostname = true;
         assertNotNull("property hostName has no value", val);
         assertTrue("property description value is SimpleValue", val instanceof SimpleValue);
         assertEquals("type of description value isn't String", String.class.getName(), val.getMetaType().getClassName());
      }
     
      val =  bindingMetadata.get("fixedPort");
      assertNotNull("property bindingName has no value", val);
      assertTrue("property bindingName value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property bindingName value is not null", ((SimpleValue) val).getValue());
      assertEquals("type of bindingName value isn't boolean", boolean.class.getName(), val.getMetaType().getClassName());
      assertNotNull("property bindingName value is not null", ((SimpleValue) val).getValue());
     
      val =  bindingMetadata.get("fixedHostName");
      assertNotNull("property bindingName has no value", val);
      assertTrue("property bindingName value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property bindingName value is not null", ((SimpleValue) val).getValue());
      assertEquals("type of bindingName value isn't boolean", boolean.class.getName(), val.getMetaType().getClassName());
      assertNotNull("property bindingName value is not null", ((SimpleValue) val).getValue());
     
      return result;
   }
View Full Code Here

      // Before passing the updated component back, store some info about
      // the binding sets so we can use it later
      prop = properties.get("bindingSets");
      assertNotNull("Missing property bindingSets", prop);
      MetaValue val =  prop.getValue();
      assertNotNull("property bindingSets has no value", val);
      assertTrue("property bindingSets value is CollectionValue", val instanceof CollectionValue);
      MetaValue[] elements = ((CollectionValue) val).getElements();
      assertNotNull(elements);
     
View Full Code Here

TOP

Related Classes of org.jboss.metatype.api.values.MetaValue

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.