use of com.adaptris.core.AdaptrisMarshaller in project interlok by adaptris.
the class AdapterManagerTest method testMBean_AddAndBindSharedService.
@Test
public void testMBean_AddAndBindSharedService() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
ObjectName adapterObj = adapterManager.createObjectName();
AdaptrisMarshaller m = DefaultMarshaller.getDefaultMarshaller();
List<BaseComponentMBean> mBeans = new ArrayList<BaseComponentMBean>();
mBeans.add(adapterManager);
mBeans.addAll(adapterManager.getAllDescendants());
try {
register(mBeans);
adapterManager.requestStart();
AdapterManagerMBean amp = JMX.newMBeanProxy(mBeanServer, adapterObj, AdapterManagerMBean.class);
amp.addAndBindSharedService(m.marshal(new NullService(getName())));
Adapter marshalledAdapter = (Adapter) m.unmarshal(amp.getConfiguration());
assertEquals(1, marshalledAdapter.getSharedComponents().getServices().size());
assertEquals(getName(), marshalledAdapter.getSharedComponents().getServices().get(0).getUniqueId());
assertTrue(amp.getSharedServiceIds().contains(getName()));
assertTrue(amp.containsSharedService(getName()));
} finally {
adapterManager.requestClose();
}
}
use of com.adaptris.core.AdaptrisMarshaller in project interlok by adaptris.
the class AdapterManagerTest method testMBean_AddAndBindSharedConnection_IllegalState.
@Test
public void testMBean_AddAndBindSharedConnection_IllegalState() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
ObjectName adapterObj = adapterManager.createObjectName();
AdaptrisMarshaller m = DefaultMarshaller.getDefaultMarshaller();
List<BaseComponentMBean> mBeans = new ArrayList<BaseComponentMBean>();
mBeans.add(adapterManager);
mBeans.addAll(adapterManager.getAllDescendants());
try {
register(mBeans);
AdapterManagerMBean amp = JMX.newMBeanProxy(mBeanServer, adapterObj, AdapterManagerMBean.class);
try {
amp.addAndBindSharedConnection(m.marshal(new NullConnection(getName())));
fail();
} catch (IllegalStateException expected) {
}
} finally {
adapterManager.requestClose();
}
}
use of com.adaptris.core.AdaptrisMarshaller in project interlok by adaptris.
the class MappedKeyMetadataFilterTest method testRoundTrip.
@Test
public void testRoundTrip() throws Exception {
MappedKeyMetadataFilter f1 = new MappedKeyMetadataFilter("^key(.*)$", "actual$1");
AdaptrisMarshaller cm = DefaultMarshaller.getDefaultMarshaller();
MappedKeyMetadataFilter f2 = (MappedKeyMetadataFilter) cm.unmarshal(cm.marshal(f1));
assertRoundtripEquality(f1, f2);
}
use of com.adaptris.core.AdaptrisMarshaller in project interlok by adaptris.
the class IdentityBuilderTest method testMappedMetadataIdentityBuilder_RoundTrip.
@Test
public void testMappedMetadataIdentityBuilder_RoundTrip() throws Exception {
MappedMetadataIdentityBuilder builder = new MappedMetadataIdentityBuilder(MetadataSource.Standard, new KeyValuePairList(Arrays.asList(new KeyValuePair[] { new KeyValuePair(MAPPED_USER, USER), new KeyValuePair(MAPPED_PASSWORD, PASSWORD), new KeyValuePair(MAPPED_ROLE, ROLE) })));
AdaptrisMarshaller m = DefaultMarshaller.getDefaultMarshaller();
assertRoundtripEquality(builder, m.unmarshal(m.marshal(builder)));
}
use of com.adaptris.core.AdaptrisMarshaller in project interlok by adaptris.
the class MessageTypeTranslatorCase method roundTrip.
protected StandaloneProducer roundTrip(StandaloneProducer src) throws Exception {
AdaptrisMarshaller m = DefaultMarshaller.getDefaultMarshaller();
String xml = m.marshal(src);
return (StandaloneProducer) m.unmarshal(xml);
}
Aggregations