Package org.jboss.metadata.spi.scope

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


*/
public class ClassLoaderDomainScopeFactory implements ScopeFactory<ClassLoaderDomainScope>
{
   public Scope create(ClassLoaderDomainScope annotation)
   {
      return new Scope(new ScopeLevel(CommonLevels.APPLICATION.getLevel() + 10, "ClassLoaderDomainScope"), annotation.value());
   }
View Full Code Here


            );
      assertEquals(subInstanceLevels, CommonLevelsUtil.getExclusiveSubLevels(CommonLevels.INSTANCE));

      try
      {
         CommonLevelsUtil.getSubLevels(new ScopeLevel(7, "foobar"));
         fail("Should not be here");
      }
      catch (Exception e)
      {
         assertInstanceOf(e, IllegalArgumentException.class);
      }

      try
      {
         CommonLevelsUtil.getExclusiveSubLevels(new ScopeLevel(7, "foobar"));
         fail("Should not be here");
      }
      catch (Exception e)
      {
         assertInstanceOf(e, IllegalArgumentException.class);
View Full Code Here

      super(name);
   }

   public void testBasicScopeLevel() throws Exception
   {
      ScopeLevel test = new ScopeLevel(99, "HELLO");
      assertEquals(99, test.getLevel());
      assertEquals("HELLO", test.getName());
      assertEquals(99, test.hashCode());
      assertEquals("HELLO", test.toString());
   }
View Full Code Here

      assertEquals("HELLO", test.toString());
   }

   public void testScopeLevelEquals() throws Exception
   {
      ScopeLevel test1 = new ScopeLevel(1, "HELLO");
      ScopeLevel test2 = new ScopeLevel(1, "HELLO");
      assertEquals(test1, test2);

      ScopeLevel test3 = new ScopeLevel(1, "DIFFERENT");
      assertEquals(test1, test3);
   }
View Full Code Here

      assertEquals(test1, test3);
   }

   public void testScopeLevelNotEquals() throws Exception
   {
      ScopeLevel test1 = new ScopeLevel(1, "HELLO");
      ScopeLevel test2 = new ScopeLevel(2, "HELLO");
      assertFalse(test1.equals(test2));
   }
View Full Code Here

      assertFalse(test1.equals(test2));
   }

   public void testScopeLevelSerialization() throws Exception
   {
      ScopeLevel test1 = new ScopeLevel(99, "HELLO");

      byte[] bytes = serialize(test1);
      ScopeLevel test2 = (ScopeLevel) deserialize(bytes);

      assertEquals(99, test2.getLevel());
      assertEquals("HELLO", test2.getName());
      assertEquals(99, test2.hashCode());
      assertEquals("HELLO", test2.toString());
     
      assertEquals(test1, test2);
   }
View Full Code Here

      assertEquals(test1, test2);
   }

   public void testScopeLevelComparison() throws Exception
   {
      ScopeLevel test1 = new ScopeLevel(1, "HELLO");
      ScopeLevel test2 = new ScopeLevel(2, "HELLO");

      assertTrue(test1.compareTo(test2) < 0);
      assertTrue(test2.compareTo(test1) > 0);

      ScopeLevel test3 = new ScopeLevel(3, "HELLO");

      assertTrue(test1.compareTo(test3) < 0);
      assertTrue(test3.compareTo(test1) > 0);
      assertTrue(test2.compareTo(test3) < 0);
      assertTrue(test3.compareTo(test2) > 0);

      ScopeLevel test4 = new ScopeLevel(1, "HELLO");

      assertTrue(test1.compareTo(test4) == 0);
     
      ScopeLevel test5 = new ScopeLevel(1, "DIFFERENT");

      assertTrue(test1.compareTo(test5) == 0);
   }
View Full Code Here

   }

   public void testScopeLevelSetBehaviourDuplicates() throws Exception
   {
      HashSet<ScopeLevel> set = new HashSet<ScopeLevel>();
      ScopeLevel test1 = new ScopeLevel(1, "HELLO");
      set.add(test1);
      checkSet(set);
      ScopeLevel test2 = new ScopeLevel(1, "HELLO");
      set.add(test2);
      checkSet(set);
      ScopeLevel test3 = new ScopeLevel(1, "DIFFERENT");
      set.add(test3);
      checkSet(set);
   }
View Full Code Here

   }
  
   protected void checkSet(HashSet<ScopeLevel> set) throws Exception
   {
      assertEquals(1, set.size());
      ScopeLevel test = set.iterator().next();
      assertEquals(1, test.getLevel());
      assertEquals("HELLO", test.getName());
   }
View Full Code Here

   }

   public void testScopeLevelSet() throws Exception
   {
      LinkedHashSet<ScopeLevel> set = new LinkedHashSet<ScopeLevel>();
      ScopeLevel test1 = new ScopeLevel(1, "HELLO");
      set.add(test1);
      ScopeLevel test2 = new ScopeLevel(2, "HELLO");
      set.add(test2);
      ScopeLevel test3 = new ScopeLevel(3, "DIFFERENT");
      set.add(test3);
     
      assertEquals(3, set.size());
      Iterator<ScopeLevel> i = set.iterator();
      ScopeLevel test = i.next();
      assertEquals(1, test.getLevel());
      assertEquals("HELLO", test.getName());
      test = i.next();
      assertEquals(2, test.getLevel());
      assertEquals("HELLO", test.getName());
      test = i.next();
      assertEquals(3, test.getLevel());
      assertEquals("DIFFERENT", test.getName());
   }
View Full Code Here

TOP

Related Classes of org.jboss.metadata.spi.scope.ScopeLevel

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.