Examples of ScopeKey


Examples of org.jboss.metadata.spi.scope.ScopeKey

      assertEquals(testScope1.getScopeLevel(), parent.getMaxScopeLevel());
   }

   public void testComplexParent() throws Exception
   {
      ScopeKey key = new ScopeKey();
      key.addScope(testScope1);
      key.addScope(testScope2);
      key.addScope(testScope3);
      key.addScope(testScope4);
      key.addScope(testScope5);
      assertEquals(testScope5.getScopeLevel(), key.getMaxScopeLevel());

      ScopeKey parent = key.getParent();
      assertNotNull(parent);
      ScopeKey expected = new ScopeKey();
      expected.addScope(testScope1);
      expected.addScope(testScope2);
      expected.addScope(testScope3);
      expected.addScope(testScope4);
      assertEquals(expected, parent);
      assertEquals(testScope4.getScopeLevel(), parent.getMaxScopeLevel());

      parent = parent.getParent();
      assertNotNull(parent);
      expected = new ScopeKey();
      expected.addScope(testScope1);
      expected.addScope(testScope2);
      expected.addScope(testScope3);
      assertEquals(expected, parent);
      assertEquals(testScope3.getScopeLevel(), parent.getMaxScopeLevel());

      parent = parent.getParent();
      assertNotNull(parent);
      expected = new ScopeKey();
      expected.addScope(testScope1);
      expected.addScope(testScope2);
      assertEquals(expected, parent);
      assertEquals(testScope2.getScopeLevel(), parent.getMaxScopeLevel());

      parent = parent.getParent();
      assertNotNull(parent);
      expected = new ScopeKey();
      expected.addScope(testScope1);
      assertEquals(expected, parent);
      assertEquals(testScope1.getScopeLevel(), parent.getMaxScopeLevel());

      parent = parent.getParent();
      assertNull(parent);
View Full Code Here

Examples of org.jboss.metadata.spi.scope.ScopeKey

      assertNull(parent);
   }

   public void testIsParentNoScopes() throws Exception
   {
      ScopeKey parent = new ScopeKey(testScope1);
      ScopeKey test = new ScopeKey();
      assertFalse(parent.isParent(test));
   }
View Full Code Here

Examples of org.jboss.metadata.spi.scope.ScopeKey

      assertFalse(parent.isParent(test));
   }

   public void testIsParentSameScope() throws Exception
   {
      ScopeKey parent = new ScopeKey(testScope1);
      assertFalse(parent.isParent(parent));
     
      ScopeKey test = new ScopeKey(testScope1);
      assertFalse(parent.isParent(test));
   }
View Full Code Here

Examples of org.jboss.metadata.spi.scope.ScopeKey

      assertFalse(parent.isParent(test));
   }

   public void testIsParentDifferentLevel() throws Exception
   {
      ScopeKey parent = new ScopeKey(testScope1);
      ScopeKey test = new ScopeKey(testScope2);
      assertFalse(parent.isParent(test));
   }
View Full Code Here

Examples of org.jboss.metadata.spi.scope.ScopeKey

      assertFalse(parent.isParent(test));
   }

   public void testIsParentDifferentQualifier() throws Exception
   {
      ScopeKey parent = new ScopeKey(testScope1);
      ScopeKey test = new ScopeKey(testScope1Different);
      assertFalse(parent.isParent(test));
   }
View Full Code Here

Examples of org.jboss.metadata.spi.scope.ScopeKey

      assertFalse(parent.isParent(test));
   }

   public void testIsParent() throws Exception
   {
      ScopeKey parent = new ScopeKey(testScope1);
      ScopeKey test = new ScopeKey();
      test.addScope(testScope1);
      test.addScope(testScope2);
      assertTrue(parent.isParent(test));

      test = new ScopeKey();
      test.addScope(testScope1);
      test.addScope(testScope3);
      assertTrue(parent.isParent(test));
   }
View Full Code Here

Examples of org.jboss.metadata.spi.scope.ScopeKey

      assertTrue(parent.isParent(test));
   }

   public void testIsParentNotDirectly() throws Exception
   {
      ScopeKey parent = new ScopeKey(testScope1);
      ScopeKey test = new ScopeKey();
      test.addScope(testScope1);
      test.addScope(testScope2);
      test.addScope(testScope3);
      assertFalse(parent.isParent(test));
   }
View Full Code Here

Examples of org.jboss.metadata.spi.scope.ScopeKey

      array[0] = new MemoryMetaDataLoader();
      array[1] = new MemoryMetaDataLoader(true, true);
      array[2] = new MemoryMetaDataLoader(true, false);
      array[3] = new MemoryMetaDataLoader(false, true);
      array[4] = new MemoryMetaDataLoader(false, false);
      ScopeKey key = new ScopeKey(CommonLevels.APPLICATION, "SignatureTester");
      array[5] = new MemoryMetaDataLoader(key);
      array[6] = new MemoryMetaDataLoader(key, true, true);
      array[7] = new MemoryMetaDataLoader(key, true, false);
      array[8] = new MemoryMetaDataLoader(key, false, true);
      array[9] = new MemoryMetaDataLoader(key, false, false);
View Full Code Here

Examples of org.jboss.metadata.spi.scope.ScopeKey

      assertNotNull(aemdl.getScopedRetrieval(CommonLevels.CLASS));
      assertNull(aemdl.getScopedRetrieval(CommonLevels.INSTANCE));

      for(ScopeLevel level : commonLevels)
      {
         MemoryMetaDataLoader mmdl = new MemoryMetaDataLoader(new ScopeKey(level, "123"));
         for(ScopeLevel sl : commonLevels)
         {
            if (sl != level)
            {
               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

Examples of org.jboss.metadata.spi.scope.ScopeKey

         try
         {
            entryLatch.countDown();
            entryLatch.await();

            ScopeKey scopeKey = loader.getScope();
            assertNotNull(scopeKey);
           
            Collection<Scope> scopes = scopeKey.getScopes();
            assertEquals(1, scopes.size());
           
            Scope scope = scopes.iterator().next();
           
            assertEquals(CommonLevels.THREAD, scope.getScopeLevel());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.