示例#1
0
  private boolean registerAsSoap(String endpoint, Object listener) throws UMOException {
    if (endpoint.startsWith("glue") || endpoint.startsWith("soap") || endpoint.startsWith("axis")) {
      UMOEndpointURI ep = new MuleEndpointURI(endpoint);
      QuickConfigurationBuilder builder = new QuickConfigurationBuilder();

      // get the service name from the URI path
      String serviceName = null;
      if (ep.getPath() != null) {
        String path = ep.getPath();
        if (path.endsWith("/")) {
          path = path.substring(0, path.length() - 1);
        }
        int i = path.lastIndexOf("/");
        if (i > -1) {
          serviceName = path.substring(i + 1);
        }
      } else {
        serviceName = descriptor.getName();
      }
      // now strip off the service name
      String newEndpoint = endpoint;
      int i = newEndpoint.indexOf(serviceName);
      newEndpoint = newEndpoint.substring(0, i - 1);
      builder.registerComponentInstance(listener, serviceName, new MuleEndpointURI(newEndpoint));
      return true;
    } else {
      return false;
    }
  }
示例#2
0
  protected void doSetUp() throws Exception {
    // By default the JmsTestUtils use the openjms config, though you can
    // pass
    // in other configs using the property below

    // Make sure we are running synchronously
    MuleManager.getConfiguration().setSynchronous(true);
    MuleManager.getConfiguration()
        .getPoolingProfile()
        .setInitialisationPolicy(PoolingProfile.POOL_INITIALISE_ONE_COMPONENT);

    MuleManager.getInstance().setModel(new SedaModel());
    callbackCalled = false;
    MuleManager.getInstance().registerConnector(createConnector());
    currentMsg = null;
    eventLatch1 = new Latch();
    eventLatch2 = new Latch();

    QuickConfigurationBuilder builder = new QuickConfigurationBuilder();
    builder.registerComponent(
        FunctionalTestComponent.class.getName(),
        "testJmsReconnection",
        getReceiverEndpoint("jms://reconnect.queue"),
        null,
        null);
  }
示例#3
0
  protected ConfigurationBuilder getBuilder() throws Exception {
    QuickConfigurationBuilder builder = new QuickConfigurationBuilder();
    builder.disableAdminAgent();

    // create JNP connector
    jnpConnector = new JnpConnector();
    jnpConnector.setName("jnp");
    jnpConnector.setJndiInitialFactory(MuleInitialContextFactory.class.getName());
    jnpConnector.setSecurityPolicy("rmi.policy");

    // Required if connectoring to a Remote Jndi context
    // builder.getManager().registerAgent(new RmiRegistryAgent());

    // Create a local Jndi Context
    Hashtable env = new Hashtable();
    // env.put(Context.PROVIDER_URL, "rmi://localhost:1099");
    env.put(Context.INITIAL_CONTEXT_FACTORY, MuleInitialContextFactory.class.getName());
    InitialContext ic = new InitialContext(env);
    // Bind our servcie object
    ic.bind("TestService", new MatchingMethodsComponent());

    jnpConnector.setJndiContext(ic);
    builder.getManager().registerConnector(jnpConnector);
    return builder;
  }
示例#4
0
  public void testSpecificContainerAddressingForComponents() throws Exception {
    QuickConfigurationBuilder builder = new QuickConfigurationBuilder();
    UMODescriptor d = builder.createDescriptor("Orange", "myOrange", "test://foo", null, null);
    d.setContainer("spring2");
    builder.registerComponent(d);
    UMOComponent c = builder.getManager().getModel().getComponent("myOrange");
    assertNotNull(c);
    Object o = c.getInstance();
    assertTrue(o instanceof Orange);
    Orange orange = (Orange) o;
    assertEquals(10, orange.getSegments().intValue());

    d = builder.createDescriptor("Orange", "myOrange2", "test://bar", null, null);
    d.setContainer("spring1");
    builder.registerComponent(d);
    c = builder.getManager().getModel().getComponent("myOrange2");
    assertNotNull(c);
    o = c.getInstance();
    assertTrue(o instanceof Orange);
    orange = (Orange) o;
    assertEquals(8, orange.getSegments().intValue());
  }