Package org.jboss.metadata.plugins.context

Examples of org.jboss.metadata.plugins.context.AbstractMetaDataContext


         MetaDataRetrieval emptyRetrieval)
   {
      boolean mix = emptyContext != null && emptyRetrieval != null;
      int size = mix ? 10 : 6;
      MetaDataContext[] contexts = new MetaDataContext[size];
      contexts[0] = new AbstractMetaDataContext(retrievals[0]);
      contexts[1] = new AbstractMetaDataContext(contexts[0], retrievals[1]);
      contexts[2] = new AbstractMetaDataContext(contexts[0], Arrays.asList(retrievals));
      contexts[3] = new CachingMetaDataContext(contexts[0]);
      contexts[4] = new CachingMetaDataContext(contexts[0], retrievals[1]);
      contexts[5] = new CachingMetaDataContext(contexts[0], Arrays.asList(retrievals));
      if (mix)
      {
         contexts[6] = new AbstractMetaDataContext(emptyContext, retrievals[0]);
         contexts[7] = new AbstractMetaDataContext(contexts[0], emptyRetrieval);
         contexts[8] = new CachingMetaDataContext(emptyContext, retrievals[0]);
         contexts[9] = new CachingMetaDataContext(contexts[0], emptyRetrieval);
      }
      return contexts;
   }
View Full Code Here


      assertTrue(mmdl.toString(), mmdl.isEmpty());
      tlmdl.removeAnnotation(TestAnnotation.class);
      assertTrue(tlmdl.toString(), tlmdl.isEmpty());     

      MetaDataRetrieval emptyRetrieval = new MemoryMetaDataLoader();
      MetaDataContext emptyContext = new AbstractMetaDataContext(emptyRetrieval);

      contexts = getMetaDataContexts(retrievals, emptyContext, emptyRetrieval);
      for(MetaDataRetrieval rdr : contexts)
         assertFalse(rdr.toString(), rdr.isEmpty());
   }
View Full Code Here

               assertNull(mmdl.getScopedRetrieval(sl));
            }
         }
      }

      MetaDataContext parent = new AbstractMetaDataContext(retrievals[0]);
      MetaDataContext context = new AbstractMetaDataContext(parent, aemdl);
      assertSame(aemdl, context.getScopedRetrieval(CommonLevels.CLASS));

      MetaDataRetrieval mmdl = new MemoryMetaDataLoader(new ScopeKey(CommonLevels.INSTANCE, "123"));

      context = new AbstractMetaDataContext(parent, mmdl);
      assertSame(mmdl, context.getScopedRetrieval(CommonLevels.INSTANCE));

      context = new AbstractMetaDataContext(parent, Arrays.asList(aemdl, mmdl));
      assertNotNull(context.getScopedRetrieval(CommonLevels.CLASS));
      assertNotNull(context.getScopedRetrieval(CommonLevels.INSTANCE));

      context = new CachingMetaDataContext(parent, Arrays.asList(aemdl, mmdl, aemdl, mmdl));
      assertNotNull(context.getScopedRetrieval(CommonLevels.CLASS));
      assertNotNull(context.getScopedRetrieval(CommonLevels.INSTANCE));

      MetaDataRetrieval expected1 = context.getScopedRetrieval(CommonLevels.CLASS);
      assertSame(expected1, context.getScopedRetrieval(CommonLevels.CLASS));
      MetaDataRetrieval expected2 = context.getScopedRetrieval(CommonLevels.INSTANCE);
      assertSame(expected2, context.getScopedRetrieval(CommonLevels.INSTANCE));

      context.append(ThreadLocalMetaDataLoader.INSTANCE);
      context.remove(ThreadLocalMetaDataLoader.INSTANCE);

      assertNotNull(context.getScopedRetrieval(CommonLevels.CLASS));
      assertNotNull(context.getScopedRetrieval(CommonLevels.INSTANCE));
      assertNotSame(expected1, context.getScopedRetrieval(CommonLevels.CLASS));
      assertNotSame(expected2, context.getScopedRetrieval(CommonLevels.INSTANCE));

      context = new AbstractMetaDataContext(parent, Arrays.asList(mmdl, mmdl));
      assertNull(context.getScopedRetrieval(CommonLevels.CLASS));
      context = new AbstractMetaDataContext(parent, Arrays.asList(aemdl, aemdl));
      assertNull(context.getScopedRetrieval(CommonLevels.INSTANCE));

      parent = new AbstractMetaDataContext(new MemoryMetaDataLoader(new ScopeKey(CommonLevels.INSTANCE, "0123")));
      context = new CachingMetaDataContext(parent, Arrays.asList(mmdl, mmdl));
      assertNull(context.getScopedRetrieval(CommonLevels.CLASS));
      MetaDataRetrieval scr1 = context.getScopedRetrieval(CommonLevels.INSTANCE);
      assertNotNull(scr1);
      assertTrue(scr1.isEmpty());

      parent = new AbstractMetaDataContext(new MemoryMetaDataLoader(new ScopeKey(CommonLevels.CLASS, "0123")));
      context = new CachingMetaDataContext(parent, Arrays.asList(aemdl, aemdl));
      assertNull(context.getScopedRetrieval(CommonLevels.INSTANCE));
      MetaDataRetrieval scr2 = context.getScopedRetrieval(CommonLevels.CLASS);
      assertNotNull(scr2);
      assertFalse(scr2.isEmpty());
   }
