Package org.aopalliance.aop

Examples of org.aopalliance.aop.Advice


    return serializer.writeReplace();
  }

  public static void register(ProxyFactory proxyFactory,
      ProxySerializer serializer) {
    Advice advice = new ProxySerializerHelper(serializer);
    NameMatchMethodPointcutAdvisor advisor = new NameMatchMethodPointcutAdvisor();
    advisor.addMethodName("writeReplace");
    advisor.setAdvice(advice);

    proxyFactory.addInterface(ProxySerializer.class);
View Full Code Here


    assertEquals(1, TestUtils.getPropertyValue(container, "concurrentConsumers"));
    assertNull(TestUtils.getPropertyValue(container, "maxConcurrentConsumers"));
    assertTrue(TestUtils.getPropertyValue(container, "defaultRequeueRejected", Boolean.class));
    assertEquals(1, TestUtils.getPropertyValue(container, "prefetchCount"));
    assertEquals(1, TestUtils.getPropertyValue(container, "txSize"));
    Advice retry = TestUtils.getPropertyValue(container, "adviceChain", Advice[].class)[0];
    assertEquals(3, TestUtils.getPropertyValue(retry, "retryOperations.retryPolicy.maxAttempts"));
    assertEquals(1000L, TestUtils.getPropertyValue(retry, "retryOperations.backOffPolicy.initialInterval"));
    assertEquals(10000L, TestUtils.getPropertyValue(retry, "retryOperations.backOffPolicy.maxInterval"));
    assertEquals(2.0, TestUtils.getPropertyValue(retry, "retryOperations.backOffPolicy.multiplier"));
    bus.unbindConsumers("props.0");
View Full Code Here

    admin.deleteExchange("xdbustest.DLX");
  }

  private SimpleMessageListenerContainer verifyContainer(AbstractEndpoint endpoint) {
    SimpleMessageListenerContainer container;
    Advice retry;
    container = TestUtils.getPropertyValue(endpoint, "messageListenerContainer",
        SimpleMessageListenerContainer.class);
    assertEquals(AcknowledgeMode.NONE, container.getAcknowledgeMode());
    assertThat(container.getQueueNames()[0], startsWith("foo.props.0"));
    assertFalse(TestUtils.getPropertyValue(container, "transactional", Boolean.class));
View Full Code Here

  public ProxyPlusCallback createServiceProxy(ServiceReference reference) {
    List advices = new ArrayList(4);

    // 1. the ServiceReference-like mixin
    Advice mixin = new ImportedOsgiServiceProxyAdvice(reference);
    advices.add(mixin);

    // 2. publication of bundleContext (if there is any)
    // TODO: make this configurable (so it can be disabled)
    advices.add(invokerBundleContextAdvice);

    // 3. TCCL handling (if there is any)
    Advice tcclAdvice = determineTCCLAdvice(reference);

    if (tcclAdvice != null)
      advices.add(tcclAdvice);

    // 4. add the infrastructure proxy
    // but first create the dispatcher since we need
    ServiceInvoker dispatcherInterceptor = createDispatcherInterceptor(reference);
    Advice infrastructureMixin = new InfrastructureOsgiProxyAdvice(dispatcherInterceptor);

    advices.add(infrastructureMixin);
    advices.add(dispatcherInterceptor);

    return new ProxyPlusCallback(ProxyUtils.createProxy(getInterfaces(reference), null, classLoader, bundleContext,
View Full Code Here

  // TESTS on target W/O an equals defined on it

  public void testSameInterceptorEquality() throws Exception {
    target = new Polygon();

    Advice interceptor = createInterceptorWOServiceRequired();

    Object proxyA = createProxy(target, Shape.class, new Advice[] { interceptor });
    Object proxyB = createProxy(target, Shape.class, new Advice[] { interceptor });

    assertFalse(proxyA == proxyB);
View Full Code Here

  public void testEqualsInterceptorsEquality() throws Exception {

    target = new Polygon();

    Advice interceptorA = createInterceptorWOServiceRequired();
    Advice interceptorB = createInterceptorWOServiceRequired();

    Object proxyA = createProxy(target, Shape.class, new Advice[] { interceptorA });
    Object proxyB = createProxy(target, Shape.class, new Advice[] { interceptorB });

    assertFalse(proxyA == proxyB);
View Full Code Here

  }

  public void testMultipleInterceptorEquality() throws Exception {
    target = new Polygon();

    Advice interceptorA1 = createInterceptorWOServiceRequired();

    Advice interceptorA2 = new LocalBundleContextAdvice(bundleContext);
    Advice interceptorA3 = new ServiceTCCLInterceptor(null);

    Advice interceptorB1 = createInterceptorWOServiceRequired();
    Advice interceptorB2 = new LocalBundleContextAdvice(bundleContext);
    Advice interceptorB3 = new ServiceTCCLInterceptor(null);

    Object proxyA = createProxy(target, Shape.class, new Advice[] { interceptorA1, interceptorA2, interceptorA3 });
    Object proxyB = createProxy(target, Shape.class, new Advice[] { interceptorB1, interceptorB2, interceptorB3 });

    assertFalse(proxyA == proxyB);
View Full Code Here

    };

    ServiceDynamicInterceptor interceptorA1 = createInterceptorWServiceRequired();
    interceptorA1.setRetryTimeout(10);

    Advice interceptorB1 = new ServiceStaticInterceptor(bundleContext, new MockServiceReference());

    InterfaceWithEquals proxyA = (InterfaceWithEquals) createProxy(target, InterfaceWithEquals.class,
      new Advice[] { interceptorA1 });
    InterfaceWithEquals proxyB = (InterfaceWithEquals) createProxy(target, InterfaceWithEquals.class,
      new Advice[] { interceptorB1 });
View Full Code Here

  }

  public void testDifferentProxySetupButTargetHasEquals() throws Exception {
    target = new Implementor();

    Advice interceptorA1 = new LocalBundleContextAdvice(bundleContext);
    Advice interceptorB1 = new ServiceTCCLInterceptor(null);

    InterfaceWithEquals proxyA = (InterfaceWithEquals) createProxy(target, InterfaceWithEquals.class,
      new Advice[] { interceptorA1 });
    InterfaceWithEquals proxyB = (InterfaceWithEquals) createProxy(target, InterfaceWithEquals.class,
      new Advice[] { interceptorB1 });
View Full Code Here

    assertSame(TestUtils.invokeMethod(invoker, "getTarget", null), proxy.getWrappedObject());
    assertSame(service, proxy.getWrappedObject());
  }

  public void testEqualityBetweenInfrastructureProxies() throws Exception {
    Advice interceptorA1 = new InfrastructureOsgiProxyAdvice(new ServiceStaticInterceptor(bundleContext, ref));
    Advice interceptorB1 = new InfrastructureOsgiProxyAdvice(new ServiceStaticInterceptor(bundleContext, ref));

    assertEquals("interceptors should be equal", interceptorA1, interceptorB1);
  }
View Full Code Here

TOP

Related Classes of org.aopalliance.aop.Advice

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.