Package org.jboss.aop.metadata

Examples of org.jboss.aop.metadata.SimpleMetaData


{
   public void testConnectionManager() throws Exception
   {
      ConnectionManager cm = new TestConnectionManager();
      ManagedConnectionFactory mcf = new TestManagedConnectionFactory();
      SimpleMetaData metadata = new SimpleMetaData();
     
      metadata.addMetaData(ConnectionFactoryInterceptor.CONNECTION_FACTORY, ConnectionFactoryInterceptor.CONNECTION_MANAGER, cm);
      metadata.addMetaData(ConnectionFactoryInterceptor.CONNECTION_MANAGER, ConnectionFactoryInterceptor.MANAGED_CONNECTION_FACTORY, mcf);
      DataSource ds = (DataSource) assertCreateHollowProxy(new Class[] { DataSource.class }, metadata, DataSource.class);
      Connection c = ds.getConnection();
      assertNotNull(c);
      assertTrue(c instanceof TestConnection);
      TestConnection tc = (TestConnection) c;
View Full Code Here


public class SimpleMetaDataTestCase extends AbstractProxyTest
{
   public void testSimpleMetaData() throws Exception
   {
      SimpleBean bean = new SimpleBean();
      SimpleMetaData metaData = new SimpleMetaData();
      metaData.addMetaData("Simple", "MetaData", "Value");
      Simple simple = (Simple) assertCreateProxy(bean, new Class[] { Simple.class }, metaData, Simple.class);
      SimpleInterceptor.invoked = null;
      simple.doSomething();
      assertTrue(bean.invoked);
      Method invoked = SimpleInterceptor.invoked;
View Full Code Here

      return "MockNextInterceptor";
   }

   public Object invoke(Invocation invocation) throws Throwable
   {
      SimpleMetaData latest = new SimpleMetaData();
      latest.mergeIn(invocation.getMetaData());
      invocationMetaData.add(latest);
      Object result = null;
      if (returnValues != null)
      {
         try
View Full Code Here

      ClusteredPojiProxy proxy = new ClusteredPojiProxy(oid, uri, new Interceptor[]{interceptor}, wrapper, lbp, FAMILY_BASE, originTarget);
     
      assertEquals(OK, proxy.invoke(this, Object.class.getDeclaredMethod("toString", new Class[]{}), new Object[]{}));
     
      List<SimpleMetaData> history = interceptor.getInvocationHistory();
      SimpleMetaData metadata = history.get(0);
      assertSame(wrapper, metadata.getMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER));
      assertSame(lbp, metadata.getMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY));
      assertSame(FAMILY_BASE, metadata.getMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.PARTITION_NAME));
      assertSame(originTarget, metadata.getMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.HA_TARGET));
      assertSame(oid, metadata.getMetaData(Dispatcher.DISPATCHER, Dispatcher.OID));
      assertSame(uri, metadata.getMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR));
      assertEquals("AOP", metadata.getMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM));
     
   }
View Full Code Here

   }

   public Object createPerInstance(Advisor advisor, InstanceAdvisor instanceAdvisor)
   {
      SimpleMetaData instanceData = instanceAdvisor.getMetaData();
      QueuedTxLock lock = null;
      synchronized(instanceData)
      {
         lock = (QueuedTxLock)instanceData.getMetaData(QueuedTxLock.TXLOCK, QueuedTxLock.TXLOCK);
         if (lock == null)
         {
            lock = new QueuedTxLock();
            instanceData.addMetaData(QueuedTxLock.TXLOCK, QueuedTxLock.TXLOCK, lock, PayloadKey.TRANSIENT);
         }
      }
      return new TxLockInterceptor(getTransactionManager(), lock);
   }
View Full Code Here

      }
   }

   public static String getDefaultMetadataXml(int indent, PrintWriter pw, ClassAdvisor advisor)
   {
      SimpleMetaData metadata = advisor.getDefaultMetaData();

      indent++;
      StringBuffer xml = getMetadataXml(indent, advisor, metadata);

      if (xml != null)
View Full Code Here

      return "";
   }

   public static String getClassMetadataXml(int indent, PrintWriter pw, ClassAdvisor advisor)
   {
      SimpleMetaData metadata = advisor.getClassMetaData();

      indent++;
      StringBuffer xml = getMetadataXml(indent, advisor, metadata);

      if (xml != null)
View Full Code Here

   @Override
   protected void addMetadataToInvocation(MethodInvocation methodInvocation)
   {
      super.addMetadataToInvocation(methodInvocation);
     
      SimpleMetaData metadata = methodInvocation.getMetaData();
      metadata.addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER, family, PayloadKey.TRANSIENT);
      metadata.addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY, lbPolicy, PayloadKey.TRANSIENT);
      metadata.addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.PARTITION_NAME, partitionName, PayloadKey.TRANSIENT);
     
      if (this.usePreferredTarget)
      {
         metadata.addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.HA_TARGET, getUri(), PayloadKey.TRANSIENT);
      }
   }
View Full Code Here

public class NotAdvisedInstanceSimpleMetaDataTestCase extends AbstractProxyTest
{
   public void testSimpleMetaData() throws Exception
   {
      Base base = new Base();
      SimpleMetaData metaData = new SimpleMetaData();
      metaData.addMetaData("Simple", "MetaData", "Value");
      Object proxy = createProxy(base, null, metaData);
      assertFalse(proxy instanceof Advised);
      assertFalse(proxy instanceof AspectManaged);
   }
View Full Code Here

   }

   private Object createProxyWithSimpleMetaData(String value) throws Exception
   {
      Base base = new Base();
      SimpleMetaData metaData = new SimpleMetaData();
      metaData.addMetaData("Simple", "MetaData", value);
      Object proxy = createProxy(base, null, metaData);
      assertTrue(proxy instanceof Advised);
      assertTrue(proxy instanceof AspectManaged);
      return proxy;
   }
View Full Code Here

TOP

Related Classes of org.jboss.aop.metadata.SimpleMetaData

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.