Package org.jboss.metatype.api.values

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


            .getValue();

        Iterator<MetaValue> it = bindingSets.iterator();

        while (it.hasNext()) {
            CompositeValue bindingSet = (CompositeValue) it.next();

            String currentName = Util.getValue(bindingSet, "name", String.class);
            if (bindingSetName.equals(currentName)) {
                return bindingSet;
            }
View Full Code Here


      ManagedProperty connectionProperties = mo.getProperty("config-property");
      MetaType cpType = connectionProperties.getMetaType();
      assertTrue("connection-properties.type="+cpType, cpType instanceof CompositeMetaType);
      Object cpValue = connectionProperties.getValue();
      assertTrue("connection-properties.value="+cpValue, cpValue instanceof CompositeValue);
      CompositeValue cvalue = (CompositeValue) cpValue;
      // Now update the values
      MapCompositeValueSupport map = (MapCompositeValueSupport) cvalue;

      // Test simple property types
      ManagedProperty xatx = mo.getProperty("xa-transaction");
View Full Code Here

      ManagedProperty connectionProperties = mo.getProperty("connection-properties");
      MetaType cpType = connectionProperties.getMetaType();
      assertTrue("connection-properties.type="+cpType, cpType instanceof CompositeMetaType);
      Object cpValue = connectionProperties.getValue();
      assertTrue("connection-properties.value="+cpValue, cpValue instanceof CompositeValue);
      CompositeValue cvalue = (CompositeValue) cpValue;
      // Now update the values
      MapCompositeValueSupport map = (MapCompositeValueSupport) cvalue;
      map.put("key1", SimpleValueSupport.wrap("value1"));
      map.put("key2", SimpleValueSupport.wrap("value2"));
      connectionProperties.setValue(map);
      // Check the underlying values
      List<DataSourceConnectionPropertyMetaData> ldsProps = lds.getDataSourceConnectionProperties();
      assertEquals(2, ldsProps.size());
      DataSourceConnectionPropertyMetaData key1 = null;
      DataSourceConnectionPropertyMetaData key2 = null;
      for(DataSourceConnectionPropertyMetaData dspmd : ldsProps)
      {
         if(dspmd.getName().equals("key1"))
            key1 = dspmd;
         else if(dspmd.getName().equals("key2"))
            key2 = dspmd;
      }
      assertNotNull(key1);
      assertEquals("value1", key1.getValue());
      assertNotNull(key2);
      assertEquals("value2", key2.getValue());
      // Test a simple property
      ManagedProperty driverClass = mo.getProperty("driver-class");
      driverClass.setValue(SimpleValueSupport.wrap("org.jboss.jdbc.ClusteredDriver"));
      String driverClassName = lds.getDriverClass();
      assertEquals("org.jboss.jdbc.ClusteredDriver", driverClassName);
      // Validate the security-domain
      ManagedProperty secDomain = mo.getProperty("security-domain");
      assertNotNull("security-domain", secDomain);
      CompositeMetaType compType = (CompositeMetaType) secDomain.getMetaType();
      assertNotNull(compType);
      CompositeValue sdCV = (CompositeValue) secDomain.getValue();
      assertNotNull("security-domain.CV", sdCV);

      SimpleValue domainName = (SimpleValue) sdCV.get("domain");
      assertNotNull("security-domain.domain", domainName);
      assertEquals(SimpleValueSupport.wrap("java:/jaas/SomeDomain"), domainName);
      assertNotNull("security-domain.deploymentType", sdCV.get("securityDeploymentType"));
      assertEquals("APPLICATION", ((EnumValue) sdCV.get("securityDeploymentType")).getValue());
      assertFalse(lds.getSecurityMetaData() instanceof SecurityDomainApplicationManagedMetaData);
     
      // Set a new security domain and check if the metaType changed
      CompositeValueSupport newSecDomain = new CompositeValueSupport(compType);
      newSecDomain.set("domain", SimpleValueSupport.wrap("test"));
View Full Code Here

      ManagedProperty connectionProperties = mo.getProperty("xa-datasource-properties");
      MetaType cpType = connectionProperties.getMetaType();
      assertTrue("xa-datasource-properties.type="+cpType, cpType instanceof CompositeMetaType);
      Object cpValue = connectionProperties.getValue();
      assertTrue("xa-datasource-properties.value="+cpValue, cpValue instanceof CompositeValue);
      CompositeValue cvalue = (CompositeValue) cpValue;
      // Now update the values
      MapCompositeValueSupport map = (MapCompositeValueSupport) cvalue;
      map.put("key1", SimpleValueSupport.wrap("value1"));
      map.put("key2", SimpleValueSupport.wrap("value2"));
      connectionProperties.setValue(map);
View Full Code Here

      assertTrue(metaData.getMap().equals(initMap()));
   }
  
   protected void assertRow(TableValue table, Serializable key, Serializable value)
   {
      CompositeValue v = (CompositeValue) table.get(new MetaValue[] { SimpleValueSupport.wrap(key) });
      assertNotNull(v);
      // Assert value
      SimpleValue simple = (SimpleValue) v.get("value");
      assertNotNull(simple);
      assertEquals(value, simple.getValue());     
   }
