Example #1
0
  public Confirm1d() {
    MessagingConfiguration config = new MessagingConfiguration();

    // Security
    SecuritySettings security = config.getSecuritySettings();
    SecurityConstraint fooConstraint = new SecurityConstraint("foo-constraint");
    fooConstraint.setMethod(SecurityConstraint.CUSTOM_AUTH_METHOD);
    fooConstraint.addRole("foo-managers");
    security.addConstraint(fooConstraint);

    SecurityConstraint barConstraint = new SecurityConstraint("bar-constraint");
    barConstraint.setMethod(SecurityConstraint.CUSTOM_AUTH_METHOD);
    barConstraint.addRole("bar-managers");
    security.addConstraint(barConstraint);

    // Channels
    ChannelSettings fooChannel = new ChannelSettings("foo-channel");
    fooChannel.setUri("/foo");
    fooChannel.setEndpointType("flex.messaging.endpoints.FooEndpoint");
    config.addChannelSettings("foo-channel", fooChannel);

    ChannelSettings barChannel = new ChannelSettings("bar-channel");
    barChannel.setUri("/bar");
    barChannel.setEndpointType("flex.messaging.endpoints.BarEndpoint");
    config.addChannelSettings("bar-channel", barChannel);

    // Services
    ServiceSettings fooService = new ServiceSettings("foo-service");
    fooService.setClassName("flex.messaging.services.FooService");
    config.addServiceSettings(fooService);

    // Adapters
    AdapterSettings fooAdapter = new AdapterSettings("foo");
    fooAdapter.setClassName("flex.messaging.services.foo.FooAdapter");
    fooService.addAdapterSettings(fooAdapter);

    AdapterSettings barAdapter = new AdapterSettings("bar");
    barAdapter.setClassName("flex.messaging.services.bar.BarAdapter");
    barAdapter.setDefault(true);
    fooService.addAdapterSettings(barAdapter);

    // Default Channels
    fooService.addDefaultChannel(fooChannel);

    // Destination - foo-dest
    DestinationSettings fooDest = new DestinationSettings("foo-dest");
    fooDest.addChannelSettings(fooChannel);
    fooDest.setAdapterSettings(fooAdapter);
    fooDest.setConstraint(fooConstraint);
    fooDest.addProperty("fooString", "fooValue");
    fooService.addDestinationSettings(fooDest);

    // Destination - bar-dest
    DestinationSettings barDest = new DestinationSettings("bar-dest");
    barDest.addChannelSettings(barChannel);
    barDest.addChannelSettings(fooChannel);
    barDest.setAdapterSettings(barAdapter);
    barDest.setConstraint(barConstraint);
    barDest.addProperty("barString", "barValue");
    fooService.addDestinationSettings(barDest);

    EXPECTED_VALUE = config;
  }