@Test
 public void testWriteComplete() throws Exception {
   String old_xml = new StringPuller().pull(COMPLETE_XML, getClass());
   SwitchYardModel switchyard = _puller.pull(new StringReader(old_xml));
   String new_xml = switchyard.toString();
   XMLUnit.setIgnoreWhitespace(true);
   Diff diff = XMLUnit.compareXML(old_xml, new_xml);
   Assert.assertTrue(diff.toString(), diff.identical());
 }
Exemple #2
0
 @Override
 public DomainModel setProperties(PropertiesModel properties) {
   setChildModel(properties);
   _properties = properties;
   SwitchYardModel switchyard = getSwitchYard();
   if (switchyard != null) {
     switchyard.setDomainPropertyResolver();
   }
   return this;
 }
 @Override
 public Object getPropertyValue(Object id) {
   if (PROP_NAME.equals(id)) {
     return _model.getName();
   } else if (PROP_TARGET_NAMESPACE.equals(id)) {
     if (_model.getTargetNamespace() == null) {
       if (_model.getComposite() == null) {
         return null;
       }
       return _model.getComposite().getTargetNamespace();
     }
     return _model.getTargetNamespace();
   }
   return null;
 }
 @Test
 public void testReadComplete() throws Exception {
   SwitchYardModel switchyard = _puller.pull(COMPLETE_XML, getClass());
   CompositeModel composite = switchyard.getComposite();
   ComponentModel component = composite.getComponents().get(0);
   ComponentImplementationModel implementation = component.getImplementation();
   Assert.assertTrue(implementation instanceof BeanComponentImplementationModel);
   BeanComponentImplementationModel bci = (BeanComponentImplementationModel) implementation;
   Assert.assertEquals("bean", bci.getType());
   Assert.assertEquals("org.switchyard.example.m1app.SimpleBean", bci.getClazz());
   Configuration config = bci.getModelConfiguration();
   Assert.assertEquals("implementation.bean", config.getName());
   QName qname = config.getQName();
   Assert.assertEquals("urn:switchyard-component-bean:config:1.0", qname.getNamespaceURI());
   Assert.assertEquals("implementation.bean", qname.getLocalPart());
 }
 @Test
 public void testValidation() throws Exception {
   SwitchYardModel switchyard = _puller.pull(COMPLETE_XML, getClass());
   switchyard.assertModelValid();
 }