mof.setInstanceClassFactory(JmsDestination.class, new JmsDestinationICF(mof));
testMOF = mof;
JmsDestinations destinations = new JmsDestinations();
List<JmsDestination> queues = new ArrayList<JmsDestination>();
QueueDestination q1 = new QueueDestination();
q1.setJndiName("queues/Q1");
q1.setDomain(new SecurityDomain("java:/jaas/JMS"));
queues.add(q1);
destinations.setDestinations(queues);
ManagedObject managedObject = initManagedObject(destinations);
checkManagedObjectDefaults(JmsDestinations.class, managedObject);
ManagedProperty destinationsMP = managedObject.getProperty("destinations");
assertNotNull(destinationsMP);
CollectionValue destinationsValue = (CollectionValue) destinationsMP.getValue();
assertNotNull(destinationsValue);
assertEquals(1, destinationsValue.getSize());
GenericValue q1GV = (GenericValue) destinationsValue.getElements()[0];
assertNotNull(q1GV);
ManagedObject q1MO = (ManagedObject) q1GV.getValue();
assertNotNull(q1MO);
ManagedProperty domain = q1MO.getProperty("domain");
getLog().info(domain);
GenericValue domainGV = (GenericValue) domain.getValue();
assertNotNull(domainGV);
ManagedObject domainMO = (ManagedObject) domainGV.getValue();
assertNotNull(domainMO);
ManagedProperty domainName = domainMO.getProperty("domain");
assertEquals(SimpleValueSupport.wrap("java:/jaas/JMS"), domainName.getValue());
ManagedObject domainUpdateMO = initManagedObject(new SecurityDomain("java:/jaas/JMS2"));
DefaultInstanceClassFactory icf = new DefaultInstanceClassFactory(mof);
GenericValue domainUpdateGV = icf.getManagedObjectValue(domain, domainUpdateMO);
assertNotNull(domainUpdateGV.getValue());
domain.setValue(domainUpdateGV);
// Validate this has been written through
assertEquals("java:/jaas/JMS2", q1.getDomain().getDomain());
}