示例#1
0
 @Test
 public void testInFaultMessageTrace() throws Exception {
   ServiceReference service =
       _domain.registerService(new QName("InFaultTrace"), new MockHandler().forwardInToFault());
   Exchange exchange = _domain.createExchange(service, ExchangeContract.IN_OUT, new MockHandler());
   exchange.send(exchange.createMessage());
 }
 /**
  * Public constructor.
  *
  * @param domain ServiceDomain instance.
  */
 public TransformerRegistryLoader(ServiceDomain domain) {
   if (domain == null) {
     throw TransformMessages.MESSAGES.nullServiceDomainArgument();
   }
   this._serviceDomain = domain;
   if (_serviceDomain.getTransformerRegistry() == null) {
     throw TransformMessages.MESSAGES.nullTransformerRegistryArgument();
   }
   this._transformerRegistry = _serviceDomain.getTransformerRegistry();
 }
  @Test
  public void testHandlerRegistration() throws Exception {
    SwitchYardModel switchyard =
        new ModelPuller<SwitchYardModel>().pull("/switchyard-config-properties-01.xml", getClass());

    ServiceDomain domain = new ServiceDomainManager().createDomain(new QName("test"), switchyard);

    Assert.assertEquals("abc-value", domain.getProperty("abc"));
    Assert.assertEquals("xyz-value", domain.getProperty("xyz"));
    Assert.assertNull(domain.getProperty("nothing"));
  }
示例#4
0
  @Before
  public void setUp() throws Exception {
    _puller = new ModelPuller<CompositeModel>();
    CompositeModel composite = _puller.pull("/HelloSwitchYard.xml", getClass());
    composite.assertModelValid();

    CompositeServiceModel compositeService = composite.getServices().get(0);
    _config = (HttpBindingModel) compositeService.getBindings().get(0);

    // Massive hack for Test Runner. Register both a service and a reference binding.
    _domain.registerService(_config.getServiceName(), new InOutService(), mockService);
    _domain.registerServiceReference(_config.getServiceName(), new InOutService());
    _httpInbound = new InboundHandler(_config, _domain);
    _httpInbound.start();

    CompositeReferenceModel compositeReference = composite.getReferences().get(0);
    _configRef = (HttpBindingModel) compositeReference.getBindings().get(0);

    _httpOutbound = new OutboundHandler(_configRef);
    // Massive hack for Test Runner. Register both a service and a reference binding.
    _domain.registerService(_configRef.getServiceName(), new HelloInterface(), _httpOutbound);
    _domain.registerServiceReference(_configRef.getServiceName(), new HelloInterface());
    _httpOutbound.start();
  }
示例#5
0
 @Test
 public void testInMessageTrace() {
   ServiceReference service = _domain.registerService(new QName("InTrace"), new MockHandler());
   Exchange exchange = _domain.createExchange(service, ExchangeContract.IN_ONLY);
   exchange.send(exchange.createMessage());
 }
示例#6
0
 @Before
 public void setUp() throws Exception {
   _domain = new MockDomain();
   _domain.getHandlerChain().addFirst("trace", new MessageTrace());
 }
示例#7
0
 @Override
 public Processor create(ServiceDomain domain) {
   return wrap(new TransformHandler(domain.getTransformerRegistry()));
 }
示例#8
0
 @Override
 public Processor create(ServiceDomain domain) {
   return wrap(new ValidateHandler(domain.getValidatorRegistry()));
 }