Package org.jboss.metadata.spi.retrieval

Examples of org.jboss.metadata.spi.retrieval.MetaDatasItem


   protected void assertMetaData(MetaDataRetrieval metaData, ExpectedMetaData expected) throws Exception
   {
      assertNotNull(metaData);
      assertNotNull(expected);
     
      MetaDatasItem result = metaData.retrieveMetaData();
      assertNotNull("Null result", result);
      MetaDataItem<?>[] items = result.getMetaDatas();
      assertNotNull("Null items", items);
      ExpectedMetaData actual = emptyExpectedMetaData();
      for (MetaDataItem<?> item : items)
      {
         assertNotNull("Null meta data item " + Arrays.asList(items), item);
View Full Code Here


   protected void assertLocalMetaData(MetaDataRetrieval metaData, ExpectedMetaData expected) throws Exception
   {
      assertNotNull(metaData);
      assertNotNull(expected);
     
      MetaDatasItem result = metaData.retrieveLocalMetaData();
      assertNotNull("Null result", result);
      MetaDataItem<?>[] items = result.getMetaDatas();
      assertNotNull("Null items", items);
      ExpectedMetaData actual = emptyExpectedMetaData();
      for (MetaDataItem<?> item : items)
      {
         assertNotNull("Null meta data item " + Arrays.asList(items), item);
View Full Code Here

   protected void assertAnnotationMetaDatas(MetaDataRetrieval metaData, ExpectedAnnotations expected) throws Exception
   {
      assertNotNull(metaData);
      assertNotNull(expected);
     
      MetaDatasItem result = metaData.retrieveMetaData();
      assertNotNull("Null result", result);
      MetaDataItem<?>[] items = result.getMetaDatas();
      assertNotNull("Null items", items);
      ExpectedAnnotations actual = emptyExpectedAnnotations();
      for (MetaDataItem<?> item : items)
      {
         assertNotNull("Null item " + Arrays.asList(items), item);
View Full Code Here

   protected void assertLocalAnnotationMetaDatas(MetaDataRetrieval metaData, ExpectedAnnotations expected) throws Exception
   {
      assertNotNull(metaData);
      assertNotNull(expected);
     
      MetaDatasItem result = metaData.retrieveLocalMetaData();
      assertNotNull("Null result", result);
      MetaDataItem<?>[] items = result.getMetaDatas();
      assertNotNull("Null items", items);
      ExpectedAnnotations actual = emptyExpectedAnnotations();
      for (MetaDataItem<?> item : items)
      {
         assertNotNull("Null item " + Arrays.asList(items), item);
View Full Code Here

      else
         retrievals = context.getLocalRetrievals();

      for (MetaDataRetrieval retrieval : retrievals)
      {
         MetaDatasItem item = retrieval.retrieveMetaData();
         if (item != null)
         {
            MetaDataItem<?>[] items = item.getMetaDatas();
            for (MetaDataItem<?> it : items)
            {
               if (temp == null)
                  temp = new HashSet<MetaDataItem<?>>();
               temp.add(it);
View Full Code Here

   public MetaDatasItem retrieveMetaData()
   {
      if (cachedMetaDatasItem == null)
         cachedMetaDatasItem = factory.createCacheItem(MetaDatasItem.class, getFqn());

      MetaDatasItem item = cachedMetaDatasItem.get();
      if (item == null)
      {
         item = super.retrieveMetaData();
         cachedMetaDatasItem.put(item);
      }
View Full Code Here

      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());
     
      Object object1 = new Object();
      parentLoader.addMetaData(object1, Object.class);
      MetaDataItem<Object> metaDataItem1Parent = parentLoader.retrieveMetaData(Object.class);

      MetaDataItem<?>[] expectedItems = { metaDataItem1Parent };
      assertUnorderedArrayEquals(expectedItems, item.getMetaDatas());
      Object[] expected = { object1 };
      assertUnorderedArrayEquals(expected, item.getValue());
     
      String object2 = "Hello";
      childLoader.addMetaData(object2, String.class);
      MetaDataItem<String> metaDataItem2Child = childLoader.retrieveMetaData(String.class);

      expectedItems = new MetaDataItem[] { metaDataItem1Parent, metaDataItem2Child };
      assertUnorderedArrayEquals(expectedItems, item.getMetaDatas());
      expected = new Object[] { object1, object2 };
      assertUnorderedArrayEquals(expected, item.getValue());
     
      Object object1Child = new Object();
      childLoader.addMetaData(object1Child, Object.class);
      MetaDataItem<Object> metaDataItem1Child = childLoader.retrieveMetaData(Object.class);

      expectedItems = new MetaDataItem[] { metaDataItem1Child, metaDataItem2Child };
      assertUnorderedArrayEquals(expectedItems, item.getMetaDatas());
      expected = new Object[] { object1Child, object2 };
      assertUnorderedArrayEquals(expected, item.getValue());
     
      childLoader.removeMetaData(Object.class);

      expectedItems = new MetaDataItem[] { metaDataItem1Parent, metaDataItem2Child };
      assertUnorderedArrayEquals(expectedItems, item.getMetaDatas());
      expected = new Object[] { object1, object2 };
      assertUnorderedArrayEquals(expected, item.getValue());

      parentLoader.removeMetaData(Object.class);

      expectedItems = new MetaDataItem[] { metaDataItem2Child };
      assertUnorderedArrayEquals(expectedItems, item.getMetaDatas());
      expected = new Object[] { object2 };
      assertUnorderedArrayEquals(expected, item.getValue());
     
      childLoader.removeMetaData(String.class);

      assertTrue(item.getMetaDatas().length == 0);
      assertTrue(item.getValue().length == 0);
   }
View Full Code Here

      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());
     
      Object object1 = new Object();
      parentLoader.addMetaData("Object", object1, Object.class);
      MetaDataItem<?> metaDataItem1Parent = parentLoader.retrieveMetaData("Object");

      MetaDataItem<?>[] expectedItems = { metaDataItem1Parent };
      assertUnorderedArrayEquals(expectedItems, item.getMetaDatas());
      Object[] expected = { object1 };
      assertUnorderedArrayEquals(expected, item.getValue());
     
      String object2 = "Hello";
      childLoader.addMetaData("String", object2, String.class);
      MetaDataItem<?> metaDataItem2Child = childLoader.retrieveMetaData("String");

      expectedItems = new MetaDataItem[] { metaDataItem1Parent, metaDataItem2Child };
      assertUnorderedArrayEquals(expectedItems, item.getMetaDatas());
      expected = new Object[] { object1, object2 };
      assertUnorderedArrayEquals(expected, item.getValue());
     
      Object object1Child = new Object();
      childLoader.addMetaData("Object", object1Child, Object.class);
      MetaDataItem<?> metaDataItem1Child = childLoader.retrieveMetaData("Object");

      expectedItems = new MetaDataItem[] { metaDataItem1Child, metaDataItem2Child };
      assertUnorderedArrayEquals(expectedItems, item.getMetaDatas());
      expected = new Object[] { object1Child, object2 };
      assertUnorderedArrayEquals(expected, item.getValue());
     
      childLoader.removeMetaData("Object", Object.class);

      expectedItems = new MetaDataItem[] { metaDataItem1Parent, metaDataItem2Child };
      assertUnorderedArrayEquals(expectedItems, item.getMetaDatas());
      expected = new Object[] { object1, object2 };
      assertUnorderedArrayEquals(expected, item.getValue());

      parentLoader.removeMetaData("Object", Object.class);

      expectedItems = new MetaDataItem[] { metaDataItem2Child };
      assertUnorderedArrayEquals(expectedItems, item.getMetaDatas());
      expected = new Object[] { object2 };
      assertUnorderedArrayEquals(expected, item.getValue());
     
      childLoader.removeMetaData("String", String.class);

      assertTrue(item.getMetaDatas().length == 0);
      assertTrue(item.getValue().length == 0);
   }
View Full Code Here

      assertTrue(item.isValid());
   }

   public void testNoSimpleMetaDatas() throws Exception
   {
      MetaDatasItem item = SimpleMetaDatasItem.NO_META_DATA;

      MetaDataItem<?>[] items = item.getMetaDatas();
      assertNotNull(items);
      assertEquals(0, items.length);

      Object[] objects = item.getValue();
      assertNotNull(objects);
      assertEquals(0, objects.length);

      assertTrue(item.isCachable());
      assertTrue(item.isValid());
   }
View Full Code Here

      else
         retrievals = context.getLocalRetrievals();

      for (MetaDataRetrieval retrieval : retrievals)
      {
         MetaDatasItem item = retrieval.retrieveMetaData();
         if (item != null)
         {
            MetaDataItem[] items = item.getMetaDatas();
            for (MetaDataItem it : items)
            {
               if (temp == null)
                  temp = new HashSet<MetaDataItem>();
               temp.add(it);
View Full Code Here

TOP

Related Classes of org.jboss.metadata.spi.retrieval.MetaDatasItem

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.