View Full Code Here

      return new CachingMetaDataContext(parent, retrievals);
   }

   protected MetaDataContext createChildContext(MetaDataContext parent, List<MetaDataRetrieval> retrievals)
   {
      return new AbstractMetaDataContext(parent, retrievals);
   }
View Full Code Here

   }

   public void testCummulativeAnnotationsItem() throws Exception
   {
      MutableMetaDataLoader parentLoader = createTestMutableMetaDataLoader();
      AbstractMetaDataContext parent = new AbstractMetaDataContext(parentLoader);
     
      MutableMetaDataLoader childLoader = createTestMutableMetaDataLoader();
      AbstractMetaDataContext child = new AbstractMetaDataContext(parent, childLoader);

      AnnotationsItem item = child.retrieveAnnotations();
     
      assertTrue(item.getAnnotations().length == 0);
      assertTrue(item.getValue().length == 0);
      assertTrue(item.isCachable());
      assertTrue(item.isValid());
View Full Code Here

   }

   public void testCummulativeMetaDatasItem() throws Exception
   {
      MutableMetaDataLoader parentLoader = createTestMutableMetaDataLoader();
      AbstractMetaDataContext parent = new AbstractMetaDataContext(parentLoader);
     
      MutableMetaDataLoader childLoader = createTestMutableMetaDataLoader();
      AbstractMetaDataContext child = new AbstractMetaDataContext(parent, childLoader);

      MetaDatasItem item = child.retrieveMetaData();
     
      assertTrue(item.getMetaDatas().length == 0);
      assertTrue(item.getValue().length == 0);
      assertTrue(item.isCachable());
      assertTrue(item.isValid());
View Full Code Here

   }

   public void testCummulativeMetaDatasItemByName() throws Exception
   {
      MutableMetaDataLoader parentLoader = createTestMutableMetaDataLoader();
      AbstractMetaDataContext parent = new AbstractMetaDataContext(parentLoader);
     
      MutableMetaDataLoader childLoader = createTestMutableMetaDataLoader();
      AbstractMetaDataContext child = new AbstractMetaDataContext(parent, childLoader);

      MetaDatasItem item = child.retrieveMetaData();
     
      assertTrue(item.getMetaDatas().length == 0);
      assertTrue(item.getValue().length == 0);
      assertTrue(item.isCachable());
      assertTrue(item.isValid());
View Full Code Here

      super(name, true);
   }

   protected MetaData setupMetaData(MetaDataLoader loader)
   {
      AbstractMetaDataContext context = new AbstractMetaDataContext(null, loader);
      return new MetaDataRetrievalToMetaDataBridge(context);
   }
View Full Code Here

      super(name, false);
   }

   protected MetaData setupMetaData(MetaDataLoader loader)
   {
      AbstractMetaDataContext parent = new AbstractMetaDataContext(null, loader);
      MutableMetaDataLoader empty = createTestMutableMetaDataLoader();
      AbstractMetaDataContext context = new AbstractMetaDataContext(parent, empty);
      return new MetaDataRetrievalToMetaDataBridge(context);
   }
View Full Code Here

      super(name);
   }

   protected MetaDataContext createContext(MetaDataContext parent, List<MetaDataRetrieval> retrievals)
   {
      return new AbstractMetaDataContext(parent, retrievals);
   }
View Full Code Here

TOP

Related Classes of org.jboss.metadata.plugins.context.AbstractMetaDataContext

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.