View Full Code Here

      deployment.getProperty("");
     
      ManagedProperty p = deployment.getProperty("primitive");
      assertNotNull(p);
     
      CompositeValue composite = (CompositeValue) p.getValue();
     
      Map<String, MetaValue> valueMap = new HashMap<String, MetaValue>();
      valueMap.put("optionalName",
            new SimpleValueSupport(SimpleMetaType.STRING, "changed"));
      valueMap.put("integer", new SimpleValueSupport(
            SimpleMetaType.INTEGER_PRIMITIVE, 111));

      //
      p.setValue(new CompositeValueSupport(composite.getMetaType(), valueMap));

      ManagedProperty property = deployment.getProperty("name");
      assertNotNull(property);
      property.setValue(SimpleValueSupport.wrap("ChangedName"));
     
      // deployment3
      deployment = getDeployment("testDeployment3", mo);
      assertNotNull(deployment);
     
      property = deployment.getProperty("name");
      assertNotNull(property);
      property.setValue(SimpleValueSupport.wrap("ChangedName3"));

      PersistedManagedObject restored = restore(mo);
      assertNotNull(restored);
      PersistedCollectionValue collection = (PersistedCollectionValue) restored.getProperties().get(0).getValue();
      assertNotNull(collection);
      PersistedManagedObject o = ((PersistedGenericValue) collection.getValues().get(0)).getManagedObject();
      assertNotNull(o);
     
      enableTrace("org.jboss.system.server.profileservice.persistence");

      // Recreate
      mo = update(createNestedTestMetaData(), restored);
     
      deployment = getDeployment("ChangedName", mo);
      assertNotNull("changed name deployment null", deployment);
     
      p = deployment.getProperty("primitive");
      assertNotNull(p);
     
      composite = (CompositeValue) p.getValue();
      assertNotNull(composite);
     
      assertEquals("changed", ((SimpleValue)composite.get("optionalName")).getValue());
     
     
      deployment = getDeployment("testDeployment2", mo);
      assertNotNull(deployment);
     
View Full Code Here

         if ((element instanceof CompositeValue) == false)
         {
            throw new IllegalArgumentException(element + " is not a " + CompositeValue.class.getSimpleName());
         }
         CompositeValue compValue = (CompositeValue) element;
         String name = Util.getValueFromComposite(compValue, "name", String.class);
         String defaultHostName = Util.getValueFromComposite(compValue, "defaultHostName", String.class);
         Integer portOffset = Util.getValueFromComposite(compValue, "portOffset", Integer.class);
         if (portOffset == null)
         {
            throw new IllegalStateException(element + " has no value for key 'port'");
         }
         Set<ServiceBindingMetadata> overrides = mapper.unwrapMetaValue(compValue.get("overrideBindings"));
         ServiceBindingSet sbs = new ServiceBindingSet(name, defaultHostName, portOffset.intValue(), overrides);
         result.add(sbs);
      }
      return result;
   }
View Full Code Here

         if ((element instanceof CompositeValue) == false)
         {
            throw new IllegalArgumentException(element + " is not a " + CompositeValue.class.getSimpleName());
         }
         CompositeValue compValue = (CompositeValue) element;
         String serviceName = Util.getValueFromComposite(compValue, "serviceName", String.class);
         String bindingName = Util.getValueFromComposite(compValue, "bindingName", String.class);
         String description = Util.getValueFromComposite(compValue, "description", String.class);
         String hostName = Util.getValueFromComposite(compValue, "hostName", String.class);
         Integer port = Util.getValueFromComposite(compValue, "port", Integer.class);
View Full Code Here

      CollectionValue subscriptionsCV = (CollectionValue) subscriptions;
      assertTrue("subscriptions.size > 0", subscriptionsCV.getSize() > 0);
      MetaValue[] subscriptionsMVs = subscriptionsCV.getElements();
      for(MetaValue mv : subscriptionsMVs)
      {
         CompositeValue cv = (CompositeValue) mv;
         MetaValue name = cv.get("name");
         log.info(name);
         MetaValue clientID = cv.get("clientID");
         log.info(clientID);
         MetaValue durable = cv.get("durable");
         log.info(durable);
         MetaValue selector = cv.get("selector");
         log.info(selector);
         MetaValue id = cv.get("id");
         log.info(id);
         MetaValue maxSize = cv.get("maxSize");
         log.info(maxSize);
         MetaValue messageCount = cv.get("messageCount");
         log.info(messageCount);
      }
   }
View Full Code Here

         assertEquals(1, nondurable.getValue());
         assertEquals(0, durable.getValue());
         assertEquals(1, all.getValue());
         assertEquals(10, allMessageCount.getValue());
  
         CompositeValue messageCounter = (CompositeValue) messageCounters.iterator().next();
         assertNotNull(messageCounter);
        
         SimpleValue count = (SimpleValue) messageCounter.get("messageCount");
         assertEquals(count, allMessageCount);
      }
      finally
      {
         pub.close();
View Full Code Here

TOP

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

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.