libjboss-metadata-java-2.0.3.GA.orig/0000755000175000017500000000000011620305603017177 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/.classpath0000644000175000017500000000467011061223045021167 0ustar twernertwerner libjboss-metadata-java-2.0.3.GA.orig/pom.xml0000644000175000017500000001057211524771001020523 0ustar twernertwerner org.jboss jboss-parent 5 4.0.0 jboss-mdr 2.0.3.GA jar JBoss MetaData Repository http://www.jboss.com/products/jbossmc JBoss MetaData Repository scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-mdr/tags/2.0.3.GA scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-mdr/tags/2.0.3.GA http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/jboss-mdr/tags/2.0.3.GA 2.2.14.GA 2.0.5.GA 2.0.5.GA 3.10.0.GA 2.0.2.GA 1.1.1.GA 4.4 ${artifactId} org.apache.maven.plugins maven-surefire-plugin 2.4.3 true org/jboss/test/**/*TestCase.java true org.apache.maven.plugins maven-assembly-plugin 2.2-beta-2 src/assembly/metadata-spi.xml src/assembly/metadata.xml org.apache.maven.plugins maven-compiler-plugin 2.0.2 1.5 1.5 org.apache.maven.plugins maven-jar-plugin 2.2 test-jar org.jboss jboss-reflect ${version.org.jboss.reflect} org.jboss jboss-common-core jboss jboss-common-logging-spi javassist javassist ${version.javassist} true org.jboss.logging jboss-logging-spi ${version.jboss.logging.spi} org.jboss jboss-common-core ${version.jboss.common.core} org.jboss.test jboss-test ${version.org.jboss.test} test junit junit ${version.junit} test libjboss-metadata-java-2.0.3.GA.orig/src/0000755000175000017500000000000011620305601017764 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/0000755000175000017500000000000011620305572020752 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/0000755000175000017500000000000011620305572021673 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/0000755000175000017500000000000011620305572022462 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/0000755000175000017500000000000011620305573023603 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/0000755000175000017500000000000011620305601024552 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/ContainerTest.java0000644000175000017500000000366211104024362030205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test; import java.lang.reflect.Array; import org.jboss.util.Objects; import org.jboss.util.JBossObject; /** * A ContainerTest. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class ContainerTest extends AbstractTestCaseWithSetup { /** * Create a new ContainerTest. * * @param name the test name */ public ContainerTest(String name) { super(name); } /** * Default setup with security manager enabled * * @param clazz the class * @return the delegate * @throws Exception for any error */ public static AbstractTestDelegate getDelegate(Class clazz) throws Exception { AbstractTestDelegate delegate = new AbstractTestDelegate(clazz); //delegate.enableSecurity = true; return delegate; } protected static void assertArrays(Object value, Object other) { assertTrue(Objects.equals(value, other)); } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/0000755000175000017500000000000011620305601026332 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/0000755000175000017500000000000011620305601030327 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/test/0000755000175000017500000000000011620305601031306 5ustar twernertwerner././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/test/BasicUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/test/BasicUnitT0000644000175000017500000001354210756326650033263 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.retrieval.test; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.basic.BasicAnnotationItem; import org.jboss.metadata.spi.retrieval.basic.BasicAnnotationsItem; import org.jboss.metadata.spi.retrieval.basic.BasicMetaDataItem; import org.jboss.metadata.spi.retrieval.basic.BasicMetaDatasItem; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.retrieval.support.TestBasicItemMetaDataLoader; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * BasicUnitTestCase. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class BasicUnitTestCase extends AbstractMetaDataTest { public BasicUnitTestCase(String name) { super(name); } public void testBasicAnnotation() throws Exception { TestBasicItemMetaDataLoader loader = new TestBasicItemMetaDataLoader(); TestAnnotationImpl annotation = new TestAnnotationImpl(); BasicAnnotationItem item = new BasicAnnotationItem(loader, annotation); assertEquals(annotation, item.getAnnotation()); assertEquals(annotation, item.getValue()); assertTrue(item.isCachable()); assertTrue(item.isValid()); loader.setCachable(false); assertFalse(item.isCachable()); assertTrue(item.isValid()); item.invalidate(); assertFalse(item.isCachable()); assertFalse(item.isValid()); } public void testBasicAnnotations() throws Exception { TestBasicItemMetaDataLoader loader = new TestBasicItemMetaDataLoader(); TestAnnotation1Impl annotation1 = new TestAnnotation1Impl(); TestAnnotation2Impl annotation2 = new TestAnnotation2Impl(); BasicAnnotationItem item1 = new BasicAnnotationItem(loader, annotation1); BasicAnnotationItem item2 = new BasicAnnotationItem(loader, annotation2); @SuppressWarnings("unchecked") AnnotationItem[] items = { item1, item2 }; @SuppressWarnings("unchecked") BasicAnnotationsItem item = new BasicAnnotationsItem(loader, items); AnnotationItem[] result = item.getAnnotations(); assertUnorderedArrayEquals(items, result); Annotation[] expected = { annotation1, annotation2 }; Annotation[] annotations = item.getValue(); assertUnorderedArrayEquals(expected, annotations); assertTrue(item.isCachable()); assertTrue(item.isValid()); loader.setCachable(false); assertFalse(item.isCachable()); assertTrue(item.isValid()); item1.invalidate(); assertFalse(item.isCachable()); assertFalse(item.isValid()); } public void testBasicMetaData() throws Exception { TestBasicItemMetaDataLoader loader = new TestBasicItemMetaDataLoader(); String object = "Hello"; BasicMetaDataItem item = new BasicMetaDataItem(loader, String.class.getName(), object); assertEquals(object, item.getValue()); assertTrue(item.isCachable()); assertTrue(item.isValid()); loader.setCachable(false); assertFalse(item.isCachable()); assertTrue(item.isValid()); item.invalidate(); assertFalse(item.isCachable()); assertFalse(item.isValid()); } public void testBasicMetaDatas() throws Exception { TestBasicItemMetaDataLoader loader = new TestBasicItemMetaDataLoader(); Object object1 = new Object(); String object2 = "Hello"; BasicMetaDataItem item1 = new BasicMetaDataItem(loader, Object.class.getName(), object1); BasicMetaDataItem item2 = new BasicMetaDataItem(loader, String.class.getName(), object2); MetaDataItem[] items = { item1, item2 }; BasicMetaDatasItem item = new BasicMetaDatasItem(loader, items); MetaDataItem[] result = item.getMetaDatas(); assertUnorderedArrayEquals(items, result); Object[] expected = { object1, object2 }; Object[] objects = item.getValue(); assertUnorderedArrayEquals(expected, objects); assertTrue(item.isCachable()); assertTrue(item.isValid()); loader.setCachable(false); assertFalse(item.isCachable()); assertTrue(item.isValid()); item.invalidate(); assertFalse(item.isCachable()); assertFalse(item.isValid()); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/test/EmptyTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/test/EmptyTestC0000644000175000017500000002357410720305746033317 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.retrieval.test; import java.lang.annotation.Annotation; import java.util.Arrays; import org.jboss.metadata.plugins.context.AbstractMetaDataContext; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.plugins.loader.SimpleMetaDataLoader; import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader; import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader; import org.jboss.metadata.plugins.loader.thread.ThreadLocalMetaDataLoader; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.scope.CommonLevels; import org.jboss.metadata.spi.scope.ScopeLevel; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.retrieval.support.TestAnnotated; import org.jboss.test.metadata.retrieval.support.TestAnnotation; /** * EmptyTestCase. * Tests isEmpty and scope. * * @author Ales Justin */ public class EmptyTestCase extends AbstractMetaDataTest { public EmptyTestCase(String name) { super(name); } protected MetaDataRetrieval[] getSimpleMetaDataRetrievals() { MetaDataRetrieval[] retrievals = new MetaDataRetrieval[4]; retrievals[0] = new AnnotatedElementMetaDataLoader(getClass()); retrievals[1] = new MemoryMetaDataLoader(); retrievals[2] = new SimpleMetaDataLoader(new Annotation[]{}); retrievals[3] = ThreadLocalMetaDataLoader.INSTANCE; return retrievals; } protected MetaDataContext[] getMetaDataContexts( MetaDataRetrieval[] retrievals, MetaDataContext emptyContext, 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; } protected TestAnnotation getAnnotation() { return new TestAnnotation() { public Class annotationType() { return TestAnnotation.class; } }; } public void testEmpty() throws Exception { MetaDataRetrieval[] retrievals = getSimpleMetaDataRetrievals(); for(MetaDataRetrieval rdr : retrievals) assertTrue(rdr.toString(), rdr.isEmpty()); MetaDataContext[] contexts = getMetaDataContexts(retrievals, null, null); for(MetaDataRetrieval rdr : contexts) assertTrue(rdr.toString(), rdr.isEmpty()); retrievals[0] = new AnnotatedElementMetaDataLoader(TestAnnotated.class); MemoryMetaDataLoader mmdl = new MemoryMetaDataLoader(); TestAnnotation annotation = getAnnotation(); mmdl.addMetaData(annotation, TestAnnotation.class); retrievals[1] = mmdl; retrievals[2] = new SimpleMetaDataLoader(new Annotation[]{annotation}); ThreadLocalMetaDataLoader tlmdl = ThreadLocalMetaDataLoader.INSTANCE; tlmdl.addAnnotation(annotation); retrievals[3] = tlmdl; for(MetaDataRetrieval rdr : retrievals) assertFalse(rdr.toString(), rdr.isEmpty()); mmdl.removeMetaData(TestAnnotation.class); 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()); } public void testScopedRetrieval() throws Exception { ScopeLevel[] commonLevels = new ScopeLevel[] { CommonLevels.DOMAIN, CommonLevels.CLUSTER, CommonLevels.MACHINE, CommonLevels.NODE, CommonLevels.JVM, CommonLevels.SERVER, CommonLevels.SUBSYSTEM, CommonLevels.APPLICATION, CommonLevels.DEPLOYMENT, CommonLevels.CLASS, CommonLevels.INSTANCE, CommonLevels.JOINPOINT, CommonLevels.JOINPOINT_OVERRIDE, CommonLevels.THREAD, CommonLevels.WORK, CommonLevels.REQUEST, }; MetaDataRetrieval[] retrievals = getSimpleMetaDataRetrievals(); for(ScopeLevel level : commonLevels) { for(MetaDataRetrieval rdr : retrievals) { MetaDataRetrieval sr = rdr.getScopedRetrieval(level); if (sr != null) assertSame(sr, rdr); } } MetaDataRetrieval aemdl = new AnnotatedElementMetaDataLoader(TestAnnotated.class); 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()); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/test/CummulativeUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/test/Cummulativ0000644000175000017500000002465710756326650033415 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.retrieval.test; import java.lang.annotation.Annotation; import org.jboss.metadata.plugins.context.AbstractMetaDataContext; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDatasItem; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; /** * CummulativeUnitTestCase. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class CummulativeUnitTestCase extends AbstractMetaDataTest { public CummulativeUnitTestCase(String name) { super(name); } 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()); TestAnnotation1Impl annotation1 = new TestAnnotation1Impl(); parentLoader.addAnnotation(annotation1); AnnotationItem annotationItem1Parent = parentLoader.retrieveAnnotation(TestAnnotation1.class); @SuppressWarnings("unchecked") AnnotationItem[] expectedItems = { annotationItem1Parent }; assertUnorderedArrayEquals(expectedItems, item.getAnnotations()); Annotation[] expected = { annotation1 }; assertUnorderedArrayEquals(expected, item.getValue()); TestAnnotation2Impl annotation2 = new TestAnnotation2Impl(); childLoader.addAnnotation(annotation2); AnnotationItem annotationItem2Child = childLoader.retrieveAnnotation(TestAnnotation2.class); expectedItems = new AnnotationItem[] { annotationItem1Parent, annotationItem2Child }; assertUnorderedArrayEquals(expectedItems, item.getAnnotations()); expected = new Annotation[] { annotation1, annotation2 }; assertUnorderedArrayEquals(expected, item.getValue()); TestAnnotation1Impl annotation1Child = new TestAnnotation1Impl(); childLoader.addAnnotation(annotation1Child); AnnotationItem annotationItem1Child = childLoader.retrieveAnnotation(TestAnnotation1.class); expectedItems = new AnnotationItem[] { annotationItem1Child, annotationItem2Child }; assertUnorderedArrayEquals(expectedItems, item.getAnnotations()); expected = new Annotation[] { annotation1Child, annotation2 }; assertUnorderedArrayEquals(expected, item.getValue()); childLoader.removeAnnotation(TestAnnotation1.class); expectedItems = new AnnotationItem[] { annotationItem1Parent, annotationItem2Child }; assertUnorderedArrayEquals(expectedItems, item.getAnnotations()); expected = new Annotation[] { annotation1, annotation2 }; assertUnorderedArrayEquals(expected, item.getValue()); parentLoader.removeAnnotation(TestAnnotation1.class); expectedItems = new AnnotationItem[] { annotationItem2Child }; assertUnorderedArrayEquals(expectedItems, item.getAnnotations()); expected = new Annotation[] { annotation2 }; assertUnorderedArrayEquals(expected, item.getValue()); childLoader.removeAnnotation(TestAnnotation2.class); assertTrue(item.getAnnotations().length == 0); assertTrue(item.getValue().length == 0); } 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()); Object object1 = new Object(); parentLoader.addMetaData(object1, Object.class); MetaDataItem 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 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 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); } 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()); 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); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/test/SimpleUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/test/SimpleUnit0000644000175000017500000001311010756326650033336 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.retrieval.test; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDatasItem; import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationItem; import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationsItem; import org.jboss.metadata.spi.retrieval.simple.SimpleMetaDataItem; import org.jboss.metadata.spi.retrieval.simple.SimpleMetaDatasItem; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * SimpleUnitTestCase. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class SimpleUnitTestCase extends AbstractMetaDataTest { public SimpleUnitTestCase(String name) { super(name); } public void testSimpleAnnotation() throws Exception { TestAnnotationImpl annotation = new TestAnnotationImpl(); SimpleAnnotationItem item = new SimpleAnnotationItem(annotation); assertEquals(annotation, item.getAnnotation()); assertEquals(annotation, item.getValue()); assertTrue(item.isCachable()); assertTrue(item.isValid()); } public void testSimpleAnnotations() throws Exception { TestAnnotation1Impl annotation1 = new TestAnnotation1Impl(); TestAnnotation2Impl annotation2 = new TestAnnotation2Impl(); SimpleAnnotationItem item1 = new SimpleAnnotationItem(annotation1); SimpleAnnotationItem item2 = new SimpleAnnotationItem(annotation2); @SuppressWarnings("unchecked") AnnotationItem[] items = { item1, item2 }; @SuppressWarnings("unchecked") SimpleAnnotationsItem item = new SimpleAnnotationsItem(items); AnnotationItem[] result = item.getAnnotations(); assertUnorderedArrayEquals(items, result); Annotation[] expected = { annotation1, annotation2 }; Annotation[] annotations = item.getValue(); assertUnorderedArrayEquals(expected, annotations); assertTrue(item.isCachable()); assertTrue(item.isValid()); } public void testNoSimpleAnnotations() throws Exception { AnnotationsItem item = SimpleAnnotationsItem.NO_ANNOTATIONS; AnnotationItem[] items = item.getAnnotations(); assertNotNull(items); assertEquals(0, items.length); Annotation[] annotations = item.getValue(); assertNotNull(annotations); assertEquals(0, annotations.length); assertTrue(item.isCachable()); assertTrue(item.isValid()); } public void testSimpleMetaData() throws Exception { String object = "Hello"; SimpleMetaDataItem item = new SimpleMetaDataItem(String.class.getName(), object); assertEquals(object, item.getValue()); assertTrue(item.isCachable()); assertTrue(item.isValid()); } public void testSimpleMetaDatas() throws Exception { Object object1 = new Object(); String object2 = "Hello"; SimpleMetaDataItem item1 = new SimpleMetaDataItem(Object.class.getName(), object1); SimpleMetaDataItem item2 = new SimpleMetaDataItem(String.class.getName(), object2); MetaDataItem[] items = { item1, item2 }; SimpleMetaDatasItem item = new SimpleMetaDatasItem(items); MetaDataItem[] result = item.getMetaDatas(); assertUnorderedArrayEquals(items, result); Object[] expected = { object1, object2 }; Object[] objects = item.getValue(); assertUnorderedArrayEquals(expected, objects); assertTrue(item.isCachable()); 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()); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/test/RetrievalTestSuite.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/test/RetrievalT0000644000175000017500000000344411037356527033336 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.retrieval.test; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * RetrievalTestSuite. * * @author Adrian Brock * @version $Revision: 75917 $ */ public class RetrievalTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Retrieval Tests"); suite.addTest(new TestSuite(HelpersUnitTestCase.class)); suite.addTest(new TestSuite(SimpleUnitTestCase.class)); suite.addTest(new TestSuite(BasicUnitTestCase.class)); suite.addTest(new TestSuite(CummulativeUnitTestCase.class)); suite.addTest(new TestSuite(EmptyTestCase.class)); return suite; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/test/HelpersUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/test/HelpersUni0000644000175000017500000001527210756326650033336 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.retrieval.test; import java.util.Arrays; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.metadata.spi.retrieval.ValidTime; import org.jboss.metadata.spi.retrieval.helper.AnnotationToMetaDataBridge; import org.jboss.metadata.spi.retrieval.helper.AnnotationsToMetaDatasBridge; import org.jboss.metadata.spi.retrieval.helper.MetaDataToAnnotationBridge; import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationItem; import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationsItem; import org.jboss.metadata.spi.retrieval.simple.SimpleMetaDataItem; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.retrieval.support.TestMetaDataRetrieval; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * HelpersUnitTestCase. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class HelpersUnitTestCase extends AbstractMetaDataTest { public HelpersUnitTestCase(String name) { super(name); } public void testValidTime() throws Exception { ValidTime time1 = new ValidTime(); ValidTime time2 = new ValidTime(); assertTrue(time2.getValidTime() >= time1.getValidTime()); time1.invalidate(); assertTrue(time1.getValidTime() > time2.getValidTime()); time2.invalidate(); assertTrue(time2.getValidTime() > time1.getValidTime()); ValidTime time3 = new ValidTime(); assertTrue(time3.getValidTime() >= time1.getValidTime()); assertTrue(time3.getValidTime() >= time2.getValidTime()); } public void testMetaDataRetrievalToMetaDataBridge() throws Exception { TestMetaDataRetrieval test = new TestMetaDataRetrieval(); MetaDataRetrievalToMetaDataBridge metaData = new MetaDataRetrievalToMetaDataBridge(test); metaData.getAnnotation(TestAnnotation.class); assertEquals("retrieveAnnotation", test.lastMethod); metaData.getAnnotations(); assertEquals("retrieveAnnotations", test.lastMethod); metaData.getLocalAnnotations(); assertEquals("retrieveLocalAnnotations", test.lastMethod); metaData.getMetaData(); assertEquals("retrieveMetaData", test.lastMethod); metaData.getLocalMetaData(); assertEquals("retrieveLocalMetaData", test.lastMethod); metaData.getMetaData(Object.class); assertEquals("retrieveMetaData(Class)", test.lastMethod); metaData.getMetaData("Hello"); assertEquals("retrieveMetaData(String)", test.lastMethod); metaData.getMetaData("Hello", Object.class); assertEquals("retrieveMetaData(String)", test.lastMethod); metaData.getValidTime(); assertEquals("getValidTime", test.lastMethod); metaData.isAnnotationPresent(TestAnnotation.class); assertEquals("retrieveAnnotation", test.lastMethod); metaData.isMetaDataPresent(Object.class); assertEquals("retrieveMetaData(Class)", test.lastMethod); metaData.isMetaDataPresent("Hello"); assertEquals("retrieveMetaData(String)", test.lastMethod); metaData.isMetaDataPresent("Hello", Object.class); assertEquals("retrieveMetaData(String)", test.lastMethod); } public void testAnnotationsToMetaDatasBridge() throws Exception { TestAnnotation1Impl annotation1 = new TestAnnotation1Impl(); TestAnnotation2Impl annotation2 = new TestAnnotation2Impl(); SimpleAnnotationItem item1 = new SimpleAnnotationItem(annotation1); SimpleAnnotationItem item2 = new SimpleAnnotationItem(annotation2); @SuppressWarnings("unchecked") AnnotationItem[] items = new AnnotationItem[] { item1, item2 }; @SuppressWarnings("unchecked") SimpleAnnotationsItem item = new SimpleAnnotationsItem(items); AnnotationsToMetaDatasBridge bridge = new AnnotationsToMetaDatasBridge(item); MetaDataItem[] result = bridge.getMetaDatas(); assertTrue(Arrays.equals(items, result)); Object[] expected = new Object[] { annotation1, annotation2 }; Object[] objects = item.getValue(); assertTrue(Arrays.equals(expected, objects)); assertTrue(item.isCachable()); assertTrue(item.isValid()); } public void testAnnotationToMetaDataBridge() throws Exception { TestAnnotation annotation = new TestAnnotationImpl(); SimpleAnnotationItem item = new SimpleAnnotationItem(annotation); AnnotationToMetaDataBridge bridge = new AnnotationToMetaDataBridge(item); assertEquals(annotation, bridge.getValue()); assertTrue(item.isCachable()); assertTrue(item.isValid()); } public void testMetaDataToAnnotationBridge() throws Exception { TestAnnotation annotation = new TestAnnotationImpl(); SimpleMetaDataItem item = new SimpleMetaDataItem(annotation.annotationType().getName(), annotation); MetaDataToAnnotationBridge bridge = new MetaDataToAnnotationBridge(item); assertEquals(annotation, bridge.getAnnotation()); assertEquals(annotation, bridge.getValue()); assertTrue(item.isCachable()); assertTrue(item.isValid()); } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/support/0000755000175000017500000000000011620305601032043 5ustar twernertwerner././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/support/TestMetaDataRetrieval.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/support/TestMet0000644000175000017500000000663710756326650033407 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.retrieval.support; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDatasItem; import org.jboss.metadata.spi.retrieval.ValidTime; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.scope.ScopeLevel; import org.jboss.metadata.spi.signature.Signature; /** * TestMetaDataRetrieval. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class TestMetaDataRetrieval implements MetaDataRetrieval { private static final ScopeLevel testLevel = new ScopeLevel(1, "TEST"); private static final ScopeKey testScopeKey = new ScopeKey(new Scope(testLevel, "TEST")); public String lastMethod; public ScopeKey getScope() { return testScopeKey; } public ValidTime getValidTime() { lastMethod = "getValidTime"; return new ValidTime(); } public AnnotationItem retrieveAnnotation(Class annotationType) { lastMethod = "retrieveAnnotation"; return null; } public AnnotationsItem retrieveAnnotations() { lastMethod = "retrieveAnnotations"; return null; } public AnnotationsItem retrieveLocalAnnotations() { lastMethod = "retrieveLocalAnnotations"; return null; } public MetaDatasItem retrieveMetaData() { lastMethod = "retrieveMetaData"; return null; } public MetaDatasItem retrieveLocalMetaData() { lastMethod = "retrieveLocalMetaData"; return null; } public MetaDataItem retrieveMetaData(Class type) { lastMethod = "retrieveMetaData(Class)"; return null; } public MetaDataItem retrieveMetaData(String name) { lastMethod = "retrieveMetaData(String)"; return null; } public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature) { lastMethod = "getComponentMetaDataRetrieval"; return null; } public boolean isEmpty() { lastMethod = "isEmpty"; return true; } public MetaDataRetrieval getScopedRetrieval(ScopeLevel level) { lastMethod = "getScopedRetrieval"; return null; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/support/TestAnnotation.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/support/TestAnn0000644000175000017500000000263710720305746033364 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.retrieval.support; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.annotation.ElementType; /** * @author Ales Justin */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) public @interface TestAnnotation { } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/support/TestAnnotated.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/support/TestAnn0000644000175000017500000000225510720305746033360 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.retrieval.support; /** * @author Ales Justin */ @TestAnnotation public class TestAnnotated { } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/support/TestBasicItemMetaDataLoader.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/retrieval/support/TestBas0000644000175000017500000000347310667274502033361 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.retrieval.support; import org.jboss.metadata.plugins.loader.BasicMetaDataLoader; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.Item; import org.jboss.util.NotImplementedException; /** * TestBasicItemMetaDataLoader. * * @author Adrian Brock * @version $Revision: 65047 $ */ public class TestBasicItemMetaDataLoader extends BasicMetaDataLoader { private boolean cachable = true; public boolean isCachable(Item item) { return cachable; } public void setCachable(boolean cachable) { this.cachable = cachable; } public AnnotationsItem retrieveAnnotations() { throw new NotImplementedException("retrieveAnnotations"); } public boolean isEmpty() { return true; } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/scope/0000755000175000017500000000000011620305601027443 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/scope/test/0000755000175000017500000000000011620305601030422 5ustar twernertwerner././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/scope/test/CommonLevelsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/scope/test/CommonLevelsUn0000644000175000017500000001063610774421015033270 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.scope.test; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.TreeSet; import org.jboss.metadata.spi.scope.CommonLevels; import org.jboss.metadata.spi.scope.CommonLevelsUtil; import org.jboss.metadata.spi.scope.ScopeLevel; import org.jboss.test.metadata.AbstractMetaDataTest; /** * CommonLevelsUnitTestCase. * * @author Adrian Brock * @author Ales Justin * @version $Revision: 71546 $ */ public class CommonLevelsUnitTestCase extends AbstractMetaDataTest { private ScopeLevel[] commonLevels = new ScopeLevel[] { CommonLevels.DOMAIN, CommonLevels.CLUSTER, CommonLevels.MACHINE, CommonLevels.NODE, CommonLevels.JVM, CommonLevels.SERVER, CommonLevels.SUBSYSTEM, CommonLevels.APPLICATION, CommonLevels.DEPLOYMENT, CommonLevels.CLASS, CommonLevels.INSTANCE, CommonLevels.JOINPOINT, CommonLevels.JOINPOINT_OVERRIDE, CommonLevels.THREAD, CommonLevels.WORK, CommonLevels.REQUEST, }; public CommonLevelsUnitTestCase(String name) { super(name); } public void testCommonLevels() throws Exception { int lastLevel = 0; String lastName = ""; for (ScopeLevel level : commonLevels) { assertTrue(level.getLevel() - lastLevel == 100); assertFalse(lastName.equals(level.getName())); lastLevel = level.getLevel(); lastName = level.getName(); } TreeSet set = new TreeSet(); for (ScopeLevel level : commonLevels) set.add(level); assertTrue(commonLevels.length == set.size()); int index = 0; for (ScopeLevel level : set) assertTrue(commonLevels[index++] == level); } public void testLevelsUtils() throws Exception { List levels = Arrays.asList(commonLevels); assertEquals(levels, CommonLevelsUtil.getSubLevels(CommonLevels.DOMAIN)); assertEmpty(CommonLevelsUtil.getExclusiveSubLevels(CommonLevels.REQUEST)); assertEquals(CommonLevelsUtil.getExclusiveSubLevels(CommonLevels.WORK), Collections.singletonList(CommonLevels.REQUEST)); List instanceLevels = Arrays.asList( CommonLevels.INSTANCE, CommonLevels.JOINPOINT, CommonLevels.JOINPOINT_OVERRIDE, CommonLevels.THREAD, CommonLevels.WORK, CommonLevels.REQUEST ); assertEquals(instanceLevels, CommonLevelsUtil.getSubLevels(CommonLevels.INSTANCE)); List subInstanceLevels = Arrays.asList( CommonLevels.JOINPOINT, CommonLevels.JOINPOINT_OVERRIDE, CommonLevels.THREAD, CommonLevels.WORK, CommonLevels.REQUEST ); 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); } } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/scope/test/ScopeTestSuite.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/scope/test/ScopeTestSuite0000644000175000017500000000334710454442653033314 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.scope.test; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * ScopeTestSuite. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class ScopeTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Scope Tests"); suite.addTest(new TestSuite(ScopeLevelUnitTestCase.class)); suite.addTest(new TestSuite(CommonLevelsUnitTestCase.class)); suite.addTest(new TestSuite(ScopeUnitTestCase.class)); suite.addTest(new TestSuite(ScopeKeyUnitTestCase.class)); return suite; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/scope/test/ScopeUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/scope/test/ScopeUnitTestC0000644000175000017500000000520610454442653033241 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.scope.test; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeLevel; import org.jboss.test.metadata.AbstractMetaDataTest; /** * ScopeUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class ScopeUnitTestCase extends AbstractMetaDataTest { private static ScopeLevel testLevel1 = new ScopeLevel(1, "TEST"); private static ScopeLevel testLevel2 = new ScopeLevel(2, "TEST"); public ScopeUnitTestCase(String name) { super(name); } public void testBasicScope() throws Exception { Scope test = new Scope(testLevel1, "localhost"); assertEquals(testLevel1, test.getScopeLevel()); assertEquals("localhost", test.getQualifier()); } public void testScopeEquals() throws Exception { Scope test1 = new Scope(testLevel1, "localhost"); Scope test2 = new Scope(testLevel1, "localhost"); assertEquals(test1, test2); } public void testScopeNotEquals() throws Exception { Scope test1 = new Scope(testLevel1, "localhost"); Scope test2 = new Scope(testLevel1, "remotehost"); assertFalse(test1.equals(test2)); Scope test3 = new Scope(testLevel2, "localhost"); assertFalse(test1.equals(test3)); } public void testScopeSerialization() throws Exception { Scope test1 = new Scope(testLevel1, "localhost"); byte[] bytes = serialize(test1); Scope test2 = (Scope) deserialize(bytes); assertEquals(testLevel1, test2.getScopeLevel()); assertEquals("localhost", test2.getQualifier()); assertEquals(test1, test2); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/scope/test/ScopeKeyUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/scope/test/ScopeKeyUnitTe0000644000175000017500000006005110454442653033237 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.scope.test; import java.util.Collection; import java.util.HashSet; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.scope.ScopeLevel; import org.jboss.test.metadata.AbstractMetaDataTest; /** * ScopeKeyUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class ScopeKeyUnitTestCase extends AbstractMetaDataTest { private static ScopeLevel testLevel1 = new ScopeLevel(1, "ONE"); private static ScopeLevel testLevel2 = new ScopeLevel(2, "TWO"); private static ScopeLevel testLevel3 = new ScopeLevel(3, "THREE"); private static ScopeLevel testLevel4 = new ScopeLevel(4, "FOUR"); private static ScopeLevel testLevel5 = new ScopeLevel(5, "FIVE"); private static String testQualifier1 = "qualifier1"; private static String testQualifier1Different = "qualifier1Different"; private static String testQualifier2 = "qualifier2"; private static String testQualifier3 = "qualifier3"; private static String testQualifier3Different = "qualifier3Different"; private static String testQualifier4 = "qualifier4"; private static String testQualifier5 = "qualifier5"; private static Scope testScope1 = new Scope(testLevel1, testQualifier1); private static Scope testScope1Different = new Scope(testLevel1, testQualifier1Different); private static Scope testScope2 = new Scope(testLevel2, testQualifier2); private static Scope testScope3 = new Scope(testLevel3, testQualifier3); private static Scope testScope3Different = new Scope(testLevel3, testQualifier3Different); private static Scope testScope4 = new Scope(testLevel4, testQualifier4); private static Scope testScope5 = new Scope(testLevel5, testQualifier5); public ScopeKeyUnitTestCase(String name) { super(name); } public void testBasicScopeKeyConstructor() throws Exception { ScopeKey key = new ScopeKey(); Scope[] expected = new Scope[0]; assertScopeKey(expected, key); assertNull(key.getMaxScopeLevel()); } public void testSingleScopeKeyConstructor() throws Exception { ScopeKey key = new ScopeKey(testScope1); Scope[] expected = new Scope[] { testScope1 }; assertScopeKey(expected, key); assertEquals(testScope1.getScopeLevel(), key.getMaxScopeLevel()); } public void testLevelQualifierScopeKeyConstructor() throws Exception { ScopeKey key = new ScopeKey(testLevel1, testQualifier1); Scope[] expected = new Scope[] { testScope1 }; assertScopeKey(expected, key); assertEquals(testScope1.getScopeLevel(), key.getMaxScopeLevel()); } public void testCollectionScopeKeyConstructor() throws Exception { Scope[] expected = new Scope[] {}; HashSet set = new HashSet(); ScopeKey key = new ScopeKey(set); assertScopeKey(expected, key); expected = new Scope[] { testScope1 }; set = new HashSet(); for (Scope scope : expected) set.add(scope); key = new ScopeKey(set); assertScopeKey(expected, key); assertEquals(testScope1.getScopeLevel(), key.getMaxScopeLevel()); expected = new Scope[] { testScope1, testScope2, testScope3, testScope4, testScope5 }; set = new HashSet(); for (Scope scope : expected) set.add(scope); key = new ScopeKey(set); assertScopeKey(expected, key); assertEquals(testScope5.getScopeLevel(), key.getMaxScopeLevel()); } public void testCollectionScopeKeyConstructorSorts() throws Exception { Scope[] expected = new Scope[] { testScope1, testScope2, testScope3, testScope4, testScope5 }; HashSet set = new HashSet(); set.add(testScope2); set.add(testScope4); set.add(testScope5); set.add(testScope3); set.add(testScope1); ScopeKey key = new ScopeKey(set); assertScopeKey(expected, key); assertEquals(testScope5.getScopeLevel(), key.getMaxScopeLevel()); } public void testArrayScopeKeyConstructor() throws Exception { Scope[] expected = new Scope[] {}; ScopeKey key = new ScopeKey(expected); assertScopeKey(expected, key); expected = new Scope[] { testScope1 }; key = new ScopeKey(expected); assertScopeKey(expected, key); assertEquals(testScope1.getScopeLevel(), key.getMaxScopeLevel()); expected = new Scope[] { testScope1, testScope2, testScope3, testScope4, testScope5 }; key = new ScopeKey(expected); assertScopeKey(expected, key); assertEquals(testScope5.getScopeLevel(), key.getMaxScopeLevel()); } public void testArrayScopeKeyConstructorSorts() throws Exception { Scope[] expected = new Scope[] { testScope1, testScope2, testScope3, testScope4, testScope5 }; Scope[] array = new Scope[] { testScope5, testScope3, testScope1, testScope2, testScope4 }; ScopeKey key = new ScopeKey(array); assertScopeKey(expected, key); assertEquals(testScope5.getScopeLevel(), key.getMaxScopeLevel()); } public void testAddScope() throws Exception { ScopeKey key = new ScopeKey(); assertAddScope(key, testScope1, null); Scope[] expected = new Scope[] { testScope1 }; assertScopeKey(expected, key); assertEquals(testScope1.getScopeLevel(), key.getMaxScopeLevel()); assertAddScope(key, testScope2, null); expected = new Scope[] { testScope1, testScope2 }; assertScopeKey(expected, key); assertEquals(testScope2.getScopeLevel(), key.getMaxScopeLevel()); } public void testAddScopeDuplicate() throws Exception { ScopeKey key = new ScopeKey(); assertAddScope(key, testScope1, null); Scope[] expected = new Scope[] { testScope1 }; assertScopeKey(expected, key); assertEquals(testScope1.getScopeLevel(), key.getMaxScopeLevel()); assertAddScope(key, testScope1, testScope1); assertScopeKey(expected, key); assertEquals(testScope1.getScopeLevel(), key.getMaxScopeLevel()); } public void testAddScopeSorts() throws Exception { ScopeKey key = new ScopeKey(); assertAddScope(key, testScope1, null); assertAddScope(key, testScope3, null); assertAddScope(key, testScope5, null); assertAddScope(key, testScope2, null); assertAddScope(key, testScope4, null); Scope[] expected = new Scope[] { testScope1, testScope2, testScope3, testScope4, testScope5 }; assertScopeKey(expected, key); assertEquals(testScope5.getScopeLevel(), key.getMaxScopeLevel()); } public void testAddScopeChange() throws Exception { ScopeKey key = new ScopeKey(); assertAddScope(key, testScope1, null); Scope[] expected = new Scope[] { testScope1 }; assertScopeKey(expected, key); assertEquals(testScope1.getScopeLevel(), key.getMaxScopeLevel()); assertAddScope(key, testScope1Different, testScope1); expected = new Scope[] { testScope1Different }; assertScopeKey(expected, key); assertEquals(testScope1Different.getScopeLevel(), key.getMaxScopeLevel()); } public void testAddScopeChangeSorts() throws Exception { ScopeKey key = new ScopeKey(); assertAddScope(key, testScope1, null); assertAddScope(key, testScope2, null); assertAddScope(key, testScope3, null); assertAddScope(key, testScope4, null); assertAddScope(key, testScope5, null); Scope[] expected = new Scope[] { testScope1, testScope2, testScope3, testScope4, testScope5 }; assertScopeKey(expected, key); assertEquals(testScope5.getScopeLevel(), key.getMaxScopeLevel()); assertAddScope(key, testScope3Different, testScope3); expected = new Scope[] { testScope1, testScope2, testScope3Different, testScope4, testScope5 }; assertScopeKey(expected, key); assertEquals(testScope5.getScopeLevel(), key.getMaxScopeLevel()); } public void testAddScopeLevelQualifier() throws Exception { ScopeKey key = new ScopeKey(); assertAddScope(key, testLevel1, testQualifier1, null); Scope[] expected = new Scope[] { testScope1 }; assertScopeKey(expected, key); assertEquals(testScope1.getScopeLevel(), key.getMaxScopeLevel()); assertAddScope(key, testLevel2, testQualifier2, null); expected = new Scope[] { testScope1, testScope2 }; assertScopeKey(expected, key); assertEquals(testScope2.getScopeLevel(), key.getMaxScopeLevel()); } public void testAddScopeLevelQualifierDuplicate() throws Exception { ScopeKey key = new ScopeKey(); assertAddScope(key, testLevel1, testQualifier1, null); Scope[] expected = new Scope[] { testScope1 }; assertScopeKey(expected, key); assertEquals(testScope1.getScopeLevel(), key.getMaxScopeLevel()); assertAddScope(key, testLevel1, testQualifier1, testScope1); assertScopeKey(expected, key); assertEquals(testScope1.getScopeLevel(), key.getMaxScopeLevel()); } public void testAddScopeLevelQualifierSorts() throws Exception { ScopeKey key = new ScopeKey(); assertAddScope(key, testLevel4, testQualifier4, null); assertAddScope(key, testLevel2, testQualifier2, null); assertAddScope(key, testLevel1, testQualifier1, null); assertAddScope(key, testLevel3, testQualifier3, null); assertAddScope(key, testLevel5, testQualifier5, null); Scope[] expected = new Scope[] { testScope1, testScope2, testScope3, testScope4, testScope5 }; assertScopeKey(expected, key); assertEquals(testScope5.getScopeLevel(), key.getMaxScopeLevel()); } public void testAddScopeLevelChange() throws Exception { ScopeKey key = new ScopeKey(); assertAddScope(key, testLevel1, testQualifier1, null); Scope[] expected = new Scope[] { testScope1 }; assertScopeKey(expected, key); assertEquals(testScope1.getScopeLevel(), key.getMaxScopeLevel()); assertAddScope(key, testLevel1, testQualifier1Different, testScope1); expected = new Scope[] { testScope1Different }; assertScopeKey(expected, key); assertEquals(testScope1Different.getScopeLevel(), key.getMaxScopeLevel()); } public void testAddScopeLevelChangeSorts() throws Exception { ScopeKey key = new ScopeKey(); assertAddScope(key, testLevel1, testQualifier1, null); assertAddScope(key, testLevel2, testQualifier2, null); assertAddScope(key, testLevel3, testQualifier3, null); assertAddScope(key, testLevel4, testQualifier4, null); assertAddScope(key, testLevel5, testQualifier5, null); Scope[] expected = new Scope[] { testScope1, testScope2, testScope3, testScope4, testScope5 }; assertScopeKey(expected, key); assertEquals(testScope5.getScopeLevel(), key.getMaxScopeLevel()); assertAddScope(key, testLevel3, testQualifier3Different, testScope3); expected = new Scope[] { testScope1, testScope2, testScope3Different, testScope4, testScope5 }; assertScopeKey(expected, key); assertEquals(testScope5.getScopeLevel(), key.getMaxScopeLevel()); } public void testRemoveScope() throws Exception { ScopeKey key = new ScopeKey(); assertAddScope(key, testScope1, null); Scope[] expected = new Scope[] { testScope1 }; assertScopeKey(expected, key); assertEquals(testScope1.getScopeLevel(), key.getMaxScopeLevel()); assertRemoveScope(key, testScope1, testScope1); expected = new Scope[0]; assertScopeKey(expected, key); assertNull(key.getMaxScopeLevel()); } public void testRemoveScopeSorts() throws Exception { ScopeKey key = new ScopeKey(); assertAddScope(key, testScope1, null); assertAddScope(key, testScope2, null); assertAddScope(key, testScope3, null); Scope[] expected = new Scope[] { testScope1, testScope2, testScope3 }; assertScopeKey(expected, key); assertEquals(testScope3.getScopeLevel(), key.getMaxScopeLevel()); assertRemoveScope(key, testScope2, testScope2); expected = new Scope[] { testScope1, testScope3 }; assertScopeKey(expected, key); assertEquals(testScope3.getScopeLevel(), key.getMaxScopeLevel()); } public void testRemoveScopeLevel() throws Exception { ScopeKey key = new ScopeKey(); assertAddScope(key, testLevel1, testQualifier1, null); Scope[] expected = new Scope[] { testScope1 }; assertScopeKey(expected, key); assertEquals(testScope1.getScopeLevel(), key.getMaxScopeLevel()); assertRemoveScope(key, testLevel1, testScope1); expected = new Scope[0]; assertScopeKey(expected, key); assertNull(key.getMaxScopeLevel()); } public void testRemoveScopeLevelSorts() throws Exception { ScopeKey key = new ScopeKey(); assertAddScope(key, testLevel1, testQualifier1, null); assertAddScope(key, testLevel2, testQualifier2, null); assertAddScope(key, testLevel3, testQualifier3, null); Scope[] expected = new Scope[] { testScope1, testScope2, testScope3 }; assertScopeKey(expected, key); assertEquals(testScope3.getScopeLevel(), key.getMaxScopeLevel()); assertRemoveScope(key, testLevel2, testScope2); expected = new Scope[] { testScope1, testScope3 }; assertScopeKey(expected, key); assertEquals(testScope3.getScopeLevel(), key.getMaxScopeLevel()); } public void testFreeze() throws Exception { ScopeKey key = new ScopeKey(testScope1); key.freeze(); try { key.addScope(testScope1); fail("Should not be here!"); } catch (IllegalStateException expected) { } try { key.addScope(testLevel1, testQualifier1); fail("Should not be here!"); } catch (IllegalStateException expected) { } try { key.removeScope(testScope1); fail("Should not be here!"); } catch (IllegalStateException expected) { } try { key.removeScopeLevel(testLevel1); fail("Should not be here!"); } catch (IllegalStateException expected) { } } public void testNoParentEmpty() throws Exception { ScopeKey key = new ScopeKey(); ScopeKey parent = key.getParent(); assertNull(parent); } public void testNoParentSingleScope() throws Exception { ScopeKey key = new ScopeKey(); key.addScope(testScope1); ScopeKey parent = key.getParent(); assertNull(parent); } public void testSimpleParent() throws Exception { ScopeKey key = new ScopeKey(); key.addScope(testScope1); key.addScope(testScope2); ScopeKey parent = key.getParent(); assertNotNull(parent); ScopeKey expected = new ScopeKey(); expected.addScope(testScope1); assertEquals(expected, parent); 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); } public void testIsParentNoScopes() throws Exception { ScopeKey parent = new ScopeKey(testScope1); ScopeKey test = new 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)); } public void testIsParentDifferentLevel() throws Exception { ScopeKey parent = new ScopeKey(testScope1); ScopeKey test = new ScopeKey(testScope2); assertFalse(parent.isParent(test)); } public void testIsParentDifferentQualifier() throws Exception { ScopeKey parent = new ScopeKey(testScope1); ScopeKey test = new ScopeKey(testScope1Different); 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)); } 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)); } public void testIsParentNotChild() throws Exception { ScopeKey parent = new ScopeKey(); parent.addScope(testScope1); parent.addScope(testScope2); ScopeKey test = new ScopeKey(); test.addScope(testScope1); assertFalse(parent.isParent(test)); } public void testIsParentComplicated() throws Exception { ScopeKey parent = new ScopeKey(); parent.addScope(testScope1); parent.addScope(testScope2); parent.addScope(testScope3); parent.addScope(testScope4); ScopeKey test = new ScopeKey(); test.addScope(testScope1); test.addScope(testScope2); test.addScope(testScope3); test.addScope(testScope4); test.addScope(testScope5); assertTrue(parent.isParent(test)); } public void testEqualsEmpty() throws Exception { ScopeKey key1 = new ScopeKey(); ScopeKey key2 = new ScopeKey(); assertEquals(key1, key2); } public void testEqualsAfterAdd() throws Exception { ScopeKey key1 = new ScopeKey(); ScopeKey key2 = new ScopeKey(); assertAddScope(key1, testScope1, null); assertAddScope(key2, testScope1, null); assertAddScope(key1, testScope2, null); assertAddScope(key2, testScope2, null); assertAddScope(key1, testScope3, null); assertAddScope(key2, testScope3, null); assertEquals(key1, key2); } public void testEqualsAfterRemove() throws Exception { ScopeKey key1 = new ScopeKey(); ScopeKey key2 = new ScopeKey(); assertAddScope(key1, testScope1, null); assertAddScope(key2, testScope1, null); assertAddScope(key1, testScope2, null); assertAddScope(key2, testScope2, null); assertAddScope(key1, testScope3, null); assertAddScope(key2, testScope3, null); assertRemoveScope(key1, testScope2, testScope2); assertRemoveScope(key2, testScope2, testScope2); assertEquals(key1, key2); } public void testEqualsAfterReplace() throws Exception { ScopeKey key1 = new ScopeKey(); ScopeKey key2 = new ScopeKey(); assertAddScope(key1, testScope1, null); assertAddScope(key2, testScope1, null); assertAddScope(key1, testScope2, null); assertAddScope(key2, testScope2, null); assertAddScope(key1, testScope3, null); assertAddScope(key2, testScope3, null); assertAddScope(key1, testScope3Different, testScope3); assertAddScope(key2, testScope3Different, testScope3); assertEquals(key1, key2); } public void testNotEqualsAfterAdd() throws Exception { ScopeKey key1 = new ScopeKey(); ScopeKey key2 = new ScopeKey(); assertAddScope(key1, testScope1, null); assertAddScope(key2, testScope1, null); assertAddScope(key1, testScope2, null); assertAddScope(key2, testScope2, null); assertEquals(key1, key2); assertAddScope(key1, testScope3, null); assertFalse(key1.equals(key2)); } public void testNotEqualsAfterRemove() throws Exception { ScopeKey key1 = new ScopeKey(); ScopeKey key2 = new ScopeKey(); assertAddScope(key1, testScope1, null); assertAddScope(key2, testScope1, null); assertAddScope(key1, testScope2, null); assertAddScope(key2, testScope2, null); assertAddScope(key1, testScope3, null); assertAddScope(key2, testScope3, null); assertEquals(key1, key2); assertRemoveScope(key1, testScope2, testScope2); assertFalse(key1.equals(key2)); } public void testNotEqualsAfterReplace() throws Exception { ScopeKey key1 = new ScopeKey(); ScopeKey key2 = new ScopeKey(); assertAddScope(key1, testScope1, null); assertAddScope(key2, testScope1, null); assertAddScope(key1, testScope2, null); assertAddScope(key2, testScope2, null); assertAddScope(key1, testScope3, null); assertAddScope(key2, testScope3, null); assertEquals(key1, key2); assertAddScope(key1, testScope3Different, testScope3); assertFalse(key1.equals(key2)); } protected void assertScopeKey(Scope[] scopes, ScopeKey key) throws Exception { assertNotNull(scopes); assertNotNull(key); Collection result = key.getScopes(); assertEquals(scopes.length, result.size()); int index = 0; for (Scope scope : result) assertEquals(scopes[index++], scope); } protected void assertAddScope(ScopeKey key, Scope add, Scope expected) throws Exception { Scope previous = key.addScope(add); assertEquals(expected, previous); } protected void assertRemoveScope(ScopeKey key, Scope remove, Scope expected) throws Exception { Scope previous = key.removeScope(remove); assertEquals(expected, previous); } protected void assertAddScope(ScopeKey key, ScopeLevel level, String qualifier, Scope expected) throws Exception { Scope previous = key.addScope(level, qualifier); assertEquals(expected, previous); } protected void assertRemoveScope(ScopeKey key, ScopeLevel level, Scope expected) throws Exception { Scope previous = key.removeScopeLevel(level); assertEquals(expected, previous); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/scope/test/ScopeLevelUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/scope/test/ScopeLevelUnit0000644000175000017500000001506510454442653033272 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.scope.test; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import org.jboss.metadata.spi.scope.ScopeLevel; import org.jboss.test.metadata.AbstractMetaDataTest; /** * ScopeUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class ScopeLevelUnitTestCase extends AbstractMetaDataTest { public ScopeLevelUnitTestCase(String name) { 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()); } 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); } public void testScopeLevelNotEquals() throws Exception { ScopeLevel test1 = new ScopeLevel(1, "HELLO"); ScopeLevel test2 = new ScopeLevel(2, "HELLO"); 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); } 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); } public void testScopeLevelSetBehaviourDuplicates() throws Exception { HashSet set = new HashSet(); 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); } protected void checkSet(HashSet set) throws Exception { assertEquals(1, set.size()); ScopeLevel test = set.iterator().next(); assertEquals(1, test.getLevel()); assertEquals("HELLO", test.getName()); } public void testScopeLevelSet() throws Exception { LinkedHashSet set = new LinkedHashSet(); 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 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()); } public void testScopeLevelMapBehaviourDuplicates() throws Exception { HashMap map = new HashMap(); ScopeLevel test1 = new ScopeLevel(1, "HELLO"); map.put(test1, new Object()); checkMap(map); ScopeLevel test2 = new ScopeLevel(1, "HELLO"); map.put(test2, new Object()); checkMap(map); ScopeLevel test3 = new ScopeLevel(1, "DIFFERENT"); map.put(test3, new Object()); checkMap(map); } protected void checkMap(HashMap map) throws Exception { assertEquals(1, map.size()); ScopeLevel test = map.keySet().iterator().next(); assertEquals(1, test.getLevel()); assertEquals("HELLO", test.getName()); } public void testScopeLevelMap() throws Exception { LinkedHashMap map = new LinkedHashMap(); ScopeLevel test1 = new ScopeLevel(1, "HELLO"); Object object1 = new Object(); map.put(test1, object1); ScopeLevel test2 = new ScopeLevel(2, "HELLO"); Object object2 = new Object(); map.put(test2, object2); ScopeLevel test3 = new ScopeLevel(3, "DIFFERENT"); Object object3 = new Object(); map.put(test3, object3); assertEquals(3, map.size()); Iterator i = map.keySet().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()); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/SignatureMetaDataTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/SignatureMetaDataTest.jav0000644000175000017500000002360411006173304033244 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.Calendar; import java.util.TimeZone; import org.jboss.config.plugins.property.PropertyConfiguration; import org.jboss.config.spi.Configuration; import org.jboss.metadata.spi.signature.ConstructorParametersSignature; import org.jboss.metadata.spi.signature.ConstructorSignature; import org.jboss.metadata.spi.signature.FieldSignature; import org.jboss.metadata.spi.signature.MethodParametersSignature; import org.jboss.metadata.spi.signature.MethodSignature; import org.jboss.metadata.spi.signature.Signature; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.FieldInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.test.metadata.shared.support.SignatureTester; /** * SignatureMetaDataTest. * * @author Ales Justin */ public abstract class SignatureMetaDataTest extends AbstractMetaDataTest { private static final Configuration configuration = new PropertyConfiguration(); public SignatureMetaDataTest(String name) { super(name); } protected ConstructorSignature getStringParameterConstructorSignature() { return new ConstructorSignature(new String[]{Calendar.class.getName()}); } protected ConstructorSignature getDefaultConstructorSignature() { return new ConstructorSignature(); } protected ConstructorSignature getClassParameterConstructorSignature() throws Exception { return new ConstructorSignature(getConstructor()); } protected ConstructorSignature getClassInfoParameterConstructorSignature() throws Exception { return new ConstructorSignature(getConstructorInfo()); } protected MethodSignature getStringMethodSignature() throws Exception { return new MethodSignature("applyTimeZone", new String[]{Calendar.class.getName(), TimeZone.class.getName()}); } protected MethodSignature getClassMethodSignature() throws Exception { return new MethodSignature("applyTimeZone", Calendar.class, TimeZone.class); } protected MethodSignature getMethodSignature() throws Exception { return new MethodSignature(getMethod()); } protected MethodSignature getMethodInfoSignature() throws Exception { return new MethodSignature(getMethodInfo()); } protected FieldSignature getStringFieldSignature() { return new FieldSignature("calendar"); } protected FieldSignature getFieldSignature() throws Exception { return new FieldSignature(getField()); } protected FieldSignature getFieldInfoSignature() { return new FieldSignature(getFieldInfo()); } protected MethodParametersSignature getStringMethodParametersSignature() { return new MethodParametersSignature("applyTimeZone", new String[]{Calendar.class.getName(), TimeZone.class.getName()}, 0); } protected MethodParametersSignature getClassMethodParametersSignature() throws Exception { return new MethodParametersSignature("applyTimeZone", 0, Calendar.class, TimeZone.class); } protected MethodParametersSignature getMethodParametersSignature() throws Exception { return new MethodParametersSignature(getMethod(), 0); } protected MethodParametersSignature getMethodInfoParametersSignature() throws Exception { return new MethodParametersSignature(getMethodInfo(), 0); } protected ConstructorParametersSignature getStringConstructorParametersSignature() throws Exception { return new ConstructorParametersSignature(0, Calendar.class.getName()); } protected ConstructorParametersSignature getClassConstructorParametersSignature() throws Exception { return new ConstructorParametersSignature(0, Calendar.class); } protected ConstructorParametersSignature getConstructorParametersSignature() throws Exception { return new ConstructorParametersSignature(getConstructor(), 0); } protected ConstructorParametersSignature getConstructorInfoParametersSignature() throws Exception { return new ConstructorParametersSignature(getConstructorInfo(), 0); } protected Constructor getConstructor() throws Exception { return SignatureTester.class.getDeclaredConstructor(Calendar.class); } protected ConstructorInfo getConstructorInfo() { ClassInfo classInfo = configuration.getClassInfo(SignatureTester.class); TypeInfo calendarTypeInfo = configuration.getTypeInfo(Calendar.class); return classInfo.getDeclaredConstructor(new TypeInfo[]{calendarTypeInfo}); } protected Method getMethod() throws Exception { return SignatureTester.class.getDeclaredMethod("applyTimeZone", Calendar.class, TimeZone.class); } protected MethodInfo getMethodInfo() { ClassInfo classInfo = configuration.getClassInfo(SignatureTester.class); TypeInfo calendarTypeInfo = configuration.getTypeInfo(Calendar.class); TypeInfo timeZoneTypeInfo = configuration.getTypeInfo(TimeZone.class); return classInfo.getDeclaredMethod("applyTimeZone", new TypeInfo[]{calendarTypeInfo, timeZoneTypeInfo}); } protected Field getField() throws Exception { return SignatureTester.class.getDeclaredField("calendar"); } protected FieldInfo getFieldInfo() { ClassInfo classInfo = configuration.getClassInfo(SignatureTester.class); return classInfo.getDeclaredField("calendar"); } protected Signature[] getSignatures() throws Exception { Signature[] signatures = new Signature[19]; signatures[0] = getDefaultConstructorSignature(); signatures[1] = getStringParameterConstructorSignature(); signatures[2] = getClassParameterConstructorSignature(); signatures[3] = getClassInfoParameterConstructorSignature(); signatures[4] = getStringMethodSignature(); signatures[5] = getClassMethodSignature(); signatures[6] = getMethodSignature(); signatures[7] = getMethodInfoSignature(); signatures[8] = getStringFieldSignature(); signatures[9] = getFieldSignature(); signatures[10] = getFieldInfoSignature(); signatures[11] = getClassMethodParametersSignature(); signatures[12] = getStringMethodParametersSignature(); signatures[13] = getMethodParametersSignature(); signatures[14] = getMethodInfoParametersSignature(); signatures[15] = getStringConstructorParametersSignature(); signatures[16] = getClassConstructorParametersSignature(); signatures[17] = getConstructorParametersSignature(); signatures[18] = getConstructorInfoParametersSignature(); return signatures; } protected ConstructorSignature[] getConstructorSignatures() throws Exception { ConstructorSignature[] signatures = new ConstructorSignature[4]; signatures[0] = getDefaultConstructorSignature(); signatures[1] = getStringParameterConstructorSignature(); signatures[2] = getClassParameterConstructorSignature(); signatures[3] = getClassInfoParameterConstructorSignature(); return signatures; } protected MethodSignature[] getMethodSignatures() throws Exception { MethodSignature[] signatures = new MethodSignature[4]; signatures[0] = getStringMethodSignature(); signatures[1] = getClassMethodSignature(); signatures[2] = getMethodSignature(); signatures[3] = getMethodInfoSignature(); return signatures; } protected FieldSignature[] getFieldSignatures() throws Exception { FieldSignature[] signatures = new FieldSignature[3]; signatures[0] = getStringFieldSignature(); signatures[1] = getFieldSignature(); signatures[2] = getFieldInfoSignature(); return signatures; } protected MethodParametersSignature[] getMethodParametersSignatures() throws Exception { MethodParametersSignature[] signatures = new MethodParametersSignature[4]; signatures[0] = getClassMethodParametersSignature(); signatures[1] = getStringMethodParametersSignature(); signatures[2] = getMethodParametersSignature(); signatures[3] = getMethodInfoParametersSignature(); return signatures; } protected ConstructorParametersSignature[] getConstructorParametersSignatures() throws Exception { ConstructorParametersSignature[] signatures = new ConstructorParametersSignature[4]; signatures[0] = getStringConstructorParametersSignature(); signatures[1] = getClassConstructorParametersSignature(); signatures[2] = getConstructorParametersSignature(); signatures[3] = getConstructorInfoParametersSignature(); return signatures; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/MetaDataAllTestSuite.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/MetaDataAllTestSuite.java0000644000175000017500000000422110703620003033154 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata; import org.jboss.test.metadata.context.MetaDataContextTestSuite; import org.jboss.test.metadata.loader.MetaDataLoaderTestSuite; import org.jboss.test.metadata.repository.test.RepositoryTestSuite; import org.jboss.test.metadata.retrieval.test.RetrievalTestSuite; import org.jboss.test.metadata.scope.test.ScopeTestSuite; import org.jboss.test.metadata.spi.ContainerSPITestSuite; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * MetaData All Test Suite. * * @author Adrian Brock * @version $Revision: 66074 $ */ public class MetaDataAllTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("MetaData Tests"); suite.addTest(RetrievalTestSuite.suite()); suite.addTest(ScopeTestSuite.suite()); suite.addTest(MetaDataLoaderTestSuite.suite()); suite.addTest(MetaDataContextTestSuite.suite()); suite.addTest(RepositoryTestSuite.suite()); suite.addTest(ContainerSPITestSuite.suite()); return suite; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/AbstractMetaDataTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/AbstractMetaDataTest.java0000644000175000017500000021341710756326650033231 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata; import java.lang.annotation.Annotation; import java.util.Arrays; import java.util.Collection; import java.util.List; import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.MutableMetaData; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDatasItem; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.test.BaseTestCase; import org.jboss.test.metadata.shared.support.ExpectedAnnotations; import org.jboss.test.metadata.shared.support.ExpectedMetaData; /** * AbstractMetaDataTest. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class AbstractMetaDataTest extends BaseTestCase { public AbstractMetaDataTest(String name) { super(name); } /** * Assert two unordered arrays are equal * * @param expected the expected values * @param actual the actual values */ public void assertUnorderedArrayEquals(Object[] expected, Object[] actual) { if (expected == null && actual == null) return; if (expected == null || actual == null) fail("Expected " + expected + " got " + actual); List expectedList = Arrays.asList(expected); List actualList = Arrays.asList(actual); if (expectedList.containsAll(actualList) == false || actualList.containsAll(expectedList) == false) fail("Expected " + expectedList + " got " + actualList); } /** * Create a test mutable meta data loader * * @return the implementation */ public MutableMetaDataLoader createTestMutableMetaDataLoader() { return new MemoryMetaDataLoader(); } /** * Create a test mutable meta data loader * * @param key the scope key * @return the implementation */ public MutableMetaDataLoader createTestMutableMetaDataLoader(ScopeKey key) { return new MemoryMetaDataLoader(key); } /** * Assert an annotation * * @param the type * @param metaData the meta data * @param type the annotation type * @throws Exception for any error */ protected void assertAnnotation(MetaData metaData, Class type) throws Exception { assertNotNull(metaData); assertNotNull(type); assertTrue(metaData.isAnnotationPresent(type)); checkAnnotation(type, metaData.getAnnotation(type)); assertTrue(metaData.isMetaDataPresent(type)); checkAnnotation(type, metaData.getMetaData(type)); assertTrue(metaData.isMetaDataPresent(type.getName())); checkAnnotation(type, metaData.getMetaData(type.getName())); assertTrue(metaData.isMetaDataPresent(type.getName(), type)); checkAnnotation(type, metaData.getMetaData(type.getName(), type)); } /** * Assert an annotation * * @param the type * @param metaData the retrieval * @param type the annotation type * @throws Exception for any error */ protected void assertAnnotation(MetaDataRetrieval metaData, Class type) throws Exception { assertNotNull(metaData); assertNotNull(type); checkAnnotation(type, metaData.retrieveAnnotation(type)); checkAnnotation(type, metaData.retrieveMetaData(type)); checkAnnotation(type, metaData.retrieveMetaData(type.getName())); } /** * Assert meta data * * @param the type * @param metaData the meta data * @param type the type * @throws Exception for any error */ protected void assertMetaData(MetaData metaData, Class type) throws Exception { assertNotNull(metaData); assertNotNull(type); assertTrue(metaData.isMetaDataPresent(type)); checkMetaData(type, metaData.getMetaData(type)); assertTrue(metaData.isMetaDataPresent(type.getName())); checkMetaData(type, metaData.getMetaData(type.getName())); assertTrue(metaData.isMetaDataPresent(type.getName(), type)); checkMetaData(type, metaData.getMetaData(type.getName(), type)); } /** * Assert meta data * * @param the type * @param metaData the retrieval * @param type the type * @throws Exception for any error */ protected void assertMetaData(MetaDataRetrieval metaData, Class type) throws Exception { assertNotNull(metaData); assertNotNull(type); checkMetaData(type, metaData.retrieveMetaData(type)); checkMetaData(type, metaData.retrieveMetaData(type.getName())); } /** * Assert meta data * * @param the type * @param metaData the meta data * @param name the name * @param type the type * @throws Exception for any error */ @SuppressWarnings("unchecked") protected void assertMetaData(MetaData metaData, String name, Class type) throws Exception { assertNotNull(metaData); assertNotNull(name); assertNotNull(type); assertTrue(metaData.isMetaDataPresent(name)); checkMetaData(type, metaData.getMetaData(name)); assertTrue(metaData.isMetaDataPresent(name, type)); checkMetaData(type, metaData.getMetaData(name, type)); } /** * Assert meta data * * @param the type * @param metaData the retrieval * @param name the name * @param type the type * @throws Exception for any error */ protected void assertMetaData(MetaDataRetrieval metaData, String name, Class type) throws Exception { assertNotNull(metaData); assertNotNull(name); assertNotNull(type); checkMetaData(type, metaData.retrieveMetaData(name)); } /** * Assert an annotation is not present * * @param the type * @param metaData the meta data * @param type the annotation type * @throws Exception for any error */ protected void assertNoAnnotation(MetaData metaData, Class type) throws Exception { assertNotNull(metaData); assertNotNull(type); assertFalse(metaData.isAnnotationPresent(type)); assertFalse(metaData.isMetaDataPresent(type)); assertFalse(metaData.isMetaDataPresent(type.getName())); assertFalse(metaData.isMetaDataPresent(type.getName(), type)); } /** * Assert an annotation is not present * * @param the type * @param metaData the retrieval * @param type the annotation type * @throws Exception for any error */ protected void assertNoAnnotation(MetaDataRetrieval metaData, Class type) throws Exception { assertNotNull(metaData); assertNotNull(type); assertNull(metaData.retrieveAnnotation(type)); assertNull(metaData.retrieveMetaData(type)); assertNull(metaData.retrieveMetaData(type.getName())); } /** * Assert a metadata type is not present * * @param the type * @param metaData the meta data * @param type the type * @throws Exception for any error */ protected void assertNoMetaData(MetaData metaData, Class type) throws Exception { assertNotNull(metaData); assertNotNull(type); assertFalse(metaData.isMetaDataPresent(type)); assertFalse(metaData.isMetaDataPresent(type.getName())); assertFalse(metaData.isMetaDataPresent(type.getName(), type)); } /** * Assert a metadata type is not present * * @param the type * @param metaData the meta data * @param type the type * @throws Exception for any error */ protected void assertNoMetaData(MetaDataRetrieval metaData, Class type) throws Exception { assertNotNull(metaData); assertNotNull(type); assertNull(metaData.retrieveMetaData(type)); assertNull(metaData.retrieveMetaData(type.getName())); } /** * Assert a metadata name is not present * * @param the type * @param metaData the meta data * @param name the name * @param type the type * @throws Exception for any error */ protected void assertNoMetaData(MetaData metaData, String name, Class type) throws Exception { assertNotNull(metaData); assertNotNull(name); assertNotNull(type); assertFalse(metaData.isMetaDataPresent(type.getName())); assertFalse(metaData.isMetaDataPresent(type.getName(), type)); } /** * Assert a metadata name is not present * * @param the type * @param metaData the retrieval * @param name the name * @param type the type * @throws Exception for any error */ protected void assertNoMetaData(MetaDataRetrieval metaData, String name, Class type) throws Exception { assertNotNull(metaData); assertNotNull(name); assertNotNull(type); assertNull(metaData.retrieveMetaData(name)); } /** * Check an annotation has the expected type * * @param expected the expected type * @param result the annotation * @throws Exception for any error */ protected void checkAnnotation(Class expected, Object result) throws Exception { assertNotNull("Annotation should not be null", result); assertTrue(result.getClass().getName() + " should be an instance of " + expected.getName(), expected.isInstance(result)); } /** * Check an annotation has the expected type * * @param expected the expected type * @param result the annotation * @throws Exception for any error */ protected void checkAnnotation(Class expected, AnnotationItem result) throws Exception { assertNotNull("AnnotationItem should not be null", result); assertTrue(result.isValid()); Annotation annotation = result.getAnnotation(); checkAnnotation(expected, annotation); } /** * Check an annotation has the expected type * * @param expected the expected type * @param result the annotation * @throws Exception for any error */ protected void checkAnnotation(Class expected, MetaDataItem result) throws Exception { assertNotNull("MetaDataItem should not be null", result); assertTrue(result.isValid()); Object object = result.getValue(); checkAnnotation(expected, object); } /** * Check meta data has the expected type * * @param expected the expected type * @param result the meta data * @throws Exception for any error */ protected void checkMetaData(Class expected, Object result) throws Exception { assertNotNull("MetaData should not be null", result); assertTrue(result.getClass().getName() + " should be an instance of " + expected.getName(), expected.isInstance(result)); } /** * Check meta data has the expected type * * @param expected the expected type * @param result the meta data * @throws Exception for any error */ protected void checkMetaData(Class expected, MetaDataItem result) throws Exception { assertNotNull("MetaDataItem should not be null", result); assertTrue(result.isValid()); Object object = result.getValue(); checkMetaData(expected, object); } /** * Check an annotation is added with no previous * * @param the type * @param mutable the meta data * @param annotation the annotation * @param expectedAnnotations the expected annotations * @param last the last valid time * @return the new valid time * @throws Exception for any error */ protected long assertAddAnnotationNoPrevious(MutableMetaData mutable, T annotation, ExpectedAnnotations expectedAnnotations, long last) throws Exception { MetaData metaData = (MetaData) mutable; return assertAddAnnotationNoPrevious(metaData, mutable, annotation, expectedAnnotations, last); } /** * Check an annotation is added with no previous * * @param the type * @param metaData the meta data * @param mutable the mutable * @param annotation the annotation * @param expectedAnnotations the expected annotations * @param last the last valid time * @return the new valid time * @throws Exception for any error */ protected long assertAddAnnotationNoPrevious(MetaData metaData, MutableMetaData mutable, T annotation, ExpectedAnnotations expectedAnnotations, long last) throws Exception { assertNotNull(metaData); assertNotNull(mutable); assertNotNull(annotation); Class expected = annotation.annotationType(); expectedAnnotations.add(expected); assertFalse(metaData.isAnnotationPresent(expected)); assertFalse(metaData.isMetaDataPresent(expected)); assertFalse(metaData.isMetaDataPresent(expected.getName())); assertFalse(metaData.isMetaDataPresent(expected.getName(), expected)); Annotation result = mutable.addAnnotation(annotation); assertNull(result); assertTrue(metaData.isAnnotationPresent(expected)); assertTrue(metaData.isMetaDataPresent(expected)); assertTrue(metaData.isMetaDataPresent(expected.getName())); assertTrue(metaData.isMetaDataPresent(expected.getName(), expected)); return assertValidTimeChanged(metaData, last); } /** * Check an annotation is added with no previous * * @param the type * @param mutable the retrieval * @param annotation the annotation * @param expectedAnnotations the expected annotations * @param last the last valid time * @return the new valid time * @throws Exception for any error */ protected long assertAddAnnotationNoPrevious(MutableMetaDataLoader mutable, T annotation, ExpectedAnnotations expectedAnnotations, long last) throws Exception { assertNotNull(mutable); assertNotNull(annotation); Class expected = annotation.annotationType(); expectedAnnotations.add(expected); assertNull(mutable.retrieveAnnotation(expected)); assertNull(mutable.retrieveMetaData(expected)); assertNull(mutable.retrieveMetaData(expected.getName())); Annotation result = mutable.addAnnotation(annotation); assertNull(result); checkAnnotation(expected, mutable.retrieveAnnotation(expected)); checkAnnotation(expected, mutable.retrieveMetaData(expected)); checkAnnotation(expected, mutable.retrieveMetaData(expected.getName())); return assertValidTimeChanged(mutable, last); } /** * Check an meta data is added with no previous * * @param the type * @param mutable the meta data * @param object the meta data * @param type the type * @param expected the expected meta data * @param last the last valid time * @return the new valid time * @throws Exception for any error */ protected long assertAddMetaDataNoPrevious(MutableMetaData mutable, T object, Class type, ExpectedMetaData expected, long last) throws Exception { MetaData metaData = (MetaData) mutable; return assertAddMetaDataNoPrevious(metaData, mutable, object, type, expected, last); } /** * Check an meta data is added with no previous * * @param the type * @param metaData the meta data * @param mutable the mutable * @param object the object * @param type the type * @param expected the expected meta data * @param last the last valid time * @return the new valid time * @throws Exception for any error */ protected long assertAddMetaDataNoPrevious(MetaData metaData, MutableMetaData mutable, T object, Class type, ExpectedMetaData expected, long last) throws Exception { assertNotNull(metaData); assertNotNull(mutable); assertNotNull(object); expected.add(type); assertFalse(metaData.isMetaDataPresent(type)); assertFalse(metaData.isMetaDataPresent(type.getName())); assertFalse(metaData.isMetaDataPresent(type.getName(), type)); Object result = mutable.addMetaData(object, type); assertNull(result); assertTrue(metaData.isMetaDataPresent(type)); assertTrue(metaData.isMetaDataPresent(type.getName())); assertTrue(metaData.isMetaDataPresent(type.getName(), type)); return assertValidTimeChanged(metaData, last); } /** * Check an meta data is added with no previous * * @param the type * @param mutable the meta data * @param object the meta data * @param type the type * @param expected the expected meta data * @param last the last valid time * @return the new valid time * @throws Exception for any error */ protected long assertAddMetaDataNoPrevious(MutableMetaDataLoader mutable, T object, Class type, ExpectedMetaData expected, long last) throws Exception { assertNotNull(mutable); assertNotNull(object); expected.add(type); assertNull(mutable.retrieveMetaData(type)); assertNull(mutable.retrieveMetaData(type.getName())); Object result = mutable.addMetaData(object, type); assertNull(result); checkMetaData(type, mutable.retrieveMetaData(type)); checkMetaData(type, mutable.retrieveMetaData(type.getName())); return assertValidTimeChanged(mutable, last); } /** * Check an meta data is added with no previous * * @param the type * @param mutable the meta data * @param object the meta data * @param name the name * @param type the type * @param expected the expected meta data * @param last the last valid time * @return the new valid time * @throws Exception for any error */ protected long assertAddMetaDataNoPrevious(MutableMetaData mutable, T object, String name, Class type, ExpectedMetaData expected, long last) throws Exception { MetaData metaData = (MetaData) mutable; return assertAddMetaDataNoPrevious(metaData, mutable, object, name, type, expected, last); } /** * Check an meta data is added with no previous * * @param the type * @param metaData the meta data * @param mutable the mutable * @param object the object * @param name the name * @param type the type * @param expected the expected meta data * @param last the last valid time * @return the new valid time * @throws Exception for any error */ protected long assertAddMetaDataNoPrevious(MetaData metaData, MutableMetaData mutable, T object, String name, Class type, ExpectedMetaData expected, long last) throws Exception { assertNotNull(metaData); assertNotNull(mutable); assertNotNull(object); assertNotNull(name); expected.add(type); assertFalse(metaData.isMetaDataPresent(name)); assertFalse(metaData.isMetaDataPresent(name, type)); Object result = mutable.addMetaData(name, object, type); assertNull(result); assertTrue(metaData.isMetaDataPresent(name)); assertTrue(metaData.isMetaDataPresent(name, type)); return assertValidTimeChanged(metaData, last); } /** * Check an meta data is added with no previous * * @param the type * @param mutable the meta data * @param object the meta data * @param name the name * @param type the type * @param expected the expected meta data * @param last the last valid time * @return the new valid time * @throws Exception for any error */ protected long assertAddMetaDataNoPrevious(MutableMetaDataLoader mutable, T object, String name, Class type, ExpectedMetaData expected, long last) throws Exception { assertNotNull(mutable); assertNotNull(object); assertNotNull(name); expected.add(type); assertNull(mutable.retrieveMetaData(name)); Object result = mutable.addMetaData(name, object, type); assertNull(result); checkMetaData(type, mutable.retrieveMetaData(name)); return assertValidTimeChanged(mutable, last); } /** * Check an annotation is added with a previous value * * @param the type * @param mutable the meta data * @param annotation the annotation * @param last the last valid time * @return the new last valid time * @throws Exception for any error */ protected long assertAddAnnotationWithPrevious(MutableMetaData mutable, T annotation, long last) throws Exception { MetaData metaData = (MetaData) mutable; return assertAddAnnotationWithPrevious(metaData, mutable, annotation, last); } /** * Check an annotation is added with a previous value * * @param the type * @param metaData the meta data * @param mutable the mutable * @param annotation the annotation * @param last the last valid time * @return the new last valid time * @throws Exception for any error */ protected long assertAddAnnotationWithPrevious(MetaData metaData, MutableMetaData mutable, T annotation, long last) throws Exception { assertNotNull(metaData); assertNotNull(mutable); assertNotNull(annotation); Class expected = annotation.annotationType(); assertTrue(metaData.isAnnotationPresent(expected)); assertTrue(metaData.isMetaDataPresent(expected)); assertTrue(metaData.isMetaDataPresent(expected.getName())); assertTrue(metaData.isMetaDataPresent(expected.getName(), expected)); Annotation result = mutable.addAnnotation(annotation); if (metaData == mutable) checkAnnotation(expected, result); assertTrue(metaData.isAnnotationPresent(expected)); assertTrue(metaData.isMetaDataPresent(expected)); assertTrue(metaData.isMetaDataPresent(expected.getName())); assertTrue(metaData.isMetaDataPresent(expected.getName(), expected)); return assertValidTimeChanged(metaData, last); } /** * Check an annotation is added with a previous value * * @param the type * @param mutable the retrieval * @param annotation the annotation * @param last the last valid time * @return the new last valid time * @throws Exception for any error */ protected long assertAddAnnotationWithPrevious(MutableMetaDataLoader mutable, T annotation, long last) throws Exception { assertNotNull(mutable); assertNotNull(annotation); Class expected = annotation.annotationType(); AnnotationItem annotationItem = mutable.retrieveAnnotation(expected); checkAnnotation(expected, annotationItem); MetaDataItem metaDataItem1 = mutable.retrieveMetaData(expected); checkAnnotation(expected, metaDataItem1); MetaDataItem metaDataItem2 = mutable.retrieveMetaData(expected.getName()); checkAnnotation(expected, metaDataItem2); Annotation result = mutable.addAnnotation(annotation); checkAnnotation(expected, result); checkAnnotation(expected, mutable.retrieveAnnotation(expected)); checkAnnotation(expected, mutable.retrieveMetaData(expected)); checkAnnotation(expected, mutable.retrieveMetaData(expected.getName())); assertFalse(annotationItem.isValid()); assertFalse(metaDataItem1.isValid()); assertFalse(metaDataItem2.isValid()); return assertValidTimeChanged(mutable, last); } /** * Check an annotation is added with a previous value * * @param the type * @param mutable the retrieval * @param annotation the annotation * @param last the last valid time * @throws Exception for any error */ protected void assertAddAnnotationWithPreviousSameObject(MutableMetaData mutable, T annotation, long last) throws Exception { assertNotNull(mutable); assertNotNull(annotation); Class expected = annotation.annotationType(); MetaData metaData = (MetaData) mutable; checkAnnotation(expected, metaData.getAnnotation(expected)); checkAnnotation(expected, metaData.getMetaData(expected)); checkAnnotation(expected, metaData.getMetaData(expected.getName(), expected)); checkAnnotation(expected, metaData.getMetaData(expected.getName())); Annotation result = mutable.addAnnotation(annotation); checkAnnotation(expected, result); checkAnnotation(expected, metaData.getAnnotation(expected)); checkAnnotation(expected, metaData.getMetaData(expected)); checkAnnotation(expected, metaData.getMetaData(expected.getName(), expected)); checkAnnotation(expected, metaData.getMetaData(expected.getName())); assertValidTimeUnchanged(metaData, last); } /** * Check an annotation is added with a previous value * * @param the type * @param mutable the retrieval * @param annotation the annotation * @param last the last valid time * @throws Exception for any error */ protected void assertAddAnnotationWithPreviousSameObject(MutableMetaDataLoader mutable, T annotation, long last) throws Exception { assertNotNull(mutable); assertNotNull(annotation); Class expected = annotation.annotationType(); AnnotationItem annotationItem = mutable.retrieveAnnotation(expected); checkAnnotation(expected, annotationItem); MetaDataItem metaDataItem1 = mutable.retrieveMetaData(expected); checkAnnotation(expected, metaDataItem1); MetaDataItem metaDataItem2 = mutable.retrieveMetaData(expected.getName()); checkAnnotation(expected, metaDataItem2); Annotation result = mutable.addAnnotation(annotation); checkAnnotation(expected, result); checkAnnotation(expected, mutable.retrieveAnnotation(expected)); checkAnnotation(expected, mutable.retrieveMetaData(expected)); checkAnnotation(expected, mutable.retrieveMetaData(expected.getName())); assertTrue(annotationItem.isValid()); assertTrue(metaDataItem1.isValid()); assertTrue(metaDataItem2.isValid()); assertValidTimeUnchanged(mutable, last); } /** * Check metadata is added with a previous value * * @param the type * @param mutable the meta data * @param object the object * @param type the type * @param last the last valid time * @return the new last valid time * @throws Exception for any error */ protected long assertAddMetaDataWithPrevious(MutableMetaData mutable, T object, Class type, long last) throws Exception { MetaData metaData = (MetaData) mutable; return assertAddMetaDataWithPrevious(metaData, mutable, object, type, last); } /** * Check metadata is added with a previous value * * @param the type * @param metaData the meta data * @param mutable the mutable * @param object the object * @param type the type * @param last the last valid time * @return the new last valid time * @throws Exception for any error */ protected long assertAddMetaDataWithPrevious(MetaData metaData, MutableMetaData mutable, T object, Class type, long last) throws Exception { assertNotNull(metaData); assertNotNull(mutable); assertNotNull(object); assertNotNull(type); assertTrue(metaData.isMetaDataPresent(type)); assertTrue(metaData.isMetaDataPresent(type.getName())); assertTrue(metaData.isMetaDataPresent(type.getName(), type)); Object result = mutable.addMetaData(object, type); if (metaData == mutable) checkMetaData(type, result); assertTrue(metaData.isMetaDataPresent(type)); assertTrue(metaData.isMetaDataPresent(type.getName())); assertTrue(metaData.isMetaDataPresent(type.getName(), type)); return assertValidTimeChanged(metaData, last); } /** * Check metadata is added with a previous value * * @param the type * @param mutable the meta data * @param object the object * @param type the type * @param last the last valid time * @return the new last valid time * @throws Exception for any error */ protected long assertAddMetaDataWithPrevious(MutableMetaDataLoader mutable, T object, Class type, long last) throws Exception { assertNotNull(mutable); assertNotNull(object); assertNotNull(type); checkMetaData(type, mutable.retrieveMetaData(type)); checkMetaData(type, mutable.retrieveMetaData(type.getName())); Object result = mutable.addMetaData(object, type); checkMetaData(type, result); checkMetaData(type, mutable.retrieveMetaData(type)); checkMetaData(type, mutable.retrieveMetaData(type.getName())); return assertValidTimeChanged(mutable, last); } /** * Check metadata is added with a previous value * * @param the type * @param mutable the meta data * @param object the object * @param name the name * @param type the type * @param last the last valid time * @return the new last valid time * @throws Exception for any error */ protected long assertAddMetaDataWithPrevious(MutableMetaData mutable, T object, String name, Class type, long last) throws Exception { MetaData metaData = (MetaData) mutable; return assertAddMetaDataWithPrevious(metaData, mutable, object, name, type, last); } /** * Check metadata is added with a previous value * * @param the type * @param metaData the meta data * @param mutable the mutable * @param object the object * @param name the name * @param type the type * @param last the last valid time * @return the new last valid time * @throws Exception for any error */ protected long assertAddMetaDataWithPrevious(MetaData metaData, MutableMetaData mutable, T object, String name, Class type, long last) throws Exception { assertNotNull(metaData); assertNotNull(mutable); assertNotNull(object); assertNotNull(type); assertNotNull(name); assertTrue(metaData.isMetaDataPresent(name)); assertTrue(metaData.isMetaDataPresent(name, type)); Object result = mutable.addMetaData(name, object, type); if (metaData == mutable) checkMetaData(type, result); assertTrue(metaData.isMetaDataPresent(name)); assertTrue(metaData.isMetaDataPresent(name, type)); return assertValidTimeChanged(metaData, last); } /** * Check metadata is added with a previous value * * @param the type * @param mutable the meta data * @param object the object * @param name the name * @param type the type * @param last the last valid time * @return the new last valid time * @throws Exception for any error */ protected long assertAddMetaDataWithPrevious(MutableMetaDataLoader mutable, T object, String name, Class type, long last) throws Exception { assertNotNull(mutable); assertNotNull(object); assertNotNull(type); assertNotNull(name); checkMetaData(type, mutable.retrieveMetaData(name)); Object result = mutable.addMetaData(name, object, type); checkMetaData(type, result); checkMetaData(type, mutable.retrieveMetaData(name)); return assertValidTimeChanged(mutable, last); } /** * Check metadata is added with a previous value the same object * * @param the type * @param mutable the meta data * @param object the object * @param type the type * @param last the last valid time * @throws Exception for any error */ protected void assertAddMetaDataWithPreviousSameObject(MutableMetaData mutable, T object, Class type, long last) throws Exception { assertNotNull(mutable); assertNotNull(object); assertNotNull(type); MetaData metaData = (MetaData) mutable; checkMetaData(type, metaData.getMetaData(type)); checkMetaData(type, metaData.getMetaData(type.getName(), type)); checkMetaData(type, metaData.getMetaData(type.getName())); Object result = mutable.addMetaData(object, type); checkMetaData(type, result); checkMetaData(type, metaData.getMetaData(type)); checkMetaData(type, metaData.getMetaData(type.getName(), type)); checkMetaData(type, metaData.getMetaData(type.getName())); assertValidTimeUnchanged(metaData, last); } /** * Check metadata is added with a previous value the same object * * @param the type * @param mutable the meta data * @param object the object * @param type the type * @param last the last valid time * @throws Exception for any error */ protected void assertAddMetaDataWithPreviousSameObject(MutableMetaDataLoader mutable, T object, Class type, long last) throws Exception { assertNotNull(mutable); assertNotNull(object); assertNotNull(type); checkMetaData(type, mutable.retrieveMetaData(type)); checkMetaData(type, mutable.retrieveMetaData(type.getName())); Object result = mutable.addMetaData(object, type); checkMetaData(type, result); checkMetaData(type, mutable.retrieveMetaData(type)); checkMetaData(type, mutable.retrieveMetaData(type.getName())); assertValidTimeUnchanged(mutable, last); } /** * Check metadata is added with a previous value the same object * * @param the type * @param mutable the meta data * @param object the object * @param name the name * @param type the type * @param last the last valid time * @throws Exception for any error */ protected void assertAddMetaDataWithPreviousSameObject(MutableMetaData mutable, T object, String name, Class type, long last) throws Exception { assertNotNull(mutable); assertNotNull(object); assertNotNull(type); assertNotNull(name); MetaData metaData = (MetaData) mutable; checkMetaData(type, metaData.getMetaData(name, type)); checkMetaData(type, metaData.getMetaData(name)); Object result = mutable.addMetaData(name, object, type); checkMetaData(type, result); checkMetaData(type, metaData.getMetaData(name, type)); checkMetaData(type, metaData.getMetaData(name)); assertValidTimeUnchanged(metaData, last); } /** * Check metadata is added with a previous value the same object * * @param the type * @param mutable the meta data * @param object the object * @param name the name * @param type the type * @param last the last valid time * @throws Exception for any error */ protected void assertAddMetaDataWithPreviousSameObject(MutableMetaDataLoader mutable, T object, String name, Class type, long last) throws Exception { assertNotNull(mutable); assertNotNull(object); assertNotNull(type); assertNotNull(name); checkMetaData(type, mutable.retrieveMetaData(name)); Object result = mutable.addMetaData(name, object, type); checkMetaData(type, result); checkMetaData(type, mutable.retrieveMetaData(name)); assertValidTimeUnchanged(mutable, last); } /** * Check an annotation is removed * * @param the type * @param mutable the meta data * @param expected the expected type * @param expectedAnnotations the expected annotations * @param last the last valid time * @throws Exception for any error */ protected void assertRemoveAnnotation(MutableMetaData mutable, Class expected, ExpectedAnnotations expectedAnnotations, long last) throws Exception { MetaData metaData = (MetaData) mutable; assertRemoveAnnotation(metaData, mutable, expected, expectedAnnotations, last, false); } /** * Check an annotation is removed * * @param the type * @param metaData the meta data * @param mutable the meta data loader * @param expected the expected type * @param expectedAnnotations the expected annotations * @param last the last valid time * @param stillExpected whether it is still expected elsewhere * @throws Exception for any error */ protected void assertRemoveAnnotation(MetaData metaData, MutableMetaData mutable, Class expected, ExpectedAnnotations expectedAnnotations, long last, boolean stillExpected) throws Exception { assertNotNull(metaData); assertNotNull(mutable); assertNotNull(expected); if (stillExpected == false) expectedAnnotations.remove(expected); assertTrue(metaData.isAnnotationPresent(expected)); assertTrue(metaData.isMetaDataPresent(expected)); assertTrue(metaData.isMetaDataPresent(expected.getName())); assertTrue(metaData.isMetaDataPresent(expected.getName(), expected)); Annotation result = mutable.removeAnnotation(expected); checkAnnotation(expected, result); if (stillExpected) { assertTrue(metaData.isAnnotationPresent(expected)); assertTrue(metaData.isMetaDataPresent(expected)); assertTrue(metaData.isMetaDataPresent(expected.getName())); assertTrue(metaData.isMetaDataPresent(expected.getName(), expected)); } else { assertFalse(metaData.isAnnotationPresent(expected)); assertFalse(metaData.isMetaDataPresent(expected)); assertFalse(metaData.isMetaDataPresent(expected.getName())); assertFalse(metaData.isMetaDataPresent(expected.getName(), expected)); } assertValidTimeUnchanged(metaData, last); } /** * Check an annotation is removed * * @param the type * @param mutable the retrieval * @param expected the expected type * @param expectedAnnotations the expected annotations * @param last the last valid time * @throws Exception for any error */ protected void assertRemoveAnnotation(MutableMetaDataLoader mutable, Class expected, ExpectedAnnotations expectedAnnotations, long last) throws Exception { assertNotNull(mutable); assertNotNull(expected); expectedAnnotations.remove(expected); AnnotationItem annotationItem = mutable.retrieveAnnotation(expected); checkAnnotation(expected, annotationItem); MetaDataItem metaDataItem1 = mutable.retrieveMetaData(expected); checkAnnotation(expected, metaDataItem1); MetaDataItem metaDataItem2 = mutable.retrieveMetaData(expected.getName()); checkAnnotation(expected, metaDataItem2); Annotation result = mutable.removeAnnotation(expected); checkAnnotation(expected, result); assertNull(mutable.retrieveAnnotation(expected)); assertNull(mutable.retrieveMetaData(expected)); assertNull(mutable.retrieveMetaData(expected.getName())); assertFalse(annotationItem.isValid()); assertFalse(metaDataItem1.isValid()); assertFalse(metaDataItem2.isValid()); assertValidTimeUnchanged(mutable, last); } /** * Check meta data is removed * * @param the type * @param mutable the meta data * @param type the type * @param expected the expected meta data * @param last the last valid time * @throws Exception for any error */ protected void assertRemoveMetaData(MutableMetaData mutable, Class type, ExpectedMetaData expected, long last) throws Exception { MetaData metaData = (MetaData) mutable; assertRemoveMetaData(metaData, mutable, type, expected, last, false); } /** * Check meta data is removed * * @param the type * @param metaData the meta data * @param mutable the mutable * @param type the type * @param expected the expected meta data * @param last the last valid time * @param stillExpected whether it is still expected elsewhere * @throws Exception for any error */ protected void assertRemoveMetaData(MetaData metaData, MutableMetaData mutable, Class type, ExpectedMetaData expected, long last, boolean stillExpected) throws Exception { assertNotNull(metaData); assertNotNull(mutable); assertNotNull(type); if (stillExpected == false) expected.remove(type); assertTrue(metaData.isMetaDataPresent(type)); assertTrue(metaData.isMetaDataPresent(type.getName())); assertTrue(metaData.isMetaDataPresent(type.getName(), type)); Object result = mutable.removeMetaData(type); checkMetaData(type, result); if (stillExpected) { assertTrue(metaData.isMetaDataPresent(type)); assertTrue(metaData.isMetaDataPresent(type.getName())); assertTrue(metaData.isMetaDataPresent(type.getName(), type)); } else { assertFalse(metaData.isMetaDataPresent(type)); assertFalse(metaData.isMetaDataPresent(type.getName())); assertFalse(metaData.isMetaDataPresent(type.getName(), type)); } assertValidTimeUnchanged(metaData, last); } /** * Check meta data is removed * * @param the type * @param mutable the meta data * @param type the type * @param expected the expected meta data * @param last the last valid time * @throws Exception for any error */ protected void assertRemoveMetaData(MutableMetaDataLoader mutable, Class type, ExpectedMetaData expected, long last) throws Exception { assertNotNull(mutable); assertNotNull(type); expected.remove(type); checkMetaData(type, mutable.retrieveMetaData(type)); checkMetaData(type, mutable.retrieveMetaData(type.getName())); Object result = mutable.removeMetaData(type); checkMetaData(type, result); assertNull(mutable.retrieveMetaData(type)); assertNull(mutable.retrieveMetaData(type.getName())); assertValidTimeUnchanged(mutable, last); } /** * Check meta data is removed * * @param the type * @param mutable the meta data * @param name the name * @param type the type * @param expected the expected meta data * @param last the last valid time * @throws Exception for any error */ protected void assertRemoveMetaData(MutableMetaData mutable, String name, Class type, ExpectedMetaData expected, long last) throws Exception { MetaData metaData = (MetaData) mutable; assertRemoveMetaData(metaData, mutable, name, type, expected, last, false); } /** * Check meta data is removed * * @param the type * @param metaData the meta data * @param mutable the mutable * @param name the name * @param type the type * @param expected the expected meta data * @param last the last valid time * @param stillExpected whether it is still expected elsewhere * @throws Exception for any error */ protected void assertRemoveMetaData(MetaData metaData, MutableMetaData mutable, String name, Class type, ExpectedMetaData expected, long last, boolean stillExpected) throws Exception { assertNotNull(metaData); assertNotNull(mutable); assertNotNull(type); assertNotNull(name); if (stillExpected == false) expected.remove(type); assertTrue(metaData.isMetaDataPresent(name)); assertTrue(metaData.isMetaDataPresent(name, type)); Object result = mutable.removeMetaData(name, type); checkMetaData(type, result); if (stillExpected) { assertTrue(metaData.isMetaDataPresent(name)); assertTrue(metaData.isMetaDataPresent(name, type)); } else { assertFalse(metaData.isMetaDataPresent(name)); assertFalse(metaData.isMetaDataPresent(name, type)); } assertValidTimeUnchanged(metaData, last); } /** * Check meta data is removed * * @param the type * @param mutable the meta data * @param name the name * @param type the type * @param expected the expected meta data * @param last the last valid time * @throws Exception for any error */ protected void assertRemoveMetaData(MutableMetaDataLoader mutable, String name, Class type, ExpectedMetaData expected, long last) throws Exception { assertNotNull(mutable); assertNotNull(type); expected.remove(type); checkMetaData(type, mutable.retrieveMetaData(name)); Object result = mutable.removeMetaData(name, type); checkMetaData(type, result); assertNull(mutable.retrieveMetaData(name)); assertValidTimeUnchanged(mutable, last); } /** * Check an annotation is not removed * * @param the type * @param mutable the meta data * @param expected the expected type * @param last the last valid time * @throws Exception for any error */ protected void assertNotRemovedAnnotation(MutableMetaData mutable, Class expected, long last) throws Exception { assertNotNull(mutable); assertNotNull(expected); MetaData metaData = (MetaData) mutable; assertFalse(metaData.isAnnotationPresent(expected)); assertFalse(metaData.isMetaDataPresent(expected)); assertFalse(metaData.isMetaDataPresent(expected.getName())); assertFalse(metaData.isMetaDataPresent(expected.getName(), expected)); Annotation result = mutable.removeAnnotation(expected); assertNull(result); assertFalse(metaData.isAnnotationPresent(expected)); assertFalse(metaData.isMetaDataPresent(expected)); assertFalse(metaData.isMetaDataPresent(expected.getName())); assertFalse(metaData.isMetaDataPresent(expected.getName(), expected)); assertValidTimeUnchanged(metaData, last); } /** * Check an annotation is not removed * * @param the type * @param mutable the retrieval * @param expected the expected type * @param last the last valid time * @throws Exception for any error */ protected void assertNotRemovedAnnotation(MutableMetaDataLoader mutable, Class expected, long last) throws Exception { assertNotNull(mutable); assertNotNull(expected); assertNull(mutable.retrieveAnnotation(expected)); assertNull(mutable.retrieveMetaData(expected)); assertNull(mutable.retrieveMetaData(expected.getName())); Annotation result = mutable.removeAnnotation(expected); assertNull(result); assertNull(mutable.retrieveAnnotation(expected)); assertNull(mutable.retrieveMetaData(expected)); assertNull(mutable.retrieveMetaData(expected.getName())); assertValidTimeUnchanged(mutable, last); } /** * Check meta data is not removed * * @param the type * @param mutable the meta data * @param type the type * @param last the last valid time * @throws Exception for any error */ protected void assertNotRemovedMetaData(MutableMetaData mutable, Class type, long last) throws Exception { assertNotNull(mutable); assertNotNull(type); MetaData metaData = (MetaData) mutable; assertFalse(metaData.isMetaDataPresent(type)); assertFalse(metaData.isMetaDataPresent(type.getName())); assertFalse(metaData.isMetaDataPresent(type.getName(), type)); Object result = mutable.removeMetaData(type); assertNull(result); assertFalse(metaData.isMetaDataPresent(type)); assertFalse(metaData.isMetaDataPresent(type.getName())); assertFalse(metaData.isMetaDataPresent(type.getName(), type)); assertValidTimeUnchanged(metaData, last); } /** * Check meta data is not removed * * @param the type * @param mutable the meta data * @param type the type * @param last the last valid time * @throws Exception for any error */ protected void assertNotRemovedMetaData(MutableMetaDataLoader mutable, Class type, long last) throws Exception { assertNotNull(mutable); assertNotNull(type); assertNull(mutable.retrieveMetaData(type)); assertNull(mutable.retrieveMetaData(type.getName())); Object result = mutable.removeMetaData(type); assertNull(result); assertNull(mutable.retrieveMetaData(type)); assertNull(mutable.retrieveMetaData(type.getName())); assertValidTimeUnchanged(mutable, last); } /** * Check meta data is not removed * * @param the type * @param mutable the meta data * @param name the name * @param type the type * @param last the last valid time * @throws Exception for any error */ protected void assertNotRemovedMetaData(MutableMetaData mutable, String name, Class type, long last) throws Exception { assertNotNull(mutable); assertNotNull(type); assertNotNull(name); MetaData metaData = (MetaData) mutable; assertFalse(metaData.isMetaDataPresent(name)); assertFalse(metaData.isMetaDataPresent(name, type)); Object result = mutable.removeMetaData(name, type); assertNull(result); assertFalse(metaData.isMetaDataPresent(name)); assertFalse(metaData.isMetaDataPresent(name, type)); assertValidTimeUnchanged(metaData, last); } /** * Check meta data is not removed * * @param the type * @param mutable the meta data * @param name the name * @param type the type * @param last the last valid time * @throws Exception for any error */ protected void assertNotRemovedMetaData(MutableMetaDataLoader mutable, String name, Class type, long last) throws Exception { assertNotNull(mutable); assertNotNull(type); assertNotNull(name); assertNull(mutable.retrieveMetaData(name)); Object result = mutable.removeMetaData(name, type); assertNull(result); assertNull(mutable.retrieveMetaData(name)); assertValidTimeUnchanged(mutable, last); } /** * Assert the valid time changed * * @param metaData the meta data * @param last the last valid time * @return the current valid time */ protected long assertValidTimeChanged(MetaData metaData, long last) { assertNotNull(metaData); long now = metaData.getValidTime(); assertTrue("ValidTime should change now=" + now + " last=" + last, now > last); return now; } /** * Assert the valid time changed * * @param metaData the retrieval * @param last the last valid time * @return the current valid time */ protected long assertValidTimeChanged(MetaDataRetrieval metaData, long last) { assertNotNull(metaData); long now = metaData.getValidTime().getValidTime(); assertTrue("ValidTime should change now=" + now + " last=" + last, now > last); return now; } /** * Assert the valid time has not changed * * @param metaData the meta data * @param last the last valid time */ protected void assertValidTimeUnchanged(MetaData metaData, long last) { assertNotNull(metaData); long now = metaData.getValidTime(); assertEquals("ValidTime should not change now=" + now + " last=" + last, now, last); } /** * Assert the valid time has not changed * * @param metaData the retrieval * @param last the last valid time */ protected void assertValidTimeUnchanged(MetaDataRetrieval metaData, long last) { assertNotNull(metaData); long now = metaData.getValidTime().getValidTime(); assertEquals("ValidTime should not change now=" + now + " last=" + last, now, last); } /** * Create an empty expected annotations * * @return the empty expected annotations */ protected ExpectedAnnotations emptyExpectedAnnotations() { return new ExpectedAnnotations(); } /** * Create an empty expected metadata * * @return the empty expected metaData */ protected ExpectedMetaData emptyExpectedMetaData() { return new ExpectedMetaData(); } /** * Check the annotations from all retrieval methods * * @param metaData the meta data * @param expected the expected annotation classes * @throws Exception for any error */ protected void assertAllAnnotations(MetaData metaData, ExpectedAnnotations expected) throws Exception { assertAllAnnotations(metaData, expected, true); } /** * Check the annotations from all retrieval methods * * @param metaData the meta data * @param expected the expected annotation classes * @param local whether to test the local annotations * @throws Exception for any error */ protected void assertAllAnnotations(MetaData metaData, ExpectedAnnotations expected, boolean local) throws Exception { assertAnnotations(metaData, expected); if (local) assertLocalAnnotations(metaData, expected); assertAnnotationMetaDatas(metaData, expected); if (local) assertLocalAnnotationMetaDatas(metaData, expected); } /** * Check the annotations * * @param metaData the meta data * @param expected the expected annotation classes * @throws Exception for any error */ protected void assertAnnotations(MetaData metaData, ExpectedAnnotations expected) throws Exception { assertNotNull(metaData); assertNotNull(expected); Annotation[] result = metaData.getAnnotations(); assertNotNull("Null result", result); ExpectedAnnotations actual = emptyExpectedAnnotations(); for (Annotation annotation : result) { assertNotNull("Null annotation " + Arrays.asList(result), annotation); actual.add(annotation.annotationType()); } assertExpectedAnnotations("Annotations", expected, actual); } /** * Check the local annotations * * @param metaData the meta data * @param expected the expected annotation classes * @throws Exception for any error */ protected void assertLocalAnnotations(MetaData metaData, ExpectedAnnotations expected) throws Exception { assertNotNull(metaData); assertNotNull(expected); Annotation[] result = metaData.getLocalAnnotations(); assertNotNull("Null result", result); ExpectedAnnotations actual = emptyExpectedAnnotations(); for (Annotation annotation : result) { assertNotNull("Null annotation " + Arrays.asList(result), annotation); actual.add(annotation.annotationType()); } assertExpectedAnnotations("Annotations", expected, actual); } /** * Check the annotations from all retrieval methods * * @param metaData the retrieval * @param expected the expected annotation classes * @throws Exception for any error */ protected void assertAllAnnotations(MetaDataRetrieval metaData, ExpectedAnnotations expected) throws Exception { assertAllAnnotations(metaData, expected, true); } /** * Check the annotations from all retrieval methods * * @param metaData the retrieval * @param expected the expected annotation classes * @param local whether to test the local annotations * @throws Exception for any error */ protected void assertAllAnnotations(MetaDataRetrieval metaData, ExpectedAnnotations expected, boolean local) throws Exception { assertAnnotations(metaData, expected); if (local) assertLocalAnnotations(metaData, expected); assertAnnotationMetaDatas(metaData, expected); if (local) assertLocalAnnotationMetaDatas(metaData, expected); } /** * Check the annotations * * @param metaData the retrieval * @param expected the expected annotation classes * @throws Exception for any error */ protected void assertAnnotations(MetaDataRetrieval metaData, ExpectedAnnotations expected) throws Exception { assertNotNull(metaData); assertNotNull(expected); AnnotationsItem result = metaData.retrieveAnnotations(); assertNotNull("Null result", result); AnnotationItem[] items = result.getAnnotations(); assertNotNull("Null items", items); ExpectedAnnotations actual = emptyExpectedAnnotations(); for (AnnotationItem item : items) { assertNotNull("Null annotation item " + Arrays.asList(items), item); Annotation annotation = item.getAnnotation(); assertNotNull("Null annotation " + Arrays.asList(items), annotation); actual.add(annotation.annotationType()); } assertExpectedAnnotations("Annotations", expected, actual); } /** * Check the local annotations * * @param metaData the retrieval * @param expected the expected annotation classes * @throws Exception for any error */ protected void assertLocalAnnotations(MetaDataRetrieval metaData, ExpectedAnnotations expected) throws Exception { assertNotNull(metaData); assertNotNull(expected); AnnotationsItem result = metaData.retrieveLocalAnnotations(); assertNotNull("Null result", result); AnnotationItem[] items = result.getAnnotations(); assertNotNull("Null items", items); ExpectedAnnotations actual = emptyExpectedAnnotations(); for (AnnotationItem item : items) { assertNotNull("Null annotation item " + Arrays.asList(items), item); Annotation annotation = item.getAnnotation(); assertNotNull("Null annotation " + Arrays.asList(items), annotation); actual.add(annotation.annotationType()); } assertExpectedAnnotations("Annotations", expected, actual); } /** * Check the meta data from all retrieval methods * * @param metaData the meta data * @param expected the expected types * @throws Exception for any error */ protected void assertAllMetaData(MetaData metaData, ExpectedMetaData expected) throws Exception { assertAllMetaData(metaData, expected, true); } /** * Check the meta data from all retrieval methods * * @param metaData the meta data * @param expected the expected types * @param local whether to include the local meta data * @throws Exception for any error */ protected void assertAllMetaData(MetaData metaData, ExpectedMetaData expected, boolean local) throws Exception { assertMetaData(metaData, expected); if (local) assertLocalMetaData(metaData, expected); } /** * Check the meta data * * @param metaData the meta data * @param expected the expected types * @throws Exception for any error */ protected void assertMetaData(MetaData metaData, ExpectedMetaData expected) throws Exception { assertNotNull(metaData); assertNotNull(expected); Object[] result = metaData.getMetaData(); assertNotNull("Null result", result); ExpectedMetaData actual = emptyExpectedMetaData(); for (Object object : result) { assertNotNull("Null object " + Arrays.asList(result), object); actual.add(getType(object)); } assertExpectedMetaData("MetaData", expected, actual); } /** * Check the local meta data * * @param metaData the meta data * @param expected the expected types * @throws Exception for any error */ protected void assertLocalMetaData(MetaData metaData, ExpectedMetaData expected) throws Exception { assertNotNull(metaData); assertNotNull(expected); Object[] result = metaData.getLocalMetaData(); assertNotNull("Null result", result); ExpectedMetaData actual = emptyExpectedMetaData(); for (Object object : result) { assertNotNull("Null object " + Arrays.asList(result), object); actual.add(getType(object)); } assertExpectedMetaData("MetaData", expected, actual); } /** * Check the meta data from all retrieval methods * * @param metaData the retrieval * @param expected the expected types * @throws Exception for any error */ protected void assertAllMetaData(MetaDataRetrieval metaData, ExpectedMetaData expected) throws Exception { assertAllMetaData(metaData, expected, true); } /** * Check the meta data from all retrieval methods * * @param metaData the retrieval * @param expected the expected types * @param local whether to include the local meta data * @throws Exception for any error */ protected void assertAllMetaData(MetaDataRetrieval metaData, ExpectedMetaData expected, boolean local) throws Exception { assertMetaData(metaData, expected); if (local) assertLocalMetaData(metaData, expected); } /** * Check the meta data * * @param metaData the retrieval * @param expected the expected types * @throws Exception for any error */ 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); Object object = item.getValue(); assertNotNull("Null object " + Arrays.asList(items), object); actual.add(getType(object)); } assertExpectedMetaData("MetaData", expected, actual); } /** * Check the local meta data * * @param metaData the retrieval * @param expected the expected types * @throws Exception for any error */ 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); Object object = item.getValue(); assertNotNull("Null object " + Arrays.asList(items), object); actual.add(getType(object)); } assertExpectedMetaData("MetaData", expected, actual); } /** * Get the type for the object * * @param object the object * @return the type */ protected Class getType(Object object) { Class type = object.getClass(); Class[] interfaces = type.getInterfaces(); if (interfaces.length == 1) return interfaces[0]; return type; } /** * Check the meta data * * @param metaData the meta data * @param expected the expected annotation classes * @throws Exception for any error */ protected void assertAnnotationMetaDatas(MetaData metaData, ExpectedAnnotations expected) throws Exception { assertNotNull(metaData); assertNotNull(expected); Object[] result = metaData.getMetaData(); assertNotNull("Null result", result); ExpectedAnnotations actual = emptyExpectedAnnotations(); for (Object object : result) { assertNotNull("Null annotation " + Arrays.asList(result), object); assertTrue("Not an annotation " + Arrays.asList(result), object instanceof Annotation); Annotation annotation = (Annotation) object; actual.add(annotation.annotationType()); } assertExpectedAnnotations("AnnotationMetaDatas", expected, actual); } /** * Check the local meta data * * @param metaData the meta data * @param expected the expected annotation classes * @throws Exception for any error */ protected void assertLocalAnnotationMetaDatas(MetaData metaData, ExpectedAnnotations expected) throws Exception { assertNotNull(metaData); assertNotNull(expected); Object[] result = metaData.getLocalMetaData(); assertNotNull("Null result", result); ExpectedAnnotations actual = emptyExpectedAnnotations(); for (Object object : result) { assertNotNull("Null annotation " + Arrays.asList(result), object); assertTrue("Not an annotation " + Arrays.asList(result), object instanceof Annotation); Annotation annotation = (Annotation) object; actual.add(annotation.annotationType()); } assertExpectedAnnotations("AnnotationMetaDatas", expected, actual); } /** * Check the meta data * * @param metaData the retrieval * @param expected the expected annotation classes * @throws Exception for any error */ 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); Object object = item.getValue(); assertNotNull("Null object " + Arrays.asList(items), object); assertTrue("Not an annotation " + Arrays.asList(items), object instanceof Annotation); Annotation annotation = (Annotation) object; actual.add(annotation.annotationType()); } assertExpectedAnnotations("AnnotationMetaDatas", expected, actual); } /** * Check the local meta data * * @param metaData the retrieval * @param expected the expected annotation classes * @throws Exception for any error */ 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); Object object = item.getValue(); assertNotNull("Null object " + Arrays.asList(items), object); assertTrue("Not an annotation " + Arrays.asList(items), object instanceof Annotation); Annotation annotation = (Annotation) object; actual.add(annotation.annotationType()); } assertExpectedAnnotations("AnnotationMetaDatas", expected, actual); } /** * Assert two expected annotations * * @param context the context * @param expected the expected * @param actual the actual */ protected void assertExpectedAnnotations(String context, ExpectedAnnotations expected, ExpectedAnnotations actual) { assertEquals(context, expected.get(), actual.get()); } /** * Assert two expected meta datas * * @param context the context * @param expected the expected * @param actual the actual */ protected void assertExpectedMetaData(String context, ExpectedMetaData expected, ExpectedMetaData actual) { assertEquals(context, expected.get(), actual.get()); } /** * Assert two collections are equal * * @param the type * @param context the context * @param expected the expected * @param actual the actual */ protected void assertEquals(String context, Collection expected, Collection actual) { if (expected == null && actual == null) return; if (expected == null || actual == null) fail(context, expected, actual); if (expected.size() != actual.size()) fail(context, expected, actual); if (expected.containsAll(actual) == false) fail(context, expected, actual); if (actual.containsAll(expected) == false) fail(context, expected, actual); } /** * Raise an assertion failure for unequal collections * * @param context the context * @param expected the expected * @param actual the actual */ @SuppressWarnings("unchecked") private void fail(String context, Collection expected, Collection actual) { assertTrue("Unexpected " + context + " expected=" + expected + " actual=" + actual, false); } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/spi/0000755000175000017500000000000011620305601027125 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/spi/signature/0000755000175000017500000000000011620305601031126 5ustar twernertwerner././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/spi/signature/JavassistSignatureTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/spi/signature/JavassistSi0000644000175000017500000001125011006173304033314 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.spi.signature; import java.util.Calendar; import java.util.TimeZone; import javassist.ClassPool; import javassist.CtClass; import javassist.CtMethod; import javassist.NotFoundException; import junit.framework.Test; import org.jboss.metadata.spi.signature.Signature; import org.jboss.metadata.spi.signature.javassist.JavassistConstructorParametersSignature; import org.jboss.metadata.spi.signature.javassist.JavassistMethodParametersSignature; import org.jboss.metadata.spi.signature.javassist.JavassistSignatureFactory; import org.jboss.test.metadata.SignatureMetaDataTest; import org.jboss.test.metadata.shared.support.SignatureTester; /** * JavassistSignatureTestCase. * * @author Ales Justin */ public class JavassistSignatureTestCase extends SignatureMetaDataTest { private ClassPool pool; public JavassistSignatureTestCase(String name) { super(name); } public static Test suite() { return suite(JavassistSignatureTestCase.class); } protected void setUp() throws Exception { super.setUp(); pool = ClassPool.getDefault(); } protected void tearDown() throws Exception { super.tearDown(); pool = null; } protected CtClass getCtClass(Class clazz) throws NotFoundException { return pool.get(clazz.getName()); } public void testConstructor() throws Exception { CtClass ctClass = getCtClass(SignatureTester.class); Signature jpcs = JavassistSignatureFactory.getSignature(ctClass.getDeclaredConstructor(new CtClass[]{getCtClass(Calendar.class)})); assertEquals(getClassParameterConstructorSignature(), jpcs); assertEquals(getClassInfoParameterConstructorSignature(), jpcs); } public void testConstructorParams() throws Exception { CtClass ctClass = getCtClass(SignatureTester.class); Signature jpcs = new JavassistConstructorParametersSignature(ctClass.getDeclaredConstructor(new CtClass[]{getCtClass(Calendar.class)}), 0); assertEquals(getConstructorParametersSignature(), jpcs); assertEquals(getConstructorInfoParametersSignature(), jpcs); } public void testMethod() throws Exception { CtClass ctClass = getCtClass(SignatureTester.class); CtMethod ctMethod = ctClass.getDeclaredMethod("applyTimeZone", new CtClass[]{getCtClass(Calendar.class), getCtClass(TimeZone.class)}); Signature sig = JavassistSignatureFactory.getSignature(ctMethod); assertEquals(getClassMethodSignature(), sig); assertEquals(getStringMethodSignature(), sig); assertEquals(getMethodSignature(), sig); assertEquals(getMethodInfoSignature(), sig); } public void testMethodParams() throws Exception { CtClass ctClass = getCtClass(SignatureTester.class); CtMethod ctMethod = ctClass.getDeclaredMethod("applyTimeZone", new CtClass[]{getCtClass(Calendar.class), getCtClass(TimeZone.class)}); Signature sig = new JavassistMethodParametersSignature(ctMethod, 0); assertEquals(getClassMethodParametersSignature(), sig); assertEquals(getStringMethodParametersSignature(), sig); assertEquals(getMethodParametersSignature(), sig); assertEquals(getMethodInfoParametersSignature(), sig); } public void testField() throws Exception { CtClass ctClass = getCtClass(SignatureTester.class); Signature sig = JavassistSignatureFactory.getSignature(ctClass.getField("calendar")); assertEquals(getStringFieldSignature(), sig); assertEquals(getFieldSignature(), sig); assertEquals(getFieldInfoSignature(), sig); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/spi/signature/SignatureTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/spi/signature/SignatureTe0000644000175000017500000000253110703620003033301 0ustar twernertwernerpackage org.jboss.test.metadata.spi.signature; import java.lang.reflect.Method; import junit.framework.Test; import org.jboss.metadata.spi.signature.Signature; import org.jboss.test.ContainerTest; /** * @author genman */ public class SignatureTestCase extends ContainerTest { public SignatureTestCase(String name) { super(name); } public static Test suite() { return suite(SignatureTestCase.class); } public void testArray() throws Exception { Method method = getClass().getMethod("method", String.class, byte[].class, Byte[].class, String[][].class); Signature s = getSignature(method); Class[] parametersTypes = s.getParametersTypes(getClass()); assertEquals(4, parametersTypes.length); String p[] = { String.class.getName(), byte[].class.getName(), Byte[].class.getName(), String[][].class.getName()}; Signature s2 = new Signature("method", p); Class[] parametersTypes2 = s2.getParametersTypes(getClass()); assertEquals(parametersTypes, parametersTypes2); } // here for a reason - this test uses it public void method(String s, byte b[], Byte b2[], String[][] sa) { } protected Signature getSignature(Method method) { return new Signature(method.getName(), method.getParameterTypes()); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/spi/signature/SignatureEqualsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/spi/signature/SignatureEq0000644000175000017500000000605011216160102033275 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.spi.signature; import java.lang.reflect.Method; import junit.framework.Test; import org.jboss.metadata.spi.signature.DeclaredMethodSignature; import org.jboss.metadata.spi.signature.MethodSignature; import org.jboss.test.BaseTestCase; /** * Signature equality tests. * * @author Kabir Khan * @version $Revision: 1.1 $ */ public class SignatureEqualsUnitTestCase extends BaseTestCase { public SignatureEqualsUnitTestCase(String s) { super(s); } public static Test suite() { return suite(SignatureEqualsUnitTestCase.class); } public void testEqualsMethodSignature() throws Exception { MethodSignature sig1 = getMethodSignature(); MethodSignature sig2 = getMethodSignature(); assertEquals(sig1.hashCode(), sig2.hashCode()); assertTrue(sig1.equals(sig2)); assertTrue(sig2.equals(sig1)); } public void testEqualsDeclaredMethodSignature() throws Exception { DeclaredMethodSignature sig1 = getDeclaredMethodSignature(); DeclaredMethodSignature sig2 = getDeclaredMethodSignature(); assertEquals(sig1.hashCode(), sig2.hashCode()); assertTrue(sig1.equals(sig2)); assertTrue(sig2.equals(sig1)); } @SuppressWarnings({"EqualsBetweenInconvertibleTypes"}) public void testEqualsMethodSignatureAndDeclaredMethodSignature() throws Exception { MethodSignature ms = getMethodSignature(); DeclaredMethodSignature ds = getDeclaredMethodSignature(); assertEquals(ms.hashCode(), ds.hashCode()); assertTrue(ms.equals(ds)); assertTrue(ds.equals(ms)); } protected MethodSignature getMethodSignature() throws Exception { return new MethodSignature(getMethod()); } protected DeclaredMethodSignature getDeclaredMethodSignature() throws Exception { return new DeclaredMethodSignature(getMethod()); } protected Method getMethod() throws Exception { Class clazz = this.getClass(); return clazz.getDeclaredMethod("getMethod"); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/spi/ContainerSPITestSuite.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/spi/ContainerSPITestSuite0000644000175000017500000000360011216160102033213 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.spi; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.metadata.spi.signature.JavassistSignatureTestCase; import org.jboss.test.metadata.spi.signature.SignatureTestCase; import org.jboss.test.metadata.spi.signature.SignatureEqualsUnitTestCase; /** * Container spi tests. * * @author Ales Justin */ public class ContainerSPITestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Container SPI Tests"); suite.addTest(SignatureTestCase.suite()); suite.addTest(JavassistSignatureTestCase.suite()); suite.addTest(SignatureEqualsUnitTestCase.suite()); return suite; } }libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/0000755000175000017500000000000011620305576030031 5ustar twernertwerner././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/AbstractMetaDataContextTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/AbstractMetaDataC0000644000175000017500000000701610446527733033235 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context; import java.util.ArrayList; import java.util.List; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.AbstractMetaDataTest; /** * AbstractMetaDataContextTest. * * @author Adrian Brock * @version $Revision: 45742 $ */ public abstract class AbstractMetaDataContextTest extends AbstractMetaDataTest { public AbstractMetaDataContextTest(String name) { super(name); } protected MetaDataRetrieval firstChild; protected MetaDataRetrieval secondChild; protected MetaDataRetrieval firstParent; protected MetaDataRetrieval secondParent; /** * Create a new context * * @param parent the parent * @param retrievals the retrievals * @return the context */ protected abstract MetaDataContext createContext(MetaDataContext parent, List retrievals); /** * Create a new parent context * * @param retrievals the retrievals * @return the context */ protected MetaDataContext createParentContext(List retrievals) { return createContext(null, retrievals); } /** * Create a new child context * * @param parent the parent * @param retrievals the retrievals * @return the context */ protected MetaDataContext createChildContext(MetaDataContext parent, List retrievals) { return createContext(parent, retrievals); } /** * Create the retrieval * * @return the retrieval */ protected abstract MetaDataRetrieval createRetrieval(); /** * Create a test context * * @return the test context */ protected MetaData createTestContext() { firstParent = createRetrieval(); secondParent = createRetrieval(); List retrievals = new ArrayList(); retrievals.add(firstParent); retrievals.add(secondParent); MetaDataContext parentContext = createParentContext(retrievals); firstChild = createRetrieval(); secondChild = createRetrieval(); retrievals = new ArrayList(); retrievals.add(firstChild); retrievals.add(secondChild); MetaDataContext context = createChildContext(parentContext, retrievals); return new MetaDataRetrievalToMetaDataBridge(context); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/AbstractMetaDataContextMemoryLoaderTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/AbstractMetaDataC0000644000175000017500000000422210446527733033231 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context; import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; /** * AbstractMetaDataContextTest. * * @author Adrian Brock * @version $Revision: 45742 $ */ public abstract class AbstractMetaDataContextMemoryLoaderTest extends AbstractMetaDataContextTest { public AbstractMetaDataContextMemoryLoaderTest(String name) { super(name); } /** * Create the retrieval * * @return the retrieval */ protected MetaDataRetrieval createRetrieval() { return new MemoryMetaDataLoader(); } protected MutableMetaDataLoader getFirstParent() { return (MutableMetaDataLoader) firstParent; } protected MutableMetaDataLoader getSecondParent() { return (MutableMetaDataLoader) secondParent; } protected MutableMetaDataLoader getFirstChild() { return (MutableMetaDataLoader) firstChild; } protected MutableMetaDataLoader getSecondChild() { return (MutableMetaDataLoader) secondChild; } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/0000755000175000017500000000000011620305573031107 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/0000755000175000017500000000000011620305574032067 5ustar twernertwerner././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/BasicContextTestSuite.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/BasicC0000644000175000017500000000400210446527733033142 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.basic.test; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * BasicContextTestSuite. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class BasicContextTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Basic Context Tests"); suite.addTest(new TestSuite(BasicContextBasicAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(BasicParentContextBasicAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(BasicContextBasicMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(BasicParentContextBasicMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(BasicMetaDataContextAnnotationUnitTestCase.class)); suite.addTest(new TestSuite(BasicMetaDataContextMetaDataUnitTestCase.class)); return suite; } } ././@LongLink0000000000000000000000000000022200000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/BasicParentContextBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/BasicP0000644000175000017500000000561710454442653033170 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.basic.test; import org.jboss.metadata.plugins.context.AbstractMetaDataContext; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.shared.BasicAnnotationsTest; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * BasicContextBasicAnnotationsUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class BasicParentContextBasicAnnotationsUnitTestCase extends BasicAnnotationsTest { public BasicParentContextBasicAnnotationsUnitTestCase(String name) { 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); } protected MetaData setupEmpty() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); return setupMetaData(loader); } protected MetaData setupTestAnnotation() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addAnnotation(new TestAnnotationImpl()); return setupMetaData(loader); } protected MetaData setupTestAnnotation12() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addAnnotation(new TestAnnotation1Impl()); loader.addAnnotation(new TestAnnotation2Impl()); return setupMetaData(loader); } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/BasicMetaDataContextMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/BasicM0000644000175000017500000000344310446527733033164 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.basic.test; import java.util.List; import org.jboss.metadata.plugins.context.AbstractMetaDataContext; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.test.metadata.context.MetaDataContextMetaDataTest; /** * BasicMetaDataContextMetaDataUnitTestCase. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class BasicMetaDataContextMetaDataUnitTestCase extends MetaDataContextMetaDataTest { public BasicMetaDataContextMetaDataUnitTestCase(String name) { super(name); } protected MetaDataContext createContext(MetaDataContext parent, List retrievals) { return new AbstractMetaDataContext(parent, retrievals); } } ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/BasicMetaDataContextAnnotationUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/BasicM0000644000175000017500000000345510446527733033167 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.basic.test; import java.util.List; import org.jboss.metadata.plugins.context.AbstractMetaDataContext; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.test.metadata.context.MetaDataContextAnnotationTest; /** * BasicMetaDataContextAnnotationUnitTestCase. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class BasicMetaDataContextAnnotationUnitTestCase extends MetaDataContextAnnotationTest { public BasicMetaDataContextAnnotationUnitTestCase(String name) { super(name); } protected MetaDataContext createContext(MetaDataContext parent, List retrievals) { return new AbstractMetaDataContext(parent, retrievals); } } ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/BasicParentContextBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/BasicP0000644000175000017500000000724410454442653033166 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.basic.test; import org.jboss.metadata.plugins.context.AbstractMetaDataContext; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.shared.BasicMetaDataTest; import org.jboss.test.metadata.shared.support.TestMetaData; import org.jboss.test.metadata.shared.support.TestMetaData1; import org.jboss.test.metadata.shared.support.TestMetaData1Impl; import org.jboss.test.metadata.shared.support.TestMetaData2; import org.jboss.test.metadata.shared.support.TestMetaData2Impl; import org.jboss.test.metadata.shared.support.TestMetaDataImpl; /** * BasicParentContextBasicMetaDataUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class BasicParentContextBasicMetaDataUnitTestCase extends BasicMetaDataTest { public BasicParentContextBasicMetaDataUnitTestCase(String name) { 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); } protected MetaData setupEmpty() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); return setupMetaData(loader); } protected MetaData setupTestMetaData() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData(new TestMetaDataImpl(), TestMetaData.class); return setupMetaData(loader); } protected MetaData setupTestMetaData12() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData(new TestMetaData1Impl(), TestMetaData1.class); loader.addMetaData(new TestMetaData2Impl(), TestMetaData2.class); return setupMetaData(loader); } protected MetaData setupTestMetaDataByName() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData("Test", new TestMetaDataImpl(), TestMetaData.class); return setupMetaData(loader); } protected MetaData setupTestMetaData12ByName() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData("Test1", new TestMetaData1Impl(), TestMetaData1.class); loader.addMetaData("Test2", new TestMetaData2Impl(), TestMetaData2.class); return setupMetaData(loader); } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/BasicContextBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/BasicC0000644000175000017500000000676710454442653033162 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.basic.test; import org.jboss.metadata.plugins.context.AbstractMetaDataContext; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.shared.BasicMetaDataTest; import org.jboss.test.metadata.shared.support.TestMetaData; import org.jboss.test.metadata.shared.support.TestMetaData1; import org.jboss.test.metadata.shared.support.TestMetaData1Impl; import org.jboss.test.metadata.shared.support.TestMetaData2; import org.jboss.test.metadata.shared.support.TestMetaData2Impl; import org.jboss.test.metadata.shared.support.TestMetaDataImpl; /** * BasicContextBasicMetaDataUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class BasicContextBasicMetaDataUnitTestCase extends BasicMetaDataTest { public BasicContextBasicMetaDataUnitTestCase(String name) { super(name, true); } protected MetaData setupMetaData(MetaDataLoader loader) { AbstractMetaDataContext context = new AbstractMetaDataContext(null, loader); return new MetaDataRetrievalToMetaDataBridge(context); } protected MetaData setupEmpty() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); return setupMetaData(loader); } protected MetaData setupTestMetaData() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData(new TestMetaDataImpl(), TestMetaData.class); return setupMetaData(loader); } protected MetaData setupTestMetaData12() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData(new TestMetaData1Impl(), TestMetaData1.class); loader.addMetaData(new TestMetaData2Impl(), TestMetaData2.class); return setupMetaData(loader); } protected MetaData setupTestMetaDataByName() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData("Test", new TestMetaDataImpl(), TestMetaData.class); return setupMetaData(loader); } protected MetaData setupTestMetaData12ByName() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData("Test1", new TestMetaData1Impl(), TestMetaData1.class); loader.addMetaData("Test2", new TestMetaData2Impl(), TestMetaData2.class); return setupMetaData(loader); } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/BasicContextBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/basic/test/BasicC0000644000175000017500000000535310454442653033150 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.basic.test; import org.jboss.metadata.plugins.context.AbstractMetaDataContext; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.shared.BasicAnnotationsTest; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * BasicContextBasicAnnotationsUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class BasicContextBasicAnnotationsUnitTestCase extends BasicAnnotationsTest { public BasicContextBasicAnnotationsUnitTestCase(String name) { super(name, true); } protected MetaData setupMetaData(MetaDataLoader loader) { AbstractMetaDataContext context = new AbstractMetaDataContext(null, loader); return new MetaDataRetrievalToMetaDataBridge(context); } protected MetaData setupEmpty() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); return setupMetaData(loader); } protected MetaData setupTestAnnotation() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addAnnotation(new TestAnnotationImpl()); return setupMetaData(loader); } protected MetaData setupTestAnnotation12() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addAnnotation(new TestAnnotation1Impl()); loader.addAnnotation(new TestAnnotation2Impl()); return setupMetaData(loader); } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/0000755000175000017500000000000011620305576031074 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/0000755000175000017500000000000011620305576032053 5ustar twernertwerner././@LongLink0000000000000000000000000000023400000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedCPSimpleCacheMetaDataContextWithFactoryUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedC0000644000175000017500000000322511033112415033127 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.TimedCachePolicyFactory; /** * CPSimpleCacheMetaDataContextWithFactoryUnitTestCase. * * @author Ales Justin */ public class TimedCPSimpleCacheMetaDataContextWithFactoryUnitTestCase extends CPSimpleCacheMetaDataContextWithFactoryUnitTestCase { public TimedCPSimpleCacheMetaDataContextWithFactoryUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new TimedCachePolicyFactory(500); } }././@LongLink0000000000000000000000000000023300000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedCPCacheContextWithFactoryBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedC0000644000175000017500000000321711033112415033130 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.TimedCachePolicyFactory; /** * CacheContextWithFactoryBasicMetaDataUnitTestCase. * * @author Ales Justin */ public class TimedCPCacheContextWithFactoryBasicMetaDataUnitTestCase extends CPCacheContextWithFactoryBasicMetaDataUnitTestCase { public TimedCPCacheContextWithFactoryBasicMetaDataUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new TimedCachePolicyFactory(500); } }././@LongLink0000000000000000000000000000024000000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPSimpleCacheParentMetaDataContextWithFactoryUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPS0000644000175000017500000000324411033112415032773 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.LRUCachePolicyFactory; /** * LRUCPSimpleCacheMetaDataContextWithFactoryUnitTestCase. * * @author Ales Justin */ public class LRUCPSimpleCacheParentMetaDataContextWithFactoryUnitTestCase extends CPSimpleCacheParentMetaDataContextWithFactoryUnitTestCase { public LRUCPSimpleCacheParentMetaDataContextWithFactoryUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new LRUCachePolicyFactory(2, 10); } }././@LongLink0000000000000000000000000000023600000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedCPCacheContextWithFactoryBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedC0000644000175000017500000000323611033112415033131 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.TimedCachePolicyFactory; /** * JBCCacheContextWithFactoryBasicAnnotationsUnitTestCase. * * @author Ales Justin */ public class TimedCPCacheContextWithFactoryBasicAnnotationsUnitTestCase extends CPCacheContextWithFactoryBasicAnnotationsUnitTestCase { public TimedCPCacheContextWithFactoryBasicAnnotationsUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new TimedCachePolicyFactory(500); } }././@LongLink0000000000000000000000000000023600000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPCacheMetaDataContextWithFactoryAnnotationUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPC0000644000175000017500000000324211033112415032751 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.LRUCachePolicyFactory; /** * LRUCPCacheMetaDataContextWithFactoryAnnotationUnitTestCase. * * @author Ales Justin */ public class LRUCPCacheMetaDataContextWithFactoryAnnotationUnitTestCase extends CPCacheMetaDataContextWithFactoryAnnotationUnitTestCase { public LRUCPCacheMetaDataContextWithFactoryAnnotationUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new LRUCachePolicyFactory(2, 10); } }././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheContextBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheC0000644000175000017500000000715411033112415033075 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.shared.BasicMetaDataTest; import org.jboss.test.metadata.shared.support.TestMetaData; import org.jboss.test.metadata.shared.support.TestMetaData1; import org.jboss.test.metadata.shared.support.TestMetaData1Impl; import org.jboss.test.metadata.shared.support.TestMetaData2; import org.jboss.test.metadata.shared.support.TestMetaData2Impl; import org.jboss.test.metadata.shared.support.TestMetaDataImpl; /** * CacheContextBasicMetaDataUnitTestCase. * * @author Adrian Brock * @version $Revision: 75335 $ */ public class CacheContextBasicMetaDataUnitTestCase extends BasicMetaDataTest { public CacheContextBasicMetaDataUnitTestCase(String name) { super(name, true); } protected MetaData setupMetaData(MetaDataLoader loader) { CachingMetaDataContext context = createContext(loader); return new MetaDataRetrievalToMetaDataBridge(context); } protected CachingMetaDataContext createContext(MetaDataLoader loader) { return new CachingMetaDataContext(null, loader); } protected MetaData setupEmpty() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); return setupMetaData(loader); } protected MetaData setupTestMetaData() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData(new TestMetaDataImpl(), TestMetaData.class); return setupMetaData(loader); } protected MetaData setupTestMetaData12() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData(new TestMetaData1Impl(), TestMetaData1.class); loader.addMetaData(new TestMetaData2Impl(), TestMetaData2.class); return setupMetaData(loader); } protected MetaData setupTestMetaDataByName() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData("Test", new TestMetaDataImpl(), TestMetaData.class); return setupMetaData(loader); } protected MetaData setupTestMetaData12ByName() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData("Test1", new TestMetaData1Impl(), TestMetaData1.class); loader.addMetaData("Test2", new TestMetaData2Impl(), TestMetaData2.class); return setupMetaData(loader); } } ././@LongLink0000000000000000000000000000023400000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPCacheMetaDataContextWithFactoryMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPC0000644000175000017500000000322711033112415032754 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.LRUCachePolicyFactory; /** * CPCacheMetaDataContextWithFactoryMetaDataUnitTestCase. * * @author Ales Justin */ public class LRUCPCacheMetaDataContextWithFactoryMetaDataUnitTestCase extends CPCacheMetaDataContextWithFactoryMetaDataUnitTestCase { public LRUCPCacheMetaDataContextWithFactoryMetaDataUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new LRUCachePolicyFactory(2, 10); } }././@LongLink0000000000000000000000000000022200000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheParentContextBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheP0000644000175000017500000000600211033112415033101 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.shared.BasicAnnotationsTest; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * CacheContextBasicAnnotationsUnitTestCase. * * @author Adrian Brock * @version $Revision: 75335 $ */ public class CacheParentContextBasicAnnotationsUnitTestCase extends BasicAnnotationsTest { public CacheParentContextBasicAnnotationsUnitTestCase(String name) { super(name, false); } protected MetaData setupMetaData(MetaDataLoader loader) { CachingMetaDataContext parent = createContext(loader); MutableMetaDataLoader empty = createTestMutableMetaDataLoader(); CachingMetaDataContext context = new CachingMetaDataContext(parent, empty); return new MetaDataRetrievalToMetaDataBridge(context); } protected CachingMetaDataContext createContext(MetaDataLoader loader) { return new CachingMetaDataContext(null, loader); } protected MetaData setupEmpty() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); return setupMetaData(loader); } protected MetaData setupTestAnnotation() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addAnnotation(new TestAnnotationImpl()); return setupMetaData(loader); } protected MetaData setupTestAnnotation12() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addAnnotation(new TestAnnotation1Impl()); loader.addAnnotation(new TestAnnotation2Impl()); return setupMetaData(loader); } } ././@LongLink0000000000000000000000000000023700000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPCacheParentContextWithFactoryBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPCach0000644000175000017500000000344211033116351033047 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyCacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyFactory; /** * CPCacheContextWithFactoryBasicAnnotationsUnitTestCase. * * @author Ales Justin */ public abstract class CPCacheParentContextWithFactoryBasicAnnotationsUnitTestCase extends CacheParentContextWithFactoryBasicAnnotationsUnitTestCase { public CPCacheParentContextWithFactoryBasicAnnotationsUnitTestCase(String name) { super(name); } protected CacheFactory createFactory() { return new CachePolicyCacheFactory(getPolicy()); } protected abstract CachePolicyFactory getPolicy(); }././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheContextWithFactoryBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheC0000644000175000017500000000362211033116351033074 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.spi.loader.MetaDataLoader; /** * CacheContextWithFactoryBasicMetaDataUnitTestCase. * * @author Ales Justin */ public abstract class CacheContextWithFactoryBasicMetaDataUnitTestCase extends CacheContextBasicMetaDataUnitTestCase { private CacheFactory factory; public CacheContextWithFactoryBasicMetaDataUnitTestCase(String name) { super(name); } protected CachingMetaDataContext createContext(MetaDataLoader loader) { return new CachingMetaDataContext(null, loader, getFactory()); } private CacheFactory getFactory() { if (factory == null) factory = createFactory(); return factory; } protected abstract CacheFactory createFactory(); }././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/SimpleCacheMetaDataContextUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/Simple0000644000175000017500000002616310756326650033244 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import java.lang.annotation.Annotation; import java.util.List; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.basic.BasicAnnotationItem; import org.jboss.metadata.spi.retrieval.basic.BasicAnnotationsItem; import org.jboss.test.metadata.context.AbstractMetaDataContextTest; import org.jboss.test.metadata.context.cache.support.TestMetaDataLoader; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * SimpleCacheMetaDataContextUnitTestCase. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class SimpleCacheMetaDataContextUnitTestCase extends AbstractMetaDataContextTest { public SimpleCacheMetaDataContextUnitTestCase(String name) { super(name); } protected MetaDataRetrieval createRetrieval() { return new TestMetaDataLoader(); } protected MetaDataContext createContext(MetaDataContext parent, List retrievals) { return new CachingMetaDataContext(parent, retrievals); } protected TestMetaDataLoader getFirstParent() { return (TestMetaDataLoader) firstParent; } protected TestMetaDataLoader getSecondParent() { return (TestMetaDataLoader) secondParent; } protected TestMetaDataLoader getFirstChild() { return (TestMetaDataLoader) firstChild; } protected TestMetaDataLoader getSecondChild() { return (TestMetaDataLoader) secondChild; } protected BasicAnnotationItem createAnnotationItem(TestMetaDataLoader loader, T annotation, Class type) { return new BasicAnnotationItem(loader, annotation); } @SuppressWarnings("unchecked") protected void setAnnotations(TestMetaDataLoader loader, AnnotationItem annotationItem) { AnnotationItem[] items = { annotationItem }; BasicAnnotationsItem item = new BasicAnnotationsItem(loader, items); loader.setAnnotationsItem(item); } protected void testAnnotation(MetaData metaData, TestMetaDataLoader loader) throws Exception { assertNoAnnotation(metaData, TestAnnotation.class); assertTrue(loader.isRetrieved()); BasicAnnotationItem annotationItem = createAnnotationItem(loader, new TestAnnotationImpl(), TestAnnotation.class); setAnnotations(loader, annotationItem); assertAnnotation(metaData, TestAnnotation.class); assertTrue(loader.isRetrieved()); assertAnnotation(metaData, TestAnnotation.class); assertFalse(loader.isRetrieved()); loader.clear(); assertNoAnnotation(metaData, TestAnnotation.class); assertTrue(loader.isRetrieved()); } public void testAnnotationFirstChild() throws Exception { MetaData metaData = createTestContext(); testAnnotation(metaData, getFirstChild()); } public void testAnnotationSecondChild() throws Exception { MetaData metaData = createTestContext(); testAnnotation(metaData, getSecondChild()); } public void testAnnotationFirstParent() throws Exception { MetaData metaData = createTestContext(); testAnnotation(metaData, getFirstParent()); } public void testAnnotationSecondParent() throws Exception { MetaData metaData = createTestContext(); testAnnotation(metaData, getSecondParent()); } protected void testBelowAnnotation(MetaData metaData, TestMetaDataLoader aboveLoader, TestMetaDataLoader belowLoader) throws Exception { assertNoAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertTrue(belowLoader.isRetrieved()); BasicAnnotationItem annotationItem = createAnnotationItem(aboveLoader, new TestAnnotationImpl(), TestAnnotation.class); setAnnotations(aboveLoader, annotationItem); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); assertAnnotation(metaData, TestAnnotation.class); assertFalse(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); annotationItem = createAnnotationItem(belowLoader, new TestAnnotationImpl(), TestAnnotation.class); setAnnotations(belowLoader, annotationItem); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); assertAnnotation(metaData, TestAnnotation.class); assertFalse(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); annotationItem.invalidate(); assertAnnotation(metaData, TestAnnotation.class); assertFalse(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); belowLoader.clear(); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); aboveLoader.clear(); assertNoAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertTrue(belowLoader.isRetrieved()); } public void testBelowAnnotationFirstChildSecondChild() throws Exception { MetaData metaData = createTestContext(); testBelowAnnotation(metaData, getFirstChild(), getSecondChild()); } public void testBelowAnnotationFirstChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testBelowAnnotation(metaData, getFirstChild(), getFirstParent()); } public void testBelowAnnotationFirstChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testBelowAnnotation(metaData, getFirstChild(), getSecondParent()); } public void testBelowAnnotationSecondChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testBelowAnnotation(metaData, getSecondChild(), getFirstParent()); } public void testBelowAnnotationSecondChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testBelowAnnotation(metaData, getSecondChild(), getSecondParent()); } public void testBelowAnnotationFirstParentSecondParent() throws Exception { MetaData metaData = createTestContext(); testBelowAnnotation(metaData, getFirstParent(), getSecondParent()); } protected void testAboveAnnotation(MetaData metaData, TestMetaDataLoader aboveLoader, TestMetaDataLoader belowLoader) throws Exception { assertNoAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertTrue(belowLoader.isRetrieved()); BasicAnnotationItem annotationItem = createAnnotationItem(belowLoader, new TestAnnotationImpl(), TestAnnotation.class); setAnnotations(belowLoader, annotationItem); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertTrue(belowLoader.isRetrieved()); assertAnnotation(metaData, TestAnnotation.class); assertFalse(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); annotationItem = createAnnotationItem(aboveLoader, new TestAnnotationImpl(), TestAnnotation.class); setAnnotations(aboveLoader, annotationItem); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); assertAnnotation(metaData, TestAnnotation.class); assertFalse(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); belowLoader.clear(); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); annotationItem = createAnnotationItem(belowLoader, new TestAnnotationImpl(), TestAnnotation.class); setAnnotations(belowLoader, annotationItem); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); assertAnnotation(metaData, TestAnnotation.class); assertFalse(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); aboveLoader.clear(); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertTrue(belowLoader.isRetrieved()); belowLoader.clear(); assertNoAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertTrue(belowLoader.isRetrieved()); } public void testAboveAnnotationFirstChildSecondChild() throws Exception { MetaData metaData = createTestContext(); testAboveAnnotation(metaData, getFirstChild(), getSecondChild()); } public void testAboveAnnotationFirstChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testAboveAnnotation(metaData, getFirstChild(), getFirstParent()); } public void testAboveAnnotationFirstChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testAboveAnnotation(metaData, getFirstChild(), getSecondParent()); } public void testAboveAnnotationSecondChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testAboveAnnotation(metaData, getSecondChild(), getFirstParent()); } public void testAboveAnnotationSecondChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testAboveAnnotation(metaData, getSecondChild(), getSecondParent()); } public void testAboveAnnotationFirstParentSecondParent() throws Exception { MetaData metaData = createTestContext(); testAboveAnnotation(metaData, getFirstParent(), getSecondParent()); } } ././@LongLink0000000000000000000000000000023100000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPCacheContextWithFactoryBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPCach0000644000175000017500000000342111033116351033044 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyCacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyFactory; /** * JBCCacheContextWithFactoryBasicAnnotationsUnitTestCase. * * @author Ales Justin */ public abstract class CPCacheContextWithFactoryBasicAnnotationsUnitTestCase extends CacheContextWithFactoryBasicAnnotationsUnitTestCase { public CPCacheContextWithFactoryBasicAnnotationsUnitTestCase(String name) { super(name); } protected CacheFactory createFactory() { return new CachePolicyCacheFactory(getPolicy()); } protected abstract CachePolicyFactory getPolicy(); }././@LongLink0000000000000000000000000000023200000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPSimpleCacheMetaDataContextWithFactoryUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPS0000644000175000017500000000321711033112415032773 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.LRUCachePolicyFactory; /** * CPSimpleCacheMetaDataContextWithFactoryUnitTestCase. * * @author Ales Justin */ public class LRUCPSimpleCacheMetaDataContextWithFactoryUnitTestCase extends CPSimpleCacheMetaDataContextWithFactoryUnitTestCase { public LRUCPSimpleCacheMetaDataContextWithFactoryUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new LRUCachePolicyFactory(2, 10); } }././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheMetaDataContextWithFactoryMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheM0000644000175000017500000000402711033116351033106 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import java.util.List; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; /** * CacheMetaDataContextWithFactoryMetaDataUnitTestCase. * * @author Ales Justin */ public abstract class CacheMetaDataContextWithFactoryMetaDataUnitTestCase extends CacheMetaDataContextMetaDataUnitTestCase { private CacheFactory factory; public CacheMetaDataContextWithFactoryMetaDataUnitTestCase(String name) { super(name); } protected MetaDataContext createContext(MetaDataContext parent, List retrievals) { return new CachingMetaDataContext(parent, retrievals, getFactory()); } private CacheFactory getFactory() { if (factory == null) factory = createFactory(); return factory; } protected abstract CacheFactory createFactory(); }././@LongLink0000000000000000000000000000023500000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPSimpleCacheParentMetaDataContextWithFactoryUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPSimp0000644000175000017500000000343211033116351033120 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyCacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyFactory; /** * CPSimpleCacheMetaDataContextWithFactoryUnitTestCase. * * @author Ales Justin */ public abstract class CPSimpleCacheParentMetaDataContextWithFactoryUnitTestCase extends SimpleCacheParentMetaDataContextWithFactoryUnitTestCase { public CPSimpleCacheParentMetaDataContextWithFactoryUnitTestCase(String name) { super(name); } protected CacheFactory createFactory() { return new CachePolicyCacheFactory(getPolicy()); } protected abstract CachePolicyFactory getPolicy(); }././@LongLink0000000000000000000000000000023200000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheParentContextWithFactoryBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheP0000644000175000017500000000424511033116351033113 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; /** * CacheParentContextWithFactoryBasicMetaDataUnitTestCase. * * @author Ales Justin */ public abstract class CacheParentContextWithFactoryBasicMetaDataUnitTestCase extends CacheParentContextBasicMetaDataUnitTestCase { private CacheFactory factory; public CacheParentContextWithFactoryBasicMetaDataUnitTestCase(String name) { super(name); } protected CachingMetaDataContext createContext(MetaDataLoader loader) { return new CachingMetaDataContext(null, loader, getFactory()); } protected CachingMetaDataContext createContext(CachingMetaDataContext parent, MutableMetaDataLoader empty) { return new CachingMetaDataContext(parent, empty, getFactory()); } private CacheFactory getFactory() { if (factory == null) factory = createFactory(); return factory; } protected abstract CacheFactory createFactory(); }././@LongLink0000000000000000000000000000023400000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPCacheParentContextWithFactoryBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPCach0000644000175000017500000000343411033116351033050 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyCacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyFactory; /** * CPCacheParentContextWithFactoryBasicMetaDataUnitTestCase. * * @author Ales Justin */ public abstract class CPCacheParentContextWithFactoryBasicMetaDataUnitTestCase extends CacheParentContextWithFactoryBasicMetaDataUnitTestCase { public CPCacheParentContextWithFactoryBasicMetaDataUnitTestCase(String name) { super(name); } protected CacheFactory createFactory() { return new CachePolicyCacheFactory(getPolicy()); } protected abstract CachePolicyFactory getPolicy(); }././@LongLink0000000000000000000000000000023700000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPCacheParentContextWithFactoryBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPC0000644000175000017500000000324311033112415032752 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.LRUCachePolicyFactory; /** * CPCacheParentContextWithFactoryBasicMetaDataUnitTestCase. * * @author Ales Justin */ public class LRUCPCacheParentContextWithFactoryBasicMetaDataUnitTestCase extends CPCacheParentContextWithFactoryBasicMetaDataUnitTestCase { public LRUCPCacheParentContextWithFactoryBasicMetaDataUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new LRUCachePolicyFactory(2, 10); } }././@LongLink0000000000000000000000000000023100000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheMetaDataContextWithFactoryAnnotationUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheM0000644000175000017500000000403711033116351033107 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import java.util.List; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; /** * CacheMetaDataContextWithFactoryAnnotationUnitTestCase. * * @author Ales Justin */ public abstract class CacheMetaDataContextWithFactoryAnnotationUnitTestCase extends CacheMetaDataContextAnnotationUnitTestCase { private CacheFactory factory; public CacheMetaDataContextWithFactoryAnnotationUnitTestCase(String name) { super(name); } protected MetaDataContext createContext(MetaDataContext parent, List retrievals) { return new CachingMetaDataContext(parent, retrievals, getFactory()); } private CacheFactory getFactory() { if (factory == null) factory = createFactory(); return factory; } protected abstract CacheFactory createFactory(); }././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheContextWithFactoryBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheC0000644000175000017500000000363611033116351033101 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.spi.loader.MetaDataLoader; /** * CacheContextWithFactoryBasicAnnotationsUnitTestCase. * * @author Ales Justin */ public abstract class CacheContextWithFactoryBasicAnnotationsUnitTestCase extends CacheContextBasicAnnotationsUnitTestCase { private CacheFactory factory; public CacheContextWithFactoryBasicAnnotationsUnitTestCase(String name) { super(name); } protected CachingMetaDataContext createContext(MetaDataLoader loader) { return new CachingMetaDataContext(null, loader, getFactory()); } private CacheFactory getFactory() { if (factory == null) factory = createFactory(); return factory; } protected abstract CacheFactory createFactory(); }././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheContextBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheC0000644000175000017500000000553511033112415033076 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.shared.BasicAnnotationsTest; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * CacheContextBasicAnnotationsUnitTestCase. * * @author Adrian Brock * @version $Revision: 75335 $ */ public class CacheContextBasicAnnotationsUnitTestCase extends BasicAnnotationsTest { public CacheContextBasicAnnotationsUnitTestCase(String name) { super(name, true); } protected CachingMetaDataContext createContext(MetaDataLoader loader) { return new CachingMetaDataContext(null, loader); } protected MetaData setupMetaData(MetaDataLoader loader) { CachingMetaDataContext context = createContext(loader); return new MetaDataRetrievalToMetaDataBridge(context); } protected MetaData setupEmpty() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); return setupMetaData(loader); } protected MetaData setupTestAnnotation() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addAnnotation(new TestAnnotationImpl()); return setupMetaData(loader); } protected MetaData setupTestAnnotation12() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addAnnotation(new TestAnnotation1Impl()); loader.addAnnotation(new TestAnnotation2Impl()); return setupMetaData(loader); } } ././@LongLink0000000000000000000000000000023300000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPCacheMetaDataContextWithFactoryAnnotationUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPCach0000644000175000017500000000343011033116351033044 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyCacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyFactory; /** * CPCacheMetaDataContextWithFactoryAnnotationUnitTestCase. * * @author Ales Justin */ public abstract class CPCacheMetaDataContextWithFactoryAnnotationUnitTestCase extends CacheMetaDataContextWithFactoryAnnotationUnitTestCase { public CPCacheMetaDataContextWithFactoryAnnotationUnitTestCase(String name) { super(name); } protected CacheFactory createFactory() { return new CachePolicyCacheFactory(getPolicy()); } protected abstract CachePolicyFactory getPolicy(); }././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheContextTestSuite.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheC0000644000175000017500000000751411034400444033100 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * CacheContextTestSuite. * * @author Adrian Brock * @author Ales Justin * @version $Revision: 75435 $ */ public class CacheContextTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Cache Context Tests"); suite.addTest(new TestSuite(CacheContextBasicAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(LRUCPCacheContextWithFactoryBasicAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(TimedCPCacheContextWithFactoryBasicAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(CacheParentContextBasicAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(LRUCPCacheParentContextWithFactoryBasicAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(TimedCPCacheParentContextWithFactoryBasicAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(CacheContextBasicMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(LRUCPCacheContextWithFactoryBasicMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(TimedCPCacheContextWithFactoryBasicMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(CacheParentContextBasicMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(LRUCPCacheParentContextWithFactoryBasicMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(TimedCPCacheParentContextWithFactoryBasicMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(CacheMetaDataContextAnnotationUnitTestCase.class)); suite.addTest(new TestSuite(LRUCPCacheMetaDataContextWithFactoryAnnotationUnitTestCase.class)); suite.addTest(new TestSuite(TimedCPCacheMetaDataContextWithFactoryAnnotationUnitTestCase.class)); suite.addTest(new TestSuite(CacheMetaDataContextMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(LRUCPCacheMetaDataContextWithFactoryMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(TimedCPCacheMetaDataContextWithFactoryMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(SimpleCacheMetaDataContextUnitTestCase.class)); suite.addTest(new TestSuite(LRUCPSimpleCacheMetaDataContextWithFactoryUnitTestCase.class)); suite.addTest(new TestSuite(TimedCPSimpleCacheMetaDataContextWithFactoryUnitTestCase.class)); suite.addTest(new TestSuite(SimpleCacheParentMetaDataContextUnitTestCase.class)); suite.addTest(new TestSuite(LRUCPSimpleCacheParentMetaDataContextWithFactoryUnitTestCase.class)); suite.addTest(new TestSuite(TimedCPSimpleCacheParentMetaDataContextWithFactoryUnitTestCase.class)); return suite; } } ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheParentContextBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheP0000644000175000017500000000767311033112415033120 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.shared.BasicMetaDataTest; import org.jboss.test.metadata.shared.support.TestMetaData; import org.jboss.test.metadata.shared.support.TestMetaData1; import org.jboss.test.metadata.shared.support.TestMetaData1Impl; import org.jboss.test.metadata.shared.support.TestMetaData2; import org.jboss.test.metadata.shared.support.TestMetaData2Impl; import org.jboss.test.metadata.shared.support.TestMetaDataImpl; /** * CacheParentContextBasicMetaDataUnitTestCase. * * @author Adrian Brock * @version $Revision: 75335 $ */ public class CacheParentContextBasicMetaDataUnitTestCase extends BasicMetaDataTest { public CacheParentContextBasicMetaDataUnitTestCase(String name) { super(name, false); } protected MetaData setupMetaData(MetaDataLoader loader) { CachingMetaDataContext parent = createContext(loader); MutableMetaDataLoader empty = createTestMutableMetaDataLoader(); CachingMetaDataContext context = createContext(parent, empty); return new MetaDataRetrievalToMetaDataBridge(context); } protected CachingMetaDataContext createContext(CachingMetaDataContext parent, MutableMetaDataLoader empty) { return new CachingMetaDataContext(parent, empty); } protected CachingMetaDataContext createContext(MetaDataLoader loader) { return new CachingMetaDataContext(null, loader); } protected MetaData setupEmpty() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); return setupMetaData(loader); } protected MetaData setupTestMetaData() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData(new TestMetaDataImpl(), TestMetaData.class); return setupMetaData(loader); } protected MetaData setupTestMetaData12() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData(new TestMetaData1Impl(), TestMetaData1.class); loader.addMetaData(new TestMetaData2Impl(), TestMetaData2.class); return setupMetaData(loader); } protected MetaData setupTestMetaDataByName() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData("Test", new TestMetaDataImpl(), TestMetaData.class); return setupMetaData(loader); } protected MetaData setupTestMetaData12ByName() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData("Test1", new TestMetaData1Impl(), TestMetaData1.class); loader.addMetaData("Test2", new TestMetaData2Impl(), TestMetaData2.class); return setupMetaData(loader); } } ././@LongLink0000000000000000000000000000024100000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedCPCacheParentContextWithFactoryBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedC0000644000175000017500000000325111033112415033126 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.TimedCachePolicyFactory; /** * CPCacheParentContextWithFactoryBasicMetaDataUnitTestCase. * * @author Ales Justin */ public class TimedCPCacheParentContextWithFactoryBasicMetaDataUnitTestCase extends CPCacheParentContextWithFactoryBasicMetaDataUnitTestCase { public TimedCPCacheParentContextWithFactoryBasicMetaDataUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new TimedCachePolicyFactory(500); } }././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPSimpleCacheMetaDataContextWithFactoryUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPSimp0000644000175000017500000000341011033116351033114 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyCacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyFactory; /** * CPSimpleCacheMetaDataContextWithFactoryUnitTestCase. * * @author Ales Justin */ public abstract class CPSimpleCacheMetaDataContextWithFactoryUnitTestCase extends SimpleCacheMetaDataContextWithFactoryUnitTestCase { public CPSimpleCacheMetaDataContextWithFactoryUnitTestCase(String name) { super(name); } protected CacheFactory createFactory() { return new CachePolicyCacheFactory(getPolicy()); } protected abstract CachePolicyFactory getPolicy(); }././@LongLink0000000000000000000000000000023100000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPCacheMetaDataContextWithFactoryMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPCach0000644000175000017500000000342011033116351033043 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyCacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyFactory; /** * CPCacheMetaDataContextWithFactoryMetaDataUnitTestCase. * * @author Ales Justin */ public abstract class CPCacheMetaDataContextWithFactoryMetaDataUnitTestCase extends CacheMetaDataContextWithFactoryMetaDataUnitTestCase { public CPCacheMetaDataContextWithFactoryMetaDataUnitTestCase(String name) { super(name); } protected CacheFactory createFactory() { return new CachePolicyCacheFactory(getPolicy()); } protected abstract CachePolicyFactory getPolicy(); }././@LongLink0000000000000000000000000000022000000000000011557 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/SimpleCacheParentMetaDataContextUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/Simple0000644000175000017500000002736310756326650033247 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import java.lang.annotation.Annotation; import java.util.List; import org.jboss.metadata.plugins.context.AbstractMetaDataContext; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.basic.BasicAnnotationItem; import org.jboss.metadata.spi.retrieval.basic.BasicAnnotationsItem; import org.jboss.test.metadata.context.AbstractMetaDataContextTest; import org.jboss.test.metadata.context.cache.support.TestMetaDataLoader; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * SimpleCacheMetaDataContextUnitTestCase. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class SimpleCacheParentMetaDataContextUnitTestCase extends AbstractMetaDataContextTest { public SimpleCacheParentMetaDataContextUnitTestCase(String name) { super(name); } protected MetaDataRetrieval createRetrieval() { return new TestMetaDataLoader(); } protected MetaDataContext createContext(MetaDataContext parent, List retrievals) { return new CachingMetaDataContext(parent, retrievals); } protected MetaDataContext createChildContext(MetaDataContext parent, List retrievals) { return new AbstractMetaDataContext(parent, retrievals); } protected TestMetaDataLoader getFirstParent() { return (TestMetaDataLoader) firstParent; } protected TestMetaDataLoader getSecondParent() { return (TestMetaDataLoader) secondParent; } protected TestMetaDataLoader getFirstChild() { return (TestMetaDataLoader) firstChild; } protected TestMetaDataLoader getSecondChild() { return (TestMetaDataLoader) secondChild; } protected BasicAnnotationItem createAnnotationItem(TestMetaDataLoader loader, T annotation, Class type) { return new BasicAnnotationItem(loader, annotation); } @SuppressWarnings("unchecked") protected void setAnnotations(TestMetaDataLoader loader, AnnotationItem annotationItem) { AnnotationItem[] items = { annotationItem }; BasicAnnotationsItem item = new BasicAnnotationsItem(loader, items); loader.setAnnotationsItem(item); } protected void testAnnotation(MetaData metaData, TestMetaDataLoader loader, boolean isChild) throws Exception { assertNoAnnotation(metaData, TestAnnotation.class); assertTrue(loader.isRetrieved()); BasicAnnotationItem annotationItem = createAnnotationItem(loader, new TestAnnotationImpl(), TestAnnotation.class); setAnnotations(loader, annotationItem); assertAnnotation(metaData, TestAnnotation.class); assertTrue(loader.isRetrieved()); assertAnnotation(metaData, TestAnnotation.class); assertEquals(isChild, loader.isRetrieved()); loader.clear(); assertNoAnnotation(metaData, TestAnnotation.class); assertTrue(loader.isRetrieved()); } public void testAnnotationFirstChild() throws Exception { MetaData metaData = createTestContext(); testAnnotation(metaData, getFirstChild(), true); } public void testAnnotationSecondChild() throws Exception { MetaData metaData = createTestContext(); testAnnotation(metaData, getSecondChild(), true); } public void testAnnotationFirstParent() throws Exception { MetaData metaData = createTestContext(); testAnnotation(metaData, getFirstParent(), false); } public void testAnnotationSecondParent() throws Exception { MetaData metaData = createTestContext(); testAnnotation(metaData, getSecondParent(), false); } protected void testBelowAnnotation(MetaData metaData, TestMetaDataLoader aboveLoader, TestMetaDataLoader belowLoader, boolean aboveChild, boolean belowChild) throws Exception { assertNoAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertTrue(belowLoader.isRetrieved()); BasicAnnotationItem annotationItem = createAnnotationItem(aboveLoader, new TestAnnotationImpl(), TestAnnotation.class); setAnnotations(aboveLoader, annotationItem); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); assertAnnotation(metaData, TestAnnotation.class); assertEquals(aboveChild, aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); annotationItem = createAnnotationItem(belowLoader, new TestAnnotationImpl(), TestAnnotation.class); setAnnotations(belowLoader, annotationItem); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); assertAnnotation(metaData, TestAnnotation.class); assertEquals(aboveChild, aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); annotationItem.invalidate(); assertAnnotation(metaData, TestAnnotation.class); assertEquals(aboveChild, aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); belowLoader.clear(); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); aboveLoader.clear(); assertNoAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertTrue(belowLoader.isRetrieved()); } public void testBelowAnnotationFirstChildSecondChild() throws Exception { MetaData metaData = createTestContext(); testBelowAnnotation(metaData, getFirstChild(), getSecondChild(), true, true); } public void testBelowAnnotationFirstChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testBelowAnnotation(metaData, getFirstChild(), getFirstParent(), true, false); } public void testBelowAnnotationFirstChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testBelowAnnotation(metaData, getFirstChild(), getSecondParent(), true, false); } public void testBelowAnnotationSecondChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testBelowAnnotation(metaData, getSecondChild(), getFirstParent(), true, false); } public void testBelowAnnotationSecondChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testBelowAnnotation(metaData, getSecondChild(), getSecondParent(), true, false); } public void testBelowAnnotationFirstParentSecondParent() throws Exception { MetaData metaData = createTestContext(); testBelowAnnotation(metaData, getFirstParent(), getSecondParent(), false, false); } protected void testAboveAnnotation(MetaData metaData, TestMetaDataLoader aboveLoader, TestMetaDataLoader belowLoader, boolean aboveChild, boolean belowChild) throws Exception { assertNoAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertTrue(belowLoader.isRetrieved()); BasicAnnotationItem annotationItem = createAnnotationItem(belowLoader, new TestAnnotationImpl(), TestAnnotation.class); setAnnotations(belowLoader, annotationItem); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertTrue(belowLoader.isRetrieved()); assertAnnotation(metaData, TestAnnotation.class); assertEquals(aboveChild, aboveLoader.isRetrieved()); assertEquals(belowChild, belowLoader.isRetrieved()); annotationItem = createAnnotationItem(aboveLoader, new TestAnnotationImpl(), TestAnnotation.class); setAnnotations(aboveLoader, annotationItem); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); assertAnnotation(metaData, TestAnnotation.class); assertEquals(aboveChild, aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); belowLoader.clear(); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); annotationItem = createAnnotationItem(belowLoader, new TestAnnotationImpl(), TestAnnotation.class); setAnnotations(belowLoader, annotationItem); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); assertAnnotation(metaData, TestAnnotation.class); assertEquals(aboveChild, aboveLoader.isRetrieved()); assertFalse(belowLoader.isRetrieved()); aboveLoader.clear(); assertAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertTrue(belowLoader.isRetrieved()); belowLoader.clear(); assertNoAnnotation(metaData, TestAnnotation.class); assertTrue(aboveLoader.isRetrieved()); assertTrue(belowLoader.isRetrieved()); } public void testAboveAnnotationFirstChildSecondChild() throws Exception { MetaData metaData = createTestContext(); testAboveAnnotation(metaData, getFirstChild(), getSecondChild(), true, true); } public void testAboveAnnotationFirstChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testAboveAnnotation(metaData, getFirstChild(), getFirstParent(), true, false); } public void testAboveAnnotationFirstChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testAboveAnnotation(metaData, getFirstChild(), getSecondParent(), true, false); } public void testAboveAnnotationSecondChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testAboveAnnotation(metaData, getSecondChild(), getFirstParent(), true, false); } public void testAboveAnnotationSecondChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testAboveAnnotation(metaData, getSecondChild(), getSecondParent(), true, false); } public void testAboveAnnotationFirstParentSecondParent() throws Exception { MetaData metaData = createTestContext(); testAboveAnnotation(metaData, getFirstParent(), getSecondParent(), false, false); } } ././@LongLink0000000000000000000000000000023300000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/SimpleCacheParentMetaDataContextWithFactoryUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/Simple0000644000175000017500000000404111033116351033213 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import java.util.List; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; /** * SimpleCacheMetaDataContextWithFactoryUnitTestCase. * * @author Ales Justin */ public abstract class SimpleCacheParentMetaDataContextWithFactoryUnitTestCase extends SimpleCacheParentMetaDataContextUnitTestCase { private CacheFactory factory; public SimpleCacheParentMetaDataContextWithFactoryUnitTestCase(String name) { super(name); } protected MetaDataContext createContext(MetaDataContext parent, List retrievals) { return new CachingMetaDataContext(parent, retrievals, getFactory()); } private CacheFactory getFactory() { if (factory == null) factory = createFactory(); return factory; } protected abstract CacheFactory createFactory(); }././@LongLink0000000000000000000000000000024200000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPCacheParentContextWithFactoryBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPC0000644000175000017500000000325411033112415032754 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.LRUCachePolicyFactory; /** * LRUCPCacheContextWithFactoryBasicAnnotationsUnitTestCase. * * @author Ales Justin */ public class LRUCPCacheParentContextWithFactoryBasicAnnotationsUnitTestCase extends CPCacheParentContextWithFactoryBasicAnnotationsUnitTestCase { public LRUCPCacheParentContextWithFactoryBasicAnnotationsUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new LRUCachePolicyFactory(2, 10); } }././@LongLink0000000000000000000000000000023600000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedCPCacheMetaDataContextWithFactoryMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedC0000644000175000017500000000323511033112415033130 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.TimedCachePolicyFactory; /** * CPCacheMetaDataContextWithFactoryMetaDataUnitTestCase. * * @author Ales Justin */ public class TimedCPCacheMetaDataContextWithFactoryMetaDataUnitTestCase extends CPCacheMetaDataContextWithFactoryMetaDataUnitTestCase { public TimedCPCacheMetaDataContextWithFactoryMetaDataUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new TimedCachePolicyFactory(500); } }././@LongLink0000000000000000000000000000024200000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedCPSimpleCacheParentMetaDataContextWithFactoryUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedC0000644000175000017500000000325411033112415033131 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.TimedCachePolicyFactory; /** * TimedCPSimpleCacheMetaDataContextWithFactoryUnitTestCase. * * @author Ales Justin */ public class TimedCPSimpleCacheParentMetaDataContextWithFactoryUnitTestCase extends CPSimpleCacheParentMetaDataContextWithFactoryUnitTestCase { public TimedCPSimpleCacheParentMetaDataContextWithFactoryUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new TimedCachePolicyFactory(500); } }././@LongLink0000000000000000000000000000023500000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheParentContextWithFactoryBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheP0000644000175000017500000000366011033116351033113 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.spi.loader.MetaDataLoader; /** * CacheContextWithFactoryBasicAnnotationsUnitTestCase. * * @author Ales Justin */ public abstract class CacheParentContextWithFactoryBasicAnnotationsUnitTestCase extends CacheParentContextBasicAnnotationsUnitTestCase { private CacheFactory factory; public CacheParentContextWithFactoryBasicAnnotationsUnitTestCase(String name) { super(name); } protected CachingMetaDataContext createContext(MetaDataLoader loader) { return new CachingMetaDataContext(null, loader, getFactory()); } private CacheFactory getFactory() { if (factory == null) factory = createFactory(); return factory; } protected abstract CacheFactory createFactory(); }././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheMetaDataContextAnnotationUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheM0000644000175000017500000000345310446527733033131 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import java.util.List; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.test.metadata.context.MetaDataContextAnnotationTest; /** * CacheMetaDataContextAnnotationUnitTestCase. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class CacheMetaDataContextAnnotationUnitTestCase extends MetaDataContextAnnotationTest { public CacheMetaDataContextAnnotationUnitTestCase(String name) { super(name); } protected MetaDataContext createContext(MetaDataContext parent, List retrievals) { return new CachingMetaDataContext(parent, retrievals); } } ././@LongLink0000000000000000000000000000023400000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPCacheContextWithFactoryBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPC0000644000175000017500000000323011033112415032746 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.LRUCachePolicyFactory; /** * JBCCacheContextWithFactoryBasicAnnotationsUnitTestCase. * * @author Ales Justin */ public class LRUCPCacheContextWithFactoryBasicAnnotationsUnitTestCase extends CPCacheContextWithFactoryBasicAnnotationsUnitTestCase { public LRUCPCacheContextWithFactoryBasicAnnotationsUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new LRUCachePolicyFactory(2, 10); } }././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/SimpleCacheMetaDataContextWithFactoryUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/Simple0000644000175000017500000000401711033116351033216 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import java.util.List; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; /** * SimpleCacheMetaDataContextWithFactoryUnitTestCase. * * @author Ales Justin */ public abstract class SimpleCacheMetaDataContextWithFactoryUnitTestCase extends SimpleCacheMetaDataContextUnitTestCase { private CacheFactory factory; public SimpleCacheMetaDataContextWithFactoryUnitTestCase(String name) { super(name); } protected MetaDataContext createContext(MetaDataContext parent, List retrievals) { return new CachingMetaDataContext(parent, retrievals, getFactory()); } private CacheFactory getFactory() { if (factory == null) factory = createFactory(); return factory; } protected abstract CacheFactory createFactory(); }././@LongLink0000000000000000000000000000024000000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedCPCacheMetaDataContextWithFactoryAnnotationUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedC0000644000175000017500000000325211033112415033127 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.TimedCachePolicyFactory; /** * TimedCPCacheMetaDataContextWithFactoryAnnotationUnitTestCase. * * @author Ales Justin */ public class TimedCPCacheMetaDataContextWithFactoryAnnotationUnitTestCase extends CPCacheMetaDataContextWithFactoryAnnotationUnitTestCase { public TimedCPCacheMetaDataContextWithFactoryAnnotationUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new TimedCachePolicyFactory(500); } }././@LongLink0000000000000000000000000000022600000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPCacheContextWithFactoryBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CPCach0000644000175000017500000000340211033116351033043 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyCacheFactory; import org.jboss.metadata.plugins.cache.CachePolicyFactory; /** * CacheContextWithFactoryBasicMetaDataUnitTestCase. * * @author Ales Justin */ public abstract class CPCacheContextWithFactoryBasicMetaDataUnitTestCase extends CacheContextWithFactoryBasicMetaDataUnitTestCase { public CPCacheContextWithFactoryBasicMetaDataUnitTestCase(String name) { super(name); } protected CacheFactory createFactory() { return new CachePolicyCacheFactory(getPolicy()); } protected abstract CachePolicyFactory getPolicy(); }././@LongLink0000000000000000000000000000023100000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPCacheContextWithFactoryBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/LRUCPC0000644000175000017500000000321111033112415032745 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.LRUCachePolicyFactory; /** * CacheContextWithFactoryBasicMetaDataUnitTestCase. * * @author Ales Justin */ public class LRUCPCacheContextWithFactoryBasicMetaDataUnitTestCase extends CPCacheContextWithFactoryBasicMetaDataUnitTestCase { public LRUCPCacheContextWithFactoryBasicMetaDataUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new LRUCachePolicyFactory(2, 10); } }././@LongLink0000000000000000000000000000024400000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedCPCacheParentContextWithFactoryBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/TimedC0000644000175000017500000000326211033112415033130 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import org.jboss.metadata.plugins.cache.CachePolicyFactory; import org.jboss.metadata.plugins.cache.TimedCachePolicyFactory; /** * LRUCPCacheContextWithFactoryBasicAnnotationsUnitTestCase. * * @author Ales Justin */ public class TimedCPCacheParentContextWithFactoryBasicAnnotationsUnitTestCase extends CPCacheParentContextWithFactoryBasicAnnotationsUnitTestCase { public TimedCPCacheParentContextWithFactoryBasicAnnotationsUnitTestCase(String name) { super(name); } protected CachePolicyFactory getPolicy() { return new TimedCachePolicyFactory(500); } }././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheMetaDataContextMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/test/CacheM0000644000175000017500000000344110446527733033126 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.test; import java.util.List; import org.jboss.metadata.plugins.context.CachingMetaDataContext; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.test.metadata.context.MetaDataContextMetaDataTest; /** * CacheMetaDataContextMetaDataUnitTestCase. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class CacheMetaDataContextMetaDataUnitTestCase extends MetaDataContextMetaDataTest { public CacheMetaDataContextMetaDataUnitTestCase(String name) { super(name); } protected MetaDataContext createContext(MetaDataContext parent, List retrievals) { return new CachingMetaDataContext(parent, retrievals); } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/support/0000755000175000017500000000000011620305576032610 5ustar twernertwerner././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/support/TestMetaDataLoader.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/cache/support/Tes0000644000175000017500000000422110756326650033272 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context.cache.support; import org.jboss.metadata.plugins.loader.BasicMetaDataLoader; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.basic.BasicAnnotationsItem; /** * TestMetaDataLoader. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class TestMetaDataLoader extends BasicMetaDataLoader { private boolean retrieved = false; @SuppressWarnings("unchecked") private final AnnotationsItem NO_ANNOTATIONS = new BasicAnnotationsItem(this, new AnnotationItem[0]); private AnnotationsItem item = NO_ANNOTATIONS; public boolean isRetrieved() { boolean result = retrieved; retrieved = false; return result; } public void setAnnotationsItem(AnnotationsItem item) { this.item = item; invalidate(); } public void clear() { setAnnotationsItem(NO_ANNOTATIONS); } public AnnotationsItem retrieveAnnotations() { retrieved = true; return item; } public boolean isEmpty() { return true; } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/MetaDataContextAnnotationTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/MetaDataContextAn0000644000175000017500000003025210454442653033264 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.test.metadata.shared.support.ExpectedAnnotations; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * MetaDataContextAnnotationTest. * * @author Adrian Brock * @version $Revision: 46146 $ */ public abstract class MetaDataContextAnnotationTest extends AbstractMetaDataContextMemoryLoaderTest { public MetaDataContextAnnotationTest(String name) { super(name); } protected void testAnnotation(MetaData metaData, MutableMetaDataLoader loader, boolean local) throws Exception { ExpectedAnnotations expected = emptyExpectedAnnotations(); long last = metaData.getValidTime(); assertNoAnnotation(metaData, TestAnnotation.class); TestAnnotation annotation = new TestAnnotationImpl(); last = assertAddAnnotationNoPrevious(metaData, loader, annotation, expected, last); assertAnnotation(metaData, TestAnnotation.class); assertAllAnnotations(metaData, expected, local); assertRemoveAnnotation(metaData, loader, TestAnnotation.class, expected, last, false); assertNoAnnotation(metaData, TestAnnotation.class); assertAllAnnotations(metaData, expected, local); } public void testAnnotationFromFirstChild() throws Exception { MetaData metaData = createTestContext(); testAnnotation(metaData, getFirstChild(), true); } public void testAnnotationFromSecondChild() throws Exception { MetaData metaData = createTestContext(); testAnnotation(metaData, getSecondChild(), true); } public void testAnnotationFromFirstParent() throws Exception { MetaData metaData = createTestContext(); testAnnotation(metaData, getFirstParent(), false); } public void testAnnotationFromSecondParent() throws Exception { MetaData metaData = createTestContext(); testAnnotation(metaData, getSecondParent(), false); } protected void testAnnotation12(MetaData metaData, MutableMetaDataLoader loader1, MutableMetaDataLoader loader2, boolean local) throws Exception { ExpectedAnnotations expected = emptyExpectedAnnotations(); long last = metaData.getValidTime(); assertNoAnnotation(metaData, TestAnnotation1.class); assertNoAnnotation(metaData, TestAnnotation2.class); TestAnnotation1 annotation1 = new TestAnnotation1Impl(); last = assertAddAnnotationNoPrevious(metaData, loader1, annotation1, expected, last); assertAnnotation(metaData, TestAnnotation1.class); assertNoAnnotation(metaData, TestAnnotation2.class); assertAllAnnotations(metaData, expected, local); TestAnnotation2 annotation2 = new TestAnnotation2Impl(); last = assertAddAnnotationNoPrevious(metaData, loader2, annotation2, expected, last); assertAnnotation(metaData, TestAnnotation1.class); assertAnnotation(metaData, TestAnnotation2.class); assertAllAnnotations(metaData, expected, local); assertRemoveAnnotation(metaData, loader1, TestAnnotation1.class, expected, last, false); assertNoAnnotation(metaData, TestAnnotation1.class); assertAnnotation(metaData, TestAnnotation2.class); assertAllAnnotations(metaData, expected, local); assertRemoveAnnotation(metaData, loader2, TestAnnotation2.class, expected, last, false); assertNoAnnotation(metaData, TestAnnotation1.class); assertNoAnnotation(metaData, TestAnnotation2.class); assertAllAnnotations(metaData, expected, local); } public void testAnnotation12FromFirstChild() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getFirstChild(), getFirstChild(), true); } public void testAnnotation12FromFirstChildSecondChild() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getFirstChild(), getSecondChild(), true); } public void testAnnotation12FromFirstChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getFirstChild(), getFirstParent(), false); } public void testAnnotation12FromFirstChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getFirstChild(), getSecondParent(), false); } public void testAnnotation12FromSecondChild() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getSecondChild(), getSecondChild(), true); } public void testAnnotation12FromSecondChildFirstChild() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getSecondChild(), getFirstChild(), true); } public void testAnnotation12FromSecondChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getSecondChild(), getFirstParent(), false); } public void testAnnotation12FromSecondChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getSecondChild(), getSecondParent(), false); } public void testAnnotation12FromFirstParent() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getFirstParent(), getFirstParent(), false); } public void testAnnotation12FromFirstParentFirstChild() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getFirstParent(), getFirstChild(), false); } public void testAnnotation12FromFirstParentSecondChild() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getFirstParent(), getSecondChild(), false); } public void testAnnotation12FromFirstParentSecondParent() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getFirstParent(), getSecondParent(), false); } public void testAnnotation12FromSecondParent() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getSecondParent(), getSecondParent(), false); } public void testAnnotation12FromSecondParentFirstChild() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getSecondParent(), getFirstChild(), false); } public void testAnnotation12FromSecondParentSecondChild() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getSecondParent(), getSecondChild(), false); } public void testAnnotation12FromSecondParentFirstParent() throws Exception { MetaData metaData = createTestContext(); testAnnotation12(metaData, getSecondParent(), getFirstParent(), false); } protected void testAnnotationOverride(MetaData metaData, MutableMetaDataLoader loader1, MutableMetaDataLoader loader2, boolean local) throws Exception { ExpectedAnnotations expected = emptyExpectedAnnotations(); long last = metaData.getValidTime(); assertNoAnnotation(metaData, TestAnnotation.class); TestAnnotation annotation1 = new TestAnnotationImpl(); last = assertAddAnnotationNoPrevious(metaData, loader1, annotation1, expected, last); assertAnnotation(metaData, TestAnnotation.class); assertAllAnnotations(metaData, expected, local); TestAnnotation annotation2 = new TestAnnotationImpl(); last = assertAddAnnotationWithPrevious(metaData, loader2, annotation2, last); assertAnnotation(metaData, TestAnnotation.class); assertAllAnnotations(metaData, expected, local); assertRemoveAnnotation(metaData, loader1, TestAnnotation.class, expected, last, true); assertAnnotation(metaData, TestAnnotation.class); assertAllAnnotations(metaData, expected, local); assertRemoveAnnotation(metaData, loader2, TestAnnotation.class, expected, last, false); assertNoAnnotation(metaData, TestAnnotation.class); assertAllAnnotations(metaData, expected, local); } public void testAnnotationOverrideFromFirstChildSecondChild() throws Exception { MetaData metaData = createTestContext(); testAnnotationOverride(metaData, getFirstChild(), getSecondChild(), true); } public void testAnnotationOverrideFromFirstChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testAnnotationOverride(metaData, getFirstChild(), getFirstParent(), false); } public void testAnnotationOverrideFromFirstChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testAnnotationOverride(metaData, getFirstChild(), getSecondParent(), false); } public void testAnnotationOverrideFromSecondChildFirstChild() throws Exception { MetaData metaData = createTestContext(); testAnnotationOverride(metaData, getSecondChild(), getFirstChild(), true); } public void testAnnotationOverrideFromSecondChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testAnnotationOverride(metaData, getSecondChild(), getFirstParent(), false); } public void testAnnotationOverrideFromSecondChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testAnnotationOverride(metaData, getSecondChild(), getSecondParent(), false); } public void testAnnotationOverrideFromFirstParentFirstChild() throws Exception { MetaData metaData = createTestContext(); testAnnotationOverride(metaData, getFirstParent(), getFirstChild(), false); } public void testAnnotationOverrideFromFirstParentSecondChild() throws Exception { MetaData metaData = createTestContext(); testAnnotationOverride(metaData, getFirstParent(), getSecondChild(), false); } public void testAnnotationOverrideFromFirstParentSecondParent() throws Exception { MetaData metaData = createTestContext(); testAnnotationOverride(metaData, getFirstParent(), getSecondParent(), false); } public void testAnnotationOverrideFromSecondParentFirstChild() throws Exception { MetaData metaData = createTestContext(); testAnnotationOverride(metaData, getSecondParent(), getFirstChild(), false); } public void testAnnotationOverrideFromSecondParentSecondChild() throws Exception { MetaData metaData = createTestContext(); testAnnotationOverride(metaData, getSecondParent(), getSecondChild(), false); } public void testAnnotationOverrideFromSecondParentFirstParent() throws Exception { MetaData metaData = createTestContext(); testAnnotationOverride(metaData, getSecondParent(), getFirstParent(), false); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/MetaDataContextMetaDataTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/MetaDataContextMe0000644000175000017500000005513510454442653033276 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.test.metadata.shared.support.ExpectedMetaData; import org.jboss.test.metadata.shared.support.TestMetaData; import org.jboss.test.metadata.shared.support.TestMetaData1; import org.jboss.test.metadata.shared.support.TestMetaData1Impl; import org.jboss.test.metadata.shared.support.TestMetaData2; import org.jboss.test.metadata.shared.support.TestMetaData2Impl; import org.jboss.test.metadata.shared.support.TestMetaDataImpl; /** * MetaDataContextMetaDataTest. * * @author Adrian Brock * @version $Revision: 46146 $ */ public abstract class MetaDataContextMetaDataTest extends AbstractMetaDataContextMemoryLoaderTest { public MetaDataContextMetaDataTest(String name) { super(name); } protected void testMetaData(MetaData metaData, MutableMetaDataLoader loader, boolean local) throws Exception { ExpectedMetaData expected = emptyExpectedMetaData(); long last = metaData.getValidTime(); assertNoMetaData(metaData, TestMetaData.class); TestMetaData object = new TestMetaDataImpl(); last = assertAddMetaDataNoPrevious(metaData, loader, object, TestMetaData.class, expected, last); assertMetaData(metaData, TestMetaData.class); assertAllMetaData(metaData, expected, local); assertRemoveMetaData(metaData, loader, TestMetaData.class, expected, last, false); assertNoMetaData(metaData, TestMetaData.class); assertAllMetaData(metaData, expected, local); } public void testMetaDataFromFirstChild() throws Exception { MetaData metaData = createTestContext(); testMetaData(metaData, getFirstChild(), true); } public void testMetaDataFromSecondChild() throws Exception { MetaData metaData = createTestContext(); testMetaData(metaData, getSecondChild(), true); } public void testMetaDataFromFirstParent() throws Exception { MetaData metaData = createTestContext(); testMetaData(metaData, getFirstParent(), false); } public void testMetaDataFromSecondParent() throws Exception { MetaData metaData = createTestContext(); testMetaData(metaData, getSecondParent(), false); } protected void testMetaDataByName(MetaData metaData, MutableMetaDataLoader loader, boolean local) throws Exception { ExpectedMetaData expected = emptyExpectedMetaData(); long last = metaData.getValidTime(); assertNoMetaData(metaData, "Test", TestMetaData.class); TestMetaData object = new TestMetaDataImpl(); last = assertAddMetaDataNoPrevious(metaData, loader, object, "Test", TestMetaData.class, expected, last); assertMetaData(metaData, "Test", TestMetaData.class); assertAllMetaData(metaData, expected, local); assertRemoveMetaData(metaData, loader, "Test", TestMetaData.class, expected, last, false); assertNoMetaData(metaData, TestMetaData.class); assertAllMetaData(metaData, expected, local); } public void testMetaDataFromFirstChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataByName(metaData, getFirstChild(), true); } public void testMetaDataFromSecondChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataByName(metaData, getSecondChild(), true); } public void testMetaDataFromFirstParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataByName(metaData, getFirstParent(), false); } public void testMetaDataFromSecondParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataByName(metaData, getSecondParent(), false); } protected void testMetaData12(MetaData metaData, MutableMetaDataLoader loader1, MutableMetaDataLoader loader2, boolean local) throws Exception { ExpectedMetaData expected = emptyExpectedMetaData(); long last = metaData.getValidTime(); assertNoMetaData(metaData, TestMetaData1.class); assertNoMetaData(metaData, TestMetaData2.class); TestMetaData1 object1 = new TestMetaData1Impl(); last = assertAddMetaDataNoPrevious(metaData, loader1, object1, TestMetaData1.class, expected, last); assertMetaData(metaData, TestMetaData1.class); assertNoMetaData(metaData, TestMetaData2.class); assertAllMetaData(metaData, expected, local); TestMetaData2 object2 = new TestMetaData2Impl(); last = assertAddMetaDataNoPrevious(metaData, loader2, object2, TestMetaData2.class, expected, last); assertMetaData(metaData, TestMetaData1.class); assertMetaData(metaData, TestMetaData2.class); assertAllMetaData(metaData, expected, local); assertRemoveMetaData(metaData, loader1, TestMetaData1.class, expected, last, false); assertNoMetaData(metaData, TestMetaData1.class); assertMetaData(metaData, TestMetaData2.class); assertAllMetaData(metaData, expected, local); assertRemoveMetaData(metaData, loader2, TestMetaData2.class, expected, last, false); assertNoMetaData(metaData, TestMetaData1.class); assertNoMetaData(metaData, TestMetaData2.class); assertAllMetaData(metaData, expected, local); } public void testMetaData12FromFirstChild() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getFirstChild(), getFirstChild(), true); } public void testMetaData12FromFirstChildSecondChild() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getFirstChild(), getSecondChild(), true); } public void testMetaData12FromFirstChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getFirstChild(), getFirstParent(), false); } public void testMetaData12FromFirstChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getFirstChild(), getSecondParent(), false); } public void testMetaData12FromSecondChild() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getSecondChild(), getSecondChild(), true); } public void testMetaData12FromSecondChildFirstChild() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getSecondChild(), getFirstChild(), true); } public void testMetaData12FromSecondChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getSecondChild(), getFirstParent(), false); } public void testMetaData12FromSecondChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getSecondChild(), getSecondParent(), false); } public void testMetaData12FromFirstParent() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getFirstParent(), getFirstParent(), false); } public void testMetaData12FromFirstParentFirstChild() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getFirstParent(), getFirstChild(), false); } public void testMetaData12FromFirstParentSecondChild() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getFirstParent(), getSecondChild(), false); } public void testMetaData12FromFirstParentSecondParent() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getFirstParent(), getSecondParent(), false); } public void testMetaData12FromSecondParent() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getSecondParent(), getSecondParent(), false); } public void testMetaData12FromSecondParentFirstChild() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getSecondParent(), getFirstChild(), false); } public void testMetaData12FromSecondParentSecondChild() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getSecondParent(), getSecondChild(), false); } public void testMetaData12FromSecondParentFirstParent() throws Exception { MetaData metaData = createTestContext(); testMetaData12(metaData, getSecondParent(), getFirstParent(), false); } protected void testMetaData12ByName(MetaData metaData, MutableMetaDataLoader loader1, MutableMetaDataLoader loader2, boolean local) throws Exception { ExpectedMetaData expected = emptyExpectedMetaData(); long last = metaData.getValidTime(); assertNoMetaData(metaData, "Test1", TestMetaData1.class); assertNoMetaData(metaData, "Test2", TestMetaData2.class); TestMetaData1 object1 = new TestMetaData1Impl(); last = assertAddMetaDataNoPrevious(metaData, loader1, object1, "Test1", TestMetaData1.class, expected, last); assertMetaData(metaData, "Test1", TestMetaData1.class); assertNoMetaData(metaData, "Test2", TestMetaData2.class); assertAllMetaData(metaData, expected, local); TestMetaData2 object2 = new TestMetaData2Impl(); last = assertAddMetaDataNoPrevious(metaData, loader2, object2, "Test2", TestMetaData2.class, expected, last); assertMetaData(metaData, "Test1", TestMetaData1.class); assertMetaData(metaData, "Test2", TestMetaData2.class); assertAllMetaData(metaData, expected, local); assertRemoveMetaData(metaData, loader1, "Test1", TestMetaData1.class, expected, last, false); assertNoMetaData(metaData, "Test1", TestMetaData1.class); assertMetaData(metaData, "Test2", TestMetaData2.class); assertAllMetaData(metaData, expected, local); assertRemoveMetaData(metaData, loader2, "Test2", TestMetaData2.class, expected, last, false); assertNoMetaData(metaData, "Test1", TestMetaData1.class); assertNoMetaData(metaData, "Test2", TestMetaData2.class); assertAllMetaData(metaData, expected, local); } public void testMetaData12FromFirstChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getFirstChild(), getFirstChild(), true); } public void testMetaData12FromFirstChildSecondChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getFirstChild(), getSecondChild(), true); } public void testMetaData12FromFirstChildFirstParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getFirstChild(), getFirstParent(), false); } public void testMetaData12FromFirstChildSecondParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getFirstChild(), getSecondParent(), false); } public void testMetaData12FromSecondChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getSecondChild(), getSecondChild(), true); } public void testMetaData12FromSecondChildFirstChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getSecondChild(), getFirstChild(), true); } public void testMetaData12FromSecondChildFirstParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getSecondChild(), getFirstParent(), false); } public void testMetaData12FromSecondChildSecondParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getSecondChild(), getSecondParent(), false); } public void testMetaData12FromFirstParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getFirstParent(), getFirstParent(), false); } public void testMetaData12FromFirstParentFirstChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getFirstParent(), getFirstChild(), false); } public void testMetaData12FromFirstParentSecondChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getFirstParent(), getSecondChild(), false); } public void testMetaData12FromFirstParentSecondParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getFirstParent(), getSecondParent(), false); } public void testMetaData12FromSecondParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getSecondParent(), getSecondParent(), false); } public void testMetaData12FromSecondParentFirstChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getSecondParent(), getFirstChild(), false); } public void testMetaData12FromSecondParentSecondChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getSecondParent(), getSecondChild(), false); } public void testMetaData12FromSecondParentFirstParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaData12ByName(metaData, getSecondParent(), getFirstParent(), false); } protected void testMetaDataOverride(MetaData metaData, MutableMetaDataLoader loader1, MutableMetaDataLoader loader2, boolean local) throws Exception { ExpectedMetaData expected = emptyExpectedMetaData(); long last = metaData.getValidTime(); assertNoMetaData(metaData, TestMetaData.class); TestMetaData object1 = new TestMetaDataImpl(); last = assertAddMetaDataNoPrevious(metaData, loader1, object1, TestMetaData.class, expected, last); assertMetaData(metaData, TestMetaData.class); assertAllMetaData(metaData, expected, local); TestMetaData object2 = new TestMetaDataImpl(); last = assertAddMetaDataWithPrevious(metaData, loader2, object2, TestMetaData.class, last); assertMetaData(metaData, TestMetaData.class); assertAllMetaData(metaData, expected, local); assertRemoveMetaData(metaData, loader1, TestMetaData.class, expected, last, true); assertMetaData(metaData, TestMetaData.class); assertAllMetaData(metaData, expected, local); assertRemoveMetaData(metaData, loader2, TestMetaData.class, expected, last, false); assertNoMetaData(metaData, TestMetaData.class); assertAllMetaData(metaData, expected, local); } public void testMetaDataOverrideFromFirstChildSecondChild() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverride(metaData, getFirstChild(), getSecondChild(), true); } public void testMetaDataOverrideFromFirstChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverride(metaData, getFirstChild(), getFirstParent(), false); } public void testMetaDataOverrideFromFirstChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverride(metaData, getFirstChild(), getSecondParent(), false); } public void testMetaDataOverrideFromSecondChildFirstChild() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverride(metaData, getSecondChild(), getFirstChild(), true); } public void testMetaDataOverrideFromSecondChildFirstParent() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverride(metaData, getSecondChild(), getFirstParent(), false); } public void testMetaDataOverrideFromSecondChildSecondParent() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverride(metaData, getSecondChild(), getSecondParent(), false); } public void testMetaDataOverrideFromFirstParentFirstChild() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverride(metaData, getFirstParent(), getFirstChild(), false); } public void testMetaDataOverrideFromFirstParentSecondChild() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverride(metaData, getFirstParent(), getSecondChild(), false); } public void testMetaDataOverrideFromFirstParentSecondParent() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverride(metaData, getFirstParent(), getSecondParent(), false); } public void testMetaDataOverrideFromSecondParentFirstChild() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverride(metaData, getSecondParent(), getFirstChild(), false); } public void testMetaDataOverrideFromSecondParentSecondChild() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverride(metaData, getSecondParent(), getSecondChild(), false); } public void testMetaDataOverrideFromSecondParentFirstParent() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverride(metaData, getSecondParent(), getFirstParent(), false); } protected void testMetaDataOverrideByName(MetaData metaData, MutableMetaDataLoader loader1, MutableMetaDataLoader loader2, boolean local) throws Exception { ExpectedMetaData expected = emptyExpectedMetaData(); long last = metaData.getValidTime(); assertNoMetaData(metaData, "Test", TestMetaData.class); TestMetaData object1 = new TestMetaDataImpl(); last = assertAddMetaDataNoPrevious(metaData, loader1, object1, "Test", TestMetaData.class, expected, last); assertMetaData(metaData, "Test", TestMetaData.class); assertAllMetaData(metaData, expected, local); TestMetaData object2 = new TestMetaDataImpl(); last = assertAddMetaDataWithPrevious(metaData, loader2, object2, "Test", TestMetaData.class, last); assertMetaData(metaData, "Test", TestMetaData.class); assertAllMetaData(metaData, expected, local); assertRemoveMetaData(metaData, loader1, "Test", TestMetaData.class, expected, last, true); assertMetaData(metaData, "Test", TestMetaData.class); assertAllMetaData(metaData, expected, local); assertRemoveMetaData(metaData, loader2, "Test", TestMetaData.class, expected, last, false); assertNoMetaData(metaData, "Test", TestMetaData.class); assertAllMetaData(metaData, expected, local); } public void testMetaDataOverrideFromFirstChildSecondChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverrideByName(metaData, getFirstChild(), getSecondChild(), true); } public void testMetaDataOverrideFromFirstChildFirstParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverrideByName(metaData, getFirstChild(), getFirstParent(), false); } public void testMetaDataOverrideFromFirstChildSecondParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverrideByName(metaData, getFirstChild(), getSecondParent(), false); } public void testMetaDataOverrideFromSecondChildFirstChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverrideByName(metaData, getSecondChild(), getFirstChild(), true); } public void testMetaDataOverrideFromSecondChildFirstParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverrideByName(metaData, getSecondChild(), getFirstParent(), false); } public void testMetaDataOverrideFromSecondChildSecondParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverrideByName(metaData, getSecondChild(), getSecondParent(), false); } public void testMetaDataOverrideFromFirstParentFirstChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverrideByName(metaData, getFirstParent(), getFirstChild(), false); } public void testMetaDataOverrideFromFirstParentSecondChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverrideByName(metaData, getFirstParent(), getSecondChild(), false); } public void testMetaDataOverrideFromFirstParentSecondParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverrideByName(metaData, getFirstParent(), getSecondParent(), false); } public void testMetaDataOverrideFromSecondParentFirstChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverrideByName(metaData, getSecondParent(), getFirstChild(), false); } public void testMetaDataOverrideFromSecondParentSecondChildByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverrideByName(metaData, getSecondParent(), getSecondChild(), false); } public void testMetaDataOverrideFromSecondParentFirstParentByName() throws Exception { MetaData metaData = createTestContext(); testMetaDataOverrideByName(metaData, getSecondParent(), getFirstParent(), false); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/MetaDataContextTestSuite.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/context/MetaDataContextTe0000644000175000017500000000337210446527733033305 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.context; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.metadata.context.basic.test.BasicContextTestSuite; import org.jboss.test.metadata.context.cache.test.CacheContextTestSuite; /** * MetaDataContextTestSuite. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class MetaDataContextTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("MetaDataContext Tests"); suite.addTest(BasicContextTestSuite.suite()); suite.addTest(CacheContextTestSuite.suite()); return suite; } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/0000755000175000017500000000000011620305600027577 5ustar twernertwerner././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/ComponentBasicAnnotationsTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/ComponentBasicAnno0000644000175000017500000001651611041642153033257 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.signature.ConstructorParametersSignature; import org.jboss.metadata.spi.signature.ConstructorSignature; import org.jboss.metadata.spi.signature.FieldSignature; import org.jboss.metadata.spi.signature.MethodParametersSignature; import org.jboss.metadata.spi.signature.MethodSignature; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.shared.support.ExpectedAnnotations; import org.jboss.test.metadata.shared.support.NotPresentAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation2; /** * ComponentBasicAnnotationsTest. * * @author Adrian Brock * @version $Revision: 46146 $ */ public abstract class ComponentBasicAnnotationsTest extends AbstractMetaDataTest { protected boolean local; public ComponentBasicAnnotationsTest(String name, boolean local) { super(name); this.local = local; } protected abstract MetaData setupConstructor(); protected abstract MetaData setupField(); protected abstract MetaData setupMethod(); protected abstract MetaData setupMethodParams(); protected abstract MetaData setupConstructorParams(); public void testFieldEmpty() throws Exception { MetaData metaData = setupField(); metaData = metaData.getComponentMetaData(new FieldSignature("empty")); testEmpty(metaData); } public void testConstructorEmpty() throws Exception { MetaData metaData = setupConstructor(); metaData = metaData.getComponentMetaData(new ConstructorSignature()); testEmpty(metaData); } public void testMethodEmpty() throws Exception { MetaData metaData = setupMethod(); metaData = metaData.getComponentMetaData(new MethodSignature("empty")); testEmpty(metaData); } public void testMethodParamsEmpty() throws Exception { MetaData metaData = setupMethodParams(); metaData = metaData.getComponentMetaData(new MethodParametersSignature("empty", 0, String.class)); testEmpty(metaData); } public void testConstructorParamsEmpty() throws Exception { MetaData metaData = setupConstructorParams(); metaData = metaData.getComponentMetaData(new ConstructorParametersSignature(0, String.class)); testEmpty(metaData); } protected void testEmpty(MetaData metaData) throws Exception { assertNotNull(metaData); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations, local); } public void testFieldTestAnnotation() throws Exception { MetaData metaData = setupField(); metaData = metaData.getComponentMetaData(new FieldSignature("testAnnotation")); testTestAnnotation(metaData); } public void testConstructorTestAnnotation() throws Exception { MetaData metaData = setupConstructor(); metaData = metaData.getComponentMetaData(new ConstructorSignature(String.class)); testTestAnnotation(metaData); } public void testMethodTestAnnotation() throws Exception { MetaData metaData = setupMethod(); metaData = metaData.getComponentMetaData(new MethodSignature("testAnnotation", String.class)); testTestAnnotation(metaData); } public void testMethodParamsTestAnnotation() throws Exception { MetaData metaData = setupMethodParams(); metaData = metaData.getComponentMetaData(new MethodParametersSignature("testAnnotation", 0, String.class)); testTestAnnotation(metaData); } public void testConstructorParamsTestAnnotation() throws Exception { MetaData metaData = setupConstructorParams(); metaData = metaData.getComponentMetaData(new ConstructorParametersSignature(0, Integer.class)); testTestAnnotation(metaData); } protected void testTestAnnotation(MetaData metaData) throws Exception { assertNotNull(metaData); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); expectedAnnotations.add(TestAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations, local); } public void testFieldTestAnnotation12() throws Exception { MetaData metaData = setupField(); metaData = metaData.getComponentMetaData(new FieldSignature("testAnnotation12")); testTestAnnotation12(metaData); } public void testConstructorTestAnnotation12() throws Exception { MetaData metaData = setupConstructor(); metaData = metaData.getComponentMetaData(new ConstructorSignature(String.class, Class.class)); testTestAnnotation12(metaData); } public void testMethodTestAnnotation12() throws Exception { MetaData metaData = setupMethod(); metaData = metaData.getComponentMetaData(new MethodSignature("testAnnotation12", String.class, Class.class)); testTestAnnotation12(metaData); } public void testMethodParamTestAnnotation12() throws Exception { MetaData metaData = setupMethodParams(); metaData = metaData.getComponentMetaData(new MethodParametersSignature("testAnnotation12", 1, String.class, Class.class)); testTestAnnotation12(metaData); } public void testConstructorParamTestAnnotation12() throws Exception { MetaData metaData = setupConstructorParams(); metaData = metaData.getComponentMetaData(new ConstructorParametersSignature(1, String.class, Class.class)); testTestAnnotation12(metaData); } protected void testTestAnnotation12(MetaData metaData) throws Exception { assertNotNull(metaData); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertAnnotation(metaData, TestAnnotation1.class); assertAnnotation(metaData, TestAnnotation2.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); expectedAnnotations.add(TestAnnotation1.class); expectedAnnotations.add(TestAnnotation2.class); assertAllAnnotations(metaData, expectedAnnotations, local); } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/0000755000175000017500000000000011620305601031314 5ustar twernertwerner././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestAnnotation2Impl.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestAnnota0000644000175000017500000000245210446527733033343 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import org.jboss.metadata.annotation.AbstractAnnotationImpl; /** * TestAnnotation2Impl. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class TestAnnotation2Impl extends AbstractAnnotationImpl implements TestAnnotation2 { } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/RestrictedAnnotationImpl.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/Restricted0000644000175000017500000000247110446527733033374 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import org.jboss.metadata.annotation.AbstractAnnotationImpl; /** * RestrictedAnnotationImpl. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class RestrictedAnnotationImpl extends AbstractAnnotationImpl implements RestrictedAnnotation { } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestMetaData2.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestMetaDa0000644000175000017500000000224110446527733033252 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; /** * Test. * * @author Adrian Brock * @version $Revision: 45742 $ */ public interface TestMetaData2 { } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestAnnotation2.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestAnnota0000644000175000017500000000245010446527733033341 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * TestAnnotation1. * * @author Adrian Brock * @version $Revision: 45742 $ */ @Retention(RetentionPolicy.RUNTIME) public @interface TestAnnotation2 { } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestAnnotation1Impl.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestAnnota0000644000175000017500000000245210446527733033343 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import org.jboss.metadata.annotation.AbstractAnnotationImpl; /** * TestAnnotation1Impl. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class TestAnnotation1Impl extends AbstractAnnotationImpl implements TestAnnotation1 { } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/ExpectedAnnotations.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/ExpectedAn0000644000175000017500000000400010446527733033272 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import java.lang.annotation.Annotation; import java.util.HashSet; import java.util.Set; /** * ExpectedAnnotations. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class ExpectedAnnotations { /** The annotations */ private Set> annotationTypes = new HashSet>(); /** * Add an annotation type * * @param annotationType the annotation type */ public void add(Class annotationType) { annotationTypes.add(annotationType); } /** * Remove an annotation type * * @param annotationType the annotation type */ public void remove(Class annotationType) { annotationTypes.remove(annotationType); } /** * Get the annotation types * * @return the annotation types */ public Set> get() { return annotationTypes; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/SignatureTester.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/SignatureT0000644000175000017500000000314010740725765033345 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import java.util.Calendar; import java.util.Locale; import java.util.TimeZone; /** * Signature test class. * * @author Ales Justin */ public class SignatureTester { public Calendar calendar; public SignatureTester() { } public SignatureTester(Calendar calendar) { } // meaningless method ;-) public boolean applyTimeZone(Calendar calendar, TimeZone timeZone) { calendar.setTimeZone(timeZone); return Locale.getDefault().equals(timeZone); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestMetaData1.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestMetaDa0000644000175000017500000000224110446527733033252 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; /** * Test. * * @author Adrian Brock * @version $Revision: 45742 $ */ public interface TestMetaData1 { } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/MetaDataAndMutableMetaDataImpl.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/MetaDataAn0000644000175000017500000001005710667274502033220 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.MutableMetaData; import org.jboss.metadata.spi.scope.ScopeLevel; import org.jboss.metadata.spi.signature.Signature; /** * MetaDataAndMutableMetaDataImpl. * * @author Adrian Brock * @version $Revision: 65047 $ */ public class MetaDataAndMutableMetaDataImpl implements MetaDataAndMutableMetaData { private MetaData metaData; private MutableMetaData mutable; public MetaDataAndMutableMetaDataImpl(MetaData metaData, MutableMetaData mutable) { this.metaData = metaData; this.mutable = mutable; } public T getAnnotation(Class annotationType) { return metaData.getAnnotation(annotationType); } public Annotation[] getAnnotations() { return metaData.getAnnotations(); } public Annotation[] getLocalAnnotations() { return metaData.getLocalAnnotations(); } public Object[] getLocalMetaData() { return metaData.getLocalMetaData(); } public Object[] getMetaData() { return metaData.getMetaData(); } public T getMetaData(Class type) { return metaData.getMetaData(type); } public T getMetaData(String name, Class type) { return metaData.getMetaData(name, type); } public Object getMetaData(String name) { return metaData.getMetaData(name); } public long getValidTime() { return metaData.getValidTime(); } public boolean isAnnotationPresent(Class annotationType) { return metaData.isAnnotationPresent(annotationType); } public boolean isMetaDataPresent(Class type) { return metaData.isMetaDataPresent(type); } public boolean isMetaDataPresent(String name, Class type) { return metaData.isMetaDataPresent(name, type); } public boolean isMetaDataPresent(String name) { return metaData.isMetaDataPresent(name); } public T addAnnotation(T annotation) { return mutable.addAnnotation(annotation); } public T addMetaData(String name, T metaData, Class type) { return mutable.addMetaData(name, metaData, type); } public T addMetaData(T metaData, Class type) { return mutable.addMetaData(metaData, type); } public T removeAnnotation(Class annotationType) { return mutable.removeAnnotation(annotationType); } public T removeMetaData(Class type) { return mutable.removeMetaData(type); } public T removeMetaData(String name, Class type) { return mutable.removeMetaData(name, type); } public MetaData getComponentMetaData(Signature signature) { return metaData.getComponentMetaData(signature); } public MetaData getScopeMetaData(ScopeLevel level) { return metaData.getScopeMetaData(level); } public boolean isEmpty() { return metaData.isEmpty(); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestMetaData1Impl.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestMetaDa0000644000175000017500000000230710446527733033255 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; /** * TestMetaData1Impl. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class TestMetaData1Impl implements TestMetaData1 { } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/MutableMetaDataLoaderToMetaDataBridge.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/MutableMet0000644000175000017500000000503110454442653033312 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; public class MutableMetaDataLoaderToMetaDataBridge extends MetaDataRetrievalToMetaDataBridge implements MetaDataAndMutableMetaData { /** * Create a new MutableMetaDataLoaderToMetaDataBridge. * * @param loader the loader */ public MutableMetaDataLoaderToMetaDataBridge(MutableMetaDataLoader loader) { super(loader); } public T addAnnotation(T annotation) { return getMetaDataLoader().addAnnotation(annotation); } public T removeAnnotation(Class annotationType) { return getMetaDataLoader().removeAnnotation(annotationType); } public T addMetaData(T metaData, Class type) { return getMetaDataLoader().addMetaData(metaData, type); } public T removeMetaData(Class type) { return getMetaDataLoader().removeMetaData(type); } public T addMetaData(String name, T metaData, Class type) { return getMetaDataLoader().addMetaData(name, metaData, type); } public T removeMetaData(String name, Class type) { return getMetaDataLoader().removeMetaData(name, type); } /** * Get the meta data loader * * @return the loader */ protected MutableMetaDataLoader getMetaDataLoader() { return (MutableMetaDataLoader) getMetaDataRetrieval(); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/RestrictedAnnotation.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/Restricted0000644000175000017500000000236010446527733033371 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import org.jboss.metadata.spi.Restricted; /** * RestrictedAnnotation. * * @author Adrian Brock * @version $Revision: 45742 $ */ @Restricted public @interface RestrictedAnnotation { } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestMetaData.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestMetaDa0000644000175000017500000000224010446527733033251 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; /** * Test. * * @author Adrian Brock * @version $Revision: 45742 $ */ public interface TestMetaData { } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestAnnotation.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestAnnota0000644000175000017500000000244610446527733033346 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * TestAnnotation. * * @author Adrian Brock * @version $Revision: 45742 $ */ @Retention(RetentionPolicy.RUNTIME) public @interface TestAnnotation { } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/RestrictedImpl.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/Restricted0000644000175000017500000000230710446527733033372 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; /** * RestrictedImpl. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class RestrictedImpl implements RestrictedInterface { } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/NotPresentType.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/NotPresent0000644000175000017500000000224210446527733033361 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; /** * Test. * * @author Adrian Brock * @version $Revision: 45742 $ */ public interface NotPresentType { } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/ExpectedMetaData.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/ExpectedMe0000644000175000017500000000322510446527733033305 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import java.util.HashSet; import java.util.Set; public class ExpectedMetaData { /** The metadata */ private Set> metaDataTypes = new HashSet>(); /** * Add a metadata type * * @param type the metadata type */ public void add(Class type) { metaDataTypes.add(type); } /** * Remove a metadata type * * @param type the metadata type */ public void remove(Class type) { metaDataTypes.remove(type); } /** * Get the types * * @return the types */ public Set> get() { return metaDataTypes; } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/NotPresentAnnotation.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/NotPresent0000644000175000017500000000245410446527733033366 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * TestAnnotation. * * @author Adrian Brock * @version $Revision: 45742 $ */ @Retention(RetentionPolicy.RUNTIME) public @interface NotPresentAnnotation { } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/MetaDataAndMutableMetaData.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/MetaDataAn0000644000175000017500000000246610454442653033223 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.MutableMetaData; /** * MetaDataAndMutable. * * @author Adrian Brock * @version $Revision: 46146 $ */ public interface MetaDataAndMutableMetaData extends MetaData, MutableMetaData { } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/RestrictedInterface.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/Restricted0000644000175000017500000000235510446527733033375 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import org.jboss.metadata.spi.Restricted; /** * RestrictedInterface. * * @author Adrian Brock * @version $Revision: 45742 $ */ @Restricted public interface RestrictedInterface { } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestMetaData2Impl.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestMetaDa0000644000175000017500000000230710446527733033255 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; /** * TestMetaData2Impl. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class TestMetaData2Impl implements TestMetaData2 { } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestMetaDataImpl.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestMetaDa0000644000175000017500000000230410446527733033252 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; /** * TestMetaDataImpl. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class TestMetaDataImpl implements TestMetaData { } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestAnnotation1.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestAnnota0000644000175000017500000000245010446527733033341 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * TestAnnotation1. * * @author Adrian Brock * @version $Revision: 45742 $ */ @Retention(RetentionPolicy.RUNTIME) public @interface TestAnnotation1 { } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestAnnotationImpl.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/support/TestAnnota0000644000175000017500000000244710446527733033347 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared.support; import org.jboss.metadata.annotation.AbstractAnnotationImpl; /** * TestAnnotationImpl. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class TestAnnotationImpl extends AbstractAnnotationImpl implements TestAnnotation { } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/BasicAnnotationsTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/BasicAnnotationsTe0000644000175000017500000000631510454442653033275 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared; import org.jboss.metadata.spi.MetaData; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.shared.support.ExpectedAnnotations; import org.jboss.test.metadata.shared.support.NotPresentAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation2; /** * BasicAnnotationsTest. * * @author Adrian Brock * @version $Revision: 46146 $ */ public abstract class BasicAnnotationsTest extends AbstractMetaDataTest { protected boolean local; public BasicAnnotationsTest(String name, boolean local) { super(name); this.local = local; } public void testEmpty() throws Exception { MetaData metaData = setupEmpty(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations, local); } protected abstract MetaData setupEmpty(); public void testTestAnnotation() throws Exception { MetaData metaData = setupTestAnnotation(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); expectedAnnotations.add(TestAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations, local); } protected abstract MetaData setupTestAnnotation(); public void testTestAnnotation12() throws Exception { MetaData metaData = setupTestAnnotation12(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertAnnotation(metaData, TestAnnotation1.class); assertAnnotation(metaData, TestAnnotation2.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); expectedAnnotations.add(TestAnnotation1.class); expectedAnnotations.add(TestAnnotation2.class); assertAllAnnotations(metaData, expectedAnnotations, local); } protected abstract MetaData setupTestAnnotation12(); } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/BasicMetaDataTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/shared/BasicMetaDataTest.0000644000175000017500000001005510454442653033101 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.shared; import org.jboss.metadata.spi.MetaData; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.shared.support.ExpectedMetaData; import org.jboss.test.metadata.shared.support.NotPresentType; import org.jboss.test.metadata.shared.support.TestMetaData; import org.jboss.test.metadata.shared.support.TestMetaData1; import org.jboss.test.metadata.shared.support.TestMetaData2; /** * BasicMetaDataTest. * * @author Adrian Brock * @version $Revision: 46146 $ */ public abstract class BasicMetaDataTest extends AbstractMetaDataTest { protected boolean local; public BasicMetaDataTest(String name, boolean local) { super(name); this.local = local; } public void testEmpty() throws Exception { MetaData metaData = setupEmpty(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected, local); } protected abstract MetaData setupEmpty(); public void testTestMetaData() throws Exception { MetaData metaData = setupTestMetaData(); ExpectedMetaData expected = emptyExpectedMetaData(); assertMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); expected.add(TestMetaData.class); assertAllMetaData(metaData, expected, local); } protected abstract MetaData setupTestMetaData(); public void testTestMetaData12() throws Exception { MetaData metaData = setupTestMetaData12(); ExpectedMetaData expected = emptyExpectedMetaData(); assertMetaData(metaData, TestMetaData1.class); assertMetaData(metaData, TestMetaData2.class); assertNoMetaData(metaData, NotPresentType.class); expected.add(TestMetaData1.class); expected.add(TestMetaData2.class); assertAllMetaData(metaData, expected, local); } protected abstract MetaData setupTestMetaData12(); public void testTestMetaDataByName() throws Exception { MetaData metaData = setupTestMetaDataByName(); ExpectedMetaData expected = emptyExpectedMetaData(); assertMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); expected.add(TestMetaData.class); assertAllMetaData(metaData, expected, local); } protected abstract MetaData setupTestMetaDataByName(); public void testTestMetaData12ByName() throws Exception { MetaData metaData = setupTestMetaData12ByName(); ExpectedMetaData expected = emptyExpectedMetaData(); assertMetaData(metaData, "Test1", TestMetaData1.class); assertMetaData(metaData, "Test2", TestMetaData2.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); expected.add(TestMetaData1.class); expected.add(TestMetaData2.class); assertAllMetaData(metaData, expected, local); } protected abstract MetaData setupTestMetaData12ByName(); } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/0000755000175000017500000000000011620305573030561 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/0000755000175000017500000000000011620305573031540 5ustar twernertwerner././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/BasicMutableMetaDataRepositoryMatchingUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/BasicMuta0000644000175000017500000000320210454442653033335 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.repository.test; import org.jboss.metadata.plugins.repository.basic.BasicMetaDataRepository; import org.jboss.metadata.spi.repository.MutableMetaDataRepository; /** * BasicMutableMetaDataRepositoryMatchingUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class BasicMutableMetaDataRepositoryMatchingUnitTestCase extends MutableMetaDataRepositoryMatchingTest { public BasicMutableMetaDataRepositoryMatchingUnitTestCase(String name) { super(name); } protected MutableMetaDataRepository setupEmpty() { return new BasicMetaDataRepository(); } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/BasicMutableMetaDataRepositoryUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/BasicMuta0000644000175000017500000000475010720557046033345 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.repository.test; import org.jboss.metadata.plugins.repository.basic.BasicMetaDataRepository; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.repository.MutableMetaDataRepository; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.metadata.spi.scope.CommonLevels; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.test.metadata.repository.support.TestClass1; import org.jboss.test.metadata.shared.support.TestAnnotation1; /** * BasicMutableMetaDataRepositoryUnitTestCase. * * @author Adrian Brock * @version $Revision: 67291 $ */ public class BasicMutableMetaDataRepositoryUnitTestCase extends MutableMetaDataRepositoryTest { public BasicMutableMetaDataRepositoryUnitTestCase(String name) { super(name); } protected MutableMetaDataRepository setupEmpty() { return new BasicMetaDataRepository(); } public void testAutoClassRetrieval() throws Exception { MutableMetaDataRepository repository = setupEmpty(); ScopeKey key = new ScopeKey(new Scope(CommonLevels.CLASS, TestClass1.class)); MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(key); assertNotNull(retrieval); MetaData metaData = new MetaDataRetrievalToMetaDataBridge(retrieval); assertNotNull(metaData.getAnnotation(TestAnnotation1.class)); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/RepositoryTestSuite.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/Repositor0000644000175000017500000000354710454442653033467 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.repository.test; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * RepositoryTestSuite. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class RepositoryTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Repository Tests"); suite.addTest(new TestSuite(BasicMutableMetaDataRepositoryUnitTestCase.class)); suite.addTest(new TestSuite(BasicMetaDataRepositoryBasicAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(BasicMetaDataRepositoryBasicMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(BasicMutableMetaDataRepositoryMatchingUnitTestCase.class)); return suite; } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/MutableMetaDataRepositoryTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/MutableMe0000644000175000017500000004210210720557046033341 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.repository.test; import java.util.HashSet; import java.util.Set; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.repository.MutableMetaDataRepository; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.scope.ScopeLevel; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.repository.support.TestMetaDataRetrievalFactory; /** * MutableMetaDataRepositoryTest. * * @author Adrian Brock * @version $Revision: 67291 $ */ public abstract class MutableMetaDataRepositoryTest extends AbstractMetaDataTest { private static ScopeLevel testLevel1 = new ScopeLevel(1, "ONE"); private static ScopeLevel testLevel2 = new ScopeLevel(2, "TWO"); private static ScopeLevel testLevel3 = new ScopeLevel(3, "THREE"); private static String testQualifier1 = "qualifier1"; private static String testQualifier1Different = "qualifier1Different"; private static String testQualifier2 = "qualifier2"; private static String testQualifier2Different = "qualifier2Different"; private static String testQualifier3 = "qualifier3"; private static Scope testScope1 = new Scope(testLevel1, testQualifier1); private static Scope testScope1Different = new Scope(testLevel1, testQualifier1Different); private static Scope testScope2 = new Scope(testLevel2, testQualifier2); private static Scope testScope2Different = new Scope(testLevel2, testQualifier2Different); private static Scope testScope3 = new Scope(testLevel3, testQualifier3); private static ScopeKey testKey1 = new ScopeKey(testScope1); private static ScopeKey testKey2 = new ScopeKey(testScope2); private static ScopeKey testKey1Different = new ScopeKey(testScope1Different); private static ScopeKey testKey12 = new ScopeKey(new Scope[] { testScope1, testScope2 }); private static ScopeKey testKey12Different = new ScopeKey(new Scope[] { testScope1, testScope2Different }); private static ScopeKey testKey123 = new ScopeKey(new Scope[] { testScope1, testScope2, testScope3 }); private static ScopeKey testKey123Different = new ScopeKey(new Scope[] { testScope1Different, testScope2, testScope3 }); public MutableMetaDataRepositoryTest(String name) { super(name); } protected abstract MutableMetaDataRepository setupEmpty(); public void testAddOneScope() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader = createTestMutableMetaDataLoader(testKey1); assertAddMetaDataRetrieval(repository, loader, null); MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(testKey1); assertTrue(loader == retrieval); } public void testAddOneScopeDifferent() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1); assertAddMetaDataRetrieval(repository, loader1, null); MutableMetaDataLoader loader1Different = createTestMutableMetaDataLoader(testKey1Different); assertAddMetaDataRetrieval(repository, loader1Different, null); MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(testKey1); assertTrue(loader1 == retrieval); retrieval = repository.getMetaDataRetrieval(testKey1Different); assertTrue(loader1Different == retrieval); } public void testReplaceOneScope() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1); assertAddMetaDataRetrieval(repository, loader1, null); MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(testKey1); assertTrue(loader1 == retrieval); MutableMetaDataLoader loader2 = createTestMutableMetaDataLoader(testKey1); assertAddMetaDataRetrieval(repository, loader2, loader1); retrieval = repository.getMetaDataRetrieval(testKey1); assertTrue(loader2 == retrieval); } public void testRemoveOneScope() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1); assertAddMetaDataRetrieval(repository, loader1, null); MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(testKey1); assertTrue(loader1 == retrieval); assertRemoveMetaDataRetrieval(repository, testKey1, loader1); retrieval = repository.getMetaDataRetrieval(testKey1); assertNull(retrieval); } public void testRemoveOneScopeDifferent() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1); assertAddMetaDataRetrieval(repository, loader1, null); MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(testKey1); assertTrue(loader1 == retrieval); assertRemoveMetaDataRetrieval(repository, testKey1Different, null); retrieval = repository.getMetaDataRetrieval(testKey1); assertTrue(loader1 == retrieval); } public void testAddMutlipleScope() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader = createTestMutableMetaDataLoader(testKey123); assertAddMetaDataRetrieval(repository, loader, null); MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(testKey123); assertTrue(loader == retrieval); } public void testAddMultipleScopeDifferent() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey123); assertAddMetaDataRetrieval(repository, loader1, null); MutableMetaDataLoader loader1Different = createTestMutableMetaDataLoader(testKey123Different); assertAddMetaDataRetrieval(repository, loader1Different, null); MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(testKey123); assertTrue(loader1 == retrieval); retrieval = repository.getMetaDataRetrieval(testKey123Different); assertTrue(loader1Different == retrieval); } public void testReplaceMultipleScope() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey123); assertAddMetaDataRetrieval(repository, loader1, null); MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(testKey123); assertTrue(loader1 == retrieval); MutableMetaDataLoader loader2 = createTestMutableMetaDataLoader(testKey123); assertAddMetaDataRetrieval(repository, loader2, loader1); retrieval = repository.getMetaDataRetrieval(testKey123); assertTrue(loader2 == retrieval); } public void testRemoveMultipleScope() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey123); assertAddMetaDataRetrieval(repository, loader1, null); MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(testKey123); assertTrue(loader1 == retrieval); assertRemoveMetaDataRetrieval(repository, testKey123, loader1); retrieval = repository.getMetaDataRetrieval(testKey1); assertNull(retrieval); } public void testRemoveMultipleScopeDifferent() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey123); assertAddMetaDataRetrieval(repository, loader1, null); MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(testKey123); assertTrue(loader1 == retrieval); assertRemoveMetaDataRetrieval(repository, testKey123Different, null); retrieval = repository.getMetaDataRetrieval(testKey123); assertTrue(loader1 == retrieval); } public void testGetChildrenEmpty() throws Exception { MutableMetaDataRepository repository = setupEmpty(); Set result = repository.getChildren(testKey1); assertNotNull(result); assertEquals(0, result.size()); } public void testGetNoChildren() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1); assertAddMetaDataRetrieval(repository, loader1, null); Set result = repository.getChildren(testKey1); assertNotNull(result); assertEquals(0, result.size()); } public void testOneChild() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1); assertAddMetaDataRetrieval(repository, loader1, null); MutableMetaDataLoader loader12 = createTestMutableMetaDataLoader(testKey12); assertAddMetaDataRetrieval(repository, loader12, null); Set result = repository.getChildren(testKey1); assertNotNull(result); Set expected = new HashSet(); expected.add(testKey12); assertEquals(expected, result); } public void testTwoChild() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1); assertAddMetaDataRetrieval(repository, loader1, null); MutableMetaDataLoader loader12 = createTestMutableMetaDataLoader(testKey12); assertAddMetaDataRetrieval(repository, loader12, null); MutableMetaDataLoader loader12Different = createTestMutableMetaDataLoader(testKey12Different); assertAddMetaDataRetrieval(repository, loader12Different, null); Set result = repository.getChildren(testKey1); assertNotNull(result); Set expected = new HashSet(); expected.add(testKey12); expected.add(testKey12Different); assertEquals(expected, result); } public void testTooManyScopes() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1); assertAddMetaDataRetrieval(repository, loader1, null); MutableMetaDataLoader loader123 = createTestMutableMetaDataLoader(testKey123); assertAddMetaDataRetrieval(repository, loader123, null); Set result = repository.getChildren(testKey1); assertNotNull(result); assertEquals(0, result.size()); } public void testManyScopes() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader12 = createTestMutableMetaDataLoader(testKey12); assertAddMetaDataRetrieval(repository, loader12, null); MutableMetaDataLoader loader123 = createTestMutableMetaDataLoader(testKey123); assertAddMetaDataRetrieval(repository, loader123, null); Set result = repository.getChildren(testKey12); assertNotNull(result); Set expected = new HashSet(); expected.add(testKey123); assertEquals(expected, result); } public void testAddMetaDataRetrievalFactory() throws Exception { MutableMetaDataRepository repository = setupEmpty(); assertNull(repository.getMetaDataRetrievalFactory(testLevel1)); TestMetaDataRetrievalFactory factory1 = new TestMetaDataRetrievalFactory(); assertNull(repository.addMetaDataRetrievalFactory(testLevel1, factory1)); assertEquals(factory1, repository.getMetaDataRetrievalFactory(testLevel1)); TestMetaDataRetrievalFactory factory2 = new TestMetaDataRetrievalFactory(); assertEquals(factory1, repository.addMetaDataRetrievalFactory(testLevel1, factory2)); assertEquals(factory2, repository.getMetaDataRetrievalFactory(testLevel1)); TestMetaDataRetrievalFactory factory3 = new TestMetaDataRetrievalFactory(); assertNull(repository.addMetaDataRetrievalFactory(testLevel2, factory3)); assertEquals(factory2, repository.getMetaDataRetrievalFactory(testLevel1)); assertEquals(factory3, repository.getMetaDataRetrievalFactory(testLevel2)); } public void testRemoveMetaDataRetrievalFactory() throws Exception { MutableMetaDataRepository repository = setupEmpty(); assertNull(repository.getMetaDataRetrievalFactory(testLevel1)); TestMetaDataRetrievalFactory factory1 = new TestMetaDataRetrievalFactory(); assertNull(repository.addMetaDataRetrievalFactory(testLevel1, factory1)); assertEquals(factory1, repository.removeMetaDataRetrievalFactory(testLevel1)); assertNull(repository.getMetaDataRetrievalFactory(testLevel1)); assertNull(repository.removeMetaDataRetrievalFactory(testLevel1)); TestMetaDataRetrievalFactory factory2 = new TestMetaDataRetrievalFactory(); assertNull(repository.addMetaDataRetrievalFactory(testLevel1, factory1)); assertNull(repository.addMetaDataRetrievalFactory(testLevel2, factory2)); assertEquals(factory1, repository.removeMetaDataRetrievalFactory(testLevel1)); assertNull(repository.getMetaDataRetrievalFactory(testLevel1)); assertNull(repository.removeMetaDataRetrievalFactory(testLevel1)); assertEquals(factory2, repository.getMetaDataRetrievalFactory(testLevel2)); } public void testBasicMetaDataRetrievalFactory() throws Exception { MutableMetaDataRepository repository = setupEmpty(); TestMetaDataRetrievalFactory factory1 = new TestMetaDataRetrievalFactory(); repository.addMetaDataRetrievalFactory(testLevel1, factory1); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1); factory1.retrievals.put(testScope1, loader1); assertEquals(loader1, repository.getMetaDataRetrieval(testKey1)); } public void testMultipleRetrievalMetaDataRetrievalFactory() throws Exception { MutableMetaDataRepository repository = setupEmpty(); TestMetaDataRetrievalFactory factory1 = new TestMetaDataRetrievalFactory(); repository.addMetaDataRetrievalFactory(testLevel1, factory1); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1); factory1.retrievals.put(testScope1, loader1); MutableMetaDataLoader loader2 = createTestMutableMetaDataLoader(testKey1Different); factory1.retrievals.put(testScope1Different, loader2); assertEquals(loader1, repository.getMetaDataRetrieval(testKey1)); assertEquals(loader2, repository.getMetaDataRetrieval(testKey1Different)); } public void testMultipleMetaDataRetrievalFactories() throws Exception { MutableMetaDataRepository repository = setupEmpty(); TestMetaDataRetrievalFactory factory1 = new TestMetaDataRetrievalFactory(); repository.addMetaDataRetrievalFactory(testLevel1, factory1); TestMetaDataRetrievalFactory factory2 = new TestMetaDataRetrievalFactory(); repository.addMetaDataRetrievalFactory(testLevel2, factory2); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1); factory1.retrievals.put(testScope1, loader1); MutableMetaDataLoader loader2 = createTestMutableMetaDataLoader(testKey2); factory2.retrievals.put(testScope2, loader2); assertEquals(loader1, repository.getMetaDataRetrieval(testKey1)); assertEquals(loader2, repository.getMetaDataRetrieval(testKey2)); } protected void assertAddMetaDataRetrieval(MutableMetaDataRepository repository, MetaDataRetrieval add, MetaDataRetrieval expected) throws Exception { MetaDataRetrieval previous = repository.addMetaDataRetrieval(add); assertEquals(expected, previous); } protected void assertRemoveMetaDataRetrieval(MutableMetaDataRepository repository, ScopeKey key, MetaDataRetrieval expected) throws Exception { MetaDataRetrieval previous = repository.removeMetaDataRetrieval(key); assertEquals(expected, previous); } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/MutableMetaDataRepositoryMatchingTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/MutableMe0000644000175000017500000002604110454442653033346 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.repository.test; import java.util.HashSet; import java.util.Set; import org.jboss.metadata.plugins.repository.visitor.FuzzyMetaDataRepositoryVisitor; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.repository.MutableMetaDataRepository; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.scope.ScopeLevel; import org.jboss.test.metadata.AbstractMetaDataTest; /** * MutableMetaDataRepositoryMatchingTest. * * @author Adrian Brock * @version $Revision: 46146 $ */ public abstract class MutableMetaDataRepositoryMatchingTest extends AbstractMetaDataTest { private static ScopeLevel testLevel1 = new ScopeLevel(1, "ONE"); private static ScopeLevel testLevel2 = new ScopeLevel(2, "TWO"); private static ScopeLevel testLevel3 = new ScopeLevel(3, "THREE"); private static ScopeLevel testLevel4 = new ScopeLevel(4, "FOUR"); private static ScopeLevel testLevel5 = new ScopeLevel(5, "FIVE"); private static ScopeLevel testLevel6 = new ScopeLevel(6, "FIVE"); private static String testQualifier1 = "qualifier1"; private static String testQualifier1x = "qualifier1x"; private static String testQualifier2 = "qualifier2"; private static String testQualifier2x = "qualifier2x"; private static String testQualifier3 = "qualifier3"; private static String testQualifier4 = "qualifier4"; private static String testQualifier5 = "qualifier5"; private static String testQualifier6 = "qualifier6"; private static Scope testLevel1Qual1 = new Scope(testLevel1, testQualifier1); private static Scope testLevel1Qual1x = new Scope(testLevel1, testQualifier1x); private static Scope testLevel2Qual2 = new Scope(testLevel2, testQualifier2); private static Scope testLevel2Qual2x = new Scope(testLevel2, testQualifier2x); private static Scope testLevel3Qual3 = new Scope(testLevel3, testQualifier3); private static Scope testLevel4Qual4 = new Scope(testLevel4, testQualifier4); private static Scope testLevel5Qual5 = new Scope(testLevel5, testQualifier5); private static Scope testLevel6Qual6 = new Scope(testLevel6, testQualifier6); private static ScopeKey testKey1 = new ScopeKey(testLevel1Qual1); private static ScopeKey testKey1x = new ScopeKey(testLevel1Qual1x); private static ScopeKey testKey2 = new ScopeKey(testLevel2Qual2); private static ScopeKey testKey3 = new ScopeKey(testLevel3Qual3); private static ScopeKey testKey12 = new ScopeKey(new Scope[] { testLevel1Qual1, testLevel2Qual2 }); private static ScopeKey testKey13 = new ScopeKey(new Scope[] { testLevel1Qual1, testLevel3Qual3 }); private static ScopeKey testKey14 = new ScopeKey(new Scope[] { testLevel1Qual1, testLevel4Qual4 }); private static ScopeKey testKey15 = new ScopeKey(new Scope[] { testLevel1Qual1, testLevel5Qual5 }); private static ScopeKey testKey16 = new ScopeKey(new Scope[] { testLevel1Qual1, testLevel6Qual6 }); private static ScopeKey testKey23 = new ScopeKey(new Scope[] { testLevel2Qual2, testLevel3Qual3 }); private static ScopeKey testKey2x3 = new ScopeKey(new Scope[] { testLevel2Qual2x, testLevel3Qual3 }); public MutableMetaDataRepositoryMatchingTest(String name) { super(name); } protected abstract MutableMetaDataRepository setupEmpty(); public void testNoMatchEmpty() throws Exception { MutableMetaDataRepository repository = setupEmpty(); FuzzyMetaDataRepositoryVisitor visitor = new FuzzyMetaDataRepositoryVisitor(testKey1); Set result = repository.matchScopes(visitor); assertNotNull(result); assertEquals(0, result.size()); } public void testSimpleMatch() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1); repository.addMetaDataRetrieval(loader1); MutableMetaDataLoader loader2 = createTestMutableMetaDataLoader(testKey2); repository.addMetaDataRetrieval(loader2); MutableMetaDataLoader loader3 = createTestMutableMetaDataLoader(testKey3); repository.addMetaDataRetrieval(loader3); FuzzyMetaDataRepositoryVisitor visitor = new FuzzyMetaDataRepositoryVisitor(testKey1); Set result = repository.matchScopes(visitor); HashSet expected = new HashSet(); expected.add(testKey1); assertEquals(expected, result); } public void testNotSimpleMatch() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1); repository.addMetaDataRetrieval(loader1); MutableMetaDataLoader loader2 = createTestMutableMetaDataLoader(testKey2); repository.addMetaDataRetrieval(loader2); MutableMetaDataLoader loader3 = createTestMutableMetaDataLoader(testKey3); repository.addMetaDataRetrieval(loader3); FuzzyMetaDataRepositoryVisitor visitor = new FuzzyMetaDataRepositoryVisitor(testKey1x); Set result = repository.matchScopes(visitor); assertNotNull(result); assertEquals(0, result.size()); } public void testNoMatchAgainstSimple() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1); repository.addMetaDataRetrieval(loader1); MutableMetaDataLoader loader2 = createTestMutableMetaDataLoader(testKey2); repository.addMetaDataRetrieval(loader2); FuzzyMetaDataRepositoryVisitor visitor = new FuzzyMetaDataRepositoryVisitor(testKey3); Set result = repository.matchScopes(visitor); assertNotNull(result); assertEquals(0, result.size()); } public void testCompositeMatch() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader23 = createTestMutableMetaDataLoader(testKey23); repository.addMetaDataRetrieval(loader23); MutableMetaDataLoader loader14 = createTestMutableMetaDataLoader(testKey14); repository.addMetaDataRetrieval(loader14); MutableMetaDataLoader loader15 = createTestMutableMetaDataLoader(testKey15); repository.addMetaDataRetrieval(loader15); MutableMetaDataLoader loader16 = createTestMutableMetaDataLoader(testKey16); repository.addMetaDataRetrieval(loader16); FuzzyMetaDataRepositoryVisitor visitor = new FuzzyMetaDataRepositoryVisitor(testKey2); Set result = repository.matchScopes(visitor); HashSet expected = new HashSet(); expected.add(testKey23); assertEquals(expected, result); } public void testNotCompositeMatch() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader23 = createTestMutableMetaDataLoader(testKey23); repository.addMetaDataRetrieval(loader23); MutableMetaDataLoader loader14 = createTestMutableMetaDataLoader(testKey14); repository.addMetaDataRetrieval(loader14); MutableMetaDataLoader loader15 = createTestMutableMetaDataLoader(testKey15); repository.addMetaDataRetrieval(loader15); MutableMetaDataLoader loader16 = createTestMutableMetaDataLoader(testKey16); repository.addMetaDataRetrieval(loader16); FuzzyMetaDataRepositoryVisitor visitor = new FuzzyMetaDataRepositoryVisitor(testKey2x3); Set result = repository.matchScopes(visitor); assertNotNull(result); assertEquals(0, result.size()); } public void testNoMatchEmptyAgainstComposite() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader12 = createTestMutableMetaDataLoader(testKey12); repository.addMetaDataRetrieval(loader12); MutableMetaDataLoader loader14 = createTestMutableMetaDataLoader(testKey14); repository.addMetaDataRetrieval(loader14); MutableMetaDataLoader loader15 = createTestMutableMetaDataLoader(testKey15); repository.addMetaDataRetrieval(loader15); MutableMetaDataLoader loader16 = createTestMutableMetaDataLoader(testKey16); repository.addMetaDataRetrieval(loader16); FuzzyMetaDataRepositoryVisitor visitor = new FuzzyMetaDataRepositoryVisitor(testKey3); Set result = repository.matchScopes(visitor); assertNotNull(result); assertEquals(0, result.size()); } public void testPartialMatch() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader12 = createTestMutableMetaDataLoader(testKey12); repository.addMetaDataRetrieval(loader12); MutableMetaDataLoader loader13 = createTestMutableMetaDataLoader(testKey13); repository.addMetaDataRetrieval(loader13); MutableMetaDataLoader loader23 = createTestMutableMetaDataLoader(testKey23); repository.addMetaDataRetrieval(loader23); FuzzyMetaDataRepositoryVisitor visitor = new FuzzyMetaDataRepositoryVisitor(testKey1); Set result = repository.matchScopes(visitor); HashSet expected = new HashSet(); expected.add(testKey12); expected.add(testKey13); assertEquals(expected, result); } public void testNotPartialMatch() throws Exception { MutableMetaDataRepository repository = setupEmpty(); MutableMetaDataLoader loader12 = createTestMutableMetaDataLoader(testKey12); repository.addMetaDataRetrieval(loader12); MutableMetaDataLoader loader13 = createTestMutableMetaDataLoader(testKey13); repository.addMetaDataRetrieval(loader13); MutableMetaDataLoader loader23 = createTestMutableMetaDataLoader(testKey23); repository.addMetaDataRetrieval(loader23); FuzzyMetaDataRepositoryVisitor visitor = new FuzzyMetaDataRepositoryVisitor(testKey1x); Set result = repository.matchScopes(visitor); assertNotNull(result); assertEquals(0, result.size()); } } ././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/BasicMetaDataRepositoryBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/BasicMeta0000644000175000017500000000535010454442653033323 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.repository.test; import org.jboss.metadata.plugins.repository.basic.BasicMetaDataRepository; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.test.metadata.shared.BasicAnnotationsTest; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * BasicMetaDataRepositoryBasicAnnotationsUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class BasicMetaDataRepositoryBasicAnnotationsUnitTestCase extends BasicAnnotationsTest { public BasicMetaDataRepositoryBasicAnnotationsUnitTestCase(String name) { super(name, true); } protected MetaData setupMetaData(MetaDataLoader loader) { BasicMetaDataRepository repository = new BasicMetaDataRepository(); repository.addMetaDataRetrieval(loader); return repository.getMetaData(loader.getScope()); } protected MetaData setupEmpty() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); return setupMetaData(loader); } protected MetaData setupTestAnnotation() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addAnnotation(new TestAnnotationImpl()); return setupMetaData(loader); } protected MetaData setupTestAnnotation12() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addAnnotation(new TestAnnotation1Impl()); loader.addAnnotation(new TestAnnotation2Impl()); return setupMetaData(loader); } } ././@LongLink0000000000000000000000000000022100000000000011560 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/BasicMetaDataRepositoryBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/test/BasicMeta0000644000175000017500000000676410454442653033335 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.repository.test; import org.jboss.metadata.plugins.repository.basic.BasicMetaDataRepository; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.test.metadata.shared.BasicMetaDataTest; import org.jboss.test.metadata.shared.support.TestMetaData; import org.jboss.test.metadata.shared.support.TestMetaData1; import org.jboss.test.metadata.shared.support.TestMetaData1Impl; import org.jboss.test.metadata.shared.support.TestMetaData2; import org.jboss.test.metadata.shared.support.TestMetaData2Impl; import org.jboss.test.metadata.shared.support.TestMetaDataImpl; /** * BasicMetaDataRepositoryBasicMetaDataUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class BasicMetaDataRepositoryBasicMetaDataUnitTestCase extends BasicMetaDataTest { public BasicMetaDataRepositoryBasicMetaDataUnitTestCase(String name) { super(name, true); } protected MetaData setupMetaData(MetaDataLoader loader) { BasicMetaDataRepository repository = new BasicMetaDataRepository(); repository.addMetaDataRetrieval(loader); return repository.getMetaData(loader.getScope()); } protected MetaData setupEmpty() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); return setupMetaData(loader); } protected MetaData setupTestMetaData() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData(new TestMetaDataImpl(), TestMetaData.class); return setupMetaData(loader); } protected MetaData setupTestMetaData12() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData(new TestMetaData1Impl(), TestMetaData1.class); loader.addMetaData(new TestMetaData2Impl(), TestMetaData2.class); return setupMetaData(loader); } protected MetaData setupTestMetaDataByName() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData("Test", new TestMetaDataImpl(), TestMetaData.class); return setupMetaData(loader); } protected MetaData setupTestMetaData12ByName() { MutableMetaDataLoader loader = createTestMutableMetaDataLoader(); loader.addMetaData("Test1", new TestMetaData1Impl(), TestMetaData1.class); loader.addMetaData("Test2", new TestMetaData2Impl(), TestMetaData2.class); return setupMetaData(loader); } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/support/0000755000175000017500000000000011620305573032275 5ustar twernertwerner././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/support/TestClass1.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/support/TestCl0000644000175000017500000000220410720557046033420 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.repository.support; import org.jboss.test.metadata.shared.support.TestAnnotation1; @TestAnnotation1 public class TestClass1 { } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/support/TestMetaDataRetrievalFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/repository/support/TestMe0000644000175000017500000000326110720557046033427 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.repository.support; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalFactory; import org.jboss.metadata.spi.scope.Scope; /** * TestMetaDataRetrievalFactory. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestMetaDataRetrievalFactory implements MetaDataRetrievalFactory { public Map retrievals = new ConcurrentHashMap(); public MetaDataRetrieval getMetaDataRetrieval(Scope scope) { return retrievals.get(scope); } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/0000755000175000017500000000000011620305577027614 5ustar twernertwerner././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/MutableMetaDataLoaderMetaDataInvalidationTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/MutableMetaDataLoa0000644000175000017500000003257110454442653033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.shared.support.ExpectedMetaData; import org.jboss.test.metadata.shared.support.NotPresentType; import org.jboss.test.metadata.shared.support.TestMetaData; import org.jboss.test.metadata.shared.support.TestMetaData1; import org.jboss.test.metadata.shared.support.TestMetaData1Impl; import org.jboss.test.metadata.shared.support.TestMetaData2; import org.jboss.test.metadata.shared.support.TestMetaData2Impl; import org.jboss.test.metadata.shared.support.TestMetaDataImpl; /** * MutableMetaDataLoaderMetaDataInvalidationTest. * * @author Adrian Brock * @version $Revision: 46146 $ */ public abstract class MutableMetaDataLoaderMetaDataInvalidationTest extends AbstractMetaDataTest { public MutableMetaDataLoaderMetaDataInvalidationTest(String name) { super(name); } public void testEmpty() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); assertValidTimeUnchanged(metaData, last); } public void testTestMetaData() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaDataImpl(), TestMetaData.class, expected, last); assertMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); assertRemoveMetaData(metaData, TestMetaData.class, expected, last); assertNoMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); } public void testTestMetaData12() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, TestMetaData1.class); assertNoMetaData(metaData, TestMetaData2.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaData1Impl(), TestMetaData1.class, expected, last); assertMetaData(metaData, TestMetaData1.class); assertNoMetaData(metaData, TestMetaData2.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaData2Impl(), TestMetaData2.class, expected, last); assertMetaData(metaData, TestMetaData1.class); assertMetaData(metaData, TestMetaData2.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); assertRemoveMetaData(metaData, TestMetaData1.class, expected, last); assertNoMetaData(metaData, TestMetaData1.class); assertMetaData(metaData, TestMetaData2.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); assertRemoveMetaData(metaData, TestMetaData2.class, expected, last); assertNoMetaData(metaData, TestMetaData1.class); assertNoMetaData(metaData, TestMetaData2.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); } public void testAddTwice() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaDataImpl(), TestMetaData.class, expected, last); assertMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataWithPrevious(metaData, new TestMetaDataImpl(), TestMetaData.class, last); assertMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); } public void testAddTwiceSameObject() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); TestMetaData object = new TestMetaDataImpl(); last = assertAddMetaDataNoPrevious(metaData, object, TestMetaData.class, expected, last); assertMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); assertAddMetaDataWithPreviousSameObject(metaData, object, TestMetaData.class, last); assertMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); } public void testRemoveDoesNotExist() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNotRemovedMetaData(metaData, TestMetaData.class, last); assertAllMetaData(metaData, expected); } public void testRemoveTwice() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); last = assertAddMetaDataNoPrevious(metaData, new TestMetaDataImpl(), TestMetaData.class, expected, last); assertRemoveMetaData(metaData, TestMetaData.class, expected, last); assertNotRemovedMetaData(metaData, TestMetaData.class, last); assertAllMetaData(metaData, expected); } public void testTestMetaDataByName() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaDataImpl(), "Test", TestMetaData.class, expected, last); assertMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); assertRemoveMetaData(metaData, "Test", TestMetaData.class, expected, last); assertNoMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); } public void testTestMetaData12ByName() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, "Test1", TestMetaData1.class); assertNoMetaData(metaData, "Test2", TestMetaData2.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaData1Impl(), "Test1", TestMetaData1.class, expected, last); assertMetaData(metaData, "Test1", TestMetaData1.class); assertNoMetaData(metaData, "Test2", TestMetaData2.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaData2Impl(), "Test2", TestMetaData2.class, expected, last); assertMetaData(metaData, "Test1", TestMetaData1.class); assertMetaData(metaData, "Test2", TestMetaData2.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); assertRemoveMetaData(metaData, "Test1", TestMetaData1.class, expected, last); assertNoMetaData(metaData, "Test1", TestMetaData1.class); assertMetaData(metaData, "Test2", TestMetaData2.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); assertRemoveMetaData(metaData, "Test2", TestMetaData2.class, expected, last); assertNoMetaData(metaData, "Test1", TestMetaData1.class); assertNoMetaData(metaData, "Test2", TestMetaData2.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); } public void testAddTwiceByName() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaDataImpl(), "Test", TestMetaData.class, expected, last); assertMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataWithPrevious(metaData, new TestMetaDataImpl(), "Test", TestMetaData.class, last); assertMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); } public void testAddTwiceSameObjectByName() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); TestMetaData object = new TestMetaDataImpl(); last = assertAddMetaDataNoPrevious(metaData, object, "Test", TestMetaData.class, expected, last); assertMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); assertAddMetaDataWithPreviousSameObject(metaData, object, "Test", TestMetaData.class, last); assertMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); } public void testRemoveDoesNotExistByName() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNotRemovedMetaData(metaData, "Test", TestMetaData.class, last); assertAllMetaData(metaData, expected); } public void testRemoveTwiceByName() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); last = assertAddMetaDataNoPrevious(metaData, new TestMetaDataImpl(), "Test", TestMetaData.class, expected, last); assertRemoveMetaData(metaData, "Test", TestMetaData.class, expected, last); assertNotRemovedMetaData(metaData, "Test", TestMetaData.class, last); assertAllMetaData(metaData, expected); } protected abstract MutableMetaDataLoader setupEmpty(); } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/0000755000175000017500000000000011620305576031123 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/0000755000175000017500000000000011620305577032103 5ustar twernertwerner././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/MemoryLoaderMutableMetaDataInvalidationUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/Memory0000644000175000017500000000332010446527733033301 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.memory.test; import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.test.metadata.loader.MutableMetaDataLoaderMetaDataInvalidationTest; /** * MemoryLoaderMutableMetaDataInvalidationUnitTestCase. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class MemoryLoaderMutableMetaDataInvalidationUnitTestCase extends MutableMetaDataLoaderMetaDataInvalidationTest { public MemoryLoaderMutableMetaDataInvalidationUnitTestCase(String name) { super(name); } protected MutableMetaDataLoader setupEmpty() { return new MemoryMetaDataLoader(); } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/MemoryLoaderComponentMutableUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/Memory0000644000175000017500000001571710756326650033315 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.memory.test; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader; import org.jboss.metadata.plugins.loader.thread.ThreadLocalMetaDataLoader; import org.jboss.metadata.spi.ComponentMutableMetaData; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.scope.CommonLevels; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.signature.ConstructorSignature; import org.jboss.metadata.spi.signature.FieldSignature; import org.jboss.metadata.spi.signature.MethodSignature; import org.jboss.metadata.spi.signature.Signature; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.FieldInfo; import org.jboss.reflect.spi.MemberInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.test.metadata.SignatureMetaDataTest; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * MemoryLoaderComponentMutableUnitTestCase. * * @author Ales Justin */ public class MemoryLoaderComponentMutableUnitTestCase extends SignatureMetaDataTest { public MemoryLoaderComponentMutableUnitTestCase(String name) { super(name); } protected ComponentMutableMetaData[] getArray() { ComponentMutableMetaData[] array = new ComponentMutableMetaData[10]; 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); return array; } public void testComponentMetaDataRetrieval() throws Exception { ComponentMutableMetaData[] array = getArray(); Signature[] signatures = getSignatures(); MetaDataRetrieval retrieval = ThreadLocalMetaDataLoader.INSTANCE; for(ComponentMutableMetaData cmmd : array) { for(Signature sig : signatures) { assertNull(cmmd.addComponentMetaDataRetrieval(sig, retrieval)); MetaDataRetrieval mdr = cmmd.removeComponentMetaDataRetrieval(sig); assertSame(retrieval, mdr); } } } public void testAnnotations() throws Exception { ComponentMutableMetaData[] array = getArray(); Signature[] signatures = getSignatures(); TestAnnotation annotation = new TestAnnotationImpl(); for(ComponentMutableMetaData cmmd : array) { for(Signature sig : signatures) { assertNull(cmmd.addAnnotation(sig, annotation)); assertSame(annotation, cmmd.removeAnnotation(sig, TestAnnotation.class)); } } Constructor c = getConstructor(); ConstructorInfo ci = getConstructorInfo(); Signature sc = new ConstructorSignature(c); checkAnnotationCycle(sc, c, ci); Method m = getMethod(); MethodInfo mi = getMethodInfo(); Signature sm = new MethodSignature(m); checkAnnotationCycle(sm, m, mi); Field f = getField(); FieldInfo fi = getFieldInfo(); Signature sf = new FieldSignature(f); checkAnnotationCycle(sf, f, fi); } public void testMetaData() throws Exception { ComponentMutableMetaData[] array = getArray(); Signature[] signatures = getSignatures(); Object metadata = new Object(); for(ComponentMutableMetaData cmmd : array) { for(Signature sig : signatures) { assertNull(cmmd.addMetaData(sig, metadata, Object.class)); Object object = cmmd.removeMetaData(sig, Object.class); assertSame(metadata, object); } } Constructor c = getConstructor(); ConstructorInfo ci = getConstructorInfo(); Signature sc = new ConstructorSignature(c); checkMetaDataCycle(sc, c, ci); Method m = getMethod(); MethodInfo mi = getMethodInfo(); Signature sm = new MethodSignature(m); checkMetaDataCycle(sm, m, mi); Field f = getField(); FieldInfo fi = getFieldInfo(); Signature sf = new FieldSignature(f); checkMetaDataCycle(sf, f, fi); } protected void checkAnnotationCycle(Signature signature, Member member, MemberInfo memberInfo) throws Exception { TestAnnotation annotation = new TestAnnotationImpl(); ComponentMutableMetaData[] array = getArray(); for(ComponentMutableMetaData cmmd : array) { assertNull(cmmd.addAnnotation(signature, annotation)); assertSame(annotation, cmmd.removeAnnotation(member, annotation.annotationType())); assertNull(cmmd.addAnnotation(memberInfo, annotation)); assertSame(annotation, cmmd.removeAnnotation(signature, annotation.annotationType())); } } protected void checkMetaDataCycle(Signature signature, Member member, MemberInfo memberInfo) throws Exception { Object metadata = new Object(); ComponentMutableMetaData[] array = getArray(); for(ComponentMutableMetaData cmmd : array) { assertNull(cmmd.addMetaData(signature, metadata, Object.class)); assertSame(metadata, cmmd.removeMetaData(member, Object.class)); assertNull(cmmd.addMetaData(memberInfo, metadata, Object.class)); assertSame(metadata, cmmd.removeMetaData(signature, Object.class)); } } } ././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/MemoryLoaderComponentBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/Memory0000644000175000017500000001423011006162205033261 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.memory.test; import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.metadata.spi.signature.ConstructorParametersSignature; import org.jboss.metadata.spi.signature.ConstructorSignature; import org.jboss.metadata.spi.signature.FieldSignature; import org.jboss.metadata.spi.signature.MethodParametersSignature; import org.jboss.metadata.spi.signature.MethodSignature; import org.jboss.test.metadata.shared.ComponentBasicAnnotationsTest; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * MemoryLoaderComponentBasicAnnotationsUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class MemoryLoaderComponentBasicAnnotationsUnitTestCase extends ComponentBasicAnnotationsTest { public MemoryLoaderComponentBasicAnnotationsUnitTestCase(String name) { super(name, true); } protected MetaData setupField() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); MemoryMetaDataLoader component = new MemoryMetaDataLoader(); loader.addComponentMetaDataRetrieval(new FieldSignature("empty"), component); component = new MemoryMetaDataLoader(); component.addAnnotation(new TestAnnotationImpl()); loader.addComponentMetaDataRetrieval(new FieldSignature("testAnnotation"), component); component = new MemoryMetaDataLoader(); component.addAnnotation(new TestAnnotation1Impl()); component.addAnnotation(new TestAnnotation2Impl()); loader.addComponentMetaDataRetrieval(new FieldSignature("testAnnotation12"), component); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupConstructor() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); MemoryMetaDataLoader component = new MemoryMetaDataLoader(); loader.addComponentMetaDataRetrieval(new ConstructorSignature(), component); component = new MemoryMetaDataLoader(); component.addAnnotation(new TestAnnotationImpl()); loader.addComponentMetaDataRetrieval(new ConstructorSignature(String.class), component); component = new MemoryMetaDataLoader(); component.addAnnotation(new TestAnnotation1Impl()); component.addAnnotation(new TestAnnotation2Impl()); loader.addComponentMetaDataRetrieval(new ConstructorSignature(String.class, Class.class), component); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupMethod() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); MemoryMetaDataLoader component = new MemoryMetaDataLoader(); loader.addComponentMetaDataRetrieval(new MethodSignature("empty"), component); component = new MemoryMetaDataLoader(); component.addAnnotation(new TestAnnotationImpl()); loader.addComponentMetaDataRetrieval(new MethodSignature("testAnnotation", String.class), component); component = new MemoryMetaDataLoader(); component.addAnnotation(new TestAnnotation1Impl()); component.addAnnotation(new TestAnnotation2Impl()); loader.addComponentMetaDataRetrieval(new MethodSignature("testAnnotation12", String.class, Class.class), component); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupMethodParams() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); MemoryMetaDataLoader component = new MemoryMetaDataLoader(); loader.addComponentMetaDataRetrieval(new MethodParametersSignature("empty", 0, String.class), component); component = new MemoryMetaDataLoader(); component.addAnnotation(new TestAnnotationImpl()); loader.addComponentMetaDataRetrieval(new MethodParametersSignature("testAnnotation", 0, String.class), component); component = new MemoryMetaDataLoader(); component.addAnnotation(new TestAnnotation1Impl()); component.addAnnotation(new TestAnnotation2Impl()); loader.addComponentMetaDataRetrieval(new MethodParametersSignature("testAnnotation12", 1, String.class, Class.class), component); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupConstructorParams() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); MemoryMetaDataLoader component = new MemoryMetaDataLoader(); loader.addComponentMetaDataRetrieval(new ConstructorParametersSignature(0, String.class), component); component = new MemoryMetaDataLoader(); component.addAnnotation(new TestAnnotationImpl()); loader.addComponentMetaDataRetrieval(new ConstructorParametersSignature(0, Integer.class), component); component = new MemoryMetaDataLoader(); component.addAnnotation(new TestAnnotation1Impl()); component.addAnnotation(new TestAnnotation2Impl()); loader.addComponentMetaDataRetrieval(new ConstructorParametersSignature(1, String.class, Class.class), component); return new MetaDataRetrievalToMetaDataBridge(loader); } } ././@LongLink0000000000000000000000000000023200000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/MemoryLoaderMutableAnnotationsInvalidationUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/Memory0000644000175000017500000000333710446527733033311 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.memory.test; import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.test.metadata.loader.MutableMetaDataLoaderAnnotationsInvalidationTest; /** * MemoryLoaderMutableAnnotationsInvalidationUnitTestCase. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class MemoryLoaderMutableAnnotationsInvalidationUnitTestCase extends MutableMetaDataLoaderAnnotationsInvalidationTest { public MemoryLoaderMutableAnnotationsInvalidationUnitTestCase(String name) { super(name); } protected MutableMetaDataLoader setupEmpty() { return new MemoryMetaDataLoader(); } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/MemoryLoaderRestrictedUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/Memory0000644000175000017500000000317710446527733033313 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.memory.test; import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.test.metadata.loader.MutableRestrictedTest; /** * MemoryLoaderRestrictedUnitTestCase. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class MemoryLoaderRestrictedUnitTestCase extends MutableRestrictedTest { public MemoryLoaderRestrictedUnitTestCase(String name) { super(name); } protected MutableMetaDataLoader setUpRestricted() { return new MemoryMetaDataLoader(true, true); } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/MemoryLoaderMutableMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/Memory0000644000175000017500000000346710454442653033311 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.memory.test; import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader; import org.jboss.test.metadata.loader.MutableMetaDataTest; import org.jboss.test.metadata.shared.support.MetaDataAndMutableMetaData; import org.jboss.test.metadata.shared.support.MutableMetaDataLoaderToMetaDataBridge; /** * MemoryLoaderMutableMetaDataUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class MemoryLoaderMutableMetaDataUnitTestCase extends MutableMetaDataTest { public MemoryLoaderMutableMetaDataUnitTestCase(String name) { super(name); } protected MetaDataAndMutableMetaData setupEmpty() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); return new MutableMetaDataLoaderToMetaDataBridge(loader); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/MemoryMetaDataLoaderTestSuite.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/Memory0000644000175000017500000000444410740726447033311 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.memory.test; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * MemoryMetaDataLoader Test Suite. * * @author Adrian Brock * @version $Revision: 68681 $ */ public class MemoryMetaDataLoaderTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Memory MetaDataLoader Tests"); suite.addTest(new TestSuite(MemoryLoaderBasicAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(MemoryLoaderComponentBasicAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(MemoryLoaderMutableAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(MemoryLoaderMutableAnnotationsInvalidationUnitTestCase.class)); suite.addTest(new TestSuite(MemoryLoaderBasicMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(MemoryLoaderMutableMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(MemoryLoaderMutableMetaDataInvalidationUnitTestCase.class)); suite.addTest(new TestSuite(MemoryLoaderRestrictedUnitTestCase.class)); suite.addTest(new TestSuite(MemoryLoaderComponentMutableUnitTestCase.class)); return suite; } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/MemoryLoaderBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/Memory0000644000175000017500000000640310454442653033302 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.memory.test; import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.shared.BasicMetaDataTest; import org.jboss.test.metadata.shared.support.TestMetaData; import org.jboss.test.metadata.shared.support.TestMetaData1; import org.jboss.test.metadata.shared.support.TestMetaData1Impl; import org.jboss.test.metadata.shared.support.TestMetaData2; import org.jboss.test.metadata.shared.support.TestMetaData2Impl; import org.jboss.test.metadata.shared.support.TestMetaDataImpl; /** * MemoryLoaderBasicMetaDataUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class MemoryLoaderBasicMetaDataUnitTestCase extends BasicMetaDataTest { public MemoryLoaderBasicMetaDataUnitTestCase(String name) { super(name, true); } protected MetaData setupEmpty() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestMetaData() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); loader.addMetaData(new TestMetaDataImpl(), TestMetaData.class); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestMetaData12() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); loader.addMetaData(new TestMetaData1Impl(), TestMetaData1.class); loader.addMetaData(new TestMetaData2Impl(), TestMetaData2.class); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestMetaDataByName() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); loader.addMetaData("Test", new TestMetaDataImpl(), TestMetaData.class); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestMetaData12ByName() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); loader.addMetaData("Test1", new TestMetaData1Impl(), TestMetaData1.class); loader.addMetaData("Test2", new TestMetaData2Impl(), TestMetaData2.class); return new MetaDataRetrievalToMetaDataBridge(loader); } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/MemoryLoaderBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/Memory0000644000175000017500000000472410454442653033306 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.memory.test; import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.shared.BasicAnnotationsTest; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * MemoryLoaderBasicAnnotationsUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class MemoryLoaderBasicAnnotationsUnitTestCase extends BasicAnnotationsTest { public MemoryLoaderBasicAnnotationsUnitTestCase(String name) { super(name, true); } protected MetaData setupEmpty() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestAnnotation() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); loader.addAnnotation(new TestAnnotationImpl()); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestAnnotation12() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); loader.addAnnotation(new TestAnnotation1Impl()); loader.addAnnotation(new TestAnnotation2Impl()); return new MetaDataRetrievalToMetaDataBridge(loader); } } ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/MemoryLoaderMutableAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/memory/test/Memory0000644000175000017500000000350610454442653033303 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.memory.test; import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader; import org.jboss.test.metadata.loader.MutableAnnotationsTest; import org.jboss.test.metadata.shared.support.MetaDataAndMutableMetaData; import org.jboss.test.metadata.shared.support.MutableMetaDataLoaderToMetaDataBridge; /** * MemoryLoaderMutableAnnotationsUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class MemoryLoaderMutableAnnotationsUnitTestCase extends MutableAnnotationsTest { public MemoryLoaderMutableAnnotationsUnitTestCase(String name) { super(name); } protected MetaDataAndMutableMetaData setupEmpty() { MemoryMetaDataLoader loader = new MemoryMetaDataLoader(); return new MutableMetaDataLoaderToMetaDataBridge(loader); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/MutableRestrictedTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/MutableRestrictedT0000644000175000017500000000675310446527733033325 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.shared.support.RestrictedAnnotation; import org.jboss.test.metadata.shared.support.RestrictedAnnotationImpl; import org.jboss.test.metadata.shared.support.RestrictedImpl; import org.jboss.test.metadata.shared.support.RestrictedInterface; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * MutableRestrictedTest. * * @author Adrian Brock * @version $Revision: 45742 $ */ public abstract class MutableRestrictedTest extends AbstractMetaDataTest { public MutableRestrictedTest(String name) { super(name); } protected abstract MutableMetaDataLoader setUpRestricted(); public void testRestrictedAnnotation() throws Exception { MutableMetaDataLoader loader = setUpRestricted(); TestAnnotation testAnnotation = new TestAnnotationImpl(); loader.addAnnotation(testAnnotation); assertNotNull(loader.retrieveAnnotation(TestAnnotation.class)); RestrictedAnnotation restrictedAnnotation = new RestrictedAnnotationImpl(); try { loader.addAnnotation(restrictedAnnotation); } catch (Throwable t) { checkThrowable(SecurityException.class, t); } } public void testRestrictedMetaData() throws Exception { MutableMetaDataLoader loader = setUpRestricted(); Object object = new Object(); loader.addMetaData(object, Object.class); assertNotNull(loader.retrieveMetaData(Object.class)); RestrictedInterface restrictedMetaData = new RestrictedImpl(); try { loader.addMetaData(restrictedMetaData, RestrictedInterface.class); } catch (Throwable t) { checkThrowable(SecurityException.class, t); } } public void testRestrictedMetaDataByName() throws Exception { MutableMetaDataLoader loader = setUpRestricted(); Object object = new Object(); loader.addMetaData("Object", object, Object.class); assertNotNull(loader.retrieveMetaData("Object")); RestrictedInterface restrictedMetaData = new RestrictedImpl(); try { loader.addMetaData("Restricted", restrictedMetaData, RestrictedInterface.class); } catch (Throwable t) { checkThrowable(SecurityException.class, t); } } } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/MutableMetaDataLoaderAnnotationsInvalidationTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/MutableMetaDataLoa0000644000175000017500000002030510454442653033166 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.shared.support.ExpectedAnnotations; import org.jboss.test.metadata.shared.support.NotPresentAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * MutableAnnotationsTest. * * @author Adrian Brock * @version $Revision: 46146 $ */ public abstract class MutableMetaDataLoaderAnnotationsInvalidationTest extends AbstractMetaDataTest { public MutableMetaDataLoaderAnnotationsInvalidationTest(String name) { super(name); } public void testEmpty() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); assertValidTimeUnchanged(metaData, last); } public void testTestAnnotation() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertNoAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); last = assertAddAnnotationNoPrevious(metaData, new TestAnnotationImpl(), expectedAnnotations, last); assertAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); assertRemoveAnnotation(metaData, TestAnnotation.class, expectedAnnotations, last); assertNoAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); } public void testTestAnnotation12() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertNoAnnotation(metaData, TestAnnotation1.class); assertNoAnnotation(metaData, TestAnnotation2.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); last = assertAddAnnotationNoPrevious(metaData, new TestAnnotation1Impl(), expectedAnnotations, last); assertAnnotation(metaData, TestAnnotation1.class); assertNoAnnotation(metaData, TestAnnotation2.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); last = assertAddAnnotationNoPrevious(metaData, new TestAnnotation2Impl(), expectedAnnotations, last); assertAnnotation(metaData, TestAnnotation1.class); assertAnnotation(metaData, TestAnnotation2.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); assertRemoveAnnotation(metaData, TestAnnotation1.class, expectedAnnotations, last); assertNoAnnotation(metaData, TestAnnotation1.class); assertAnnotation(metaData, TestAnnotation2.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); assertRemoveAnnotation(metaData, TestAnnotation2.class, expectedAnnotations, last); assertNoAnnotation(metaData, TestAnnotation1.class); assertNoAnnotation(metaData, TestAnnotation2.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); } public void testAddTwice() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertNoAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); last = assertAddAnnotationNoPrevious(metaData, new TestAnnotationImpl(), expectedAnnotations, last); assertAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); last = assertAddAnnotationWithPrevious(metaData, new TestAnnotationImpl(), last); assertAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); } public void testAddTwiceSameObject() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertNoAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); TestAnnotation annotation = new TestAnnotationImpl(); last = assertAddAnnotationNoPrevious(metaData, annotation, expectedAnnotations, last); assertAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); assertAddAnnotationWithPreviousSameObject(metaData, annotation, last); assertAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); } public void testRemoveDoesNotExist() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertNotRemovedAnnotation(metaData, TestAnnotation.class, last); assertAllAnnotations(metaData, expectedAnnotations); } public void testRemoveTwice() throws Exception { MutableMetaDataLoader metaData = setupEmpty(); long last = metaData.getValidTime().getValidTime(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); last = assertAddAnnotationNoPrevious(metaData, new TestAnnotationImpl(), expectedAnnotations, last); assertRemoveAnnotation(metaData, TestAnnotation.class, expectedAnnotations, last); assertNotRemovedAnnotation(metaData, TestAnnotation.class, last); assertAllAnnotations(metaData, expectedAnnotations); } protected abstract MutableMetaDataLoader setupEmpty(); } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/0000755000175000017500000000000011620305576032075 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/0000755000175000017500000000000011620305576033054 5ustar twernertwerner././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/ThreadLocalLoaderBasicMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/T0000644000175000017500000000621610454442653033211 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.threadlocal.test; import org.jboss.metadata.plugins.loader.thread.ThreadLocalMetaDataLoader; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.shared.BasicMetaDataTest; import org.jboss.test.metadata.shared.support.TestMetaData; import org.jboss.test.metadata.shared.support.TestMetaData1; import org.jboss.test.metadata.shared.support.TestMetaData1Impl; import org.jboss.test.metadata.shared.support.TestMetaData2; import org.jboss.test.metadata.shared.support.TestMetaData2Impl; import org.jboss.test.metadata.shared.support.TestMetaDataImpl; /** * ThreadLocalLoaderBasicMetaDataUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class ThreadLocalLoaderBasicMetaDataUnitTestCase extends BasicMetaDataTest { ThreadLocalMetaDataLoader loader = ThreadLocalMetaDataLoader.INSTANCE; public ThreadLocalLoaderBasicMetaDataUnitTestCase(String name) { super(name, true); } protected void tearDown() throws Exception { loader.clear(); super.tearDown(); } protected MetaData setupEmpty() { return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestMetaData() { loader.addMetaData(new TestMetaDataImpl(), TestMetaData.class); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestMetaData12() { loader.addMetaData(new TestMetaData1Impl(), TestMetaData1.class); loader.addMetaData(new TestMetaData2Impl(), TestMetaData2.class); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestMetaDataByName() { loader.addMetaData("Test", new TestMetaDataImpl(), TestMetaData.class); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestMetaData12ByName() { loader.addMetaData("Test1", new TestMetaData1Impl(), TestMetaData1.class); loader.addMetaData("Test2", new TestMetaData2Impl(), TestMetaData2.class); return new MetaDataRetrievalToMetaDataBridge(loader); } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/ThreadLocalLoaderScopeUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/T0000644000175000017500000000612010454442653033203 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.threadlocal.test; import java.util.Collection; import java.util.concurrent.CountDownLatch; import org.jboss.metadata.plugins.loader.thread.ThreadLocalMetaDataLoader; import org.jboss.metadata.spi.scope.CommonLevels; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.test.metadata.AbstractMetaDataTest; /** * AnnotatedElementLoaderScopeUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class ThreadLocalLoaderScopeUnitTestCase extends AbstractMetaDataTest { ThreadLocalMetaDataLoader loader = ThreadLocalMetaDataLoader.INSTANCE; CountDownLatch entryLatch; public ThreadLocalLoaderScopeUnitTestCase(String name) { super(name); } public void testThreadScope() throws Exception { TestScopeRunnable[] runnables = new TestScopeRunnable[5]; Thread[] threads = new Thread[runnables.length]; entryLatch = new CountDownLatch(runnables.length); for (int i = 0; i < 5; ++i) { runnables[i] = new TestScopeRunnable(); threads[i] = new Thread(runnables[i], "Thread" + i); threads[i].start(); } for (int i = 0; i< 5; ++i) { threads[i].join(); assertNull(runnables[i].error); } } public class TestScopeRunnable implements Runnable { Throwable error; public void run() { try { entryLatch.countDown(); entryLatch.await(); ScopeKey scopeKey = loader.getScope(); assertNotNull(scopeKey); Collection scopes = scopeKey.getScopes(); assertEquals(1, scopes.size()); Scope scope = scopes.iterator().next(); assertEquals(CommonLevels.THREAD, scope.getScopeLevel()); assertEquals(Thread.currentThread().getName(), scope.getQualifier()); } catch (Throwable t) { log.error("Error", t); error = t; } } } } ././@LongLink0000000000000000000000000000024400000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/ThreadLocalLoaderMutableAnnotationsInvalidationUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/T0000644000175000017500000000362610446527733033217 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.threadlocal.test; import org.jboss.metadata.plugins.loader.thread.ThreadLocalMetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.test.metadata.loader.MutableMetaDataLoaderAnnotationsInvalidationTest; /** * ThreadLocalLoaderMutableAnnotationsInvalidationUnitTestCase. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class ThreadLocalLoaderMutableAnnotationsInvalidationUnitTestCase extends MutableMetaDataLoaderAnnotationsInvalidationTest { ThreadLocalMetaDataLoader loader = ThreadLocalMetaDataLoader.INSTANCE; public ThreadLocalLoaderMutableAnnotationsInvalidationUnitTestCase(String name) { super(name); } protected void tearDown() throws Exception { loader.clear(); super.tearDown(); } protected MutableMetaDataLoader setupEmpty() { return loader; } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/ThreadLocalLoaderUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/T0000644000175000017500000000550710446527733033217 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.threadlocal.test; import java.util.concurrent.CountDownLatch; import org.jboss.metadata.plugins.loader.thread.ThreadLocalMetaDataLoader; import org.jboss.test.metadata.AbstractMetaDataTest; /** * ThreadLocalLoaderUnitTestCase. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class ThreadLocalLoaderUnitTestCase extends AbstractMetaDataTest { ThreadLocalMetaDataLoader loader = ThreadLocalMetaDataLoader.INSTANCE; CountDownLatch entryLatch; CountDownLatch initLatch; public ThreadLocalLoaderUnitTestCase(String name) { super(name); } public void testMetaDataConcurrent() throws Exception { TestMetaDataRunnable[] runnables = new TestMetaDataRunnable[5]; Thread[] threads = new Thread[runnables.length]; entryLatch = new CountDownLatch(runnables.length); initLatch = new CountDownLatch(runnables.length); for (int i = 0; i < 5; ++i) { runnables[i] = new TestMetaDataRunnable(); threads[i] = new Thread(runnables[i], "Thread" + i); threads[i].start(); } for (int i = 0; i< 5; ++i) { threads[i].join(); assertNull(runnables[i].error); } } public class TestMetaDataRunnable implements Runnable { Throwable error; public void run() { try { entryLatch.countDown(); entryLatch.await(); loader.addMetaData(Thread.currentThread(), Thread.class); initLatch.countDown(); initLatch.await(); assertEquals(Thread.currentThread(), loader.removeMetaData(Thread.class)); } catch (Throwable t) { log.error("Error", t); error = t; } } } } ././@LongLink0000000000000000000000000000024100000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/ThreadLocalLoaderMutableMetaDataInvalidationUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/T0000644000175000017500000000360710446527733033216 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.threadlocal.test; import org.jboss.metadata.plugins.loader.thread.ThreadLocalMetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.test.metadata.loader.MutableMetaDataLoaderMetaDataInvalidationTest; /** * ThreadLocalLoaderMutableMetaDataInvalidationUnitTestCase. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class ThreadLocalLoaderMutableMetaDataInvalidationUnitTestCase extends MutableMetaDataLoaderMetaDataInvalidationTest { ThreadLocalMetaDataLoader loader = ThreadLocalMetaDataLoader.INSTANCE; public ThreadLocalLoaderMutableMetaDataInvalidationUnitTestCase(String name) { super(name); } protected void tearDown() throws Exception { loader.clear(); super.tearDown(); } protected MutableMetaDataLoader setupEmpty() { return loader; } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/ThreadLocalMetaDataLoaderTestSuite.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/T0000644000175000017500000000450510454442653033210 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.threadlocal.test; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * ThreadLocalMetaDataLoaderTestSuite. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class ThreadLocalMetaDataLoaderTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("ThreadLocal MetaDataLoader Tests"); suite.addTest(new TestSuite(ThreadLocalLoaderBasicAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(ThreadLocalLoaderMutableAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(ThreadLocalLoaderMutableAnnotationsInvalidationUnitTestCase.class)); suite.addTest(new TestSuite(ThreadLocalLoaderBasicMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(ThreadLocalLoaderMutableMetaDataUnitTestCase.class)); suite.addTest(new TestSuite(ThreadLocalLoaderMutableMetaDataInvalidationUnitTestCase.class)); suite.addTest(new TestSuite(ThreadLocalLoaderUnitTestCase.class)); suite.addTest(new TestSuite(ThreadLocalLoaderRestrictedUnitTestCase.class)); suite.addTest(new TestSuite(ThreadLocalLoaderScopeUnitTestCase.class)); return suite; } } ././@LongLink0000000000000000000000000000023000000000000011560 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/ThreadLocalLoaderMutableAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/T0000644000175000017500000000372110454442653033207 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.threadlocal.test; import org.jboss.metadata.plugins.loader.thread.ThreadLocalMetaDataLoader; import org.jboss.test.metadata.loader.MutableAnnotationsTest; import org.jboss.test.metadata.shared.support.MetaDataAndMutableMetaData; import org.jboss.test.metadata.shared.support.MutableMetaDataLoaderToMetaDataBridge; /** * ThreadLocalLoaderMutableAnnotationsUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class ThreadLocalLoaderMutableAnnotationsUnitTestCase extends MutableAnnotationsTest { ThreadLocalMetaDataLoader loader = ThreadLocalMetaDataLoader.INSTANCE; public ThreadLocalLoaderMutableAnnotationsUnitTestCase(String name) { super(name); } protected void tearDown() throws Exception { loader.clear(); super.tearDown(); } protected MetaDataAndMutableMetaData setupEmpty() { return new MutableMetaDataLoaderToMetaDataBridge(loader); } } ././@LongLink0000000000000000000000000000022000000000000011557 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/ThreadLocalLoaderRestrictedUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/T0000644000175000017500000000345410446527733033216 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.threadlocal.test; import org.jboss.metadata.plugins.loader.thread.ThreadLocalMetaDataLoader; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.test.metadata.loader.MutableRestrictedTest; /** * ThreadLocalLoaderRestrictedUnitTestCase. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class ThreadLocalLoaderRestrictedUnitTestCase extends MutableRestrictedTest { ThreadLocalMetaDataLoader loader = ThreadLocalMetaDataLoader.INSTANCE; public ThreadLocalLoaderRestrictedUnitTestCase(String name) { super(name); } protected void tearDown() throws Exception { loader.clear(); super.tearDown(); } protected MutableMetaDataLoader setUpRestricted() { return loader; } } ././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/ThreadLocalLoaderMutableMetaDataUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/T0000644000175000017500000000370210454442653033206 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.threadlocal.test; import org.jboss.metadata.plugins.loader.thread.ThreadLocalMetaDataLoader; import org.jboss.test.metadata.loader.MutableMetaDataTest; import org.jboss.test.metadata.shared.support.MetaDataAndMutableMetaData; import org.jboss.test.metadata.shared.support.MutableMetaDataLoaderToMetaDataBridge; /** * ThreadLocalLoaderMutableMetaDataUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class ThreadLocalLoaderMutableMetaDataUnitTestCase extends MutableMetaDataTest { ThreadLocalMetaDataLoader loader = ThreadLocalMetaDataLoader.INSTANCE; public ThreadLocalLoaderMutableMetaDataUnitTestCase(String name) { super(name); } protected void tearDown() throws Exception { loader.clear(); super.tearDown(); } protected MetaDataAndMutableMetaData setupEmpty() { return new MutableMetaDataLoaderToMetaDataBridge(loader); } } ././@LongLink0000000000000000000000000000022600000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/ThreadLocalLoaderBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/threadlocal/test/T0000644000175000017500000000474210454442653033213 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.threadlocal.test; import org.jboss.metadata.plugins.loader.thread.ThreadLocalMetaDataLoader; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.shared.BasicAnnotationsTest; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * ThreadLocalLoaderBasicAnnotationsUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class ThreadLocalLoaderBasicAnnotationsUnitTestCase extends BasicAnnotationsTest { ThreadLocalMetaDataLoader loader = ThreadLocalMetaDataLoader.INSTANCE; public ThreadLocalLoaderBasicAnnotationsUnitTestCase(String name) { super(name, true); } protected void tearDown() throws Exception { loader.clear(); super.tearDown(); } protected MetaData setupEmpty() { return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestAnnotation() { loader.addAnnotation(new TestAnnotationImpl()); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestAnnotation12() { loader.addAnnotation(new TestAnnotation1Impl()); loader.addAnnotation(new TestAnnotation2Impl()); return new MetaDataRetrievalToMetaDataBridge(loader); } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/custom/0000755000175000017500000000000011620305577031126 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/custom/test/0000755000175000017500000000000011620305577032105 5ustar twernertwerner././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/custom/test/CustomBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/custom/test/Custom0000644000175000017500000000464510772470244033314 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.custom.test; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.loader.custom.support.TestAnnotationMetaDataLoader; import org.jboss.test.metadata.shared.BasicAnnotationsTest; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * CustomBasicAnnotationsUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class CustomBasicAnnotationsUnitTestCase extends BasicAnnotationsTest { public CustomBasicAnnotationsUnitTestCase(String name) { super(name, true); } protected MetaData setupEmpty() { TestAnnotationMetaDataLoader loader = new TestAnnotationMetaDataLoader(); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestAnnotation() { TestAnnotationMetaDataLoader loader = new TestAnnotationMetaDataLoader(new TestAnnotationImpl()); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestAnnotation12() { TestAnnotationMetaDataLoader loader = new TestAnnotationMetaDataLoader(new TestAnnotation1Impl(), new TestAnnotation2Impl()); return new MetaDataRetrievalToMetaDataBridge(loader); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/custom/test/CustomMetaDataLoaderTestSuite.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/custom/test/Custom0000644000175000017500000000314410772470244033305 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.custom.test; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * MemoryMetaDataLoader Test Suite. * * @author Adrian Brock * @version $Revision: 68681 $ */ public class CustomMetaDataLoaderTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Custom MetaDataLoader Tests"); suite.addTest(new TestSuite(CustomBasicAnnotationsUnitTestCase.class)); return suite; } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/custom/support/0000755000175000017500000000000011620305577032642 5ustar twernertwerner././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/custom/support/TestAnnotationMetaDataLoader.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/custom/support/Tes0000644000175000017500000000561410772470244033327 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.custom.support; import java.lang.annotation.Annotation; import java.util.Arrays; import java.util.List; import org.jboss.metadata.plugins.loader.AbstractMetaDataLoader; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationItem; import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationsItem; import org.jboss.metadata.spi.signature.Signature; /** * TestAnnotationMetaDataLoader. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestAnnotationMetaDataLoader extends AbstractMetaDataLoader { private List annotations; public TestAnnotationMetaDataLoader(Annotation... annotations) { this.annotations = Arrays.asList(annotations); } public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature) { return null; } public boolean isEmpty() { return annotations.isEmpty(); } public AnnotationItem retrieveAnnotation(Class annotationType) { for (Annotation annotation : annotations) { if (annotation.annotationType().equals(annotationType)) return new SimpleAnnotationItem(annotationType.cast(annotation)); } return null; } @SuppressWarnings("unchecked") public AnnotationsItem retrieveAnnotations() { if (annotations.isEmpty()) return SimpleAnnotationsItem.NO_ANNOTATIONS; Annotation[] annotations = this.annotations.toArray(new Annotation[0]); AnnotationItem[] items = new AnnotationItem[annotations.length]; for (int i = 0; i < items.length; ++i) items[i] = new SimpleAnnotationItem(annotations[i]); return new SimpleAnnotationsItem(items); } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/0000755000175000017500000000000011620305600031731 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/0000755000175000017500000000000011620305600032710 5ustar twernertwerner././@LongLink0000000000000000000000000000024100000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/AnnotatedElementLoaderDeclaredMethodSignatureUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/An0000644000175000017500000000673511050621021033177 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.test; import java.lang.reflect.Method; import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.metadata.spi.signature.DeclaredMethodSignature; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.loader.reflection.support.TestAnnotationWithValue; import org.jboss.test.metadata.loader.reflection.support.TestSub; import org.jboss.test.metadata.loader.reflection.support.TestSuper; /** * AnnotatedElementLoaderNotPublicUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class AnnotatedElementLoaderDeclaredMethodSignatureUnitTestCase extends AbstractMetaDataTest { public AnnotatedElementLoaderDeclaredMethodSignatureUnitTestCase(String name) { super(name); } public void testSubClassMethodConstructor() throws Exception { MetaData metaData = createMetaData(); Method method = TestSub.class.getDeclaredMethod("doSomething"); doTest(metaData.getComponentMetaData(new DeclaredMethodSignature(method)), "sub"); } public void testSubClassStringConstructor() throws Exception { MetaData metaData = createMetaData(); doTest(metaData.getComponentMetaData(new DeclaredMethodSignature(TestSub.class.getName(), "doSomething")), "sub"); } public void testSuperClassMethodConstructor() throws Exception { MetaData metaData = createMetaData(); Method method = TestSuper.class.getDeclaredMethod("doSomething"); doTest(metaData.getComponentMetaData(new DeclaredMethodSignature(method)), "super"); } public void testSuperClassStringConstructor() throws Exception { MetaData metaData = createMetaData(); doTest(metaData.getComponentMetaData(new DeclaredMethodSignature(TestSuper.class.getName(), "doSomething")), "super"); } protected void doTest(MetaData metaData, String expected) throws Exception { assertNotNull(metaData); TestAnnotationWithValue annotation = metaData.getAnnotation(TestAnnotationWithValue.class); assertNotNull(annotation); assertEquals(expected, annotation.value()); } protected MetaData createMetaData() { AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader(TestSub.class); return new MetaDataRetrievalToMetaDataBridge(loader); } } ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/AnnotatedElementLoaderScopeUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/An0000644000175000017500000000704310770504126033206 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.test; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.util.Collection; import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader; import org.jboss.metadata.spi.scope.CommonLevels; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.loader.reflection.support.TestAnnotationScopeBean; /** * AnnotatedElementLoaderScopeUnitTestCase. * * @author Adrian Brock * @version $Revision: 71079 $ */ public class AnnotatedElementLoaderScopeUnitTestCase extends AbstractMetaDataTest { public AnnotatedElementLoaderScopeUnitTestCase(String name) { super(name); } public void testClassScope() throws Exception { AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader(TestAnnotationScopeBean.class); ScopeKey scopeKey = loader.getScope(); assertNotNull(scopeKey); Collection scopes = scopeKey.getScopes(); assertEquals(1, scopes.size()); Scope scope = scopes.iterator().next(); assertEquals(CommonLevels.CLASS, scope.getScopeLevel()); assertEquals(TestAnnotationScopeBean.class, scope.getQualifier()); } public void testFieldScope() throws Exception { Field field = TestAnnotationScopeBean.class.getField("something"); testMember(field); } public void testConstructorScope() throws Exception { Constructor constructor = TestAnnotationScopeBean.class.getConstructor((Class[]) null); testMember(constructor); } public void testMethodScope() throws Exception { Method method = TestAnnotationScopeBean.class.getMethod("doSomething", (Class[]) null); testMember(method); } protected void testMember(Member member) throws Exception { assertNotNull(member); AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader((AnnotatedElement) member); ScopeKey scopeKey = loader.getScope(); assertNotNull(scopeKey); Collection scopes = scopeKey.getScopes(); assertEquals(1, scopes.size()); Scope scope = scopes.iterator().next(); assertEquals(CommonLevels.JOINPOINT, scope.getScopeLevel()); assertEquals(member, scope.getQualifier()); } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/ReflectionMetaDataLoaderTestSuite.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/Re0000644000175000017500000000377111050621021033204 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.test; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * ReflectionMetaDataLoader Test Suite. * * @author Adrian Brock * @version $Revision: 77023 $ */ public class ReflectionMetaDataLoaderTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Reflection MetaDataLoader Tests"); suite.addTest(new TestSuite(AnnotatedElementLoaderBasicAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(AnnotatedElementLoaderComponentBasicAnnotationsUnitTestCase.class)); suite.addTest(new TestSuite(AnnotatedElementLoaderScopeUnitTestCase.class)); suite.addTest(new TestSuite(AnnotatedElementLoaderNotPublicUnitTestCase.class)); suite.addTest(new TestSuite(AnnotatedElementLoaderDeclaredMethodSignatureUnitTestCase.class)); return suite; } } ././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/AnnotatedElementLoaderNotPublicUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/An0000644000175000017500000001066711050266501033206 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.test; import java.lang.reflect.Method; import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.metadata.spi.signature.ConstructorSignature; import org.jboss.metadata.spi.signature.FieldSignature; import org.jboss.metadata.spi.signature.MethodSignature; import org.jboss.metadata.spi.signature.Signature; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.loader.reflection.support.NotPublic; import org.jboss.test.metadata.loader.reflection.support.SuperClassOfNotPublic; import org.jboss.test.metadata.shared.support.ExpectedAnnotations; import org.jboss.test.metadata.shared.support.NotPresentAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation; /** * AnnotatedElementLoaderNotPublicUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class AnnotatedElementLoaderNotPublicUnitTestCase extends AbstractMetaDataTest { public AnnotatedElementLoaderNotPublicUnitTestCase(String name) { super(name); } public void testNotPublicConstructor() throws Exception { MetaData metaData = createMetaData(); testTestAnnotation(metaData.getComponentMetaData(new ConstructorSignature())); } public void testNotPublicMethod() throws Exception { MetaData metaData = createMetaData(); testTestAnnotation(metaData.getComponentMetaData(new MethodSignature("notPublic"))); } public void testNotPublicField() throws Exception { MetaData metaData = createMetaData(); testTestAnnotation(metaData.getComponentMetaData(new FieldSignature("notPublic"))); } public void testNotPublicMethodSuperClass() throws Exception { MetaData metaData = createMetaData(); testTestAnnotation(metaData.getComponentMetaData(new MethodSignature("notPublicSuperClass"))); } public void testNotPublicFieldSuperClass() throws Exception { MetaData metaData = createMetaData(); testTestAnnotation(metaData.getComponentMetaData(new FieldSignature("notPublicSuperClass"))); } public void testSameName() throws Exception { MetaData metaData = createMetaData(); Method superMethod = SuperClassOfNotPublic.class.getDeclaredMethod("sameName"); MetaData superMethodMetaData = metaData.getComponentMetaData(Signature.getSignature(superMethod)); assertAnnotation(superMethodMetaData, TestAnnotation.class); Method method = NotPublic.class.getDeclaredMethod("sameName"); MetaData methodMetaData = metaData.getComponentMetaData(Signature.getSignature(method)); assertNoAnnotation(methodMetaData, TestAnnotation.class); } protected void testTestAnnotation(MetaData metaData) throws Exception { assertNotNull(metaData); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); expectedAnnotations.add(TestAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations, false); } protected MetaData createMetaData() { AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader(NotPublic.class); return new MetaDataRetrievalToMetaDataBridge(loader); } } ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/AnnotatedElementMetadataLoaderTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/An0000644000175000017500000003226211524770005033206 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2009, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.test; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.Map; import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.metadata.spi.signature.DeclaredMethodSignature; import org.jboss.metadata.spi.signature.MethodSignature; import org.jboss.metadata.spi.signature.Signature; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.loader.reflection.support.BridgeMethodBean; import org.jboss.test.metadata.loader.reflection.support.BridgeMethodChildBean; import org.jboss.test.metadata.loader.reflection.support.Child; import org.jboss.test.metadata.loader.reflection.support.Event; import org.jboss.test.metadata.loader.reflection.support.MethodBean; import org.jboss.test.metadata.loader.reflection.support.NoAnnotationBean; /** * AnnotatedElementMetadataLoaderTestCase * * Tests that the {@link AnnotatedElementMetaDataLoader} correctly identifies * the presence of annotations on beans * * @author Jaikiran Pai * @version $Revision: $ */ public class AnnotatedElementMetadataLoaderTestCase extends AbstractMetaDataTest { /** * Constructor. * * @param name the test name */ public AnnotatedElementMetadataLoaderTestCase(String name) { super(name); } /** * Test that a class having no annotations is successfully processed by the * {@link AnnotatedElementMetaDataLoader}. The {@link AnnotatedElementMetaDataLoader} is * expected to find *no* annotations on that class * * @throws Exception for any error */ public void testNoAnnotationPresent() throws Exception { // The NoAnnotationBean does not have any annotations AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(NoAnnotationBean.class); MetaData metadata = new MetaDataRetrievalToMetaDataBridge(annotatedElementLoader); // should be empty array since the bean has no annotations Annotation[] annotations = metadata.getAnnotations(); assertEmpty(annotations); } /** * Tests that the {@link AnnotatedElementMetaDataLoader} correctly identifies * the presence of annotations on methods when a {@link DeclaredMethodSignature} * is used to create the {@link AnnotatedElementMetaDataLoader} * * @throws Exception for any error */ public void testMethodLevelAnnotationsWithDeclaredMethodSignature() throws Exception { AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(MethodBean.class); // Create a DeclaredMethodSignature for the method with 1 annotation Method methodWithOneAnnotation = MethodBean.class.getMethod("testAnnotation", new Class[] {String.class}); DeclaredMethodSignature declaredMethodSignature = new DeclaredMethodSignature(methodWithOneAnnotation); // create a retrieval out of it MetaDataRetrieval retrieval = annotatedElementLoader.getComponentMetaDataRetrieval(declaredMethodSignature); MetaData metadata = new MetaDataRetrievalToMetaDataBridge(retrieval); // should be empty array since the bean has no annotations Annotation[] annotations = metadata.getAnnotations(); assertTrue("Expected one annotation on " + methodWithOneAnnotation, annotations.length == 1); // Now try the same on a method which has 2 annotations Method methodWithTwoAnnotations = MethodBean.class.getMethod("testAnnotation12", new Class[] {String.class, Class.class}); DeclaredMethodSignature anotherDeclaredMethodSignature = new DeclaredMethodSignature(methodWithTwoAnnotations); // create a retrieval out of it MetaDataRetrieval anotherRetrieval = annotatedElementLoader.getComponentMetaDataRetrieval(anotherDeclaredMethodSignature); MetaData anotherMetadata = new MetaDataRetrievalToMetaDataBridge(anotherRetrieval); // should be empty array since the bean has no annotations Annotation[] annotationsOnMethodWithTwoAnnotations = anotherMetadata.getAnnotations(); assertTrue("Expected two annotations on " + anotherDeclaredMethodSignature, annotationsOnMethodWithTwoAnnotations.length == 2); } /** * Tests that the {@link AnnotatedElementMetaDataLoader} correctly identifies * the presence of annotations on methods when a {@link MethodSignature} * is used to create the {@link AnnotatedElementMetaDataLoader} * * @throws Exception for any error */ public void testMethodLevelAnnotationsWithMethodSignature() throws Exception { AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(MethodBean.class); // Create a MethodSignature for the method with 1 annotation MethodSignature methodSignature = new MethodSignature("testAnnotation", String.class); // create a retrieval out of it MetaDataRetrieval retrieval = annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature); MetaData metadata = new MetaDataRetrievalToMetaDataBridge(retrieval); // should be empty array since the bean has no annotations Annotation[] annotations = metadata.getAnnotations(); assertTrue("Expected one annotation on testAnnotation method of " + MethodBean.class, annotations.length == 1); // Now try the same on a method which has 2 annotations MethodSignature anotherMethodSignature = new MethodSignature("testAnnotation12", String.class, Class.class); // create a retrieval out of it MetaDataRetrieval anotherRetrieval = annotatedElementLoader.getComponentMetaDataRetrieval(anotherMethodSignature); MetaData anotherMetadata = new MetaDataRetrievalToMetaDataBridge(anotherRetrieval); // should be empty array since the bean has no annotations Annotation[] annotationsOnMethodWithTwoAnnotations = anotherMetadata.getAnnotations(); assertTrue("Expected two annotations on testAnnotation12 method of " + MethodBean.class, annotationsOnMethodWithTwoAnnotations.length == 2); } /** * Tests that the {@link AnnotatedElementMetaDataLoader} correctly identifies * bridge methods. */ public void testMethodLevelAnnotationOnBridgeMethod() throws Exception { AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(BridgeMethodBean.class); Method method = BridgeMethodBean.class.getMethod("unambiguous", Object.class); assertTrue(method.isBridge()); MethodSignature methodSignature = new MethodSignature(method); MetaDataRetrieval retrieval = annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature); assertNotNull("Expected a MetaDataRetrieval for method " + method, retrieval); MetaData metadata = new MetaDataRetrievalToMetaDataBridge(retrieval); Annotation[] annotations = metadata.getAnnotations(); assertTrue("Expected one annotation on unambiguous method of " + BridgeMethodBean.class, annotations.length == 1); method = BridgeMethodBean.class.getMethod("ambiguous", Object.class); assertTrue(method.isBridge()); methodSignature = new MethodSignature(method); assertNull(annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature)); } /** * Tests that the {@link AnnotatedElementMetaDataLoader} correctly identifies * bridge methods. */ public void testMethodLevelAnnotationOnDeclaredBridgeMethod() throws Exception { AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(BridgeMethodBean.class); Method method = BridgeMethodBean.class.getMethod("unambiguous", Object.class); assertTrue(method.isBridge()); Signature methodSignature = new DeclaredMethodSignature(method); MetaDataRetrieval retrieval = annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature); assertNotNull("Expected a MetaDataRetrieval for method " + method, retrieval); MetaData metadata = new MetaDataRetrievalToMetaDataBridge(retrieval); Annotation[] annotations = metadata.getAnnotations(); assertTrue("Expected one annotation on unambiguous method of " + BridgeMethodBean.class, annotations.length == 1); method = BridgeMethodBean.class.getMethod("ambiguous", Object.class); assertTrue(method.isBridge()); methodSignature = new DeclaredMethodSignature(method); assertNull(annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature)); } /** * Tests that the {@link AnnotatedElementMetaDataLoader} correctly identifies * bridge methods. */ public void testMethodLevelAnnotationOnBridgeMethodFromParent() throws Exception { AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(BridgeMethodChildBean.class); Method method = BridgeMethodChildBean.class.getMethod("unambiguous", Object.class); assertTrue(method.isBridge()); MethodSignature methodSignature = new MethodSignature(method); MetaDataRetrieval retrieval = annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature); assertNotNull("Expected a MetaDataRetrieval for method " + method, retrieval); MetaData metadata = new MetaDataRetrievalToMetaDataBridge(retrieval); Annotation[] annotations = metadata.getAnnotations(); assertTrue("Expected one annotation on unambiguous method of " + BridgeMethodChildBean.class, annotations.length == 1); method = BridgeMethodChildBean.class.getMethod("ambiguous", Object.class); assertTrue(method.isBridge()); methodSignature = new MethodSignature(method); assertNull(annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature)); } /** * Tests that the {@link AnnotatedElementMetaDataLoader} correctly identifies * bridge methods. */ public void testMethodLevelAnnotationOnDeclaredBridgeMethodFromParent() throws Exception { AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(BridgeMethodChildBean.class); Method method = BridgeMethodChildBean.class.getMethod("unambiguous", Object.class); assertTrue(method.isBridge()); Signature methodSignature = new DeclaredMethodSignature(method); MetaDataRetrieval retrieval = annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature); assertNotNull("Expected a MetaDataRetrieval for method " + method, retrieval); MetaData metadata = new MetaDataRetrievalToMetaDataBridge(retrieval); Annotation[] annotations = metadata.getAnnotations(); assertTrue("Expected one annotation on unambiguous method of " + BridgeMethodChildBean.class, annotations.length == 1); method = BridgeMethodChildBean.class.getMethod("ambiguous", Object.class); assertTrue(method.isBridge()); methodSignature = new DeclaredMethodSignature(method); assertNull(annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature)); } /** * Test the bug fix for JBMDR-73 *

* * Tests that overlaoded methods don't cause "No original methods found for..." exception * while looking for real method corresponding to a bridged method, through {@link AnnotatedElementMetaDataLoader} */ public void testBridgedMethodWithOverloadedMethods() throws Exception { AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(Child.class); // get the bridged method Method method = Child.class.getMethod("loadByExample", Event.class, Map.class); // Ensure that the bridged method was picked up assertTrue("Method " + method + " was expected to be a bridged method", method.isBridge()); // now just get the ComponentMetaDataRetrieval (which internally triggers the call to search for the // non-bridged method). Signature methodSignature = new DeclaredMethodSignature(method); MetaDataRetrieval retrieval = annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature); assertNotNull("Expected a MetaDataRetrieval for method " + method, retrieval); } } ././@LongLink0000000000000000000000000000023200000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/AnnotatedElementLoaderBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/An0000644000175000017500000000500310454442653033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.test; import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.loader.reflection.support.NoAnnotationBean; import org.jboss.test.metadata.loader.reflection.support.TestAnnotationBean; import org.jboss.test.metadata.loader.reflection.support.TestAnnotation12Bean; import org.jboss.test.metadata.shared.BasicAnnotationsTest; /** * AnnotatedElementLoaderBasicAnnotationsUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class AnnotatedElementLoaderBasicAnnotationsUnitTestCase extends BasicAnnotationsTest { public AnnotatedElementLoaderBasicAnnotationsUnitTestCase(String name) { super(name, true); } protected MetaData setupEmpty() { AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader(NoAnnotationBean.class); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestAnnotation() { AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader(TestAnnotationBean.class); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupTestAnnotation12() { AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader(TestAnnotation12Bean.class); return new MetaDataRetrievalToMetaDataBridge(loader); } } ././@LongLink0000000000000000000000000000024300000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/AnnotatedElementLoaderComponentBasicAnnotationsUnitTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/test/An0000644000175000017500000000611111006162205033170 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.test; import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.test.metadata.loader.reflection.support.ConstructorBean; import org.jboss.test.metadata.loader.reflection.support.ConstructorParamBean; import org.jboss.test.metadata.loader.reflection.support.FieldBean; import org.jboss.test.metadata.loader.reflection.support.MethodBean; import org.jboss.test.metadata.loader.reflection.support.MethodParamBean; import org.jboss.test.metadata.shared.ComponentBasicAnnotationsTest; /** * AnnotatedElementLoaderBasicAnnotationsUnitTestCase. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class AnnotatedElementLoaderComponentBasicAnnotationsUnitTestCase extends ComponentBasicAnnotationsTest { public AnnotatedElementLoaderComponentBasicAnnotationsUnitTestCase(String name) { super(name, true); } protected MetaData setupField() { AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader(FieldBean.class); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupConstructor() { AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader(ConstructorBean.class); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupMethod() { AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader(MethodBean.class); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupMethodParams() { AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader(MethodParamBean.class); return new MetaDataRetrievalToMetaDataBridge(loader); } protected MetaData setupConstructorParams() { AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader(ConstructorParamBean.class); return new MetaDataRetrievalToMetaDataBridge(loader); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000755000175000017500000000000011620305600033366 5ustar twernertwerner././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/SuperClassOfNotPublic.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000273311050266501033400 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import org.jboss.test.metadata.shared.support.TestAnnotation; /** * SuperClassOfNotPublic. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class SuperClassOfNotPublic { @TestAnnotation protected int notPublicSuperClass; @TestAnnotation protected void notPublicSuperClass() { } @SuppressWarnings("unused") @TestAnnotation private void sameName() { } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/TestAnnotationScopeBean.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000267710454442653033422 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import org.jboss.test.metadata.shared.support.TestAnnotation; /** * TestAnnotationBean. * * @author Adrian Brock * @version $Revision: 46146 $ */ @TestAnnotation public class TestAnnotationScopeBean { @TestAnnotation public boolean something; @TestAnnotation public TestAnnotationScopeBean() { } @TestAnnotation public void doSomething() { } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/TestAnnotation12Bean.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000254010446527733033413 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation2; /** * TestAnnotation12Bean. * * @author Adrian Brock * @version $Revision: 45742 $ */ @TestAnnotation1 @TestAnnotation2 public class TestAnnotation12Bean { } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/Event.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000217411524770005033404 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2010, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; /** * User: jpai */ public class Event extends NamedEvent { } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/BridgeInterface.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000232011364050357033400 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright (c) 2010, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; /** * @author Carlo de Wolf */ public interface BridgeInterface { T unambiguous(T t); T ambiguous(T t); } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/NoAnnotationBean.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000226710446527733033421 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; /** * NoAnnotationBean. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class NoAnnotationBean { } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/ConstructorParamBean.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000307511006162205033375 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation2; /** * ConstructorParamBean. * * @author Ales Justin */ public class ConstructorParamBean { public ConstructorParamBean(String p1) { } public ConstructorParamBean(@TestAnnotation Integer p1) { } public ConstructorParamBean(String p1, @TestAnnotation1 @TestAnnotation2 Class p2) { } }././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/TestAnnotationBean.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000241210446527733033411 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import org.jboss.test.metadata.shared.support.TestAnnotation; /** * TestAnnotationBean. * * @author Adrian Brock * @version $Revision: 45742 $ */ @TestAnnotation public class TestAnnotationBean { } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/FieldBean.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000277710540110763033411 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation2; /** * FieldBean. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class FieldBean { public String empty; @TestAnnotation public String testAnnotation; @TestAnnotation1 @TestAnnotation2 public String testAnnotation12; } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/MethodBean.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000307310756326650033414 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation2; /** * MethodBean. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class MethodBean { public void empty() { } @TestAnnotation public void testAnnotation(String p1) { } @TestAnnotation1 @TestAnnotation2 public void testAnnotation12(String p1, Class p2) { } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/BridgeMethodBean.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000346211364050357033410 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright (c) 2010, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import org.jboss.test.metadata.shared.support.TestAnnotation; /** * @author Carlo de Wolf */ public class BridgeMethodBean implements BridgeInterface { @TestAnnotation public String unambiguous(String t) { throw new RuntimeException("NYI: org.jboss.test.metadata.loader.reflection.support.BridgedMethodBean.unambiguous"); } @TestAnnotation public String ambiguous(String t) { throw new RuntimeException("NYI: org.jboss.test.metadata.loader.reflection.support.BridgedMethodBean.ambiguous"); } @TestAnnotation public Long ambiguous(Long t) { throw new RuntimeException("NYI: org.jboss.test.metadata.loader.reflection.support.BridgedMethodBean.ambiguous"); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/TestSub.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000243711050621021033371 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; /** * TestSub. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestSub extends TestSuper { @SuppressWarnings("unused") @TestAnnotationWithValue("sub") private void doSomething() { } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/Parent.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000260511524770005033403 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2010, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import java.util.Map; /** * User: jpai */ public abstract class Parent { public T loadByExample(T entity, Map parameters) { return null; } // dummy overloaded method to reproduce JBMDR-73 public T loadByExample(T entity, String dummy) { return null; } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/TestSuper.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000242311050621021033364 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; /** * TestSuper. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestSuper { @SuppressWarnings("unused") @TestAnnotationWithValue("super") private void doSomething() { } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/Child.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000223711524770005033404 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2010, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; /** * User: Jaikiran Pai */ public class Child extends Parent implements IBean { } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/BridgeMethodChildBean.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000234611511006206033374 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright (c) 2010, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; /** * @author James Livingston */ public class BridgeMethodChildBean extends BridgeMethodParentBean implements BridgeInterface { } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/IBean.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000232411524770005033401 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2010, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import java.util.Map; /** * User: jpai */ public interface IBean { T loadByExample(T entity, Map parameters); } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/NotPublic.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000302611050615325033376 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import org.jboss.test.metadata.shared.support.TestAnnotation; /** * NotPublic. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NotPublic extends SuperClassOfNotPublic { @TestAnnotation protected int notPublic; @TestAnnotation protected NotPublic() { } @TestAnnotation protected void notPublic() { } // There is no annotation here @SuppressWarnings("unused") private void sameName() { } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/BridgeMethodParentBean.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000342511511006206033373 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright (c) 2010, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import org.jboss.test.metadata.shared.support.TestAnnotation; /** * @author Carlo de Wolf */ public class BridgeMethodParentBean { @TestAnnotation public String unambiguous(String t) { throw new RuntimeException("NYI: org.jboss.test.metadata.loader.reflection.support.BridgedMethodBean.unambiguous"); } @TestAnnotation public String ambiguous(String t) { throw new RuntimeException("NYI: org.jboss.test.metadata.loader.reflection.support.BridgedMethodBean.ambiguous"); } @TestAnnotation public Long ambiguous(Long t) { throw new RuntimeException("NYI: org.jboss.test.metadata.loader.reflection.support.BridgedMethodBean.ambiguous"); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/ConstructorBean.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000310010756326650033403 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation2; /** * ConstructorBean. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class ConstructorBean { public ConstructorBean() { } @TestAnnotation public ConstructorBean(String p1) { } @TestAnnotation1 @TestAnnotation2 public ConstructorBean(String p1, Class p2) { } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/MethodParamBean.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000310510756326650033410 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation2; /** * MethodParamBean. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class MethodParamBean { public void empty(String p1) { } public void testAnnotation(@TestAnnotation String p1) { } public void testAnnotation12(String p1, @TestAnnotation1 @TestAnnotation2 Class p2) { } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/TestAnnotationWithValue.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000233011050621021033361 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) public @interface TestAnnotationWithValue { String value(); } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support/NamedEvent.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/reflection/support0000644000175000017500000000216711524770005033406 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2010, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader.reflection.support; /** * User: jpai */ public abstract class NamedEvent { } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/MutableMetaDataTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/MutableMetaDataTes0000644000175000017500000003227410454442653033216 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.shared.support.ExpectedMetaData; import org.jboss.test.metadata.shared.support.MetaDataAndMutableMetaData; import org.jboss.test.metadata.shared.support.NotPresentType; import org.jboss.test.metadata.shared.support.TestMetaData; import org.jboss.test.metadata.shared.support.TestMetaData1; import org.jboss.test.metadata.shared.support.TestMetaData1Impl; import org.jboss.test.metadata.shared.support.TestMetaData2; import org.jboss.test.metadata.shared.support.TestMetaData2Impl; import org.jboss.test.metadata.shared.support.TestMetaDataImpl; /** * MutableMetaDataTest. * * @author Adrian Brock * @version $Revision: 46146 $ */ public abstract class MutableMetaDataTest extends AbstractMetaDataTest { public MutableMetaDataTest(String name) { super(name); } public void testEmpty() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); assertValidTimeUnchanged(metaData, last); } public void testTestMetaData() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaDataImpl(), TestMetaData.class, expected, last); assertMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); assertRemoveMetaData(metaData, TestMetaData.class, expected, last); assertNoMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); } public void testTestMetaData12() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, TestMetaData1.class); assertNoMetaData(metaData, TestMetaData2.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaData1Impl(), TestMetaData1.class, expected, last); assertMetaData(metaData, TestMetaData1.class); assertNoMetaData(metaData, TestMetaData2.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaData2Impl(), TestMetaData2.class, expected, last); assertMetaData(metaData, TestMetaData1.class); assertMetaData(metaData, TestMetaData2.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); assertRemoveMetaData(metaData, TestMetaData1.class, expected, last); assertNoMetaData(metaData, TestMetaData1.class); assertMetaData(metaData, TestMetaData2.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); assertRemoveMetaData(metaData, TestMetaData2.class, expected, last); assertNoMetaData(metaData, TestMetaData1.class); assertNoMetaData(metaData, TestMetaData2.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); } public void testAddTwice() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaDataImpl(), TestMetaData.class, expected, last); assertMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataWithPrevious(metaData, new TestMetaDataImpl(), TestMetaData.class, last); assertMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); } public void testAddTwiceSameObject() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); TestMetaData object = new TestMetaDataImpl(); last = assertAddMetaDataNoPrevious(metaData, object, TestMetaData.class, expected, last); assertMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); assertAddMetaDataWithPreviousSameObject(metaData, object, TestMetaData.class, last); assertMetaData(metaData, TestMetaData.class); assertNoMetaData(metaData, NotPresentType.class); assertAllMetaData(metaData, expected); } public void testRemoveDoesNotExist() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNotRemovedMetaData(metaData, TestMetaData.class, last); assertAllMetaData(metaData, expected); } public void testRemoveTwice() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); last = assertAddMetaDataNoPrevious(metaData, new TestMetaDataImpl(), TestMetaData.class, expected, last); assertRemoveMetaData(metaData, TestMetaData.class, expected, last); assertNotRemovedMetaData(metaData, TestMetaData.class, last); assertAllMetaData(metaData, expected); } public void testTestMetaDataByName() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaDataImpl(), "Test", TestMetaData.class, expected, last); assertMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); assertRemoveMetaData(metaData, "Test", TestMetaData.class, expected, last); assertNoMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); } public void testTestMetaData12ByName() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, "Test1", TestMetaData1.class); assertNoMetaData(metaData, "Test2", TestMetaData2.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaData1Impl(), "Test1", TestMetaData1.class, expected, last); assertMetaData(metaData, "Test1", TestMetaData1.class); assertNoMetaData(metaData, "Test2", TestMetaData2.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaData2Impl(), "Test2", TestMetaData2.class, expected, last); assertMetaData(metaData, "Test1", TestMetaData1.class); assertMetaData(metaData, "Test2", TestMetaData2.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); assertRemoveMetaData(metaData, "Test1", TestMetaData1.class, expected, last); assertNoMetaData(metaData, "Test1", TestMetaData1.class); assertMetaData(metaData, "Test2", TestMetaData2.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); assertRemoveMetaData(metaData, "Test2", TestMetaData2.class, expected, last); assertNoMetaData(metaData, "Test1", TestMetaData1.class); assertNoMetaData(metaData, "Test2", TestMetaData2.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); } public void testAddTwiceByName() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataNoPrevious(metaData, new TestMetaDataImpl(), "Test", TestMetaData.class, expected, last); assertMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); last = assertAddMetaDataWithPrevious(metaData, new TestMetaDataImpl(), "Test", TestMetaData.class, last); assertMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); } public void testAddTwiceSameObjectByName() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNoMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); TestMetaData object = new TestMetaDataImpl(); last = assertAddMetaDataNoPrevious(metaData, object, "Test", TestMetaData.class, expected, last); assertMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); assertAddMetaDataWithPreviousSameObject(metaData, object, "Test", TestMetaData.class, last); assertMetaData(metaData, "Test", TestMetaData.class); assertNoMetaData(metaData, "NotPresent", NotPresentType.class); assertAllMetaData(metaData, expected); } public void testRemoveDoesNotExistByName() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); assertNotRemovedMetaData(metaData, "Test", TestMetaData.class, last); assertAllMetaData(metaData, expected); } public void testRemoveTwiceByName() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedMetaData expected = emptyExpectedMetaData(); last = assertAddMetaDataNoPrevious(metaData, new TestMetaDataImpl(), "Test", TestMetaData.class, expected, last); assertRemoveMetaData(metaData, "Test", TestMetaData.class, expected, last); assertNotRemovedMetaData(metaData, "Test", TestMetaData.class, last); assertAllMetaData(metaData, expected); } protected abstract MetaDataAndMutableMetaData setupEmpty(); } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/MetaDataLoaderTestSuite.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/MetaDataLoaderTest0000644000175000017500000000370010446527733033213 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader; import org.jboss.test.metadata.loader.memory.test.MemoryMetaDataLoaderTestSuite; import org.jboss.test.metadata.loader.reflection.test.ReflectionMetaDataLoaderTestSuite; import org.jboss.test.metadata.loader.threadlocal.test.ThreadLocalMetaDataLoaderTestSuite; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * MetaDataLoader Test Suite. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class MetaDataLoaderTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("MetaDataLoader Tests"); suite.addTest(MemoryMetaDataLoaderTestSuite.suite()); suite.addTest(ThreadLocalMetaDataLoaderTestSuite.suite()); suite.addTest(ReflectionMetaDataLoaderTestSuite.suite()); return suite; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/MutableAnnotationsTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/metadata/loader/MutableAnnotations0000644000175000017500000002013610454442653033351 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.metadata.loader; import org.jboss.test.metadata.AbstractMetaDataTest; import org.jboss.test.metadata.shared.support.ExpectedAnnotations; import org.jboss.test.metadata.shared.support.MetaDataAndMutableMetaData; import org.jboss.test.metadata.shared.support.NotPresentAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation; import org.jboss.test.metadata.shared.support.TestAnnotation1; import org.jboss.test.metadata.shared.support.TestAnnotation1Impl; import org.jboss.test.metadata.shared.support.TestAnnotation2; import org.jboss.test.metadata.shared.support.TestAnnotation2Impl; import org.jboss.test.metadata.shared.support.TestAnnotationImpl; /** * MutableAnnotationsTest. * * @author Adrian Brock * @version $Revision: 46146 $ */ public abstract class MutableAnnotationsTest extends AbstractMetaDataTest { public MutableAnnotationsTest(String name) { super(name); } public void testEmpty() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); assertValidTimeUnchanged(metaData, last); } public void testTestAnnotation() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertNoAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); last = assertAddAnnotationNoPrevious(metaData, new TestAnnotationImpl(), expectedAnnotations, last); assertAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); assertRemoveAnnotation(metaData, TestAnnotation.class, expectedAnnotations, last); assertNoAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); } public void testTestAnnotation12() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertNoAnnotation(metaData, TestAnnotation1.class); assertNoAnnotation(metaData, TestAnnotation2.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); last = assertAddAnnotationNoPrevious(metaData, new TestAnnotation1Impl(), expectedAnnotations, last); assertAnnotation(metaData, TestAnnotation1.class); assertNoAnnotation(metaData, TestAnnotation2.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); last = assertAddAnnotationNoPrevious(metaData, new TestAnnotation2Impl(), expectedAnnotations, last); assertAnnotation(metaData, TestAnnotation1.class); assertAnnotation(metaData, TestAnnotation2.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); assertRemoveAnnotation(metaData, TestAnnotation1.class, expectedAnnotations, last); assertNoAnnotation(metaData, TestAnnotation1.class); assertAnnotation(metaData, TestAnnotation2.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); assertRemoveAnnotation(metaData, TestAnnotation2.class, expectedAnnotations, last); assertNoAnnotation(metaData, TestAnnotation1.class); assertNoAnnotation(metaData, TestAnnotation2.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); } public void testAddTwice() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertNoAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); last = assertAddAnnotationNoPrevious(metaData, new TestAnnotationImpl(), expectedAnnotations, last); assertAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); last = assertAddAnnotationWithPrevious(metaData, new TestAnnotationImpl(), last); assertAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); } public void testAddTwiceSameObject() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertNoAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); TestAnnotation annotation = new TestAnnotationImpl(); last = assertAddAnnotationNoPrevious(metaData, annotation, expectedAnnotations, last); assertAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); assertAddAnnotationWithPreviousSameObject(metaData, annotation, last); assertAnnotation(metaData, TestAnnotation.class); assertNoAnnotation(metaData, NotPresentAnnotation.class); assertAllAnnotations(metaData, expectedAnnotations); } public void testRemoveDoesNotExist() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); assertNotRemovedAnnotation(metaData, TestAnnotation.class, last); assertAllAnnotations(metaData, expectedAnnotations); } public void testRemoveTwice() throws Exception { MetaDataAndMutableMetaData metaData = setupEmpty(); long last = metaData.getValidTime(); ExpectedAnnotations expectedAnnotations = emptyExpectedAnnotations(); last = assertAddAnnotationNoPrevious(metaData, new TestAnnotationImpl(), expectedAnnotations, last); assertRemoveAnnotation(metaData, TestAnnotation.class, expectedAnnotations, last); assertNotRemovedAnnotation(metaData, TestAnnotation.class, last); assertAllAnnotations(metaData, expectedAnnotations); } protected abstract MetaDataAndMutableMetaData setupEmpty(); } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/MDRAllTestSuite.java0000644000175000017500000000327110770502023030347 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.annotation.factory.test.AnnotationCreatorTestSuite; import org.jboss.test.metadata.MetaDataAllTestSuite; /** * MDR All Test Suite. * * @author Adrian Brock * @version $Revision: 66074 $ */ public class MDRAllTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("MDR Tests"); suite.addTest(AnnotationCreatorTestSuite.suite()); suite.addTest(MetaDataAllTestSuite.suite()); return suite; } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/0000755000175000017500000000000011620305601026724 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/0000755000175000017500000000000011620305601030373 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/test/0000755000175000017500000000000011620305601031352 5ustar twernertwerner././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/test/AnnotationCreatorTestSuite.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/test/Annotation0000644000175000017500000000325010732056653033424 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.annotation.factory.test; import junit.framework.TestSuite; import junit.framework.Test; import junit.textui.TestRunner; /** * Annotation creator tests. * * @author Ales Justin */ public class AnnotationCreatorTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Annotation Creator tests"); suite.addTest(JavassistAnnotationCreatorTestCase.suite()); suite.addTest(NoJavassistAnnotationCreatorTestCase.suite()); return suite; } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/test/NoJavassistAnnotationCreatorTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/test/NoJavassis0000644000175000017500000001021010764240767033372 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.annotation.factory.test; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import junit.framework.Test; import org.jboss.annotation.factory.AnnotationCreator; import org.jboss.annotation.factory.AnnotationValidationException; import org.jboss.test.annotation.factory.support.ComplexWithDefault; /** * * @author Kabir Khan * @version $Revision: 70541 $ */ public class NoJavassistAnnotationCreatorTestCase extends AnnotationCreatorTest { public static Test suite() { return suite(NoJavassistAnnotationCreatorTestCase.class); } public NoJavassistAnnotationCreatorTestCase(String name) { super(name); } public void testDefaultValues() throws Exception { ClassLoader old = Thread.currentThread().getContextClassLoader(); ClassLoader test = new TestClassLoader(); Thread.currentThread().setContextClassLoader(test); try { String expr = "@org.jboss.test.annotation.factory.support.ComplexWithDefault"; Class annotation = test.loadClass(ComplexWithDefault.class.getName()); Class annotationCreator = test.loadClass(AnnotationCreator.class.getName()); Method createAnnotation = annotationCreator.getDeclaredMethod("createAnnotation", new Class[] { String.class, Class.class }); createAnnotation.invoke(null, new Object[] { expr, annotation }); fail("Should have had a validation exception"); } catch (InvocationTargetException expected) { Throwable cause = expected.getCause(); assertEquals(AnnotationValidationException.class.getName(), cause.getClass().getName()); } finally { Thread.currentThread().setContextClassLoader(old); } } public class TestClassLoader extends ClassLoader { public TestClassLoader() { super(TestClassLoader.class.getClassLoader()); } public Class loadClass(String name, boolean resolve) throws ClassNotFoundException { System.out.println(name); if (name.startsWith("javassist")) throw new ClassNotFoundException("exluding javassist"); if (name.startsWith("org.jboss")) { String classPath = name.replace('.', '/') + ".class"; try { InputStream is = getResourceAsStream(classPath); ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] bytes = new byte[1024]; int read = is.read(bytes); while (read >= 0) { baos.write(bytes, 0, read); read = is.read(bytes); } is.close(); baos.flush(); bytes = baos.toByteArray(); return defineClass(name, bytes, 0, bytes.length); } catch (IOException e) { throw new RuntimeException(e); } } return super.loadClass(name, resolve); } } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/test/JavassistAnnotationCreatorTestCase.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/test/JavassistA0000644000175000017500000000561510457142306033364 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.annotation.factory.test; import java.lang.annotation.Annotation; import junit.framework.Test; import org.jboss.annotation.factory.AnnotationCreator; import org.jboss.test.annotation.factory.support.ComplexWithDefault; import org.jboss.test.annotation.factory.support.MyEnum; /** * * @author Kabir Khan * @version $Revision: 46363 $ */ public class JavassistAnnotationCreatorTestCase extends AnnotationCreatorTest { public static Test suite() { return suite(JavassistAnnotationCreatorTestCase.class); } public JavassistAnnotationCreatorTestCase(String name) { super(name); } public void testDefaultValues() throws Exception { String expr = "@org.jboss.test.annotation.factory.support.ComplexWithDefault"; Annotation annotation = (Annotation)AnnotationCreator.createAnnotation(expr, ComplexWithDefault.class); assertEquals(ComplexWithDefault.class, annotation.annotationType()); ComplexWithDefault complex = (ComplexWithDefault)annotation; assertEquals('d', complex.ch()); assertEquals("default", complex.string()); assertEquals(1.0, complex.flt()); assertEquals(2.3, complex.dbl()); assertEquals(2, complex.shrt()); assertEquals(123456789, complex.lng()); assertEquals(123, complex.integer()); assertEquals(true, complex.bool()); assertEquals(String.class, complex.clazz()); assertEquals(MyEnum.ONE, complex.enumVal()); assertEquals("default", complex.annotation().value()); assertEquals(new String[]{"The", "defaults"}, complex.array()); int[] expectedIntArray = new int[] {1,2,3}; int[] actualIntArray = complex.intArray(); assertEquals(expectedIntArray.length, actualIntArray.length); for (int i = 0 ; i < expectedIntArray.length ; i++) { assertEquals(expectedIntArray[i], actualIntArray[i]); } } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/test/AnnotationCreatorTest.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/test/Annotation0000644000175000017500000002221411104024362033407 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.annotation.factory.test; import java.lang.annotation.Annotation; import java.io.Serializable; import org.jboss.annotation.factory.AnnotationCreator; import org.jboss.annotation.factory.AnnotationValidationException; import org.jboss.test.ContainerTest; import org.jboss.test.annotation.factory.support.Complex; import org.jboss.test.annotation.factory.support.MyEnum; import org.jboss.test.annotation.factory.support.Name; import org.jboss.test.annotation.factory.support.NameDefaults; import org.jboss.test.annotation.factory.support.Simple; import org.jboss.test.annotation.factory.support.SimpleValue; import org.jboss.test.annotation.factory.support.NameImpl; /** * * @author Kabir Khan * @version $Revision: 80468 $ */ public abstract class AnnotationCreatorTest extends ContainerTest { public AnnotationCreatorTest(String name) { super(name); } public void testSimple() throws Exception { String expr = "@org.jboss.test.annotation.factory.support.Simple"; Annotation annotation = (Annotation)AnnotationCreator.createAnnotation(expr, Simple.class); assertEquals(Simple.class, annotation.annotationType()); } public void testSimpleValue() throws Exception { String expr = "@org.jboss.test.annotation.factory.support.SimpleValue(\"Test\")"; Annotation annotation = (Annotation)AnnotationCreator.createAnnotation(expr, SimpleValue.class); assertEquals(SimpleValue.class, annotation.annotationType()); assertEquals("Test", ((SimpleValue)annotation).value()); } public void testSimpleValueWithPropertyReplacement() throws Exception { String expr = "@org.jboss.test.annotation.factory.support.SimpleValue(\"${value1}\")"; System.setProperty("value1", "Test"); Annotation annotation = (Annotation)AnnotationCreator.createAnnotation(expr, SimpleValue.class, true); assertEquals(SimpleValue.class, annotation.annotationType()); assertEquals("Test", ((SimpleValue)annotation).value()); } public void testSimpleValueWithPropertyReplacementFromProperties() throws Exception { String expr = "@org.jboss.test.annotation.factory.support.SimpleValue(\"${value1}\")"; System.setProperty("value1", "Test"); Annotation annotation = (Annotation)AnnotationCreator.createAnnotation(expr, SimpleValue.class, System.getProperties()); assertEquals(SimpleValue.class, annotation.annotationType()); assertEquals("Test", ((SimpleValue)annotation).value()); } public void testComplex() throws Exception { String expr = "@org.jboss.test.annotation.factory.support.Complex(ch='a', string=\"Test123\", flt=9.9, dbl=123456789.99, shrt=1, lng=987654321, integer=123, bool=true, annotation=@org.jboss.test.annotation.factory.support.SimpleValue(\"Yes\"), array={\"Test\", \"123\"}, clazz=java.lang.Long.class, enumVal=org.jboss.test.annotation.factory.support.MyEnum.TWO, primitiveArray={1,2,3})"; Annotation annotation = (Annotation)AnnotationCreator.createAnnotation(expr, Complex.class); assertEquals(Complex.class, annotation.annotationType()); Complex complex = (Complex)annotation; assertEquals('a', complex.ch()); assertEquals("Test123", complex.string()); assertEquals(9,9, complex.flt()); assertEquals(123456789.99, complex.dbl()); assertEquals(1, complex.shrt()); assertEquals(987654321, complex.lng()); assertEquals(123, complex.integer()); assertEquals(true, complex.bool()); assertEquals(Long.class, complex.clazz()); assertEquals("Yes", complex.annotation().value()); assertEquals(new String[]{"Test", "123"}, complex.array()); assertEquals(MyEnum.TWO, complex.enumVal()); assertArrays(new int[]{1, 2, 3}, complex.primitiveArray()); } public void testComplexWithPropertyReplacement() throws Exception { String expr = "@org.jboss.test.annotation.factory.support.Complex(ch='${ch}', string=\"${string}\", flt=${flt}, dbl=${dbl}, shrt=${shrt}, " + "lng=${lng}, integer=${integer}, bool=${bool}, annotation=${annotation}, array=${array}, clazz=${clazz}, enumVal=${enumVal}, primitiveArray=${primitiveArray})"; System.setProperty("ch", "a"); System.setProperty("string", "Test123"); System.setProperty("flt", "9.9"); System.setProperty("dbl", "123456789.99"); System.setProperty("shrt", "1"); System.setProperty("lng", "987654321"); System.setProperty("integer", "123"); System.setProperty("bool", "true"); System.setProperty("annotation", "@org.jboss.test.annotation.factory.support.SimpleValue(\"Yes\")"); System.setProperty("array", "{\"Test\", \"123\"}"); System.setProperty("clazz", "java.lang.Long.class"); System.setProperty("enumVal", "org.jboss.test.annotation.factory.support.MyEnum.TWO"); System.setProperty("primitiveArray", "{1, 2, 3}"); Annotation annotation = (Annotation)AnnotationCreator.createAnnotation(expr, Complex.class, true); assertEquals(Complex.class, annotation.annotationType()); Complex complex = (Complex)annotation; assertEquals('a', complex.ch()); assertEquals("Test123", complex.string()); assertEquals(9,9, complex.flt()); assertEquals(123456789.99, complex.dbl()); assertEquals(1, complex.shrt()); assertEquals(987654321, complex.lng()); assertEquals(123, complex.integer()); assertEquals(true, complex.bool()); assertEquals(Long.class, complex.clazz()); assertEquals("Yes", complex.annotation().value()); assertEquals(new String[]{"Test", "123"}, complex.array()); assertEquals(MyEnum.TWO, complex.enumVal()); assertArrays(new int[]{1, 2, 3}, complex.primitiveArray()); } public void testSerializable() throws Exception { String expr = "@org.jboss.test.annotation.factory.support.Complex(ch='a', string=\"Test123\", flt=9.9, dbl=123456789.99, shrt=1, lng=987654321, integer=123, bool=true, annotation=@org.jboss.test.annotation.factory.support.SimpleValue(\"Yes\"), array={\"Test\", \"123\"}, clazz=java.lang.Long.class, enumVal=org.jboss.test.annotation.factory.support.MyEnum.TWO, primitiveArray={1,2,3})"; Annotation annotation = (Annotation)AnnotationCreator.createAnnotation(expr, Complex.class); assertInstanceOf(annotation, Serializable.class); byte[] bytes = serialize((Serializable)annotation); Object desAnn = deserialize(bytes); assertEquals(annotation, desAnn); } public void testMissingAttributeAndNoDefault() throws Exception { try { String expr = "@org.jboss.test.annotation.factory.support.SimpleValue"; AnnotationCreator.createAnnotation(expr, SimpleValue.class); fail("Should have picked up on missing attribute"); } catch (AnnotationValidationException expected) { } } public void testEquals() throws Exception { String expr = "@"+Name.class.getName() + "(type=\"type\",subtype=\"subtype\")"; Name n0 = (Name) AnnotationCreator.createAnnotation(expr, Name.class); getLog().debug("n0: "+n0); Name n1 = NameDefaults.class.getAnnotation(Name.class); getLog().debug("n1: "+n1); assertEquals(n0, n1); assertEquals(n1, n0); Name defaultName = NameDefaults.defaultNameType(); getLog().debug("defaultName: "+defaultName); // The jdk annotation should not equal the defaultName assertFalse(n1+" != "+defaultName, n1.equals(defaultName)); assertFalse(defaultName+" != "+n1, defaultName.equals(n1)); // The AnnotationCreator annotation should not equal the defaultName assertFalse(n0+" != "+defaultName, n0.equals(defaultName)); assertFalse(defaultName+" != "+n0, defaultName.equals(n0)); Name n2 = new NameImpl("type", "subtype"); getLog().debug("n2: " + n2); assertEquals(n0, n2); assertEquals(n2, n0); assertEquals(n1, n2); assertEquals(n2, n1); Name n3 = new NameImpl(); assertFalse(n0 + "!=" + n3, n0.equals(n3)); assertFalse(n3 + "!=" + n0, n3.equals(n0)); assertFalse(n1 + "!=" + n3, n1.equals(n3)); assertFalse(n3 + "!=" + n1, n3.equals(n1)); } } libjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/0000755000175000017500000000000011620305601032107 5ustar twernertwerner././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/SimpleValueWithDefault.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/SimpleV0000644000175000017500000000231510457142306033422 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.annotation.factory.support; /** * * @author Kabir Khan * @version $Revision: 46363 $ */ public @interface SimpleValueWithDefault { String value() default "default"; } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/Name.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/Name.ja0000644000175000017500000000251111104024362033301 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2008, Red Hat Middleware LLC, and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.annotation.factory.support; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * @author Scott.Stark@jboss.org * @version $Revision:$ */ @Retention(RetentionPolicy.RUNTIME) public @interface Name { public String type() default ""; public String subtype() default ""; } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/Simple.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/Simple.0000644000175000017500000000223110457142306033347 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.annotation.factory.support; /** * * @author Kabir Khan * @version $Revision: 46363 $ */ public @interface Simple { } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/NameDefaults.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/NameDef0000644000175000017500000000327711104024362033341 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2008, Red Hat Middleware LLC, and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.annotation.factory.support; /** * @author Scott.Stark@jboss.org * @version $Revision:$ */ @Name(type="type", subtype="subtype") public class NameDefaults { @Name(type="", subtype="") public static class NAME_CLASS {} @Name(type="", subtype="") public static class NAME_CLASS2 {} /** The ManagementComponent uninitialized default */ public static final Name COMP_TYPE = defaultNameType(); /** * The unitialized/default ManagementComponent value * @return The unitialized/default ManagementComponent value */ public static synchronized Name defaultNameType() { Name name = NAME_CLASS.class.getAnnotation(Name.class); return name; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/MyEnum.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/MyEnum.0000644000175000017500000000232210457142306033331 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.annotation.factory.support; /** * Comment * * @author Bill Burke * @version $Revision: 46363 $ */ public enum MyEnum { ONE, TWO; } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/SimpleValue.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/SimpleV0000644000175000017500000000226010457142306033421 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.annotation.factory.support; /** * * @author Kabir Khan * @version $Revision: 46363 $ */ public @interface SimpleValue { String value(); } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/NameImpl.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/NameImp0000644000175000017500000000431211104024362033357 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.annotation.factory.support; import java.lang.annotation.Annotation; import org.jboss.util.JBossObject; /** * @author Ales Justin */ public class NameImpl implements Name { private String type = ""; private String subtype = ""; public NameImpl() { } public NameImpl(String type, String subtype) { if (type != null) this.type = type; if (subtype != null) this.subtype = subtype; } public String type() { return type; } public String subtype() { return subtype; } public Class annotationType() { return Name.class; } public int hashCode() { return type.hashCode() + subtype.hashCode(); } public boolean equals(Object obj) { if (obj instanceof Name == false) return false; Name name = (Name)obj; return JBossObject.equals(type, name.type()) && JBossObject.equals(subtype, name.subtype()); } public String toString() { return "@" + annotationType().getName() + "(type=" + type + ", subtype=" + subtype + ")"; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/ComplexWithDefault.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/Complex0000644000175000017500000000322710756326650033465 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.annotation.factory.support; /** * * @author Kabir Khan * @version $Revision: 69888 $ */ public @interface ComplexWithDefault { char ch() default 'd'; String string() default "default"; float flt() default 1.0f; double dbl() default 2.3; short shrt() default 2; long lng() default 123456789; int integer() default 123; boolean bool() default true; SimpleValueWithDefault annotation() default @SimpleValueWithDefault; String[] array() default {"The", "defaults"}; Class clazz() default String.class; MyEnum enumVal() default MyEnum.ONE; int[] intArray() default {1,2,3}; } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/Complex.javalibjboss-metadata-java-2.0.3.GA.orig/src/test/java/org/jboss/test/annotation/factory/support/Complex0000644000175000017500000000264511104024362033447 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.annotation.factory.support; /** * * @author Kabir Khan * @version $Revision: 80468 $ */ public @interface Complex { char ch(); String string(); float flt(); double dbl(); short shrt(); long lng(); int integer(); boolean bool(); SimpleValue annotation(); String[] array(); Class clazz(); MyEnum enumVal(); int[] primitiveArray(); } libjboss-metadata-java-2.0.3.GA.orig/src/assembly/0000755000175000017500000000000011620305572021612 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/assembly/metadata-spi.xml0000644000175000017500000000060110600557226024704 0ustar twernertwerner metadata-spi jar false target/classes org/jboss/metadata/spi/** libjboss-metadata-java-2.0.3.GA.orig/src/assembly/metadata.xml0000644000175000017500000000107010600557226024114 0ustar twernertwerner metadata jar false target/classes org/jboss/metadata/plugins/** org/jboss/metadata/annotation/** org/jboss/metadata/generic/** org/jboss/metadata/repository/** libjboss-metadata-java-2.0.3.GA.orig/src/main/0000755000175000017500000000000011620305601020710 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/0000755000175000017500000000000011620305601021631 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/0000755000175000017500000000000011620305601022420 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/0000755000175000017500000000000011620305603023542 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/0000755000175000017500000000000011620305603025322 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/0000755000175000017500000000000011620305602027002 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/scope/0000755000175000017500000000000011620305602030113 5ustar twernertwerner././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/scope/DeploymentScope.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/scope/DeploymentScope.0000644000175000017500000000306510565061074033243 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.scope; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.jboss.metadata.spi.scope.ScopeFactoryLookup; /** * Deployment scope annotation. * * @author Ales Justin */ @ScopeFactoryLookup(DeploymentScopeFactory.class) @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) public @interface DeploymentScope { String value() default ""; } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/scope/InstanceScope.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/scope/InstanceScope.ja0000644000175000017500000000304410565061074033177 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.scope; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.jboss.metadata.spi.scope.ScopeFactoryLookup; /** * Instance scope annotation. * * @author Ales Justin */ @ScopeFactoryLookup(InstanceScopeFactory.class) @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) public @interface InstanceScope { String value(); } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/scope/ApplicationScopeFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/scope/ApplicationScope0000644000175000017500000000307410567273335033317 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.scope; import org.jboss.metadata.spi.scope.CommonLevels; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeFactory; /** * Factory for creating Application scope key * from ApplicationScope annotation. * * @author Ales Justin */ public class ApplicationScopeFactory implements ScopeFactory { public Scope create(ApplicationScope annotation) { return new Scope(CommonLevels.APPLICATION, annotation.value()); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/scope/InstanceScopeFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/scope/InstanceScopeFac0000644000175000017500000000305210564102651033213 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.scope; import org.jboss.metadata.spi.scope.CommonLevels; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeFactory; /** * Factory for creating Instance scope key * from InstanceScope annotation. * * @author Ales Justin */ public class InstanceScopeFactory implements ScopeFactory { public Scope create(InstanceScope annotation) { return new Scope(CommonLevels.INSTANCE, annotation.value()); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/scope/DeploymentScopeFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/scope/DeploymentScopeF0000644000175000017500000000306610564102651033270 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.scope; import org.jboss.metadata.spi.scope.CommonLevels; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeFactory; /** * Factory for creating Deployment scope key * from DeploymentScope annotation. * * @author Ales Justin */ public class DeploymentScopeFactory implements ScopeFactory { public Scope create(DeploymentScope annotation) { return new Scope(CommonLevels.DEPLOYMENT, annotation.value()); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/scope/ApplicationScope.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/scope/ApplicationScope0000644000175000017500000000305510567273335033316 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.scope; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.jboss.metadata.spi.scope.ScopeFactoryLookup; /** * Application scope annotation. * * @author Ales Justin */ @ScopeFactoryLookup(ApplicationScopeFactory.class) @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) public @interface ApplicationScope { String value(); } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/context/0000755000175000017500000000000011620305601030465 5ustar twernertwerner././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/context/CachingMetaDataContext.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/context/CachingMetaDat0000644000175000017500000002556211041642153033221 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.context; import java.lang.annotation.Annotation; import java.util.Collections; import java.util.List; import org.jboss.metadata.plugins.cache.Cache; import org.jboss.metadata.plugins.cache.CacheFactory; import org.jboss.metadata.plugins.cache.CacheItem; import org.jboss.metadata.plugins.cache.DefaultCacheFactory; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDatasItem; import org.jboss.metadata.spi.scope.ScopeLevel; import org.jboss.metadata.spi.signature.Signature; /** * CachingMetaDataContext. * * @author Adrian Brock * @author Ales Justin * @version $Revision: 76136 $ */ public class CachingMetaDataContext extends AbstractMetaDataContext { /** The annotations */ @SuppressWarnings("unchecked") private volatile Cache annotations; /** MetaData by name */ @SuppressWarnings("unchecked") private volatile Cache metaDataByName; /** All annotations */ private volatile CacheItem cachedAnnotationsItem; /** All meta data */ private volatile CacheItem cachedMetaDatasItem; /** Cached components */ private volatile Cache cachedComponents; /** The valid time */ private volatile long validTime; /** Is empty */ private volatile Boolean empty; /** Scoped contexs */ private volatile Cache cachedScopedRetrievals; /** The cache factory */ private CacheFactory factory; /** The fqn */ private String fqn; /** * Create a new CachingMetaDataContext. * * @param retrieval the retrieval */ public CachingMetaDataContext(MetaDataRetrieval retrieval) { this(null, retrieval); } /** * Create a new CachingMetaDataContext. * * @param retrieval the retrieval * @param factory the cache factory */ public CachingMetaDataContext(MetaDataRetrieval retrieval, CacheFactory factory) { this(null, retrieval, factory); } /** * Create a new CachingMetaDataContext. * * @param parent the parent * @param retrieval the retrieval */ public CachingMetaDataContext(MetaDataContext parent, MetaDataRetrieval retrieval) { this(parent, Collections.singletonList(retrieval)); } /** * Create a new CachingMetaDataContext. * * @param parent the parent * @param retrieval the retrieval * @param factory the cache factory */ public CachingMetaDataContext(MetaDataContext parent, MetaDataRetrieval retrieval, CacheFactory factory) { this(parent, Collections.singletonList(retrieval), factory); } /** * Create a new CachingMetaDataContext. * * @param parent the parent * @param retrievals the retrievals */ public CachingMetaDataContext(MetaDataContext parent, List retrievals) { this(parent, retrievals, null); } /** * Create a new CachingMetaDataContext. * * @param parent the parent * @param retrievals the retrievals * @param factory the cache factory */ public CachingMetaDataContext(MetaDataContext parent, List retrievals, CacheFactory factory) { super(parent, retrievals); if (factory == null) factory = new DefaultCacheFactory(); validTime = getValidTime().getValidTime(); this.factory = factory; this.fqn = factory.createFqn(this); } /** * Get fqn for this instance. * * @return the instance's fqn */ protected String getFqn() { return fqn; } public AnnotationsItem retrieveAnnotations() { if (cachedAnnotationsItem == null) cachedAnnotationsItem = factory.createCacheItem(AnnotationsItem.class, getFqn()); AnnotationsItem item = cachedAnnotationsItem.get(); if (item == null) { item = super.retrieveAnnotations(); cachedAnnotationsItem.put(item); } return item; } @SuppressWarnings("unchecked") public AnnotationItem retrieveAnnotation(Class annotationType) { if (annotationType == null) throw new IllegalArgumentException("Null annotationType"); String annotationName = annotationType.getName(); long newValidTime = getValidTime().getValidTime(); if (validTime < newValidTime) { clearCache(annotations); clearCache(metaDataByName); validTime = newValidTime; } if (annotations != null) { AnnotationItem result = annotations.get(annotationName); if (result != null) { if (result.isValid()) return result; annotations.remove(annotationName); } } AnnotationItem result = super.retrieveAnnotation(annotationType); if (result != null && result.isCachable()) { if (annotations == null) annotations = factory.createCache(String.class, AnnotationItem.class, getFqn()); annotations.put(annotationName, result); } return result; } 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); } return item; } @SuppressWarnings("unchecked") public MetaDataItem retrieveMetaData(Class type) { if (type == null) throw new IllegalArgumentException("Null type"); String name = type.getName(); long newValidTime = getValidTime().getValidTime(); if (validTime < newValidTime) { clearCache(annotations); clearCache(metaDataByName); validTime = newValidTime; } if (metaDataByName != null) { MetaDataItem result = metaDataByName.get(name); if (result != null) { if (result.isValid()) return result; metaDataByName.remove(name); } } MetaDataItem result = super.retrieveMetaData(type); if (result != null && result.isCachable()) { if (metaDataByName == null) metaDataByName = factory.createCache(String.class, MetaDataItem.class, getFqn()); metaDataByName.put(name, result); } return result; } public MetaDataItem retrieveMetaData(String name) { if (name == null) throw new IllegalArgumentException("Null name"); long newValidTime = getValidTime().getValidTime(); if (validTime < newValidTime) { clearCache(annotations); clearCache(metaDataByName); validTime = newValidTime; } if (metaDataByName != null) { MetaDataItem result = metaDataByName.get(name); if (result != null) { if (result.isValid()) return result; metaDataByName.remove(name); } } MetaDataItem result = super.retrieveMetaData(name); if (result != null && result.isCachable()) { if (metaDataByName == null) metaDataByName = factory.createCache(String.class, MetaDataItem.class, getFqn()); metaDataByName.put(name, result); } return result; } public void append(MetaDataRetrieval retrieval) { super.append(retrieval); clearCache(cachedComponents); clearCache(cachedScopedRetrievals); empty = null; } public void prepend(MetaDataRetrieval retrieval) { super.prepend(retrieval); clearCache(cachedComponents); clearCache(cachedScopedRetrievals); empty = null; } public void remove(MetaDataRetrieval retrieval) { super.remove(retrieval); clearCache(cachedComponents); clearCache(cachedScopedRetrievals); empty = null; } public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature) { if (signature == null) return null; if (cachedComponents != null) { MetaDataRetrieval retrieval = cachedComponents.get(signature); if (retrieval != null) return retrieval; } MetaDataRetrieval retrieval = super.getComponentMetaDataRetrieval(signature); if (retrieval != null) { if (cachedComponents == null) cachedComponents = factory.createCache(Signature.class, MetaDataRetrieval.class, getFqn()); cachedComponents.put(signature, retrieval); } return retrieval; } public boolean isEmpty() { if (empty == null) empty = super.isEmpty(); return empty; } public MetaDataRetrieval getScopedRetrieval(ScopeLevel level) { if (level == null) return null; if (cachedScopedRetrievals != null) { MetaDataRetrieval retrieval = cachedScopedRetrievals.get(level); if (retrieval != null) return retrieval; } MetaDataRetrieval retrieval = super.getScopedRetrieval(level); if (retrieval != null) { if (cachedScopedRetrievals == null) cachedScopedRetrievals = factory.createCache(ScopeLevel.class, MetaDataRetrieval.class, getFqn()); cachedScopedRetrievals.put(level, retrieval); } return retrieval; } /** * Clear cache. * * @param cache the cache to clear */ protected void clearCache(Cache cache) { if (cache != null) cache.clear(); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/context/AbstractMetaDataContext.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/context/AbstractMetaDa0000644000175000017500000002247610756326650033262 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.context; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDatasItem; import org.jboss.metadata.spi.retrieval.ValidTime; import org.jboss.metadata.spi.retrieval.cummulative.CummulativeAnnotationsItem; import org.jboss.metadata.spi.retrieval.cummulative.CummulativeMetaDatasItem; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.scope.ScopeLevel; import org.jboss.metadata.spi.signature.Signature; /** * AbstractMetaDataContext. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class AbstractMetaDataContext implements MetaDataContext { /** The meta data retrievals */ private List retrievals; /** The parent context */ private MetaDataContext parent; /** The scope */ private volatile ScopeKey scopeKey; /** * Create a new AbstractMetaDataContext. * * @param retrieval the retrieval */ public AbstractMetaDataContext(MetaDataRetrieval retrieval) { this(null, retrieval); } /** * Create a new AbstractMetaDataContext. * * @param parent the parent * @param retrieval the retrieval */ public AbstractMetaDataContext(MetaDataContext parent, MetaDataRetrieval retrieval) { this(parent, Collections.singletonList(retrieval)); } /** * Create a new AbstractMetaDataContext. * * @param parent the parent * @param retrievals the retrievals */ public AbstractMetaDataContext(MetaDataContext parent, List retrievals) { if (retrievals == null) throw new IllegalArgumentException("Null retrievals"); if (retrievals.isEmpty()) throw new IllegalArgumentException("Must have at least one retrieval"); for (MetaDataRetrieval retrieval : retrievals) { if (retrieval == null) throw new IllegalArgumentException("Null retrieval"); } this.parent = parent; this.retrievals = retrievals; } public ScopeKey getScope() { if (scopeKey == null) { ScopeKey key = new ScopeKey(); for (MetaDataRetrieval retrieval : getRetrievals()) { ScopeKey retrievalKey = retrieval.getScope(); Collection scopes = retrievalKey.getScopes(); for (Scope scope : scopes) key.addScope(scope); } scopeKey = key; } return scopeKey; } public ValidTime getValidTime() { ValidTime result = null; long resultLong = Long.MIN_VALUE; if (parent != null) { result = parent.getValidTime(); resultLong = result.getValidTime(); } for (MetaDataRetrieval retrieval : retrievals) { ValidTime temp = retrieval.getValidTime(); long tempLong = temp.getValidTime(); if (tempLong > resultLong || result == null) { result = temp; resultLong = tempLong; } } return result; } public MetaDataContext getParent() { return parent; } public List getRetrievals() { if (parent == null) return retrievals; List result = new ArrayList(retrievals); result.add(parent); return result; } public List getLocalRetrievals() { return retrievals; } public void append(MetaDataRetrieval retrieval) { if (retrieval == null) throw new IllegalArgumentException("Null retrieval"); if (retrievals instanceof CopyOnWriteArrayList == false) retrievals = new CopyOnWriteArrayList(retrievals); retrievals.add(retrieval); scopeKey = null; } public void prepend(MetaDataRetrieval retrieval) { if (retrieval == null) throw new IllegalArgumentException("Null retrieval"); if (retrievals instanceof CopyOnWriteArrayList == false) retrievals = new CopyOnWriteArrayList(retrievals); retrievals.add(0, retrieval); scopeKey = null; } public void remove(MetaDataRetrieval retrieval) { if (retrieval == null) throw new IllegalArgumentException("Null retrieval"); if (retrievals.size() == 1) throw new IllegalStateException("Must have at least one retrieval"); retrievals.remove(retrieval); scopeKey = null; } public AnnotationsItem retrieveAnnotations() { return new CummulativeAnnotationsItem(this, true); } public AnnotationsItem retrieveLocalAnnotations() { return new CummulativeAnnotationsItem(this, false); } public AnnotationItem retrieveAnnotation(Class annotationType) { for (MetaDataRetrieval retrieval : retrievals) { AnnotationItem item = retrieval.retrieveAnnotation(annotationType); if (item != null) return item; } if (parent != null) return parent.retrieveAnnotation(annotationType); return null; } public MetaDatasItem retrieveMetaData() { return new CummulativeMetaDatasItem(this, true); } public MetaDatasItem retrieveLocalMetaData() { return new CummulativeMetaDatasItem(this, false); } public MetaDataItem retrieveMetaData(Class type) { for (MetaDataRetrieval retrieval : retrievals) { MetaDataItem item = retrieval.retrieveMetaData(type); if (item != null) return item; } if (parent != null) return parent.retrieveMetaData(type); return null; } public MetaDataItem retrieveMetaData(String name) { for (MetaDataRetrieval retrieval : retrievals) { MetaDataItem item = retrieval.retrieveMetaData(name); if (item != null) return item; } if (parent != null) return parent.retrieveMetaData(name); return null; } public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature) { if (signature == null) return null; List componentRetrievals = null; for (MetaDataRetrieval retrieval : retrievals) { retrieval = retrieval.getComponentMetaDataRetrieval(signature); if (retrieval != null) { if (componentRetrievals == null) componentRetrievals = new ArrayList(); componentRetrievals.add(retrieval); } } MetaDataContext parentComponent = null; if (parent != null) parentComponent = (MetaDataContext) parent.getComponentMetaDataRetrieval(signature); if (componentRetrievals == null) return parentComponent; return new AbstractMetaDataContext(parentComponent, componentRetrievals); } public boolean isEmpty() { for(MetaDataRetrieval retrieval : retrievals) { if (retrieval.isEmpty() == false) return false; } return (parent == null || parent.isEmpty()); } public MetaDataRetrieval getScopedRetrieval(ScopeLevel level) { List matchingRetrievals = new ArrayList(); List localRetrievals = getLocalRetrievals(); for (MetaDataRetrieval localRetrieval : localRetrievals) { ScopeKey scopeKey = localRetrieval.getScope(); if (scopeKey.getScopeLevel(level) != null) matchingRetrievals.add(localRetrieval); } if (matchingRetrievals.isEmpty() == false) { if (matchingRetrievals.size() > 1) return new AbstractMetaDataContext(null, matchingRetrievals); else return matchingRetrievals.get(0); } return null; } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/repository/0000755000175000017500000000000011620305601031220 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/repository/basic/0000755000175000017500000000000011620305601032301 5ustar twernertwerner././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/repository/basic/BasicMetaDataRepository.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/repository/basic/Basic0000644000175000017500000001214510720557046033264 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.repository.basic; import java.util.Collection; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.jboss.metadata.plugins.loader.reflection.ClassMetaDataRetrievalFactory; import org.jboss.metadata.plugins.repository.AbstractMetaDataRepository; import org.jboss.metadata.plugins.repository.visitor.ChildrenMetaDataRepositoryVisitor; import org.jboss.metadata.spi.repository.MutableMetaDataRepository; import org.jboss.metadata.spi.repository.visitor.MetaDataRepositoryVisitor; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalFactory; import org.jboss.metadata.spi.scope.CommonLevels; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.scope.ScopeLevel; /** * BasicMetaDataRepository. * * @author Adrian Brock * @version $Revision: 67291 $ */ public class BasicMetaDataRepository extends AbstractMetaDataRepository implements MutableMetaDataRepository { /** The retrievals */ private Map retrievals = new ConcurrentHashMap(); /** The retrieval factories by scope level */ private Map factories = new ConcurrentHashMap(); /** * Create a new BasicMetaDataRepository. */ public BasicMetaDataRepository() { // ClassMetaData retrieval by default addMetaDataRetrievalFactory(CommonLevels.CLASS, ClassMetaDataRetrievalFactory.INSTANCE); } public MetaDataRetrieval getMetaDataRetrieval(ScopeKey key) { MetaDataRetrieval result = retrievals.get(key); if (result != null) return result; // Is this a single level? Collection scopes = key.getScopes(); if (scopes.size() != 1) return null; // See if we have a factory Scope scope = scopes.iterator().next(); ScopeLevel scopeLevel = scope.getScopeLevel(); MetaDataRetrievalFactory factory = getMetaDataRetrievalFactory(scopeLevel); if (factory == null) return null; // We have a factory, use it return factory.getMetaDataRetrieval(scope); } public Set getChildren(ScopeKey key) { if (key == null) return retrievals.keySet(); ChildrenMetaDataRepositoryVisitor visitor = new ChildrenMetaDataRepositoryVisitor(key); return matchScopes(visitor); } public Set matchScopes(MetaDataRepositoryVisitor visitor) { Set result = new HashSet(); for (ScopeKey repositoryKey : retrievals.keySet()) { if (visitor.matchScope(this, repositoryKey)) result.add(repositoryKey); } return result; } public MetaDataRetrieval addMetaDataRetrieval(MetaDataRetrieval retrieval) { if (retrieval == null) throw new IllegalArgumentException("Null retrieval"); ScopeKey key = retrieval.getScope(); key.freeze(); return retrievals.put(key, retrieval); } public MetaDataRetrieval removeMetaDataRetrieval(ScopeKey key) { if (key == null) throw new IllegalArgumentException("Null key"); return retrievals.remove(key); } public MetaDataRetrievalFactory addMetaDataRetrievalFactory(ScopeLevel level, MetaDataRetrievalFactory factory) { if (level == null) throw new IllegalArgumentException("Null level"); if (factory == null) throw new IllegalArgumentException("Null factory"); return factories.put(level,factory); } public MetaDataRetrievalFactory getMetaDataRetrievalFactory(ScopeLevel level) { if (level == null) throw new IllegalArgumentException("Null level"); return factories.get(level); } public MetaDataRetrievalFactory removeMetaDataRetrievalFactory(ScopeLevel level) { if (level == null) throw new IllegalArgumentException("Null level"); return factories.remove(level); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/repository/AbstractMetaDataRepository.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/repository/AbstractMet0000644000175000017500000000335010454442653033372 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.repository; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.repository.MetaDataRepository; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge; import org.jboss.metadata.spi.scope.ScopeKey; /** * AbstractMetaDataRepository. * * @author Adrian Brock * @version $Revision: 46146 $ */ public abstract class AbstractMetaDataRepository implements MetaDataRepository { public MetaData getMetaData(ScopeKey key) { MetaDataRetrieval retrieval = getMetaDataRetrieval(key); if (retrieval == null) return null; return new MetaDataRetrievalToMetaDataBridge(retrieval); } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/repository/visitor/0000755000175000017500000000000011620305601032717 5ustar twernertwerner././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/repository/visitor/FuzzyMetaDataRepositoryVisitor.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/repository/visitor/Fuz0000644000175000017500000000635710454442653033436 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.repository.visitor; import java.util.Collection; import java.util.Iterator; import org.jboss.metadata.spi.repository.MetaDataRepository; import org.jboss.metadata.spi.repository.visitor.MetaDataRepositoryVisitor; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.scope.ScopeLevel; /** * FuzzyMetaDataRepositoryVisitor. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class FuzzyMetaDataRepositoryVisitor implements MetaDataRepositoryVisitor { /** The key scopes */ private Scope[] matchScopes; /** * Create a new FuzzyMetaDataRepositoryVisitor. * * @param matchKey the match key */ public FuzzyMetaDataRepositoryVisitor(ScopeKey matchKey) { if (matchKey != null) { Collection testScopes = matchKey.getScopes(); matchScopes = testScopes.toArray(new Scope[testScopes.size()]); } } public boolean matchScope(MetaDataRepository repository, ScopeKey key) { if (matchScopes == null || matchScopes.length == 0) return true; boolean match = false; int index = 0; Iterator i = key.getScopes().iterator(); Scope repositoryScope = i.next(); Scope matchScope = matchScopes[index]; while (true) { ScopeLevel keyLevel = matchScope.getScopeLevel(); ScopeLevel repositoryLevel = repositoryScope.getScopeLevel(); // Same level if (keyLevel.compareTo(repositoryLevel) == 0) { if (matchScope.equals(repositoryScope)) match = true; else { // No match, we are done match = false; break; } } // Key is next if (keyLevel.compareTo(repositoryLevel) <= 0) { // Ran out of keys if (++index == matchScopes.length) break; matchScope = matchScopes[index]; } else { // Ran out of keys if (i.hasNext() == false) break; repositoryScope = i.next(); } } return match; } } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/repository/visitor/ChildrenMetaDataRepositoryVisitor.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/repository/visitor/Chi0000644000175000017500000000361110454442653033363 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.repository.visitor; import org.jboss.metadata.spi.repository.MetaDataRepository; import org.jboss.metadata.spi.repository.visitor.MetaDataRepositoryVisitor; import org.jboss.metadata.spi.scope.ScopeKey; /** * FuzzyMetaDataRepositoryVisitor. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class ChildrenMetaDataRepositoryVisitor implements MetaDataRepositoryVisitor { /** The parent */ private ScopeKey parent; /** * Create a new ChildrenMetaDataRepositoryVisitor. * * @param parent the parent */ public ChildrenMetaDataRepositoryVisitor(ScopeKey parent) { if (parent == null) throw new IllegalArgumentException("Null parent"); this.parent = parent; } public boolean matchScope(MetaDataRepository repository, ScopeKey key) { return parent.isParent(key); } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/0000755000175000017500000000000011620305601030044 5ustar twernertwerner././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/CachePolicyFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/CachePolicyFacto0000644000175000017500000000252611033103725033135 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.cache; import org.jboss.util.CachePolicy; /** * Cache policy factory. * * @author Ales Justin */ public interface CachePolicyFactory { /** * Create cache policy. * * @return the cache policy */ CachePolicy createCachePolicy(); }libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/CacheItem.java0000644000175000017500000000303611032701025032530 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.cache; /** * Simple cache item. * * Candidate to be purged via * similar cache mechanisms. * * @param value key type * @author Ales Justin */ public interface CacheItem { /** * Put value. * * @param value the value * @return old value if exists */ V put(V value); /** * Get value. * * @return old value if exists */ V get(); /** * Clear node. */ void clear(); }././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/CacheFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/CacheFactory.jav0000644000175000017500000000367611041642153033120 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.cache; /** * Simple cache factory. * * @author Ales Justin */ public interface CacheFactory { /** * Create the owner's fqn. * * @param owner the factory owner instance * @return owner's fqn */ String createFqn(Object owner); /** * Create cache. * * @param the key class * @param the value class * @param keyClass the key class * @param valueClass the value class * @param rootFqn the root fqn * @return new cache instance */ Cache createCache(Class keyClass, Class valueClass, String rootFqn); /** * Create cache. * * @param the value class * @param valueClass the value class * @param rootFqn the root fqn * @return new cache instance */ CacheItem createCacheItem(Class valueClass, String rootFqn); }libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/Cache.java0000644000175000017500000000333111032701025031707 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.cache; /** * Simple cache interface. * * @param exact key type * @param value key type * @author Ales Justin */ public interface Cache { /** * Put value under key. * * @param key the key * @param value the value * @return old value if exists */ V put(K key, V value); /** * Get value under key. * * @param key the key * @return old value if exists */ V get(K key); /** * Remove value under key. * * @param key the key * @return removed value */ V remove(K key); /** * Clear node. */ void clear(); } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/ConcurrentLRUCachePolicyFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/ConcurrentLRUCac0000644000175000017500000000372211041642153033112 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.cache; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.jboss.util.CachePolicy; import org.jboss.util.LRUCachePolicy; /** * Concurrent LRU cache policy factory. * * @author Ales Justin */ public class ConcurrentLRUCachePolicyFactory implements CachePolicyFactory { private int min; private int max; public ConcurrentLRUCachePolicyFactory(int min, int max) { this.min = min; this.max = max; } public CachePolicy createCachePolicy() { return new ConcurrentLRUCachePolicy(min, max); } private class ConcurrentLRUCachePolicy extends LRUCachePolicy { private ConcurrentLRUCachePolicy(int min, int max) { super(min, max); } @SuppressWarnings("unchecked") protected Map createMap() { return new ConcurrentHashMap(); } } }././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/SynchronizedCachePolicyFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/SynchronizedCach0000644000175000017500000000333311033103725033230 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.cache; import org.jboss.util.CachePolicy; import org.jboss.util.SynchronizedCachePolicy; /** * Synchronized cache policy factory. * * @author Ales Justin */ public class SynchronizedCachePolicyFactory implements CachePolicyFactory { private CachePolicyFactory factory; public SynchronizedCachePolicyFactory(CachePolicyFactory factory) { if (factory == null) throw new IllegalArgumentException("Null factory"); this.factory = factory; } public CachePolicy createCachePolicy() { CachePolicy policy = factory.createCachePolicy(); return new SynchronizedCachePolicy(policy); } }././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/ConcurrentHashMapCache.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/ConcurrentHashMa0000644000175000017500000000326211041642153033201 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.cache; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * Simple map backed-up cache. * * @param the key class * @param the value class * @author Ales Justin */ public class ConcurrentHashMapCache implements Cache { private Map map = new ConcurrentHashMap(); public V put(K key, V value) { return map.put(key, value); } public V get(K key) { return map.get(key); } public V remove(K key) { return map.remove(key); } public void clear() { map.clear(); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/LRUCachePolicyFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/LRUCachePolicyFa0000644000175000017500000000304411033103725033006 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.cache; import org.jboss.util.CachePolicy; import org.jboss.util.LRUCachePolicy; /** * LRU cache policy factory. * * @author Ales Justin */ public class LRUCachePolicyFactory implements CachePolicyFactory { private int min; private int max; public LRUCachePolicyFactory(int min, int max) { this.min = min; this.max = max; } public CachePolicy createCachePolicy() { return new LRUCachePolicy(min, max); } }././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/TimedCachePolicyFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/TimedCachePolicy0000644000175000017500000000375111033103725033144 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.cache; import org.jboss.util.CachePolicy; import org.jboss.util.TimedCachePolicy; /** * Timed cache policy factory. * * @author Ales Justin */ public class TimedCachePolicyFactory implements CachePolicyFactory { private int defaultLifetime; private boolean threadSafe; private int resolution; public TimedCachePolicyFactory() { this(30*60, false, 0); } public TimedCachePolicyFactory(int defaultLifetime) { this(defaultLifetime, false, 0); } public TimedCachePolicyFactory(int defaultLifetime, boolean threadSafe, int resolution) { this.defaultLifetime = defaultLifetime; this.threadSafe = threadSafe; if( resolution <= 0 ) resolution = 60; this.resolution = resolution; } public CachePolicy createCachePolicy() { return new TimedCachePolicy(defaultLifetime, threadSafe, resolution); } }././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/CachePolicyCacheFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/CachePolicyCache0000644000175000017500000001154711033103725033107 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.cache; import java.util.ArrayList; import java.util.List; import java.util.ListIterator; import org.jboss.logging.Logger; import org.jboss.util.CachePolicy; /** * Cache policy cache factory. * * @author Ales Justin */ public class CachePolicyCacheFactory implements CacheFactory { private static final Logger log = Logger.getLogger(CachePolicyCacheFactory.class); private CachePolicyFactory factory; private List policies; public CachePolicyCacheFactory(CachePolicyFactory factory) { if (factory == null) throw new IllegalArgumentException("Null factory"); this.factory = factory; this.policies = new ArrayList(); } public String createFqn(Object owner) { return null; } /** * Create cache policy. * * @return the cache policy */ protected CachePolicy createCachePolicy() { try { CachePolicy policy = factory.createCachePolicy(); policy.create(); policy.start(); policies.add(policy); return policy; } catch (Exception e) { if (e instanceof RuntimeException) throw (RuntimeException)e; else throw new RuntimeException(e); } } public Cache createCache(Class keyClass, Class valueClass, String rootFqn) { return new CachePolicyCache(createCachePolicy()); } public CacheItem createCacheItem(Class valueClass, String rootFqn) { return new CachePolicyCacheItem(createCachePolicy()); } /** * Stop created policies. */ public void stop() { ListIterator iter = policies.listIterator(policies.size()); while(iter.hasPrevious()) { CachePolicy policy = iter.previous(); try { policy.stop(); } catch (Throwable t) { log.debug("Exception while stopping policy: " + policy + ", problem: " + t); } } } /** * Destroy created policies. */ public void destroy() { ListIterator iter = policies.listIterator(policies.size()); while(iter.hasPrevious()) { CachePolicy policy = iter.previous(); try { policy.destroy(); } catch (Throwable t) { log.debug("Exception while destroying policy: " + policy + ", problem: " + t); } } policies.clear(); } @SuppressWarnings("unchecked") private static class CachePolicyCache implements Cache { private CachePolicy policy; private CachePolicyCache(CachePolicy policy) { if (policy == null) throw new IllegalArgumentException("Null policy"); this.policy = policy; } public V put(K key, V value) { V old = (V)policy.get(key); policy.insert(key, value); return old; } public V get(K key) { return (V)policy.get(key); } public V remove(K key) { V old = (V)policy.get(key); policy.remove(key); return old; } public void clear() { policy.flush(); } } private static class CachePolicyCacheItem extends CachePolicyCache implements CacheItem { private static final Object KEY = ""; private CachePolicyCacheItem(CachePolicy policy) { super(policy); } public V put(V value) { return put(KEY, value); } public V get() { return get(KEY); } } }././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/DefaultCacheFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/cache/DefaultCacheFact0000644000175000017500000000402511033103725033077 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.cache; /** * Default cache factory - legacy mock. * * @author Ales Justin */ public class DefaultCacheFactory implements CacheFactory { public String createFqn(Object owner) { // no need for fqn return null; } public Cache createCache(Class keyClass, Class valueClass, String rootFqn) { return new ConcurrentHashMapCache(); } public CacheItem createCacheItem(Class valueClass, String rootFqn) { return new InMemoryCacheItem(); } /** * Simple in memory item. */ private class InMemoryCacheItem implements CacheItem { private V value; public V put(V value) { V oldValue = this.value; this.value = value; return oldValue; } public V get() { return value; } public void clear() { value = null; } } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/signature/0000755000175000017500000000000011620305601031002 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/signature/SignatureNameUtil.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/signature/SignatureNam0000644000175000017500000000321111216160102033313 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.signature; import java.util.Arrays; /** * Common / helper to turn signature into string. * * @author Kabir Khan * @version $Revision: 1.1 $ */ public class SignatureNameUtil { /** * Append name and parameters. * * @param builder the string builder * @param name the name * @param parameters the parameters */ public static void signatureToString(StringBuilder builder, String name, String[] parameters) { if (name != null) builder.append(name); if (parameters != null) builder.append(Arrays.asList(parameters)); } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/0000755000175000017500000000000011620305602030250 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/SimpleMetaDataLoader.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/SimpleMetaDataL0000644000175000017500000000447710667274502033173 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.loader; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationItem; import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationsItem; /** * SimpleMetaDataLoader. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class SimpleMetaDataLoader extends BasicMetaDataLoader { /** The annotations */ private AnnotationsItem annotationsItem; /** * Create a new SimpleMetaDataLoader. * * @param annotations the annoations */ @SuppressWarnings("unchecked") public SimpleMetaDataLoader(Annotation[] annotations) { if (annotations == null) throw new IllegalArgumentException("Null annotations"); AnnotationItem[] annotationItems = new AnnotationItem[annotations.length]; for (int i = 0; i < annotations.length; ++i) annotationItems[i] = new SimpleAnnotationItem(annotations[i]); annotationsItem = new SimpleAnnotationsItem(annotationItems); } public AnnotationsItem retrieveAnnotations() { return annotationsItem; } public boolean isEmpty() { return annotationsItem.getAnnotations().length == 0; } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/memory/0000755000175000017500000000000011620305601031557 5ustar twernertwerner././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/memory/MemoryMetaDataLoader.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/memory/MemoryMe0000644000175000017500000003106310756326650033257 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.loader.memory; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.Collection; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.jboss.metadata.plugins.loader.AbstractMutableComponentMetaDataLoader; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.Item; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDatasItem; import org.jboss.metadata.spi.retrieval.basic.BasicAnnotationItem; import org.jboss.metadata.spi.retrieval.basic.BasicAnnotationsItem; import org.jboss.metadata.spi.retrieval.basic.BasicMetaDataItem; import org.jboss.metadata.spi.retrieval.basic.BasicMetaDatasItem; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.signature.Signature; /** * MemoryMetaDataLoader. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class MemoryMetaDataLoader extends AbstractMutableComponentMetaDataLoader { /** The annotations */ private volatile Map> annotations; /** MetaData by name */ private volatile Map> metaDataByName; /** All annotations */ private volatile BasicAnnotationsItem cachedAnnotationsItem; /** All meta data */ private volatile BasicMetaDatasItem cachedMetaDatasItem; /** Whether we should cache items */ private final boolean cachable; /** * Create a new MemoryMetaDataLoader. */ public MemoryMetaDataLoader() { this(true, false); } /** * Create a new MemoryMetaDataLoader. * * @param cachable whether items produced should be cachable * @param restricted whether restricted items are allowed */ public MemoryMetaDataLoader(boolean cachable, boolean restricted) { super(restricted); this.cachable = cachable; } /** * Create a new MemoryMetaDataLoader. * * @param scope the scope key */ public MemoryMetaDataLoader(ScopeKey scope) { this(scope, true, false); } /** * Create a new MemoryMetaDataLoader. * * @param scope the scope key * @param cachable whether items produced should be cachable * @param restricted whether restricted items are allowed */ public MemoryMetaDataLoader(ScopeKey scope, boolean cachable, boolean restricted) { super(scope, restricted); this.cachable = cachable; } public boolean isCachable(Item item) { return cachable; } @SuppressWarnings("unchecked") public AnnotationsItem retrieveAnnotations() { BasicAnnotationsItem result = cachedAnnotationsItem; if (result != null && result.isValid()) return result; Map> temp = annotations; if (temp == null) return noAnnotations(); Collection> values = temp.values(); if (values.isEmpty()) return noAnnotations(); AnnotationItem[] items = values.toArray(new AnnotationItem[values.size()]); result = new BasicAnnotationsItem(this, items); cachedAnnotationsItem = result; return result; } @SuppressWarnings("unchecked") public AnnotationItem retrieveAnnotation(Class annotationType) { Map> temp = annotations; if (temp == null) return null; return (AnnotationItem) temp.get(annotationType.getName()); } @SuppressWarnings("unchecked") public T addAnnotation(T annotation) { if (annotation == null) throw new IllegalArgumentException("Null annotation"); checkRestricted(annotation); synchronized (this) { if (annotations == null) annotations = new ConcurrentHashMap>(); } T result = null; Class annotationType = annotation.annotationType(); BasicAnnotationItem old = (BasicAnnotationItem) annotations.get(annotationType.getName()); if (old != null) { result = old.getAnnotation(); if (result == annotation) return result; old.invalidate(); } BasicAnnotationItem item = new BasicAnnotationItem(this, annotation); annotations.put(annotationType.getName(), item); invalidateAnnotationsItem(); invalidateMetaDatasItem(); invalidate(); return result; } @SuppressWarnings("unchecked") public T removeAnnotation(Class annotationType) { if (annotations == null) return null; BasicAnnotationItem annotation = (BasicAnnotationItem) annotations.remove(annotationType.getName()); if (annotation == null) return null; annotation.invalidate(); invalidateAnnotationsItem(); invalidateMetaDatasItem(); return annotation.getAnnotation(); } public MetaDatasItem retrieveMetaData() { BasicMetaDatasItem result = cachedMetaDatasItem; if (result != null && result.isValid()) return result; Collection> all = null; Map> temp1 = annotations; if (temp1 != null && temp1.size() > 0) { all = new ArrayList>(); Collection> values = temp1.values(); all.addAll(values); } Map> temp2 = metaDataByName; if (temp2 != null && temp2.size() > 0) { if (all == null) all = new ArrayList>(); Collection> values = temp2.values(); all.addAll(values); } if (all == null) return noMetaDatas(); MetaDataItem[] metaDataItems = all.toArray(new MetaDataItem[all.size()]); result = new BasicMetaDatasItem(this, metaDataItems); cachedMetaDatasItem = result; return result; } @SuppressWarnings("unchecked") public MetaDataItem retrieveMetaData(Class type) { MetaDataItem result = super.retrieveMetaData(type); if (result != null) return result; Map temp = metaDataByName; if (temp == null) return null; return (MetaDataItem) temp.get(type.getName()); } public MetaDataItem retrieveMetaData(String name) { Map> temp = metaDataByName; if (temp != null) { MetaDataItem result = temp.get(name); if (result != null) return result; } Map> temp2 = annotations; if (temp2 != null) return temp2.get(name); return null; } @SuppressWarnings("unchecked") public T addMetaData(T metaData, Class type) { if (metaData == null) throw new IllegalArgumentException("Null metaData"); if (type == null) throw new IllegalArgumentException("Null type"); if (metaData instanceof Annotation) return (T) addAnnotation((Annotation) metaData); checkRestricted(type); synchronized (this) { if (metaDataByName == null) metaDataByName = new ConcurrentHashMap>(); } T result = null; BasicMetaDataItem old = (BasicMetaDataItem) metaDataByName.get(type.getName()); if (old != null) { result = old.getValue(); if (result == metaData) return result; old.invalidate(); } BasicMetaDataItem item = new BasicMetaDataItem(this, type.getName(), metaData); metaDataByName.put(type.getName(), item); invalidateMetaDatasItem(); invalidate(); return result; } @SuppressWarnings("unchecked") public T removeMetaData(Class type) { if (type == null) throw new IllegalArgumentException("Null type"); if (type.isAnnotation()) return (T) removeAnnotation((Class) type); if (metaDataByName == null) return null; BasicMetaDataItem result = (BasicMetaDataItem) metaDataByName.remove(type.getName()); if (result == null) return null; result.invalidate(); invalidateMetaDatasItem(); return result.getValue(); } @SuppressWarnings("unchecked") public T addMetaData(String name, T metaData, Class type) { if (name == null) throw new IllegalArgumentException("Null name"); if (metaData == null) throw new IllegalArgumentException("Null metaData"); if (type == null) throw new IllegalArgumentException("Null type"); checkRestricted(type); synchronized (this) { if (metaDataByName == null) metaDataByName = new ConcurrentHashMap>(); } T result = null; BasicMetaDataItem old = (BasicMetaDataItem) metaDataByName.get(name); if (old != null) { result = old.getValue(); if (result == metaData) return result; old.invalidate(); } BasicMetaDataItem item = new BasicMetaDataItem(this, name, metaData); metaDataByName.put(name, item); invalidateMetaDatasItem(); invalidate(); return result; } @SuppressWarnings("unchecked") public T removeMetaData(String name, Class type) { if (name == null) throw new IllegalArgumentException("Null name"); Map> temp = metaDataByName; if (temp == null) return null; BasicMetaDataItem result = (BasicMetaDataItem) temp.remove(name); if (result == null) return null; result.invalidate(); invalidateMetaDatasItem(); return result.getValue(); } public boolean isEmpty() { return isNullOrEmpty(annotations) && isNullOrEmpty(metaDataByName) && super.isEmpty(); } /** * Invalidate the annotations item */ protected void invalidateAnnotationsItem() { BasicAnnotationsItem temp = cachedAnnotationsItem; if (temp != null) { temp.invalidate(); cachedAnnotationsItem = null; } } /** * Set no annotations * * @return no annotations */ protected BasicAnnotationsItem noAnnotations() { BasicAnnotationsItem result = new BasicAnnotationsItem(this, BasicAnnotationsItem.NO_ANNOTATION_ITEMS); cachedAnnotationsItem = result; return result; } /** * Invalidate the metaDatas item */ protected void invalidateMetaDatasItem() { BasicMetaDatasItem temp = cachedMetaDatasItem; if (temp != null) { temp.invalidate(); cachedMetaDatasItem = null; } } /** * Set no meta data * * @return no meta data */ protected BasicMetaDatasItem noMetaDatas() { BasicMetaDatasItem result = new BasicMetaDatasItem(this, BasicMetaDatasItem.NO_META_DATA_ITEMS); cachedMetaDatasItem = result; return result; } @Override protected MetaDataRetrieval initComponentRetrieval(Signature signature) { return new MemoryMetaDataLoader(); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/AbstractMutableComponentMetaDataLoader.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/AbstractMutable0000644000175000017500000001741710720557046033275 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.loader; import java.lang.annotation.Annotation; import java.lang.reflect.Member; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.jboss.metadata.spi.ComponentMutableMetaData; import org.jboss.metadata.spi.MutableMetaData; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.signature.Signature; import org.jboss.reflect.spi.MemberInfo; /** * AbstractMutableComponentMetaDataLoader. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractMutableComponentMetaDataLoader extends AbstractMutableMetaDataLoader implements ComponentMutableMetaData { /** The component metadata */ private volatile Map components; /** * Create a new AbstractMutableComponentMetaDataLoader. */ public AbstractMutableComponentMetaDataLoader() { this(false); } /** * Create a new AbstractMutableComponentMetaDataLoader. * * @param restricted whether items are restricted */ public AbstractMutableComponentMetaDataLoader(boolean restricted) { super(restricted); } /** * Create a new AbstractComponentMutableMetaDataLoader. * * @param key the scope key */ public AbstractMutableComponentMetaDataLoader(ScopeKey key) { this(key, false); } /** * Create a new AbstractComponentMetaDataLoader. * * @param key the scope key * @param restricted whether the context is restricted */ public AbstractMutableComponentMetaDataLoader(ScopeKey key, boolean restricted) { super(key, restricted); } public boolean isEmpty() { return isNullOrEmpty(components); } /** * Is map null or empty. * * @param map the map * @return is null or empty */ @SuppressWarnings("unchecked") protected static boolean isNullOrEmpty(Map map) { return map == null || map.isEmpty(); } public MetaDataRetrieval addComponentMetaDataRetrieval(Signature signature, MetaDataRetrieval component) { if (signature == null) throw new IllegalArgumentException("Null signature"); if (components == null) components = new ConcurrentHashMap(); return components.put(signature, component); } public MetaDataRetrieval removeComponentMetaDataRetrieval(Signature signature) { if (signature == null) throw new IllegalArgumentException("Null signature"); if (components == null) return null; return components.remove(signature); } public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature) { if (components == null) return null; return components.get(signature); } /** * Initialise the retrieval * * @param signature the signature * @return the result */ protected MutableMetaData initRetrieval(Signature signature) { MetaDataRetrieval result = getComponentMetaDataRetrieval(signature); if (result == null) { result = initComponentRetrieval(signature); addComponentMetaDataRetrieval(signature, result); } if (result instanceof MutableMetaData == false) throw new IllegalStateException("Component is not mutable: " + signature); return (MutableMetaData) result; } /** * Initialise a component metadata retrieval * * @param signature the signature * @return the result */ protected abstract MetaDataRetrieval initComponentRetrieval(Signature signature); public T addAnnotation(Signature signature, T annotation) { MutableMetaData component = initRetrieval(signature); return component.addAnnotation(annotation); } public T addMetaData(Signature signature, String name, T metaData, Class type) { MutableMetaData component = initRetrieval(signature); return component.addMetaData(name, metaData, type); } public T addMetaData(Signature signature, T metaData, Class type) { MutableMetaData component = initRetrieval(signature); return component.addMetaData(metaData, type); } public T removeAnnotation(Signature signature, Class annotationType) { MutableMetaData component = initRetrieval(signature); return component.removeAnnotation(annotationType); } public T removeMetaData(Signature signature, Class type) { MutableMetaData component = initRetrieval(signature); return component.removeMetaData(type); } public T removeMetaData(Signature signature, String name, Class type) { MutableMetaData component = initRetrieval(signature); return component.removeMetaData(name, type); } public T addAnnotation(Member member, T annotation) { return addAnnotation(Signature.getSignature(member), annotation); } public T addAnnotation(MemberInfo member, T annotation) { return addAnnotation(Signature.getSignature(member), annotation); } public T addMetaData(Member member, String name, T metaData, Class type) { return addMetaData(Signature.getSignature(member), name, metaData, type); } public T addMetaData(Member member, T metaData, Class type) { return addMetaData(Signature.getSignature(member), metaData, type); } public T addMetaData(MemberInfo member, String name, T metaData, Class type) { return addMetaData(Signature.getSignature(member), name, metaData, type); } public T addMetaData(MemberInfo member, T metaData, Class type) { return addMetaData(Signature.getSignature(member), metaData, type); } public T removeAnnotation(Member member, Class annotationType) { return removeAnnotation(Signature.getSignature(member), annotationType); } public T removeAnnotation(MemberInfo member, Class annotationType) { return removeAnnotation(Signature.getSignature(member), annotationType); } public T removeMetaData(Member member, Class type) { return removeMetaData(Signature.getSignature(member), type); } public T removeMetaData(Member member, String name, Class type) { return removeMetaData(Signature.getSignature(member), name, type); } public T removeMetaData(MemberInfo member, Class type) { return removeMetaData(Signature.getSignature(member), type); } public T removeMetaData(MemberInfo member, String name, Class type) { return removeMetaData(Signature.getSignature(member), name, type); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/AbstractMutableMetaDataLoader.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/AbstractMutable0000644000175000017500000001067410505734347033275 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.loader; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.Restricted; import org.jboss.metadata.spi.loader.MutableMetaDataLoader; import org.jboss.metadata.spi.scope.ScopeKey; /** * AbstractMutableMetaDataLoader. * *

The default behaviour is to assume there are only * annotations with the types and names of the getMetadata() * methods interprets as annotation types and class names. * * @author Adrian Brock * @version $Revision: 57133 $ */ public abstract class AbstractMutableMetaDataLoader extends BasicMetaDataLoader implements MutableMetaDataLoader { /** Whether restricted items are allowed */ private final boolean restricted; /** * Create a new AbstractMutableMetaDataLoader. */ public AbstractMutableMetaDataLoader() { this(false); } /** * Create a new AbstractMutableMetaDataLoader. * * @param restricted whether the context is restricted */ public AbstractMutableMetaDataLoader(boolean restricted) { this.restricted = restricted; } /** * Create a new AbstractMutableMetaDataLoader. * * @param key the scope key */ public AbstractMutableMetaDataLoader(ScopeKey key) { this(key, false); } /** * Create a new AbstractMutableMetaDataLoader. * * @param key the scope key * @param restricted whether the context is restricted */ public AbstractMutableMetaDataLoader(ScopeKey key, boolean restricted) { super(key); this.restricted = restricted; } /** * Check whether an annotation is retricted * * @param annotation the annotation */ public void checkRestricted(Annotation annotation) { if (restricted) { Class annotationType = annotation.annotationType(); if (annotationType.isAnnotationPresent(Restricted.class)) throw new SecurityException("Context is restricted, not allowed to add " + annotationType.getName()); } } /** * Check whether an object is retricted * * @param type the type */ public void checkRestricted(Class type) { if (restricted && type.isAnnotationPresent(Restricted.class)) throw new SecurityException("Context is restricted, not allowed to add " + type.getName()); } @SuppressWarnings("unchecked") public T addMetaData(T metaData, Class type) { if (metaData == null) throw new IllegalArgumentException("Null metaData"); if (type == null) throw new IllegalArgumentException("Null type"); if (type.isAnnotation() == false) throw new IllegalArgumentException("Only annotation types are supported: " + type.getClass().getName()); Annotation annotation = (Annotation) metaData; return (T) addAnnotation(annotation); } @SuppressWarnings("unchecked") public T removeMetaData(Class type) { if (type == null) throw new IllegalArgumentException("Null type"); if (type.isAnnotation() == false) throw new IllegalArgumentException("Only annotation types are supported: " + type.getName()); return (T) removeAnnotation((Class) type); } public T addMetaData(String name, T metaData, Class type) { return addMetaData(metaData, type); } public T removeMetaData(String name, Class type) { return removeMetaData(type); } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/reflection/0000755000175000017500000000000011620305602032402 5ustar twernertwerner././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/reflection/SecurityActions.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/reflection/Secu0000644000175000017500000001133111216160102033216 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2008, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.loader.reflection; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import org.jboss.reflect.plugins.introspection.ReflectionUtils; /** * SecurityActions. * * @author Adrian Brock * @version $Revision: 1.1 $ */ class SecurityActions { /** * Find the method by name and parameters. * * @param clazz the class to look for method * @param name the name * @param parameterTypes the types * @return method or null if not found */ static Method findMethod(final Class clazz, final String name, final Class... parameterTypes) { SecurityManager sm = System.getSecurityManager(); if (sm == null) return ReflectionUtils.findMethod(clazz, name, parameterTypes); return AccessController.doPrivileged(new PrivilegedAction() { public Method run() { return ReflectionUtils.findMethod(clazz, name, parameterTypes); } }); } /** * Find the field by name. * * @param clazz the class to look for field * @param name the name * @return field or null if not found */ static Field findField(final Class clazz, final String name) { SecurityManager sm = System.getSecurityManager(); if (sm == null) return ReflectionUtils.findField(clazz, name); return AccessController.doPrivileged(new PrivilegedAction() { public Field run() { return ReflectionUtils.findField(clazz, name); } }); } /** * Find the constructor by parameters. * * @param clazz the class to look for constructor * @param parameterTypes the types * @return constructor or null if not found */ static Constructor findConstructor(final Class clazz, final Class... parameterTypes) { SecurityManager sm = System.getSecurityManager(); if (sm == null) return ReflectionUtils.findConstructor(clazz, parameterTypes); return AccessController.doPrivileged(new PrivilegedAction>() { public Constructor run() { return ReflectionUtils.findConstructor(clazz, parameterTypes); } }); } /** * Returns a method named methodName with params * parameterTypes declared in the declaringClass. * Methods with public, private, protected and package access are considered while * * @param declaringClass The Class declaring the method * @param methodName The name of the method * @param parameterTypes The parameters types accepted by the method * @return found declared method * @throws NoSuchMethodException If the method is not found in the declaringClass */ static Method findDeclaredMethod(final Class declaringClass, final String methodName, final Class... parameterTypes) throws NoSuchMethodException { SecurityManager sm = System.getSecurityManager(); if (sm == null) return declaringClass.getDeclaredMethod(methodName, parameterTypes); try { return AccessController.doPrivileged(new PrivilegedExceptionAction() { public Method run() throws NoSuchMethodException { return declaringClass.getDeclaredMethod(methodName, parameterTypes); } }); } catch (PrivilegedActionException pae) { throw (NoSuchMethodException) pae.getException(); } } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/reflection/ClassMetaDataRetrievalFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/reflection/Clas0000644000175000017500000000420310720572132033212 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.loader.reflection; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalFactory; import org.jboss.metadata.spi.scope.CommonLevels; import org.jboss.metadata.spi.scope.Scope; /** * ClassMetaDataRetrievalFactory. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassMetaDataRetrievalFactory implements MetaDataRetrievalFactory { /** The singleton instance */ public static final ClassMetaDataRetrievalFactory INSTANCE = new ClassMetaDataRetrievalFactory(); public MetaDataRetrieval getMetaDataRetrieval(Scope scope) { if (scope == null) throw new IllegalArgumentException("Null scope"); if (CommonLevels.CLASS.equals(scope.getScopeLevel()) == false) throw new IllegalArgumentException("Not a class scope: " + scope); // Not a class Object qualifier = scope.getQualifier(); if (qualifier instanceof Class == false) return null; Class clazz = Class.class.cast(qualifier); return new AnnotatedElementMetaDataLoader(clazz); } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/reflection/AnnotatedElementMetaDataLoader.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/reflection/Anno0000644000175000017500000003326411524770005033236 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.loader.reflection; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import org.jboss.logging.Logger; import org.jboss.metadata.plugins.loader.BasicMetaDataLoader; import org.jboss.metadata.plugins.loader.SimpleMetaDataLoader; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationItem; import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationsItem; import org.jboss.metadata.spi.scope.CommonLevels; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.signature.*; import org.jboss.util.JBossStringBuilder; import org.jboss.util.Strings; /** * AnnotatedElementMetaDataLoader. * * @author Adrian Brock * @author Carlo de Wolf * @author Ales Justin * @version $Revision: 110580 $ */ public class AnnotatedElementMetaDataLoader extends BasicMetaDataLoader { /** The log */ private static final Logger log = Logger.getLogger(AnnotatedElementMetaDataLoader.class); /** The annotated element */ private AnnotatedElement annotated; private static final ScopeKey getScopeKey(AnnotatedElement annotated) { Scope scope; if (annotated instanceof Class) { Class clazz = Class.class.cast(annotated); scope = new Scope(CommonLevels.CLASS, clazz); } else if (annotated instanceof Member) { Member member = (Member) annotated; scope = new Scope(CommonLevels.JOINPOINT, member); } else { return ScopeKey.DEFAULT_SCOPE; } return new ScopeKey(scope); } /** * Create a new AnnotatedElementMetaDataContext. * * @param annotated the annotated element */ public AnnotatedElementMetaDataLoader(AnnotatedElement annotated) { super(getScopeKey(annotated)); if (annotated == null) throw new IllegalArgumentException("Null annotated element"); this.annotated = annotated; } @SuppressWarnings("unchecked") public AnnotationsItem retrieveAnnotations() { Annotation[] annotations = annotated.getAnnotations(); if (annotations.length == 0) return SimpleAnnotationsItem.NO_ANNOTATIONS; AnnotationItem[] items = new AnnotationItem[annotations.length]; for (int i = 0; i < items.length; ++i) items[i] = new SimpleAnnotationItem(annotations[i]); return new SimpleAnnotationsItem(items); } public AnnotationItem retrieveAnnotation(Class annotationType) { T annotation = annotated.getAnnotation(annotationType); if (annotation == null) return null; return new SimpleAnnotationItem(annotation); } public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature) { if (signature == null) return null; if (annotated instanceof Class) { Class clazz = Class.class.cast(annotated); if (signature instanceof ConstructorSignature) { ConstructorSignature constructorSignature = (ConstructorSignature) signature; Constructor constructor = constructorSignature.getConstructor(); if (constructor == null) constructor = SecurityActions.findConstructor(clazz, signature.getParametersTypes(clazz)); if (constructor == null) { if (log.isTraceEnabled()) log.trace("Constructor with signature " + signature + " does not exist on class " + clazz.getName()); return null; } return new AnnotatedElementMetaDataLoader(constructor); } else if (signature instanceof MethodSignature) { MethodSignature methodSignature = (MethodSignature) signature; Method method = methodSignature.getMethod(); if (method == null) method = SecurityActions.findMethod(clazz, signature.getName(), signature.getParametersTypes(clazz)); if (method == null) { if (log.isTraceEnabled()) log.trace("Method with signature " + signature + " does not exist on class " + clazz.getName()); return null; } if (method.getAnnotations().length == 0) { if (method.isBridge()) { method = searchForRealBridgeMethodSignature(method); if (method == null) return null; } } return new AnnotatedElementMetaDataLoader(method); } else if (signature instanceof DeclaredMethodSignature) { DeclaredMethodSignature methodSignature = (DeclaredMethodSignature) signature; Method method = methodSignature.getMethod(); if (method == null) { clazz = getDeclaringClass(clazz, methodSignature.getDeclaringClass()); if (clazz == null) return null; try { method = SecurityActions.findDeclaredMethod(clazz, signature.getName(), signature.getParametersTypes(clazz)); } catch (NoSuchMethodException nsme) { if (log.isTraceEnabled()) log.trace("Method with signature " + signature + " does not exist on class " + clazz.getName()); return null; } } if (method.getAnnotations().length == 0) { if (method.isBridge()) { method = searchForRealBridgeMethodSignature(method); if (method == null) return null; } } return new AnnotatedElementMetaDataLoader(method); } else if (signature instanceof MethodParametersSignature) { MethodParametersSignature methodParametersSignature = (MethodParametersSignature) signature; Method method = methodParametersSignature.getMethod(); if (method == null) method = SecurityActions.findMethod(clazz, signature.getName(), signature.getParametersTypes(clazz)); if (method == null) { if (log.isTraceEnabled()) log.trace("Method with signature " + signature + " does not exist on class " + clazz.getName()); return null; } Annotation[][] paramAnnotations = method.getParameterAnnotations(); return new SimpleMetaDataLoader(paramAnnotations[methodParametersSignature.getParam()]); } else if (signature instanceof ConstructorParametersSignature) { ConstructorParametersSignature constructorParametersSignature = (ConstructorParametersSignature) signature; Constructor constructor = constructorParametersSignature.getConstructor(); if (constructor == null) constructor = SecurityActions.findConstructor(clazz, signature.getParametersTypes(clazz)); if (constructor == null) { if (log.isTraceEnabled()) log.trace("Constructor with signature " + signature + " does not exist on class " + clazz.getName()); return null; } Annotation[][] paramAnnotations = constructor.getParameterAnnotations(); return new SimpleMetaDataLoader(paramAnnotations[constructorParametersSignature.getParam()]); } else if (signature instanceof FieldSignature) { FieldSignature fieldSignature = (FieldSignature) signature; Field field = fieldSignature.getField(); if (field == null) field = SecurityActions.findField(clazz, signature.getName()); if (field == null) { if (log.isTraceEnabled()) log.trace("Field " + signature.getName() + " does not exist on class " + clazz.getName()); return null; } return new AnnotatedElementMetaDataLoader(field); } } if (annotated instanceof Method) { if (signature instanceof MethodParametersSignature) { Method method = (Method)annotated; Annotation[][] paramAnnotations = method.getParameterAnnotations(); MethodParametersSignature sig = (MethodParametersSignature) signature; return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]); } } if (annotated instanceof Constructor) { if (signature instanceof ConstructorParametersSignature) { Constructor constructor = Constructor.class.cast(annotated); Annotation[][] paramAnnotations = constructor.getParameterAnnotations(); ConstructorParametersSignature sig = (ConstructorParametersSignature) signature; return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]); } } return null; } public boolean isEmpty() { Annotation[] annotations = annotated.getAnnotations(); return annotations == null || annotations.length == 0; } public String toString() { JBossStringBuilder buffer = new JBossStringBuilder(); Strings.defaultToString(buffer, this); buffer.append("["); buffer.append(annotated); buffer.append("]"); return buffer.toString(); } /** * Get the declaring class from the reference class * * @param reference the reference class * @param declaringClass the declaring class * @return the class or null if the declaring class is not a super class of the reference */ private static Class getDeclaringClass(Class reference, String declaringClass) { while (reference != null) { if (declaringClass.equals(reference.getName())) return reference; reference = reference.getSuperclass(); } return null; } /** * Search for real bridge method. * * @param bridge the current method * @return real bridge method */ private Method searchForRealBridgeMethodSignature(Method bridge) { Class declaringClass = bridge.getDeclaringClass(); Class[] parameters = bridge.getParameterTypes(); List simpleMatch = new ArrayList(); Class searchClass = declaringClass; while (searchClass != null && Object.class.equals(searchClass) == false) { Method[] all = searchClass.getDeclaredMethods(); for (Method m : all) { if (m.getName().equals(bridge.getName()) && m.getParameterTypes().length == parameters.length && m.equals(bridge) == false && m.isBridge() == false) simpleMatch.add(m); } searchClass = searchClass.getSuperclass(); } if (simpleMatch.size() == 1) return simpleMatch.get(0); //Should not happen if (simpleMatch.size() == 0) throw new IllegalStateException("No original methods found: " + bridge); List typesMatch = new ArrayList(); for (Method cur : simpleMatch) { Class brt = bridge.getReturnType(); Class crt = cur.getReturnType(); if (brt.isAssignableFrom(crt) == false && crt.isAssignableFrom(brt) == false) { continue; } boolean parametersMatch = true; Class[] currentParameters = cur.getParameterTypes(); for (int i = 0; i < parameters.length; i++) { if (parameters[i].isAssignableFrom(currentParameters[i]) == false && currentParameters[i].isAssignableFrom(parameters[i]) == false) { parametersMatch = false; break; } } if (parametersMatch) typesMatch.add(cur); } if (typesMatch.size() == 1) return typesMatch.get(0); //Should not happen if (typesMatch.size() == 0) throw new IllegalStateException("No original methods found: " + bridge); if (log.isTraceEnabled()) log.trace("Could not determine original method for " + bridge + " found: " + typesMatch); return null; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/AbstractMetaDataLoader.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/AbstractMetaDat0000644000175000017500000001013610772470244033213 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.loader; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.Item; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDatasItem; import org.jboss.metadata.spi.retrieval.ValidTime; import org.jboss.metadata.spi.retrieval.helper.AnnotationToMetaDataBridge; import org.jboss.metadata.spi.retrieval.helper.AnnotationsToMetaDatasBridge; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.scope.ScopeLevel; /** * AbstractMetaDataLoader. * *

The default behaviour is to assume there are only * annotations with the types and names of the getMetadata() * methods interpreted as annotation types and class names. * * @author Adrian Brock * @version $Revision: 71300 $ */ public abstract class AbstractMetaDataLoader implements MetaDataLoader { /** The valid time */ private ValidTime validTime; /** The scope key */ private ScopeKey scopeKey; /** * Create a new AbstractMetaDataLoader. */ public AbstractMetaDataLoader() { this(ScopeKey.DEFAULT_SCOPE); } /** * Create a new AbstractMetaDataLoader. * * @param key the scope */ public AbstractMetaDataLoader(ScopeKey key) { this.scopeKey = key; validTime = new ValidTime(); } public ScopeKey getScope() { return scopeKey; } public ValidTime getValidTime() { return validTime; } public boolean isCachable(Item item) { return true; } public AnnotationsItem retrieveLocalAnnotations() { return retrieveAnnotations(); } @SuppressWarnings("unchecked") public MetaDataItem retrieveMetaData(Class type) { if (type.isAnnotation() == false) return null; AnnotationItem annotation = retrieveAnnotation((Class) type); if (annotation == null) return null; return new AnnotationToMetaDataBridge(annotation); } public MetaDatasItem retrieveLocalMetaData() { return retrieveMetaData(); } public MetaDatasItem retrieveMetaData() { AnnotationsItem annotations = retrieveAnnotations(); return new AnnotationsToMetaDatasBridge(annotations); } @SuppressWarnings("unchecked") public MetaDataItem retrieveMetaData(String name) { AnnotationsItem annotations = retrieveAnnotations(); for (AnnotationItem annotation : annotations.getAnnotations()) { if (annotation.getName().equals(name)) return new AnnotationToMetaDataBridge(annotation); } return null; } public MetaDataRetrieval getScopedRetrieval(ScopeLevel level) { if (getScope().getScopeLevel(level) != null) return this; return null; } /** * Invalidate */ public void invalidate() { validTime.invalidate(); } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/thread/0000755000175000017500000000000011620305601031516 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/thread/GetThreadName.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/thread/GetThrea0000644000175000017500000000253310454442653033164 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.loader.thread; import java.security.PrivilegedAction; /** * GetThreadName. * * @author Adrian Brock * @version $Revision: 46146 $ */ class GetThreadName implements PrivilegedAction { public String run() { Thread thread = Thread.currentThread(); return thread.getName(); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/thread/ThreadLocalMetaDataLoader.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/thread/ThreadLo0000644000175000017500000001562110756326650033170 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.loader.thread; import java.lang.annotation.Annotation; import java.security.AccessController; import org.jboss.metadata.plugins.loader.AbstractMutableMetaDataLoader; import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.Item; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDatasItem; import org.jboss.metadata.spi.retrieval.ValidTime; import org.jboss.metadata.spi.retrieval.basic.BasicAnnotationsItem; import org.jboss.metadata.spi.retrieval.basic.BasicMetaDatasItem; import org.jboss.metadata.spi.scope.CommonLevels; import org.jboss.metadata.spi.scope.Scope; import org.jboss.metadata.spi.scope.ScopeKey; /** * ThreadLocalMetaDataLoader. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class ThreadLocalMetaDataLoader extends AbstractMutableMetaDataLoader { /** The singleton instance */ public static final ThreadLocalMetaDataLoader INSTANCE = new ThreadLocalMetaDataLoader(); private static final GetThreadName GET_THREAD_NAME = new GetThreadName(); /** The thread local */ private ThreadLocal threadLocal = new ThreadLocal(); /** No annotations */ private final BasicAnnotationsItem NO_ANNOTATIONS = new BasicAnnotationsItem(this, BasicAnnotationsItem.NO_ANNOTATION_ITEMS); /** No meta data */ private final BasicMetaDatasItem NO_META_DATA = new BasicMetaDatasItem(this, BasicMetaDatasItem.NO_META_DATA_ITEMS); /** * Get the thread scope key * * @return the scope key */ private static final ScopeKey getThreadScopeKey() { String name = AccessController.doPrivileged(GET_THREAD_NAME); Scope scope = new Scope(CommonLevels.THREAD, name); return new ScopeKey(scope); } /** * Singleton */ private ThreadLocalMetaDataLoader() { super(true); } /** * Clear all the values for the current thread */ public void clear() { threadLocal.set(null); } public ScopeKey getScope() { MemoryMetaDataLoader delegate = threadLocal.get(); if (delegate == null) return getThreadScopeKey(); else return delegate.getScope(); } // The only items we produce are the no annotations and no metadata // these should not be cached public boolean isCachable(Item item) { return false; } public ValidTime getValidTime() { MemoryMetaDataLoader delegate = threadLocal.get(); if (delegate == null) return super.getValidTime(); return delegate.getValidTime(); } public void invalidate() { MemoryMetaDataLoader delegate = threadLocal.get(); if (delegate == null) super.invalidate(); else delegate.invalidate(); } public AnnotationsItem retrieveAnnotations() { MemoryMetaDataLoader delegate = threadLocal.get(); if (delegate == null) return NO_ANNOTATIONS; return delegate.retrieveAnnotations(); } public AnnotationItem retrieveAnnotation(Class annotationType) { MemoryMetaDataLoader delegate = threadLocal.get(); if (delegate == null) return null; return delegate.retrieveAnnotation(annotationType); } public T addAnnotation(T annotation) { MemoryMetaDataLoader delegate = threadLocal.get(); if (delegate == null) { delegate = new MemoryMetaDataLoader(getThreadScopeKey(), false, true); threadLocal.set(delegate); } return delegate.addAnnotation(annotation); } public T removeAnnotation(Class annotationType) { MemoryMetaDataLoader delegate = threadLocal.get(); if (delegate == null) return null; return delegate.removeAnnotation(annotationType); } public MetaDatasItem retrieveMetaData() { MemoryMetaDataLoader delegate = threadLocal.get(); if (delegate == null) return NO_META_DATA; return delegate.retrieveMetaData(); } public MetaDataItem retrieveMetaData(Class type) { MemoryMetaDataLoader delegate = threadLocal.get(); if (delegate == null) return null; return delegate.retrieveMetaData(type); } public MetaDataItem retrieveMetaData(String name) { MemoryMetaDataLoader delegate = threadLocal.get(); if (delegate == null) return null; return delegate.retrieveMetaData(name); } public T addMetaData(T metaData, Class type) { MemoryMetaDataLoader delegate = threadLocal.get(); if (delegate == null) { delegate = new MemoryMetaDataLoader(getThreadScopeKey(), false, true); threadLocal.set(delegate); } return delegate.addMetaData(metaData, type); } public T removeMetaData(Class type) { MemoryMetaDataLoader delegate = threadLocal.get(); if (delegate == null) return null; return delegate.removeMetaData(type); } public T addMetaData(String name, T metaData, Class type) { MemoryMetaDataLoader delegate = threadLocal.get(); if (delegate == null) { delegate = new MemoryMetaDataLoader(getThreadScopeKey(), false, true); threadLocal.set(delegate); } return delegate.addMetaData(name, metaData, type); } public T removeMetaData(String name, Class type) { MemoryMetaDataLoader delegate = threadLocal.get(); if (delegate == null) return null; return delegate.removeMetaData(name, type); } public boolean isEmpty() { MemoryMetaDataLoader delegate = threadLocal.get(); return delegate == null || delegate.isEmpty(); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/BasicMetaDataLoader.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/plugins/loader/BasicMetaDataLo0000644000175000017500000000471510756326650033136 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.plugins.loader; import java.lang.annotation.Annotation; import org.jboss.metadata.annotation.AnnotationMatcher; import org.jboss.metadata.generic.GenericMatcher; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.signature.Signature; /** * BasicMetaDataLoader. * * @author Adrian Brock * @version $Revision: 69888 $ */ public abstract class BasicMetaDataLoader extends AbstractMetaDataLoader { /** * Create a new BasicMetaDataLoader. */ public BasicMetaDataLoader() { } /** * Create a new BasicMetaDataLoader. * * @param key the scope key */ public BasicMetaDataLoader(ScopeKey key) { super(key); } public AnnotationItem retrieveAnnotation(Class annotationType) { AnnotationItem[] annotations = retrieveAnnotations().getAnnotations(); return AnnotationMatcher.matchAnnotationItem(annotations, annotationType); } public MetaDataItem retrieveMetaData(String name) { MetaDataItem[] metaDatas = retrieveMetaData().getMetaDatas(); return GenericMatcher.matchMetaDataItem(metaDatas, name); } public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature) { return null; } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/0000755000175000017500000000000011620305602026114 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/MutableMetaData.java0000644000175000017500000000514410565040063031761 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi; import java.lang.annotation.Annotation; /** * MutableMetaData. * * @author Adrian Brock * @version $Revision: 60565 $ */ public interface MutableMetaData { /** * Add an annotation * * @param the annotation type * @param annotation the annotation * @return any previous annotation */ T addAnnotation(T annotation); /** * Remove an annotation * * @param the annotation type * @param annotationType the annotation type * @return any previous annotation */ T removeAnnotation(Class annotationType); /** * Add metaData * * @param the metadata type * @param metaData the meta data * @param type the expected type * @return any previous meta data */ T addMetaData(T metaData, Class type); /** * Remove metaData * * @param the metadata type * @param type the meta data type * @return any previous meta data */ T removeMetaData(Class type); /** * Add metaData * * @param the metadata type * @param name the name * @param metaData the meta data * @param type the expected type * @return any previous meta data */ T addMetaData(String name, T metaData, Class type); /** * Remove metadata * * @param the metadata type * @param name the name of the meta data * @param type the expected type of the metadata * @return the metadata or null if not present */ T removeMetaData(String name, Class type); } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/0000755000175000017500000000000011620305603030112 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/Item.java0000644000175000017500000000275610505734347031701 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval; /** * Retrieval Item. * * @param the item type * @author Adrian Brock * @version $Revision: 57133 $ */ public interface Item { /** * Whether the item is cachable * * @return true when cachable */ boolean isCachable(); /** * Whether the value is valid * * @return true when valid */ boolean isValid(); /** * Get the value * * @return the value */ T getValue(); } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/MetaDataRetrieval.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/MetaDataRetrieva0000644000175000017500000000632410756326650033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.scope.ScopeLevel; import org.jboss.metadata.spi.signature.Signature; /** * MetaDataRetrieval. * * @author Adrian Brock * @version $Revision: 69888 $ */ public interface MetaDataRetrieval { /** * Return the scope key * * @return the scope key */ ScopeKey getScope(); /** * The valid time * * @return the valid time */ ValidTime getValidTime(); /** * Get all the annotations * * @return the annotations */ AnnotationsItem retrieveAnnotations(); /** * Get all the local annotations * * @return the annotations */ AnnotationsItem retrieveLocalAnnotations(); /** * Get annotation * * @param the annotation type * @param annotationType the annotation type * @return the annotation or null if not present */ AnnotationItem retrieveAnnotation(Class annotationType); /** * Get all the metadata * * @return the metadata */ MetaDatasItem retrieveMetaData(); /** * Get all the local metadata * * @return the metadata */ MetaDatasItem retrieveLocalMetaData(); /** * Get metadata * * @param the metadata type * @param type the type * @return the metadata or null if not present */ MetaDataItem retrieveMetaData(Class type); /** * Get metadata * * @param name the name of the meta data * @return the metadata or null if not present */ MetaDataItem retrieveMetaData(String name); /** * Get the component metadata retrieval * * @param signature the signature * @return the component metadata retrieval */ MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature); /** * Is metadata empty. * * @return true if metadata empty */ boolean isEmpty(); /** * Get scoped retrieval for level param. * * @param level the scope level * @return list of retrieval instances */ MetaDataRetrieval getScopedRetrieval(ScopeLevel level); } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/MetaDataItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/MetaDataItem.jav0000644000175000017500000000262710505734347033136 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval; /** * MetaData Item * *

For the purposes of retrieval, two annotations * are equal if they have the same name. * * @param the item type * @author Adrian Brock * @version $Revision: 57133 $ */ public interface MetaDataItem extends Item { /** * Get the name of the metadata * * @return the name */ String getName(); } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/MetaDatasItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/MetaDatasItem.ja0000644000175000017500000000263510756326650033134 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval; /** * MetaDatas Item. * * @author Adrian Brock * @version $Revision: 69888 $ */ public interface MetaDatasItem extends Item { /** No meta data items */ public static final MetaDataItem[] NO_META_DATA_ITEMS = new MetaDataItem[0]; /** * Get the meta datas * * @return the meta datas */ MetaDataItem[] getMetaDatas(); } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/basic/0000755000175000017500000000000011620305602031172 5ustar twernertwerner././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/basic/BasicAnnotationsItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/basic/BasicAnnot0000644000175000017500000000621610756326650033162 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.basic; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; /** * BasicAnnotationsItem. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class BasicAnnotationsItem extends BasicItem implements AnnotationsItem { /** The annotation items */ private AnnotationItem[] annotationItems; /** The annotations */ private Annotation[] annotations; /** * Create a new BasicAnnotationsItem. * * @param loader the loader * @param annotationItems the annotation items */ public BasicAnnotationsItem(MetaDataLoader loader, AnnotationItem[] annotationItems) { super(loader); if (annotationItems == null) throw new IllegalArgumentException("Null annotation items"); this.annotationItems = annotationItems; if (annotationItems.length == 0) annotations = MetaData.NO_ANNOTATIONS; } public Annotation[] getValue() { if (annotations == null) { Annotation[] temp = new Annotation[annotationItems.length]; for (int i = 0; i < temp.length; ++i) temp[i] = annotationItems[i].getAnnotation(); annotations = temp; } return annotations; } public AnnotationItem[] getAnnotations() { return annotationItems; } public boolean isCachable() { if (super.isCachable() == false) return false; for (AnnotationItem item : annotationItems) { if (item.isCachable() == false) return false; } return true; } public boolean isValid() { if (super.isValid() == false) return false; for (AnnotationItem item : annotationItems) { if (item.isValid() == false) return false; } return true; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/basic/BasicItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/basic/BasicItem.0000644000175000017500000000360110505734347033050 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.basic; import java.util.concurrent.atomic.AtomicBoolean; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.retrieval.Item; /** * BasicItem. * * @param The item type * @author Adrian Brock * @version $Revision: 57133 $ */ public abstract class BasicItem implements Item { /** The loader */ private MetaDataLoader loader; /** Whether this is valid */ private AtomicBoolean valid = new AtomicBoolean(true); /** * Create a new BasicItem. * * @param loader the loader */ public BasicItem(MetaDataLoader loader) { this.loader = loader; } public boolean isCachable() { return loader.isCachable(this); } public boolean isValid() { return valid.get(); } public void invalidate() { this.valid.set(false); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/basic/BasicMetaDataItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/basic/BasicMetaD0000644000175000017500000000463310756326650033076 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.basic; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.retrieval.MetaDataItem; /** * BasicMetaDataItem. * * @param the item type * @author Adrian Brock * @version $Revision: 69888 $ */ public class BasicMetaDataItem extends BasicItem implements MetaDataItem { /** The meta data */ private T metaData; /** The name */ private String name; /** * Create a new BaiscMetaDataItem. * * @param loader the loader * @param name the name * @param metaData the metadata */ public BasicMetaDataItem(MetaDataLoader loader, String name, T metaData) { super(loader); if (name == null) throw new IllegalArgumentException("Null name"); this.name = name; this.metaData = metaData; } public T getValue() { return metaData; } public String getName() { return name; } public boolean equals(Object object) { if (object == this) return true; if (object == null || object instanceof MetaDataItem == false) return false; MetaDataItem other = (MetaDataItem) object; return getName().equals(other.getName()); } public int hashCode() { return getName().hashCode(); } public String toString() { return getValue().toString(); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/basic/BasicAnnotationItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/basic/BasicAnnot0000644000175000017500000000422410756326650033157 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.basic; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.retrieval.AnnotationItem; /** * BasicAnnotationItem. * * @param the annotation type * @author Adrian Brock * @version $Revision: 69888 $ */ public class BasicAnnotationItem extends BasicMetaDataItem implements AnnotationItem { /** * Create a new BasicAnnotationItem. * * @param loader the loader * @param annotation the annotation */ public BasicAnnotationItem(MetaDataLoader loader, T annotation) { super(loader, annotation.annotationType().getName(), annotation); } public T getAnnotation() { return getValue(); } @SuppressWarnings("unchecked") public boolean equals(Object object) { if (object == this) return true; if (object == null || object instanceof AnnotationItem == false) return false; AnnotationItem other = (AnnotationItem) object; return getAnnotation().annotationType().equals(other.getAnnotation().annotationType()); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/basic/BasicMetaDatasItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/basic/BasicMetaD0000644000175000017500000000566210756326650033101 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.basic; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.loader.MetaDataLoader; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDatasItem; /** * BasicMetaDatasItem. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class BasicMetaDatasItem extends BasicItem implements MetaDatasItem { /** The meta data items */ private MetaDataItem[] metaDataItems; /** The meta data */ private Object[] metaDatas; /** * Create a new BasicMetaDatasItem. * * @param loader the loader * @param metaDataItems the meta data items */ public BasicMetaDatasItem(MetaDataLoader loader, MetaDataItem[] metaDataItems) { super(loader); if (metaDataItems == null) throw new IllegalArgumentException("Null metaDataItems"); this.metaDataItems = metaDataItems; if (metaDataItems.length == 0) metaDatas = MetaData.NO_METADATA; } public Object[] getValue() { if (metaDatas == null) { Object[] temp = new Object[metaDataItems.length]; for (int i = 0; i < temp.length; ++i) temp[i] = metaDataItems[i].getValue(); metaDatas = temp; } return metaDatas; } public MetaDataItem[] getMetaDatas() { return metaDataItems; } public boolean isCachable() { if (super.isCachable() == false) return false; for (MetaDataItem item : metaDataItems) { if (item.isCachable() == false) return false; } return true; } public boolean isValid() { if (super.isValid() == false) return false; for (MetaDataItem item : metaDataItems) { if (item.isValid() == false) return false; } return true; } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/ValidTime.java0000644000175000017500000000355210720054650032643 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval; import java.util.concurrent.atomic.AtomicLong; import java.io.Serializable; /** * ValidTime. * * @author Adrian Brock * @version $Revision: 67232 $ */ public class ValidTime implements Serializable { /** The serialVersionUID */ private static final long serialVersionUID = 1075815265759870744L; /** The next valid time */ private static final AtomicLong next = new AtomicLong(Long.MIN_VALUE); /** This valid time */ private volatile long value; /** * Create a new ValidTime. */ public ValidTime() { value = next.get(); } /** * Get the valid time * * @return the valid time */ public long getValidTime() { return value; } /** * Invalidate */ public void invalidate() { value = next.incrementAndGet(); } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/cummulative/0000755000175000017500000000000011620305603032445 5ustar twernertwerner././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/cummulative/CummulativeAnnotationsItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/cummulative/Cumm0000644000175000017500000001052510756326650033312 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.cummulative; import java.lang.annotation.Annotation; import java.util.HashSet; import java.util.List; import java.util.Set; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationsItem; /** * CummulativeAnnotationsItem. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class CummulativeAnnotationsItem extends SimpleAnnotationsItem { /** The context */ private MetaDataContext context; /** Whether to include the parent */ private boolean includeParent; /** The valid time */ private long validTime; /** * Create a new CummulativeAnnotationsItem. * * @param context the context * @param includeParent whether to include the parent */ public CummulativeAnnotationsItem(MetaDataContext context, boolean includeParent) { if (context == null) throw new IllegalArgumentException("Null context"); this.context = context; this.includeParent = includeParent; init(context.getValidTime().getValidTime()); } public Annotation[] getValue() { checkValid(); return super.getValue(); } public AnnotationItem[] getAnnotations() { checkValid(); return super.getAnnotations(); } public boolean isCachable() { return true; } public boolean isValid() { return true; } /** * Check whether we are valid */ protected void checkValid() { AnnotationItem[] items = super.getAnnotations(); boolean valid = (items != null); long newValidTime = context.getValidTime().getValidTime(); if (validTime < newValidTime) valid = false; if (valid && items != null) { for (AnnotationItem item : items) { if (item.isValid() == false) valid = false; } } if (valid == false) init(newValidTime); } /** * Initialise * * @param validTime the valid time */ @SuppressWarnings("unchecked") protected void init(long validTime) { Set> temp = null; List retrievals; if (includeParent) retrievals = context.getRetrievals(); else retrievals = context.getLocalRetrievals(); for (MetaDataRetrieval retrieval : retrievals) { AnnotationsItem item = retrieval.retrieveAnnotations(); if (item != null) { AnnotationItem[] items = item.getAnnotations(); for (AnnotationItem it : items) { if (temp == null) temp = new HashSet>(); temp.add(it); } } } AnnotationItem[] items = NO_ANNOTATION_ITEMS; if (temp != null) items = temp.toArray(new AnnotationItem[temp.size()]); setAnnotationItems(items); this.validTime = validTime; } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/cummulative/CummulativeMetaDatasItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/cummulative/Cumm0000644000175000017500000001005310756326650033306 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.cummulative; import java.util.HashSet; import java.util.List; import java.util.Set; import org.jboss.metadata.spi.context.MetaDataContext; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDatasItem; import org.jboss.metadata.spi.retrieval.simple.SimpleMetaDatasItem; /** * CummulativeMetaDatasItem. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class CummulativeMetaDatasItem extends SimpleMetaDatasItem { /** The context */ private MetaDataContext context; /** Whether to include the parent */ private boolean includeParent; /** The valid time */ private long validTime; /** * Create a new CummulativeMetaDatasItem. * * @param context the context * @param includeParent whether to include the parent */ public CummulativeMetaDatasItem(MetaDataContext context, boolean includeParent) { if (context == null) throw new IllegalArgumentException("Null context"); this.context = context; this.includeParent = includeParent; init(context.getValidTime().getValidTime()); } public Object[] getValue() { checkValid(); return super.getValue(); } public MetaDataItem[] getMetaDatas() { checkValid(); return super.getMetaDatas(); } public boolean isCachable() { return true; } public boolean isValid() { return true; } /** * Check whether we are valid */ protected void checkValid() { MetaDataItem[] items = super.getMetaDatas(); boolean valid = (items != null); long newValidTime = context.getValidTime().getValidTime(); if (validTime < newValidTime) valid = false; if (items != null) { for (MetaDataItem item : items) { if (item.isValid() == false) valid = false; } } if (valid == false) init(newValidTime); } /** * Initialise * * @param validTime the valid time */ protected void init(long validTime) { Set> temp = null; List retrievals; if (includeParent) retrievals = context.getRetrievals(); 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>(); temp.add(it); } } } MetaDataItem[] items = NO_META_DATA_ITEMS; if (temp != null) items = temp.toArray(new MetaDataItem[temp.size()]); setMetaDataItems(items); this.validTime = validTime; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/AnnotationsItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/AnnotationsItem.0000644000175000017500000000304010756326650033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval; import java.lang.annotation.Annotation; /** * Annotations item. * * @author Adrian Brock * @version $Revision: 69888 $ */ public interface AnnotationsItem extends Item { /** No annotations */ @SuppressWarnings("unchecked") public static final AnnotationItem[] NO_ANNOTATION_ITEMS = new AnnotationItem[0]; /** * Get the annotations * * @return the annotations */ AnnotationItem[] getAnnotations(); } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/MetaDataRetrievalToMetaDataBridge.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/MetaDataRetrieva0000644000175000017500000001364710756326650033250 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.scope.ScopeLevel; import org.jboss.metadata.spi.signature.Signature; /** * MetaDataRetrievalToMetaDataBridge. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class MetaDataRetrievalToMetaDataBridge implements MetaData { /** The meta data retrieval method */ private MetaDataRetrieval retrieval; /** * Create a new MetaDataRetrievalToMetaDataBridge. * * @param retrieval the retrieval */ public MetaDataRetrievalToMetaDataBridge(MetaDataRetrieval retrieval) { if (retrieval == null) throw new IllegalArgumentException("Null retrieval"); this.retrieval = retrieval; } public long getValidTime() { ValidTime validTime = retrieval.getValidTime(); return validTime.getValidTime(); } public T getAnnotation(Class annotationType) { if (annotationType == null) throw new IllegalArgumentException("Null annotationType"); AnnotationItem item = retrieval.retrieveAnnotation(annotationType); if (item == null) return null; return item.getValue(); } public Annotation[] getAnnotations() { AnnotationsItem item = retrieval.retrieveAnnotations(); if (item == null) return NO_ANNOTATIONS; return item.getValue(); } public Annotation[] getLocalAnnotations() { AnnotationsItem item = retrieval.retrieveLocalAnnotations(); if (item == null) return NO_ANNOTATIONS; return item.getValue(); } public Object[] getMetaData() { MetaDatasItem item = retrieval.retrieveMetaData(); if (item == null) return NO_METADATA; return item.getValue(); } public Object[] getLocalMetaData() { MetaDatasItem item = retrieval.retrieveLocalMetaData(); if (item == null) return NO_METADATA; return item.getValue(); } public T getMetaData(Class type) { if (type == null) throw new IllegalArgumentException("Null type"); MetaDataItem item = retrieval.retrieveMetaData(type); if (item == null) return null; return item.getValue(); } public T getMetaData(String name, Class type) { if (name == null) throw new IllegalArgumentException("Null name"); if (type == null) throw new IllegalArgumentException("Null type"); MetaDataItem item = retrieval.retrieveMetaData(name); if (item == null) return null; return type.cast(item.getValue()); } public Object getMetaData(String name) { if (name == null) throw new IllegalArgumentException("Null name"); MetaDataItem item = retrieval.retrieveMetaData(name); if (item == null) return null; return item.getValue(); } public boolean isAnnotationPresent(Class annotationType) { return getAnnotation(annotationType) != null; } public boolean isMetaDataPresent(Class type) { return getMetaData(type) != null; } public boolean isMetaDataPresent(String name, Class type) { if (type == null) throw new IllegalArgumentException("Null type"); Object value = getMetaData(name); if (value == null) return false; return type.isInstance(value); } public boolean isMetaDataPresent(String name) { return getMetaData(name) != null; } public MetaData getComponentMetaData(Signature signature) { MetaDataRetrieval component = retrieval.getComponentMetaDataRetrieval(signature); if (component == null) return null; return new MetaDataRetrievalToMetaDataBridge(component); } public MetaData getScopeMetaData(ScopeLevel level) { if (level == null) throw new IllegalArgumentException("Null scope level"); MetaDataRetrieval scopedRetrieval = retrieval.getScopedRetrieval(level); if (scopedRetrieval != null) return new MetaDataRetrievalToMetaDataBridge(scopedRetrieval); return null; } public boolean isEmpty() { return retrieval.isEmpty(); } public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj instanceof MetaDataRetrievalToMetaDataBridge == false) return false; MetaDataRetrievalToMetaDataBridge other = (MetaDataRetrievalToMetaDataBridge) obj; return retrieval.equals(other.retrieval); } public int hashCode() { return retrieval.hashCode(); } public String toString() { return super.toString() + "{" + retrieval.getScope() + "}"; } /** * Get the meta data retrieval * * @return the retrieval */ protected MetaDataRetrieval getMetaDataRetrieval() { return retrieval; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/AnnotationItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/AnnotationItem.j0000644000175000017500000000275510505734347033243 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval; import java.lang.annotation.Annotation; /** * Annotation Item. * *

For the purposes of retrieval, two annotations * are equal if they have the same annotation type. * * @param the annoation type * @author Adrian Brock * @version $Revision: 57133 $ */ public interface AnnotationItem extends MetaDataItem { /** * Get the annotation * * @return the annotation */ T getAnnotation(); } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/MetaDataRetrievalFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/MetaDataRetrieva0000644000175000017500000000261210720557046033232 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval; import org.jboss.metadata.spi.scope.Scope; /** * MetaDataRetrievalFactory. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface MetaDataRetrievalFactory { /** * Get a metadata retrieval * * @param scope the scope * @return the retrieval */ MetaDataRetrieval getMetaDataRetrieval(Scope scope); } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/simple/0000755000175000017500000000000011620305602031402 5ustar twernertwerner././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/simple/SimpleMetaDataItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/simple/SimpleMet0000644000175000017500000000442710756326650033252 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.simple; import org.jboss.metadata.spi.retrieval.MetaDataItem; /** * SimpleMetaDataItem. * * @param the item type * @author Adrian Brock * @version $Revision: 69888 $ */ public class SimpleMetaDataItem extends SimpleItem implements MetaDataItem { /** The meta data */ private T metaData; /** The name */ private String name; /** * Create a new SimpleMetaDataItem. * * @param name the name * @param metaData the metadata */ public SimpleMetaDataItem(String name, T metaData) { if (name == null) throw new IllegalArgumentException("Null name"); this.name = name; this.metaData = metaData; } public T getValue() { return metaData; } public String getName() { return name; } public boolean equals(Object object) { if (object == this) return true; if (object == null || object instanceof MetaDataItem == false) return false; MetaDataItem other = (MetaDataItem) object; return getName().equals(other.getName()); } public int hashCode() { return getName().hashCode(); } public String toString() { return getValue().toString(); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/simple/SimpleAnnotationItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/simple/SimpleAnn0000644000175000017500000000404610756326650033236 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.simple; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.retrieval.AnnotationItem; /** * SimpleAnnotationItem. * * @param the annotation type * @author Adrian Brock * @version $Revision: 69888 $ */ public class SimpleAnnotationItem extends SimpleMetaDataItem implements AnnotationItem { /** * Create a new SimpleAnnotationItem. * * @param annotation the annotation */ public SimpleAnnotationItem(T annotation) { super(annotation.annotationType().getName(),annotation); } public T getAnnotation() { return getValue(); } @SuppressWarnings("unchecked") public boolean equals(Object object) { if (object == this) return true; if (object == null || object instanceof AnnotationItem == false) return false; AnnotationItem other = (AnnotationItem) object; return getAnnotation().annotationType().equals(other.getAnnotation().annotationType()); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/simple/SimpleMetaDatasItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/simple/SimpleMet0000644000175000017500000000541510756326650033250 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.simple; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDatasItem; /** * SimpleMetaDatasItem. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class SimpleMetaDatasItem extends SimpleItem implements MetaDatasItem { /** No meta data */ public static final SimpleMetaDatasItem NO_META_DATA = new SimpleMetaDatasItem(); /** The meta data items */ private MetaDataItem[] metaDataItems; /** The meta data */ private Object[] metaDatas; /** * Create a new SimpleMetaDatasItem. */ protected SimpleMetaDatasItem() { this(NO_META_DATA_ITEMS); } /** * Create a new SimpleMetaDatasItem. * * @param metaDataItems the meta data items */ public SimpleMetaDatasItem(MetaDataItem[] metaDataItems) { setMetaDataItems(metaDataItems); } public Object[] getValue() { if (metaDatas == null) { Object[] temp = new Object[metaDataItems.length]; for (int i = 0; i < temp.length; ++i) temp[i] = metaDataItems[i].getValue(); metaDatas = temp; } return metaDatas; } public MetaDataItem[] getMetaDatas() { return metaDataItems; } /** * Set the meta data items * * @param metaDataItems the meta data items */ protected void setMetaDataItems(MetaDataItem[] metaDataItems) { if (metaDataItems == null) throw new IllegalArgumentException("Null metaDataItems"); this.metaDataItems = metaDataItems; if (metaDataItems.length == 0) metaDatas = MetaData.NO_METADATA; else metaDatas = null; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/simple/SimpleItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/simple/SimpleIte0000644000175000017500000000260110505734347033234 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.simple; import org.jboss.metadata.spi.retrieval.Item; /** * SimpleItem. * * @param the item type * @author Adrian Brock * @version $Revision: 57133 $ */ public abstract class SimpleItem implements Item { public boolean isCachable() { return true; } public boolean isValid() { return true; } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/simple/SimpleAnnotationsItem.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/simple/SimpleAnn0000644000175000017500000000602010756326650033230 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.simple; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.AnnotationsItem; /** * SimpleAnnotationsItem. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class SimpleAnnotationsItem extends SimpleItem implements AnnotationsItem { /** No annotations */ public static final SimpleAnnotationsItem NO_ANNOTATIONS = new SimpleAnnotationsItem(); /** The annotation items */ private AnnotationItem[] annotationItems; /** The annotations */ private Annotation[] annotations; /** * Create a new SimpleAnnotationsItem with no annotations */ protected SimpleAnnotationsItem() { this(NO_ANNOTATION_ITEMS); } /** * Create a new SimpleAnnotationsItem. * * @param annotationItems the annotation items */ public SimpleAnnotationsItem(AnnotationItem[] annotationItems) { setAnnotationItems(annotationItems); } public Annotation[] getValue() { if (annotations == null) { Annotation[] temp = new Annotation[annotationItems.length]; for (int i = 0; i < temp.length; ++i) temp[i] = annotationItems[i].getAnnotation(); annotations = temp; } return annotations; } public AnnotationItem[] getAnnotations() { return annotationItems; } /** * Set the annotation items * * @param annotationItems the annotation items */ protected void setAnnotationItems(AnnotationItem[] annotationItems) { if (annotationItems == null) throw new IllegalArgumentException("Null annotation items"); this.annotationItems = annotationItems; if (annotationItems.length == 0) annotations = MetaData.NO_ANNOTATIONS; else annotations = null; } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/helper/0000755000175000017500000000000011620305602031370 5ustar twernertwerner././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/helper/AnnotationsToMetaDatasBridge.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/helper/Annotatio0000644000175000017500000000417010756326650033270 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.helper; import org.jboss.metadata.spi.retrieval.AnnotationsItem; import org.jboss.metadata.spi.retrieval.MetaDataItem; import org.jboss.metadata.spi.retrieval.MetaDatasItem; /** * AnnotationsToMetaDatasBridge. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class AnnotationsToMetaDatasBridge implements MetaDatasItem { /** The annotations */ private AnnotationsItem annotations; /** * Create a new AnnotationsToMetaDatasBridge. * * @param annotations the annotations */ public AnnotationsToMetaDatasBridge(AnnotationsItem annotations) { if (annotations == null) throw new IllegalArgumentException("Null annotations"); this.annotations = annotations; } public boolean isCachable() { return annotations.isCachable(); } public boolean isValid() { return annotations.isValid(); } @SuppressWarnings("unchecked") public Object[] getValue() { return annotations.getValue(); } public MetaDataItem[] getMetaDatas() { return annotations.getAnnotations(); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/helper/AnnotationToMetaDataBridge.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/helper/Annotatio0000644000175000017500000000420510756326650033267 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.helper; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.MetaDataItem; /** * AnnotationToMetaDataBridge. * * @param the item type * @author Adrian Brock * @version $Revision: 69888 $ */ public class AnnotationToMetaDataBridge implements MetaDataItem { /** The annotation */ private AnnotationItem annotation; /** * Create a new AnnotationToMetaDataBridge. * * @param annotation the annotation */ public AnnotationToMetaDataBridge(AnnotationItem annotation) { if (annotation == null) throw new IllegalArgumentException("Null annotation"); this.annotation = annotation; } public boolean isCachable() { return annotation.isCachable(); } public boolean isValid() { return annotation.isValid(); } @SuppressWarnings("unchecked") public T getValue() { return (T) annotation.getValue(); } public String getName() { return annotation.getName(); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/helper/MetaDataToAnnotationBridge.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/retrieval/helper/MetaDataT0000644000175000017500000000426110756326650033141 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.retrieval.helper; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.retrieval.AnnotationItem; import org.jboss.metadata.spi.retrieval.MetaDataItem; /** * MetaDataToAnnotationBridge. * * @param the annotation type * @author Adrian Brock * @version $Revision: 69888 $ */ public class MetaDataToAnnotationBridge implements AnnotationItem { /** The meta data */ private MetaDataItem metaData; /** * Create a new MetaDataToAnnotationBridge. * * @param metaData the meta data */ public MetaDataToAnnotationBridge(MetaDataItem metaData) { if (metaData == null) throw new IllegalArgumentException("Null metaData"); this.metaData = metaData; } public boolean isCachable() { return metaData.isCachable(); } public boolean isValid() { return metaData.isValid(); } @SuppressWarnings("unchecked") public T getValue() { return (T) metaData.getValue(); } public T getAnnotation() { return getValue(); } public String getName() { return getValue().annotationType().getName(); } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/stack/0000755000175000017500000000000011620305602027221 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/stack/MetaDataStack.java0000644000175000017500000000637310540110763032545 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.stack; import java.util.ArrayList; import org.jboss.metadata.spi.MetaData; /** * MetaDataStack. * * TODO add some security to the mutable operations * @author Adrian Brock * @version $Revision: 1.1 $ */ public final class MetaDataStack { /** The stack */ private static ThreadLocal> stack = new ThreadLocal>() { protected ArrayList initialValue() { return new ArrayList(); } }; /** * Push some meta data * * @param metaData the meta data */ public static void push(MetaData metaData) { /** TODO MetaDataStackPermission if (metaData == null) throw new IllegalArgumentException("Null meta data"); */ SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(MetaDataStackPermission.MODIFY); stack.get().add(metaData); } /** * Pop some meta data */ public static void pop() { /** TODO MetaDataStackPermission SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(MetaDataStackPermission.MODIFY); */ ArrayList list = stack.get(); if (list.size() == 0) throw new IllegalArgumentException("Empty stack"); list.remove(list.size()-1); } /** * Peek some meta data * * @return the metadata or null if there isn't one */ public static MetaData peek() { /** TODO MetaDataStackPermission SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(MetaDataStackPermission.PEEK); */ ArrayList list = stack.get(); if (list.size() == 0) return null; return list.get(list.size()-1); } /** * Mask the metadataa */ public static void mask() { /** TODO MetaDataStackPermission SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(MetaDataStackPermission.MODIFY); */ stack.get().add(null); } /** * Unmask the metadata */ public static void unmask() { pop(); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/stack/MetaDataStackPermission.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/stack/MetaDataStackPermiss0000644000175000017500000001451310540110763033163 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.stack; import java.io.IOException; import java.io.ObjectInputStream; import java.security.BasicPermission; import java.security.Permission; import java.security.PermissionCollection; import java.util.Enumeration; import java.util.HashSet; import java.util.Iterator; /** * This permission represents "trust" in a signer or codebase. * * It contains a target name but no actions list. The targets are *

    *
  • modify - whether the caller can push/pop onto the stack *
  • peek - whether the caller can peek onto the stack *
  • * - all *
* * @author adrian@jboss.com * @version $Revision: 57306 $ */ public class MetaDataStackPermission extends BasicPermission { /** For serialization */ private static final long serialVersionUID = 5661980843569388590L; /** The modify permission */ static MetaDataStackPermission MODIFY = new MetaDataStackPermission("modify"); /** The peek permission */ static MetaDataStackPermission PEEK = new MetaDataStackPermission("peek"); /** Whether we have all names */ private transient boolean allNames; /** * Create a new Permission * * @param name the target * @throws IllegalArgumentException for invalid name * @throws NullPointerException for null name */ public MetaDataStackPermission(String name) { this(name, null); } /** * Create a new Permission * * @param name the target * @param actions the actions * @throws IllegalArgumentException for an invalid name or target * @throws NullPointerException for null name */ public MetaDataStackPermission(String name, String actions) { super(name, actions); init(name, actions); } /** * @return human readable string. */ public String toString() { StringBuffer buffer = new StringBuffer(100); buffer.append(getClass().getName()).append(":"); buffer.append(" name=").append(getName()); buffer.append(" actions=").append(getActions()); return buffer.toString(); } /** * Checks if this KernelPermission object "implies" the specified * permission. More specifically, this method returns true if: * p is an instance of KernelPermission, * p's target names are a subset of this object's target names * * The configure permission implies the access permission. * * @param p the permission * @return true when the permission is implied */ public boolean implies(Permission p) { if( (p instanceof MetaDataStackPermission) == false) return false; return (allNames == true); } /** * Must override to handle the configure implies access relationship. * * @return the permission collection */ public PermissionCollection newPermissionCollection() { return new MetaDataStackPermissionCollection(); } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject(); init(getName(), getActions()); } /** * Construct a new KernelPermission for a given name * * @param name the name of the permission to grant * @param actions unused * @exception NullPointerException if the name is null * @exception IllegalArgumentException if the name is not * or one of the * allowed names or a comma-separated list of the allowed names, or if * actions is a non-null non-empty string. */ private void init(String name, String actions) { if( name == null ) throw new NullPointerException("name cannot be null"); if( actions != null && actions.length() > 0 ) throw new IllegalArgumentException("actions must be null or empty"); if (name.equals("*") == false && name.equals("modify") == false && name.equals("peek") == false) throw new IllegalArgumentException("Unknown name: " + name); allNames = name.equals("*"); } /** * A MetaDataStackPermissionCollection. */ class MetaDataStackPermissionCollection extends PermissionCollection { /** The serialVersionUID */ private static final long serialVersionUID = 3256442516797665329L; /** The permissions */ private HashSet permissions = new HashSet(); /** Whether we have all permissions */ private boolean hasAll; public void add(Permission p) { if (isReadOnly()) throw new SecurityException("Collection is read-only"); if (p instanceof MetaDataStackPermission) permissions.add(p); if (p.getName().equals("*")) hasAll = true; } public boolean implies(Permission p) { boolean implies = false; if (p instanceof MetaDataStackPermission) { implies = hasAll; if (implies == false) implies = permissions.contains(p); } return implies; } public Enumeration elements() { final Iterator iter = permissions.iterator(); return new Enumeration() { public boolean hasMoreElements() { return iter.hasNext(); } public Permission nextElement() { return iter.next(); } }; } } }libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/scope/0000755000175000017500000000000011620305602027225 5ustar twernertwerner././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/scope/ScopeKeyFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/scope/ScopeKeyFactory.java0000644000175000017500000000277310564102651033160 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.scope; import java.lang.annotation.Annotation; /** * Factory to create ScopeKey from annotation. * * @param the scope key annotation * @author Ales Justin */ public interface ScopeKeyFactory { /** * Create ScopeKey from scope annotation instance * * @param annotation scope annotation * @return scope key from scope annotation */ ScopeKey create(T annotation); } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/scope/ScopeLevel.java0000644000175000017500000000570710454442653032156 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.scope; import java.io.Serializable; import java.util.concurrent.ConcurrentHashMap; /** * ScopeLevel. * * @author Adrian Brock * @version $Revision: 46146 $ */ public class ScopeLevel implements Serializable, Comparable { /** The serialVersionUID */ private static final long serialVersionUID = 9090783215048463821L; /** The levels by name */ private static final ConcurrentHashMap levelsByName = new ConcurrentHashMap(); /** The scope level */ private final int level; /** The scope level name */ private final String name; /** * Get the scope level for a name * * @param name the name * @return the level or zero if no such level name */ public static int getScopeLevel(String name) { Integer result = levelsByName.get(name); if (result != null) return result; else return 0; } /** * Create a new ScopeLevel. * * @param level the level * @param name the name */ public ScopeLevel(int level, String name) { if (level <= 0) throw new IllegalArgumentException("Invalid level"); if (name == null) throw new IllegalArgumentException("Null name"); this.level = level; this.name = name; levelsByName.put(name, level); } public int getLevel() { return level; } public String getName() { return name; } public String toString() { return name; } public int compareTo(ScopeLevel o) { return level - o.level; } public boolean equals(Object object) { if (object == this) return true; if (object == null || object instanceof ScopeLevel == false) return false; ScopeLevel other = (ScopeLevel) object; return level == other.level; } public int hashCode() { return level; } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/scope/Scope.java0000644000175000017500000000455610720557046031166 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.scope; import java.io.Serializable; /** * Scope. * * @author Adrian Brock * @version $Revision: 67291 $ */ public class Scope implements Serializable { /** The serialVersionUID */ private static final long serialVersionUID = 5255750644324593361L; /** The scope level */ private final ScopeLevel level; /** The scope qualifier */ private final Object qualifier; public Scope(ScopeLevel level, Object qualifier) { if (level == null) throw new IllegalArgumentException("Null level"); if (qualifier == null) throw new IllegalArgumentException("Null qualifier"); this.level = level; this.qualifier = qualifier; } public ScopeLevel getScopeLevel() { return level; } public Object getQualifier() { return qualifier; } public String toString() { return level.getName() + "=" + qualifier; } public boolean equals(Object object) { if (object == this) return true; if (object == null || object instanceof Scope == false) return false; Scope other = (Scope) object; if (level.compareTo(other.getScopeLevel()) != 0) return false; return qualifier.equals(other.qualifier); } public int hashCode() { return level.hashCode(); } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/scope/CommonLevels.java0000644000175000017500000001000410454442653032502 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.scope; /** * CommonLevels. * * @author Adrian Brock * @version $Revision: 46146 $ */ public interface CommonLevels { /** The domain level name */ String DOMAIN_NAME = "DOMAIN"; /** The domain level */ ScopeLevel DOMAIN = new ScopeLevel(100, DOMAIN_NAME); /** The cluster level name */ String CLUSTER_NAME = "CLUSTER"; /** The cluster level */ ScopeLevel CLUSTER = new ScopeLevel(DOMAIN.getLevel() + 100, CLUSTER_NAME); /** The machine level name */ String MACHINE_NAME = "MACHINE"; /** The machine level */ ScopeLevel MACHINE = new ScopeLevel(CLUSTER.getLevel() + 100, MACHINE_NAME); /** The node level name */ String NODE_NAME = "NODE"; /** The node level */ ScopeLevel NODE = new ScopeLevel(MACHINE.getLevel() + 100, NODE_NAME); /** The jvm level name */ String JVM_NAME = "JVM"; /** The jvm level */ ScopeLevel JVM = new ScopeLevel(NODE.getLevel() + 100, JVM_NAME); /** The server level name */ String SERVER_NAME = "SERVER"; /** The server level */ ScopeLevel SERVER = new ScopeLevel(JVM.getLevel() + 100, SERVER_NAME); /** The subsystem level name */ String SUBSYSTEM_NAME = "SUBSYSTEM"; /** The subsystem level */ ScopeLevel SUBSYSTEM = new ScopeLevel(SERVER.getLevel() + 100, SUBSYSTEM_NAME); /** The application level name */ String APPLICATION_NAME = "APPLICATION"; /** The application level */ ScopeLevel APPLICATION = new ScopeLevel(SUBSYSTEM.getLevel() + 100, APPLICATION_NAME); /** The deployment level name */ String DEPLOYMENT_NAME = "DEPLOYMENT"; /** The deployment level */ ScopeLevel DEPLOYMENT = new ScopeLevel(APPLICATION.getLevel() + 100, DEPLOYMENT_NAME); /** The class level name */ String CLASS_NAME = "CLASS"; /** The class level */ ScopeLevel CLASS = new ScopeLevel(DEPLOYMENT.getLevel() + 100, CLASS_NAME); /** The instance level name */ String INSTANCE_NAME = "INSTANCE"; /** The instance level */ ScopeLevel INSTANCE = new ScopeLevel(CLASS.getLevel() + 100, INSTANCE_NAME); /** The join point level name */ String JOINPOINT_NAME = "JOINPOINT"; /** The join point level */ ScopeLevel JOINPOINT = new ScopeLevel(INSTANCE.getLevel() + 100, JOINPOINT_NAME); /** The join point override level name */ String JOINPOINT_OVERRIDE_NAME = "JOINPOINT_OVERRIDE"; /** The join point override level */ ScopeLevel JOINPOINT_OVERRIDE = new ScopeLevel(JOINPOINT.getLevel() + 100, JOINPOINT_OVERRIDE_NAME); /** The thread level name */ String THREAD_NAME = "THREAD"; /** The thread level */ ScopeLevel THREAD = new ScopeLevel(JOINPOINT_OVERRIDE.getLevel() + 100, THREAD_NAME); /** The unit of work level name */ String WORK_NAME = "WORK"; /** The unit of work level */ ScopeLevel WORK = new ScopeLevel(THREAD.getLevel() + 100, WORK_NAME); /** The request level name */ String REQUEST_NAME = "REQUEST"; /** The request level */ ScopeLevel REQUEST = new ScopeLevel(WORK.getLevel() + 100, REQUEST_NAME); } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/scope/CommonLevelsUtil.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/scope/CommonLevelsUtil.jav0000644000175000017500000000610210774421015033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.scope; import java.util.List; import java.util.ArrayList; import java.util.Collections; /** * CommonLevels util class. * * @author Ales Justin */ public class CommonLevelsUtil { private final static List levels; private static final int size; static { levels = new ArrayList(); levels.add(CommonLevels.DOMAIN); levels.add(CommonLevels.CLUSTER); levels.add(CommonLevels.MACHINE); levels.add(CommonLevels.NODE); levels.add(CommonLevels.JVM); levels.add(CommonLevels.SERVER); levels.add(CommonLevels.SUBSYSTEM); levels.add(CommonLevels.APPLICATION); levels.add(CommonLevels.DEPLOYMENT); levels.add(CommonLevels.CLASS); levels.add(CommonLevels.INSTANCE); levels.add(CommonLevels.JOINPOINT); levels.add(CommonLevels.JOINPOINT_OVERRIDE); levels.add(CommonLevels.THREAD); levels.add(CommonLevels.WORK); levels.add(CommonLevels.REQUEST); Collections.sort(levels); size = levels.size(); } /** * Get the levels (including level param) that * are below level param. * * @param level the flag level * @return sub list of levels */ public static List getSubLevels(ScopeLevel level) { int index = levels.indexOf(level); if (index < 0) throw new IllegalArgumentException("No such scope level in levels: " + level); return levels.subList(index, size); } /** * Get the levels that are exclusively below level param. * * @param level the flag level * @return sub list of levels */ public static List getExclusiveSubLevels(ScopeLevel level) { int index = levels.indexOf(level); if (index < 0) throw new IllegalArgumentException("No such scope level in levels: " + level); if (index + 1 == size) return Collections.emptyList(); return levels.subList(index + 1, size); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/scope/ScopeKeyFactoryLookup.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/scope/ScopeKeyFactoryLooku0000644000175000017500000000314310756326650033254 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.scope; import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Defining the factory class to create actual ScopeKey * from annotated scope key annotation. * * @author Ales Justin */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.ANNOTATION_TYPE}) public @interface ScopeKeyFactoryLookup { Class> value(); } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/scope/ScopeKey.java0000644000175000017500000002014211035635747031631 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.scope; import java.io.Serializable; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.SortedMap; import java.util.TreeMap; /** * ScopeKey. * * @author Adrian Brock * @version $Revision: 75678 $ */ public class ScopeKey implements Serializable, Cloneable { /** The serialVersionUID */ private static final long serialVersionUID = -496238095349593371L; /** The default scope */ public static ScopeKey DEFAULT_SCOPE = new ScopeKey(new Scope(CommonLevels.JVM, "THIS")); /** The scopes */ private SortedMap scopes = Collections.synchronizedSortedMap(new TreeMap()); /** The scope level for this key */ private ScopeLevel maxScopeLevel; /** Whether the key is frozen */ private volatile boolean frozen; static { DEFAULT_SCOPE.freeze(); } /** * Create a new ScopeKey. */ public ScopeKey() { } /** * Create a new ScopeKey. * * @param scope the scope */ public ScopeKey(Scope scope) { addScope(scope); } /** * Create a new ScopeKey. * * @param level the scope level * @param qualifier the scope qualifier */ public ScopeKey(ScopeLevel level, Object qualifier) { addScope(level, qualifier); } /** * Create a new ScopeKey. * * @param scopes the scopes */ public ScopeKey(Collection scopes) { if (scopes == null) throw new IllegalArgumentException("Null scopes"); for (Scope scope : scopes) addScope(scope); } /** * Create a new ScopeKey. * * @param scopes the scopes */ public ScopeKey(Scope[] scopes) { if (scopes == null) throw new IllegalArgumentException("Null scopes"); for (Scope scope : scopes) addScope(scope); } /** * Get the frozen. * * @return the frozen. */ public boolean isFrozen() { return frozen; } /** * Set to frozen. */ public void freeze() { if (scopes.isEmpty()) throw new IllegalStateException("Attempt to freeze an empty key"); this.frozen = true; } /** * Get the scopes * * @return the scopes */ public Collection getScopes() { return Collections.unmodifiableCollection(scopes.values()); } /** * Get a scope * * @param level the scope level * @return the scope */ public Scope getScope(ScopeLevel level) { if (level == null) throw new IllegalArgumentException("Null level"); return scopes.get(level); } /** * Get the maximum scope level * * @return the largest scope level */ public ScopeLevel getMaxScopeLevel() { return maxScopeLevel; } /** * Get the parent scope key * * @return the parent or null if there is no parent */ public ScopeKey getParent() { if (scopes.size() < 2) return null; ScopeKey result = new ScopeKey(); for (Iterator i = scopes.values().iterator(); i.hasNext();) { Scope scope = i.next(); if (i.hasNext()) result.addScope(scope); } return result; } /** * Is this parent of key parameter. * * @param key the key parameter * @return true if this is direct parent of key param */ public boolean isParent(ScopeKey key) { if (key == null) throw new IllegalArgumentException("Null key"); // The passed key doesn't have a parent if (key.scopes.size() < 2) return false; // If it is a child, it will have one more scope if (scopes.size() != key.scopes.size() - 1) return false; Iterator thisScopes = scopes.values().iterator(); Iterator keyScopes = key.scopes.values().iterator(); while (thisScopes.hasNext()) { Scope thisScope = thisScopes.next(); Scope keyScope = keyScopes.next(); if (thisScope.equals(keyScope) == false) return false; } return true; } /** * Add a scope * * @param scope the scope * @return the previous value or null if there wasn't one */ public Scope addScope(Scope scope) { if (scope == null) throw new IllegalArgumentException("Null scope"); if (frozen) throw new IllegalStateException("The scope key is frozen"); ScopeLevel level = scope.getScopeLevel(); Scope result = scopes.put(level, scope); if (maxScopeLevel == null || level.compareTo(maxScopeLevel) >= 0) maxScopeLevel = level; return result; } /** * Add a scope * * @param level the scope level * @param qualifier the scope qualifier * @return the previous value or null if there wasn't one */ public Scope addScope(ScopeLevel level, Object qualifier) { Scope scope = new Scope(level, qualifier); return addScope(scope); } /** * Remove a scope * * @param scope the scope * @return the previous value or null if there wasn't one */ public Scope removeScope(Scope scope) { if (scope == null) throw new IllegalArgumentException("Null scope"); return removeScopeLevel(scope.getScopeLevel()); } /** * Get a scope level * * @param scopeLevel the scope level * @return the scope or null if there is no such level */ public Scope getScopeLevel(ScopeLevel scopeLevel) { if (scopeLevel == null) throw new IllegalArgumentException("Null scope level"); return scopes.get(scopeLevel); } /** * Remove a scope level * * @param scopeLevel the scope level * @return the scope or null if there is no such level */ public Scope removeScopeLevel(ScopeLevel scopeLevel) { if (scopeLevel == null) throw new IllegalArgumentException("Null scope level"); if (frozen) throw new IllegalStateException("The scope key is frozen"); Scope result = scopes.remove(scopeLevel); if (scopeLevel.equals(maxScopeLevel)) { maxScopeLevel = null; for (ScopeLevel level : scopes.keySet()) maxScopeLevel = level; } return result; } public String toString() { return scopes.values().toString(); } public boolean equals(Object object) { if (object == this) return true; if (object == null || object instanceof ScopeKey == false) return false; ScopeKey other = (ScopeKey) object; return scopes.equals(other.scopes); } public int hashCode() { return scopes.hashCode(); } public ScopeKey clone() { try { ScopeKey result = (ScopeKey) super.clone(); result.scopes = Collections.synchronizedSortedMap(new TreeMap(scopes)); result.frozen = false; return result; } catch (CloneNotSupportedException e) { throw new Error(e); } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/scope/ScopeFactoryLookup.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/scope/ScopeFactoryLookup.j0000644000175000017500000000312610756326650033214 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.scope; import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Defining the factory class to create actual Scope * from annotated scope annotation. * * @author Ales Justin */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.ANNOTATION_TYPE}) public @interface ScopeFactoryLookup { Class> value(); } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/scope/ScopeFactory.java0000644000175000017500000000275610564102651032510 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.scope; import java.lang.annotation.Annotation; /** * Factory to create Scope from annotation. * * @param the scope annotation * @author Ales Justin */ public interface ScopeFactory { /** * Create ScopeKey from scope annotation instance * * @param annotation scope annotation * @return scope key from scope annotation */ Scope create(T annotation); } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/Restricted.java0000644000175000017500000000252410446527733031112 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Restricted. * *

A tagging annotation to disallow items in runtime contexts. * * @author Adrian Brock * @version $Revision: 45742 $ */ @Retention(RetentionPolicy.RUNTIME) public @interface Restricted { } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/context/0000755000175000017500000000000011620305602027600 5ustar twernertwerner././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/context/MetaDataContext.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/context/MetaDataContext.ja0000644000175000017500000000410710505734347033160 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.context; import java.util.List; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; /** * MetaDataContext. * * @author Adrian Brock * @version $Revision: 57133 $ */ public interface MetaDataContext extends MetaDataRetrieval { /** * Get the parent * * @return the parent context */ MetaDataContext getParent(); /** * Get the retrievals * * @return the retrievals */ List getRetrievals(); /** * Get the local retrievals * * @return the local retrievals */ List getLocalRetrievals(); /** * Append a meta data retrieval * * @param retrieval the meta data retrieval */ void append(MetaDataRetrieval retrieval); /** * Prepend a meta data retrieval * * @param retrieval the meta data retrieval */ void prepend(MetaDataRetrieval retrieval); /** * Remove a meta data retrieval * * @param retrieval the meta data retrieval */ void remove(MetaDataRetrieval retrieval); } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/MetaData.java0000644000175000017500000001013210774377505030460 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.scope.ScopeLevel; import org.jboss.metadata.spi.signature.Signature; /** * MetaData. * * @author Adrian Brock * @version $Revision: 71541 $ */ public interface MetaData { /** No annotations */ Annotation[] NO_ANNOTATIONS = new Annotation[0]; /** No meta data */ Object[] NO_METADATA = new Object[0]; /** * Get the valid time * * @return the valid time */ long getValidTime(); /** * Get annotation * * @param the annotation type * @param annotationType the annotation type * @return the annotation or null if not present */ T getAnnotation(Class annotationType); /** * Get all the annotations * * @return the annotations */ Annotation[] getAnnotations(); /** * Get all the local annotations * * @return the annotations */ Annotation[] getLocalAnnotations(); /** * Is the annotation present? * * @param annotationType the annotation type * @return true when present */ boolean isAnnotationPresent(Class annotationType); /** * Get metadata * * @param the metadata type * @param type the type * @return the metadata or null if not present */ T getMetaData(Class type); /** * Get all the metadata * * @return the metadata */ Object[] getMetaData(); /** * Get all the local metadata * * @return the metadata */ Object[] getLocalMetaData(); /** * Is the metadata present * * @param type the type of the meta data * @return true when the metadata is present */ boolean isMetaDataPresent(Class type); /** * Get metadata * * @param name the name of the meta data * @return the metadata or null if not present */ Object getMetaData(String name); /** * Get metadata * * @param the metadata type * @param name the name of the meta data * @param type the expected type of the metadata * @return the metadata or null if not present */ T getMetaData(String name, Class type); /** * Is the metadata present * * @param name the name of the meta data * @return true when the metadata is present */ boolean isMetaDataPresent(String name); /** * Is the metadata present * * @param name the name of the meta data * @param type the expected type of the metadata * @return true when the metadata is present */ boolean isMetaDataPresent(String name, Class type); /** * Get the component metadata * * @param signature the signature * @return the component metadata */ MetaData getComponentMetaData(Signature signature); /** * Get the scope metadata. * * @param level the scope level * @return the scope metadata */ MetaData getScopeMetaData(ScopeLevel level); /** * Is metadata empty. * * @return true if empty */ boolean isEmpty(); } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/repository/0000755000175000017500000000000011620305602030333 5ustar twernertwerner././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/repository/MutableMetaDataRepository.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/repository/MutableMetaData0000644000175000017500000000512010720557046033261 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.repository; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.retrieval.MetaDataRetrievalFactory; import org.jboss.metadata.spi.scope.ScopeKey; import org.jboss.metadata.spi.scope.ScopeLevel; /** * MutableMetaDataRepository. * * @author Adrian Brock * @version $Revision: 67291 $ */ public interface MutableMetaDataRepository extends MetaDataRepository { /** * Add a meta data retrieval for the given scope * * @param retrieval the retrieval * @return any previous retrieval */ MetaDataRetrieval addMetaDataRetrieval(MetaDataRetrieval retrieval); /** * Remove a meta data retrieval for the given scope * * @param key the key * @return any previous retrieval */ MetaDataRetrieval removeMetaDataRetrieval(ScopeKey key); /** * Get a meta data retrieval factory for the given scope level * * @param level the scope level * @return the factory */ MetaDataRetrievalFactory getMetaDataRetrievalFactory(ScopeLevel level); /** * Add a meta data retrieval factory to the given scope level * * @param level the scope level * @param factory the factory * @return any previous factory */ MetaDataRetrievalFactory addMetaDataRetrievalFactory(ScopeLevel level, MetaDataRetrievalFactory factory); /** * Remove a meta data retrieval factory for the given scope level * * @param level the scope level * @return any previous factory */ MetaDataRetrievalFactory removeMetaDataRetrievalFactory(ScopeLevel level); } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/repository/visitor/0000755000175000017500000000000011620305602032032 5ustar twernertwerner././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/repository/visitor/MetaDataRepositoryVisitor.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/repository/visitor/MetaDat0000644000175000017500000000303210454442653033306 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.repository.visitor; import org.jboss.metadata.spi.repository.MetaDataRepository; import org.jboss.metadata.spi.scope.ScopeKey; /** * MetaDataRepositoryVisitor. * * @author Adrian Brock * @version $Revision: 46146 $ */ public interface MetaDataRepositoryVisitor { /** * Decide whether the scope matches * * @param repository the repository * @param key the scope key * @return true when it matches */ boolean matchScope(MetaDataRepository repository, ScopeKey key); } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/repository/MetaDataRepository.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/repository/MetaDataReposit0000644000175000017500000000410110454442653033314 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.repository; import java.util.Set; import org.jboss.metadata.spi.MetaData; import org.jboss.metadata.spi.repository.visitor.MetaDataRepositoryVisitor; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.scope.ScopeKey; /** * MetaDataRepository. * * @author Adrian Brock * @version $Revision: 46146 $ */ public interface MetaDataRepository { /** * Get the meta data for a scope key * * @param key the key * @return the meta data */ MetaData getMetaData(ScopeKey key); /** * Get the meta data retrieval for a scope key * * @param key the key * @return the meta data */ MetaDataRetrieval getMetaDataRetrieval(ScopeKey key); /** * Get the children of this scope * * @param key the key * @return the children */ Set getChildren(ScopeKey key); /** * Visit each node * * @param visitor the visitor * @return the matching scopes */ Set matchScopes(MetaDataRepositoryVisitor visitor); } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/annotation/0000755000175000017500000000000011620305602030266 5ustar twernertwerner././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/ComponentMutableMetaData.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/ComponentMutableMetaData.j0000644000175000017500000001612410720557046033163 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi; import java.lang.annotation.Annotation; import java.lang.reflect.Member; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; import org.jboss.metadata.spi.signature.Signature; import org.jboss.reflect.spi.MemberInfo; /** * ComponentMutableMetaData. * * @author Adrian Brock * @version $Revision: 57133 $ */ public interface ComponentMutableMetaData { /** * Add a component metadata * * @param signature the signature * @param component the component * @return any previous component at that signature */ MetaDataRetrieval addComponentMetaDataRetrieval(Signature signature, MetaDataRetrieval component); /** * Remove a component metadata * * @param signature the signature * @return any previous component at that signature */ MetaDataRetrieval removeComponentMetaDataRetrieval(Signature signature); /** * Add a component annotation * * @param the annotation type * @param signature the signature * @param annotation the annotation * @return any previous annotation */ T addAnnotation(Signature signature, T annotation); /** * Remove a member annotation * * @param the annotation type * @param signature the signature * @param annotationType the annotation type * @return any previous annotation */ T removeAnnotation(Signature signature, Class annotationType); /** * Add member metaData * * @param the metadata type * @param signature the signature * @param metaData the meta data * @param type the expected type * @return any previous meta data */ T addMetaData(Signature signature, T metaData, Class type); /** * Remove member metaData * * @param the metadata type * @param signature the signature * @param type the meta data type * @return any previous meta data */ T removeMetaData(Signature signature, Class type); /** * Add member metaData * * @param the metadata type * @param signature the signature * @param name the name * @param metaData the meta data * @param type the expected type * @return any previous meta data */ T addMetaData(Signature signature, String name, T metaData, Class type); /** * Remove member metadata * * @param the metadata type * @param signature the signature * @param name the name of the meta data * @param type the expected type of the metadata * @return the metadata or null if not present */ T removeMetaData(Signature signature, String name, Class type); /** * Add a component annotation * * @param the annotation type * @param member member * @param annotation the annotation * @return any previous annotation */ T addAnnotation(Member member, T annotation); /** * Remove a member annotation * * @param the annotation type * @param member member * @param annotationType the annotation type * @return any previous annotation */ T removeAnnotation(Member member, Class annotationType); /** * Add member metaData * * @param the metadata type * @param member member * @param metaData the meta data * @param type the expected type * @return any previous meta data */ T addMetaData(Member member, T metaData, Class type); /** * Remove member metaData * * @param the metadata type * @param member member * @param type the meta data type * @return any previous meta data */ T removeMetaData(Member member, Class type); /** * Add member metaData * * @param the metadata type * @param member member * @param name the name * @param metaData the meta data * @param type the expected type * @return any previous meta data */ T addMetaData(Member member, String name, T metaData, Class type); /** * Remove member metadata * * @param the metadata type * @param member member * @param name the name of the meta data * @param type the expected type of the metadata * @return the metadata or null if not present */ T removeMetaData(Member member, String name, Class type); /** * Add a member annotation * * @param the annotation type * @param member member * @param annotation the annotation * @return any previous annotation */ T addAnnotation(MemberInfo member, T annotation); /** * Remove a member annotation * * @param the annotation type * @param member member * @param annotationType the annotation type * @return any previous annotation */ T removeAnnotation(MemberInfo member, Class annotationType); /** * Add member metaData * * @param the metadata type * @param member member * @param metaData the meta data * @param type the expected type * @return any previous meta data */ T addMetaData(MemberInfo member, T metaData, Class type); /** * Remove member metaData * * @param the metadata type * @param member member * @param type the meta data type * @return any previous meta data */ T removeMetaData(MemberInfo member, Class type); /** * Add member metaData * * @param the metadata type * @param member member * @param name the name * @param metaData the meta data * @param type the expected type * @return any previous meta data */ T addMetaData(MemberInfo member, String name, T metaData, Class type); /** * Remove member metadata * * @param the metadata type * @param member member * @param name the name of the meta data * @param type the expected type of the metadata * @return the metadata or null if not present */ T removeMetaData(MemberInfo member, String name, Class type); } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/0000755000175000017500000000000011620305602030115 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/javassist/0000755000175000017500000000000011620305602032124 5ustar twernertwerner././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/javassist/JavassistConstructorParametersSignature.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/javassist/Javass0000644000175000017500000000341311006162205033275 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.signature.javassist; import javassist.CtConstructor; import javassist.NotFoundException; import org.jboss.metadata.spi.signature.ConstructorParametersSignature; /** * Javassist Constructor parameters Signature. * * @author Ales Justin */ public class JavassistConstructorParametersSignature extends ConstructorParametersSignature { /** * Create a new Signature. * * @param constructor the method * @param param the parameter number * @throws javassist.NotFoundException for any error */ public JavassistConstructorParametersSignature(CtConstructor constructor, int param) throws NotFoundException { super(param, JavassistSignatureFactory.convertParameters(constructor.getParameterTypes())); } }././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/javassist/JavassistFieldSignature.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/javassist/Javass0000644000175000017500000000266511006035275033313 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.signature.javassist; import javassist.CtField; import org.jboss.metadata.spi.signature.FieldSignature; /** * Javassist Field Signature. * * @author Ales Justin */ public class JavassistFieldSignature extends FieldSignature { /** * Create a new Signature. * * @param field the field */ public JavassistFieldSignature(CtField field) { super(field.getName()); } }././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/javassist/JavassistMethodSignature.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/javassist/Javass0000644000175000017500000000317611006035275033311 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.signature.javassist; import javassist.CtMethod; import javassist.NotFoundException; import org.jboss.metadata.spi.signature.MethodSignature; /** * Javassist Method Signature. * * @author Ales Justin */ public class JavassistMethodSignature extends MethodSignature { /** * Create a new Signature. * * @param method the method * @throws javassist.NotFoundException for any error */ public JavassistMethodSignature(CtMethod method) throws NotFoundException { super(method.getName(), JavassistSignatureFactory.convertParameters(method.getParameterTypes())); } }././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/javassist/JavassistSignatureFactory.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/javassist/Javass0000644000175000017500000001112511044101757033303 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.signature.javassist; import javassist.CtConstructor; import javassist.CtField; import javassist.CtMember; import javassist.CtMethod; import javassist.NotFoundException; import javassist.CtClass; import javassist.CtPrimitiveType; import org.jboss.metadata.spi.signature.Signature; /** * Javassist Signature factory. * * @author Ales Justin */ public class JavassistSignatureFactory { /** * Get a signature for a member * * @param member the member * @return the result */ public static Signature getSignature(CtMember member) { if (member == null) throw new IllegalArgumentException("Null member"); try { if (member instanceof CtMethod) { CtMethod method = CtMethod.class.cast(member); return new JavassistMethodSignature(method); } if (member instanceof CtField) { CtField field = CtField.class.cast(member); return new JavassistFieldSignature(field); } if (member instanceof CtConstructor) { CtConstructor constructor = CtConstructor.class.cast(member); return new JavassistConstructorSignature(constructor); } } catch (NotFoundException e) { throw raiseClassNotFound("member", member.toString(), e); } throw new IllegalArgumentException("Unknown member: " + member); } /** * Convert ct classes to string class names. * * @param classes the classes * @return class names */ public static String[] convertParameters(CtClass[] classes) { if (classes == null || classes.length == 0) return Signature.NO_PARAMETERS; String[] paramTypes = new String[classes.length]; for (int i = 0; i < classes.length; ++i) paramTypes[i] = convertName(classes[i]); return paramTypes; } /** * Convert ct class to full classname. * * @param clazz the ct class * @return class name */ protected static String convertName(CtClass clazz) { if (clazz == null) throw new IllegalArgumentException("Null CtClass"); CtClass temp = clazz; if (temp.isArray()) { StringBuilder buffer = new StringBuilder(); try { while (temp.isArray()) { buffer.append('['); temp = temp.getComponentType(); } if (temp.isPrimitive()) { CtPrimitiveType primitive = (CtPrimitiveType) temp; buffer.append(Character.toString(primitive.getDescriptor())); } else { buffer.append('L'); buffer.append(temp.getName()); buffer.append(';'); } return buffer.toString(); } catch (NotFoundException e) { throw raiseClassNotFound("class", clazz.getName(), e); } } return clazz.getName(); } /** * Raise NCDFE exception. * * @param type the error type * @param info the info * @param e javassist exception * @return NCDFE instance * @throws NoClassDefFoundError transform e param into NCDFE */ protected static NoClassDefFoundError raiseClassNotFound(String type, String info, NotFoundException e) throws NoClassDefFoundError { NoClassDefFoundError ex = new NoClassDefFoundError("Unable to find " + type + ": " + info); if (e.getCause() != null) ex.initCause(e.getCause()); // Hide the javassist error throw ex; } }././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/javassist/JavassistConstructorSignature.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/javassist/Javass0000644000175000017500000000324411006035275033305 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.signature.javassist; import javassist.CtConstructor; import javassist.NotFoundException; import org.jboss.metadata.spi.signature.ConstructorSignature; /** * Javassist Constructor Signature. * * @author Ales Justin */ public class JavassistConstructorSignature extends ConstructorSignature { /** * Create a new Signature. * * @param constructor the constructor * @throws javassist.NotFoundException for any errors */ public JavassistConstructorSignature(CtConstructor constructor) throws NotFoundException { super(JavassistSignatureFactory.convertParameters(constructor.getParameterTypes())); } }././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/javassist/JavassistMethodParametersSignature.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/javassist/Javass0000644000175000017500000000335311006035275033306 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.signature.javassist; import javassist.CtMethod; import javassist.NotFoundException; import org.jboss.metadata.spi.signature.MethodParametersSignature; /** * Javassist Method parameters Signature. * * @author Ales Justin */ public class JavassistMethodParametersSignature extends MethodParametersSignature { /** * Create a new Signature. * * @param method the method * @param param the parameter number * @throws javassist.NotFoundException for any error */ public JavassistMethodParametersSignature(CtMethod method, int param) throws NotFoundException { super(method.getName(), JavassistSignatureFactory.convertParameters(method.getParameterTypes()), param); } }././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/ParametersSignature.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/ParametersSignat0000644000175000017500000000564211006162205033316 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.signature; /** * Parameters Signature. * * @author Ales Justin */ public abstract class ParametersSignature extends Signature { /** The parameter number */ private int param; /** * Create a new Signature. * * @param param the parameter number * @param parameters the parameters */ protected ParametersSignature(int param, String... parameters) { super(parameters); this.param = param; checkParam(); } /** * Create a new Signature. * * @param param the parameter number * @param parameters the parameters */ protected ParametersSignature(int param, Class... parameters) { super(parameters); this.param = param; checkParam(); } /** * Create a new Signature. * * @param name the name * @param param the parameter number * @param parameters the parameters */ protected ParametersSignature(String name, int param, String... parameters) { super(name, parameters); this.param = param; checkParam(); } /** * Create a new Signature. * * @param name the name * @param param the parameter number * @param parameters the parameters */ protected ParametersSignature(String name, int param, Class... parameters) { super(name, parameters); this.param = param; checkParam(); } /** * Get the param. * * @return the param. */ public int getParam() { return param; } /** * Check the param number makes sense */ protected void checkParam() { if (param < 0 || param >= getParameters().length) throw new IllegalArgumentException("param must be between 0 and " + getParameters().length); } protected void internalToString(StringBuilder builder) { super.internalToString(builder); builder.append("#").append(param); } }././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/ConstructorParametersSignature.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/ConstructorParam0000644000175000017500000000520611041642153033353 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.signature; import java.lang.reflect.Constructor; import org.jboss.reflect.spi.ConstructorInfo; /** * Constructor parameters Signature. * * @author Ales Justin */ public class ConstructorParametersSignature extends ParametersSignature { /** The constructor */ private Constructor constructor; /** * Create a new Signature. * * @param param the parameter number * @param parameters the parameters */ public ConstructorParametersSignature(int param, String... parameters) { super(param, parameters); } /** * Create a new Signature. * * @param param the parameter number * @param parameters the parameters */ public ConstructorParametersSignature(int param, Class... parameters) { super(param, parameters); } /** * Create a new Signature. * * @param constructor the constructor * @param param the parameter number */ public ConstructorParametersSignature(Constructor constructor, int param) { super(param, constructor.getParameterTypes()); this.constructor = constructor; } /** * Create a new Signature. * * @param constructor the constructor info * @param param the parameter number */ public ConstructorParametersSignature(ConstructorInfo constructor, int param) { super(param, convertParameterTypes(constructor.getParameterTypes())); } /** * Get the constructor. * * @return the constructor (could be null if not created using a constructor . */ public Constructor getConstructor() { return constructor; } }././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/MethodParametersSignature.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/MethodParameters0000644000175000017500000000530011041642153033304 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.signature; import java.lang.reflect.Method; import org.jboss.reflect.spi.MethodInfo; /** * Method parameters Signature. * * @author Adrian Brock * @author Ales Justin * @version $Revision: 1.1 $ */ public class MethodParametersSignature extends ParametersSignature { /** The method */ private Method method; /** * Create a new Signature. * * @param name the name * @param param the parameter number * @param parameters the parameters */ public MethodParametersSignature(String name, String[] parameters, int param) { super(name, param, parameters); } /** * Create a new Signature. * * @param name the name * @param param the parameter number * @param parameters the parameters */ public MethodParametersSignature(String name, int param, Class... parameters) { super(name, param, parameters); } /** * Create a new Signature. * * @param method the method * @param param the parameter number */ public MethodParametersSignature(Method method, int param) { super(method.getName(), param, method.getParameterTypes()); this.method = method; } /** * Create a new Signature. * * @param method the method info * @param param the parameter number */ public MethodParametersSignature(MethodInfo method, int param) { super(method.getName(), param, convertParameterTypes(method.getParameterTypes())); } /** * Get the method. * * @return the method could be null if not created using a method */ public Method getMethod() { return method; } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/Signature.java0000644000175000017500000002725411214235640032736 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.signature; import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.util.Arrays; import org.jboss.metadata.plugins.signature.SignatureNameUtil; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.FieldInfo; import org.jboss.reflect.spi.MemberInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.PrimitiveInfo; import org.jboss.reflect.spi.TypeInfo; /** * Signature. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Signature { /** No Name */ public static final String NO_NAME = "?%NO_NAME%?"; /** No Parameters */ public static final String[] NO_PARAMETERS = new String[0]; /** No Parameters Types */ public static final Class[] NO_PARAMETER_TYPES = new Class[0]; /** The name */ private String name; /** The parameters */ private String[] parameters; /** The parameter types */ private Class[] parameterTypes; /** The cached hashcode */ private transient int cachedHashCode = Integer.MIN_VALUE; /** * Get a signature for a member * * @param member the member * @return the result */ public static Signature getSignature(Member member) { if (member == null) throw new IllegalArgumentException("Null member"); if (member instanceof Method) { Method method = Method.class.cast(member); return new MethodSignature(method); } if (member instanceof Field) { Field field = Field.class.cast(member); return new FieldSignature(field); } if (member instanceof Constructor) { Constructor constructor = Constructor.class.cast(member); return new ConstructorSignature(constructor); } throw new IllegalArgumentException("Unknown member: " + member); } /** * Get a signature for a member info * * @param member the member * @return the result */ public static Signature getSignature(MemberInfo member) { if (member == null) throw new IllegalArgumentException("Null member"); if (member instanceof MethodInfo) { MethodInfo method = MethodInfo.class.cast(member); return new MethodSignature(method); } if (member instanceof FieldInfo) { FieldInfo field = FieldInfo.class.cast(member); return new FieldSignature(field); } if (member instanceof ConstructorInfo) { ConstructorInfo constructor = ConstructorInfo.class.cast(member); return new ConstructorSignature(constructor); } throw new IllegalArgumentException("Unknown member: " + member); } @Deprecated // Use PrimitiveInfo.getPrimitiveArrayType(String) public static String getPrimativeArrayType(String name) { return PrimitiveInfo.getPrimativeArrayType(name); } public static String[] convertParameters(TypeInfo[] typeInfos) { if (typeInfos == null || typeInfos.length == 0) return NO_PARAMETERS; String[] paramTypes = new String[typeInfos.length]; for (int i = 0; i < typeInfos.length; ++i) paramTypes[i] = typeInfos[i].getName(); return paramTypes; } @SuppressWarnings("deprecation") public static Class[] convertParameterTypes(TypeInfo[] typeInfos) { if (typeInfos == null || typeInfos.length == 0) return NO_PARAMETER_TYPES; Class[] paramTypes = new Class[typeInfos.length]; for (int i = 0; i < typeInfos.length; ++i) paramTypes[i] = typeInfos[i].getType(); return paramTypes; } /** * Convert classes to string * * @param parameters the parameters as classes * @return the parameters as strings */ private static String[] classesToStrings(Class... parameters) { if (parameters == null || parameters.length == 0) return NO_PARAMETERS; String[] result = new String[parameters.length]; for (int i = 0; i < result.length; ++i) { if (parameters[i] == null) throw new IllegalArgumentException("Null class"); result[i] = parameters[i].getName(); } return result; } /** * Convert classes to string * * @param clazz the reference class * @param parameters the parameters as strings * @return the parameters as classes */ private static Class[] stringsToClasses(Class clazz, String... parameters) { if (clazz == null) throw new IllegalArgumentException("Null clazz"); ClassLoader cl = clazz.getClassLoader(); if (cl == null) { cl = Class.class.getClassLoader(); if (cl == null) { //Bootstrap classloader was represented as null, use the tcl cl = Thread.currentThread().getContextClassLoader(); } } return stringsToClasses(cl, parameters); } /** * Loads a class by name. * * TODO A similar method exists in org.jboss.util.Classes ... */ private static Class loadClass(ClassLoader cl, String name) throws ClassNotFoundException { Class primitive = PrimitiveInfo.getPrimativeType(name); if (primitive != null) { return primitive; } int index = name.lastIndexOf('['); if (index >= 0) { // count opening braces int arrayDimension = 0; while (name.charAt(arrayDimension) == '[') arrayDimension++; Class componentType; if (name.charAt(arrayDimension) == 'L') { String arrayType = name.substring(arrayDimension + 1, name.length() - 1); componentType = loadClass(cl, arrayType); } else { String arrayType = name.substring(arrayDimension); componentType = PrimitiveInfo.getPrimativeArrayComponentType(arrayType); } // construct array class return Array.newInstance(componentType, new int[arrayDimension]).getClass(); } return Class.forName(name, true, cl); } /** * Convert classes to string * * @param cl the classloader * @param parameters the parameters as strings * @return the parameters as classes */ private static Class[] stringsToClasses(ClassLoader cl, String... parameters) { if (cl == null) throw new IllegalArgumentException("Null classloader"); if (parameters == null || parameters.length == 0) return NO_PARAMETER_TYPES; Class[] result = new Class[parameters.length]; for (int i = 0; i < result.length; ++i) { try { result[i] = loadClass(cl, parameters[i]); } catch (ClassNotFoundException e) { throw new IllegalStateException("Class not found: " + parameters[i], e); } } return result; } /** * Create a new Signature. */ public Signature() { this(NO_NAME, NO_PARAMETER_TYPES, NO_PARAMETERS); } /** * Create a new Signature. * * @param name the name */ public Signature(String name) { this(name, null, NO_PARAMETERS); } /** * Create a new Signature. * * @param parameters the parameters */ public Signature(String... parameters) { this(NO_NAME, null, parameters); } /** * Create a new Signature. * * @param parameters the parameters */ public Signature(Class... parameters) { this(NO_NAME, parameters, null); } /** * Create a new Signature. * * @param name the name * @param parameters the parameters */ public Signature(String name, Class... parameters) { this(name, parameters, null); } /** * Create a new Signature. * * @param name the name * @param parameters the parameters */ public Signature(String name, String... parameters) { this(name, null, parameters); } /** * Create a new Signature. * * @param name the name * @param parameterTypes the parameterTypes * @param parameters the parameters */ private Signature(String name, Class[] parameterTypes, String[] parameters) { this.name = name; if (name == null) this.name = NO_NAME; this.parameters = parameters; this.parameterTypes = parameterTypes; } /** * Returns the name. * * @return the name. */ public String getName() { return name; } /** * Returns the parameters. * * @return the parameters. */ public String[] getParameters() { if (parameters == null) parameters = classesToStrings(getParameterTypes()); return parameters; } /** * Get the parameter types (for override by sub-classes) * * @return the parameters types */ protected Class[] getParameterTypes() { return parameterTypes; } /** * Returns the parameter types. * * @param clazz the reference class * @return the parameter types. */ public Class[] getParametersTypes(Class clazz) { if (parameterTypes == null) { parameterTypes = getParameterTypes(); if (parameterTypes == null) parameterTypes = stringsToClasses(clazz, parameters); } return parameterTypes; } public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj instanceof Signature == false) return false; Signature other = (Signature) obj; if (getName().equals(other.getName()) == false) return false; String[] thisParameters = getParameters(); String[] otherParameters = other.getParameters(); if (thisParameters.length != otherParameters.length) return false; for (int i = 0; i < thisParameters.length; ++i) { if (thisParameters[i].equals(otherParameters[i]) == false) return false; } return true; } public int hashCode() { if (cachedHashCode == Integer.MIN_VALUE) cachedHashCode = toString().hashCode(); return cachedHashCode; } public String toString() { StringBuilder builder = new StringBuilder(); internalToString(builder); return builder.toString(); } /** * Build the to String * * @param builder the builder to use */ protected void internalToString(StringBuilder builder) { SignatureNameUtil.signatureToString(builder, name, getParameters()); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/ConstructorSignature.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/ConstructorSigna0000644000175000017500000000503511041642153033354 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.signature; import java.lang.reflect.Constructor; import org.jboss.reflect.spi.ConstructorInfo; /** * Constructor Signature. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ConstructorSignature extends Signature { /** The constructor */ private Constructor constructor; /** * Create a new Signature. * * @param parameters the parameters */ public ConstructorSignature(String[] parameters) { super(parameters); } /** * Create a new Signature. * * @param parameters the parameters */ public ConstructorSignature(Class... parameters) { super(parameters); } /** * Create a new Signature. * * @param constructor the constructor */ public ConstructorSignature(Constructor constructor) { super((Class[]) null); this.constructor = constructor; } /** * Create a new Signature. * * @param constructor the constructor */ public ConstructorSignature(ConstructorInfo constructor) { super(convertParameterTypes(constructor.getParameterTypes())); } /** * Get the constructor. * * @return the constructor (could be null if not created using a constructor . */ public Constructor getConstructor() { return constructor; } @Override protected Class[] getParameterTypes() { if (constructor != null) return constructor.getParameterTypes(); return super.getParameterTypes(); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/MethodSignature.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/MethodSignature.0000644000175000017500000000477311041642153033235 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.signature; import java.lang.reflect.Method; import org.jboss.reflect.spi.MethodInfo; /** * Method Signature. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class MethodSignature extends Signature { /** The method */ private Method method; /** * Create a new Signature. * * @param name the name * @param parameters the parameters */ public MethodSignature(String name, String[] parameters) { super(name, parameters); } /** * Create a new Signature. * * @param name the name * @param parameters the parameters */ public MethodSignature(String name, Class... parameters) { super(name, parameters); } /** * Create a new Signature. * * @param method the method */ public MethodSignature(Method method) { super(method.getName(), (Class[]) null); this.method = method; } /** * Create a new Signature. * * @param method the method */ public MethodSignature(MethodInfo method) { super(method.getName(), convertParameterTypes(method.getParameterTypes())); } /** * Get the method. * * @return the method could be null if not created using a method */ public Method getMethod() { return method; } @Override protected Class[] getParameterTypes() { if (method != null) return method.getParameterTypes(); return super.getParameterTypes(); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/DeclaredMethodSignature.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/DeclaredMethodSi0000644000175000017500000001040311214235640033201 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.signature; import java.lang.reflect.Method; import org.jboss.metadata.plugins.signature.SignatureNameUtil; import org.jboss.reflect.spi.MethodInfo; /** * Method Signature. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class DeclaredMethodSignature extends Signature { /** The declaring class */ private String declaringClass; /** The method */ private Method method; /** * The cached hash code */ int cachedHashCode = Integer.MIN_VALUE; /** * Create a new Signature. * * @param declaringClass the declaring class * @param name the name * @param parameters the parameters */ public DeclaredMethodSignature(String declaringClass, String name, String[] parameters) { super(name, parameters); this.declaringClass = declaringClass; } /** * Create a new Signature. * * @param declaringClass the declaring class * @param name the name * @param parameters the parameters */ public DeclaredMethodSignature(String declaringClass, String name, Class... parameters) { super(name, parameters); this.declaringClass = declaringClass; } /** * Create a new Signature. * * @param method the method */ public DeclaredMethodSignature(Method method) { super(method.getName(), (Class[]) null); this.method = method; this.declaringClass = method.getDeclaringClass().getName(); } /** * Create a new Signature. * * @param method the method */ public DeclaredMethodSignature(MethodInfo method) { super(method.getName(), convertParameterTypes(method.getParameterTypes())); this.declaringClass = method.getDeclaringClass().getName(); } /** * Get the declaringClass. * * @return the declaringClass. */ public String getDeclaringClass() { return declaringClass; } /** * Get the method. * * @return the method could be null if not created using a method */ public Method getMethod() { return method; } @Override protected Class[] getParameterTypes() { if (method != null) return method.getParameterTypes(); return super.getParameterTypes(); } @Override public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || super.equals(obj) == false) return false; if (obj instanceof DeclaredMethodSignature) { DeclaredMethodSignature other = (DeclaredMethodSignature) obj; return getDeclaringClass().equals(other.getDeclaringClass()); } return true; } @Override public int hashCode() { //Only take the short version of the name into consideration when creating the hashCode if (cachedHashCode == Integer.MIN_VALUE) { StringBuilder builder = new StringBuilder(); SignatureNameUtil.signatureToString(builder, getName(), getParameters()); cachedHashCode = builder.toString().hashCode(); } return cachedHashCode; } @Override protected void internalToString(StringBuilder builder) { super.internalToString(builder); builder.append(" declaring=").append(declaringClass); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/FieldSignature.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/signature/FieldSignature.j0000644000175000017500000000370411041642153033203 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.signature; import java.lang.reflect.Field; import org.jboss.reflect.spi.FieldInfo; /** * Field Signature. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class FieldSignature extends Signature { /** The field */ private Field field; /** * Create a new Signature. * * @param name the name */ public FieldSignature(String name) { super(name); } /** * Create a new Signature. * * @param field the field */ public FieldSignature(Field field) { super(field.getName()); this.field = field; } /** * Create a new Signature. * * @param field the field */ public FieldSignature(FieldInfo field) { super(field.getName()); } /** * Get the field. * * @return the field could be null if not constructed with a field */ public Field getField() { return field; } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/loader/0000755000175000017500000000000011620305602027362 5ustar twernertwerner././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/loader/MutableMetaDataLoader.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/loader/MutableMetaDataLoad0000644000175000017500000000241110446527733033115 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.loader; import org.jboss.metadata.spi.MutableMetaData; /** * MutableMetaDataLoader. * * @author Adrian Brock * @version $Revision: 45742 $ */ public interface MutableMetaDataLoader extends MetaDataLoader, MutableMetaData { } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/loader/MetaDataLoader.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/spi/loader/MetaDataLoader.java0000644000175000017500000000274310505734347033057 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.spi.loader; import org.jboss.metadata.spi.retrieval.Item; import org.jboss.metadata.spi.retrieval.MetaDataRetrieval; /** * MetaDataLoader. * * @author Adrian Brock * @version $Revision: 57133 $ */ public interface MetaDataLoader extends MetaDataRetrieval { /** * Whether the item is cachable * * @param the item type * @param item the item * @return true when cachable */ boolean isCachable(Item item); } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/annotation/0000755000175000017500000000000011620305602027473 5ustar twernertwerner././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/annotation/AnnotationMatcher.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/annotation/AnnotationMatcher.j0000644000175000017500000000507010505734347033303 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.annotation; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.retrieval.AnnotationItem; /** * AnnotationMatcher. * * @author Adrian Brock * @version $Revision: 57133 $ */ public final class AnnotationMatcher { /** * Match an annotation * * @param the annotation type * @param annotations the annotations * @param annotationType the annotation type * @return the matched annotation or null if no match */ @SuppressWarnings("unchecked") public static final T matchAnnotation(Annotation[] annotations, Class annotationType) { if (annotations != null) { for (Annotation a : annotations) { if (annotationType.equals(a.annotationType())) return (T) a; } } return null; } /** * Match an annotation item * * @param the annotation type * @param annotations the annotation items * @param annotationType the annotation type * @return the matched annotation item or null if no match */ @SuppressWarnings("unchecked") public static final AnnotationItem matchAnnotationItem(AnnotationItem[] annotations, Class annotationType) { if (annotations != null) { for (AnnotationItem item : annotations) { Annotation a = item.getAnnotation(); if (annotationType.equals(a.annotationType())) return item; } } return null; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/annotation/AbstractAnnotationImpl.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/annotation/AbstractAnnotationI0000644000175000017500000000471010446527733033347 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.annotation; import java.lang.annotation.Annotation; /** * AbstractAnnotationImpl. * * @author Adrian Brock * @version $Revision: 45742 $ */ public class AbstractAnnotationImpl implements Annotation { /** The annotation type */ private Class annotationType; /** * Create a new AbstractAnnotationImpl. * *

This constructor guesses the annotationType. */ @SuppressWarnings("unchecked") public AbstractAnnotationImpl() { for (Class clazz : getClass().getInterfaces()) { if (clazz.equals(Annotation.class) == false && (clazz.isAnnotation())) { annotationType = clazz; return; } } } /** * Create a new AbstractAnnotationImpl. * * @param annotationType the annotation type */ public AbstractAnnotationImpl(Class annotationType) { this.annotationType = annotationType; } public Class annotationType() { return annotationType; } public boolean equals(Object object) { if (object == this) return true; if (object == null || object instanceof Annotation == false) return false; Annotation other = (Annotation) object; return annotationType.equals(other.annotationType()); } public int hashCode() { return annotationType.hashCode(); } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/generic/0000755000175000017500000000000011620305603026736 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/metadata/generic/GenericMatcher.java0000644000175000017500000000526610756326650032510 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata.generic; import java.lang.annotation.Annotation; import org.jboss.metadata.spi.retrieval.MetaDataItem; /** * GenericMatcher. * * @author Adrian Brock * @version $Revision: 69888 $ */ public final class GenericMatcher { /** * Match an object class * * @param objects the objects * @param name the type name * @return the matched object or null if no match */ @SuppressWarnings("unchecked") public static final Object matchObject(Object[] objects, String name) { if (objects != null) { for (Object o : objects) { if (o instanceof Annotation) { Annotation a = (Annotation) o; if (name.equals(a.annotationType().getName())) return o; } else if (name.equals(o.getClass().getName())) return o; } } return null; } /** * Match a meta data item * * @param metaDatas the meta data items * @param name the type name * @return the matched meta data item or null if no match */ public static final MetaDataItem matchMetaDataItem(MetaDataItem[] metaDatas, String name) { if (metaDatas != null) { for (MetaDataItem item : metaDatas) { Object o = item.getValue(); if (o instanceof Annotation) { Annotation a = (Annotation) o; if (name.equals(a.annotationType().getName())) return item; } else if (name.equals(item.getName())) return item; } } return null; } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/0000755000175000017500000000000011620305603025714 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/0000755000175000017500000000000011620305603027363 5ustar twernertwerner././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/AnnotationValidator.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/AnnotationValidator.0000644000175000017500000000346410756326650033371 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory; import java.util.Map; /** * Validates that all annotations created for a proxy have been filled in. * Depending on the underlying implementation fills in missing attributes with default values. * * @author Kabir Khan * @version $Revision: 69888 $ */ public interface AnnotationValidator { /** * Validates that all annotations created for a proxy have been filled in. * Depending on the underlying implementation fills in missing attributes with default values. * @param map The annotation attribute values * @param annotation The annotation type * @throws AnnotationValidationException if some attributes were not filled in and no default value exists for that attribute */ void validate(Map map, Class annotation); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/AnnotationProxy.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/AnnotationProxy.java0000644000175000017500000001255311104024362033405 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory; import java.io.Serializable; import java.lang.reflect.Array; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.UndeclaredThrowableException; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Collections; import java.util.Map; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.config.plugins.property.PropertyConfiguration; import org.jboss.config.spi.Configuration; import org.jboss.util.JBossObject; import org.jboss.util.Objects; /** * InvocationHandler implementation for creating an annotation proxy. * * @author Bill Burke * @author Kabir Khan * @author Ales Justin */ public class AnnotationProxy implements InvocationHandler, Serializable { private static final long serialVersionUID = 1; private static Configuration configuration; static { configuration = AccessController.doPrivileged(new PrivilegedAction() { public Configuration run() { return new PropertyConfiguration(); } }); } private Class annotationType; private transient BeanInfo beanInfo; private Map map; @SuppressWarnings("unchecked") public AnnotationProxy(Class annotationType, Map valueMap) { if (annotationType == null) throw new IllegalArgumentException("Null annotation type."); this.annotationType = annotationType; this.map = valueMap != null ? valueMap : Collections.emptyMap(); } /** * Get bean info. * * @return the annotation's bean info */ protected BeanInfo getBeanInfo() { if (beanInfo == null) beanInfo = configuration.getBeanInfo(annotationType); return beanInfo; } public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String name = method.getName(); if ("equals".equals(name)) { return doEquals(proxy, args[0]); } else if ("hashCode".equals(name)) { return doHashCode(); } else if ("toString".equals(name)) { return map.toString(); } else if ("annotationType".equals(name)) { return annotationType; } return map.get(name); } public Object getValue(String name) { return map.get(name); } @SuppressWarnings("unchecked") private Object doEquals(Object proxy, Object obj) { if (obj == proxy) return Boolean.TRUE; if (obj == null) return Boolean.FALSE; if (annotationType.isInstance(obj) == false) { return Boolean.FALSE; } try { for (String key : map.keySet()) { Object value = getValue(key); Object other = getBeanInfo().getProperty(obj, key); if (Objects.isArray(value)) { if (Objects.isArray(other) == false) return Boolean.FALSE; int length = Array.getLength(value); if (length != Array.getLength(other)) return Boolean.FALSE; for (int i = 0; i < length; i++) { if (JBossObject.equals(Array.get(value, i), Array.get(other, i)) == false) return Boolean.FALSE; } } else if (JBossObject.equals(value, other) == false) return Boolean.FALSE; } } catch (Throwable t) { throw new UndeclaredThrowableException(t); } return Boolean.TRUE; } private Object doHashCode() { return map.hashCode(); } /** * Create a proxy implementation for the annotation class. * @param map - map of the annotation values * @param annotation - the annotation class * @return an instance implementing the annotation * @throws Exception for any error */ public static Object createProxy(Map map, Class annotation) throws Exception { AnnotationProxy proxyHandler = new AnnotationProxy(annotation, map); return java.lang.reflect.Proxy.newProxyInstance(annotation.getClassLoader(), new Class[]{annotation}, proxyHandler); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/AnnotationValidationException.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/AnnotationValidation0000644000175000017500000000252110457142306033441 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory; /** * * @author Kabir Khan * @version $Revision: 46363 $ */ public class AnnotationValidationException extends RuntimeException { private static final long serialVersionUID = 2710034018990217179L; public AnnotationValidationException(String msg) { super(msg); } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/javassist/0000755000175000017500000000000011620305603031372 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/javassist/AnnotationProxy.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/javassist/Annotation0000644000175000017500000000467610756326650033462 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.javassist; import java.lang.reflect.InvocationHandler; import java.util.Map; /** * Comment * * @author Bill Burke * @author Kabir Khan * @version $Revision: 69888 $ */ public class AnnotationProxy extends org.jboss.annotation.factory.AnnotationProxy implements InvocationHandler { /** The serialVersionUID */ private static final long serialVersionUID = -3253810562939848082L; @SuppressWarnings("unchecked") public AnnotationProxy(Class annotationType, Map valueMap) { super(annotationType, valueMap); } public static Object createProxy(javassist.bytecode.annotation.Annotation info) throws Exception { Class annotation = Thread.currentThread().getContextClassLoader().loadClass(info.getTypeName()); return createProxy(info, annotation); } public static Object createProxy(javassist.bytecode.annotation.Annotation info, Class annotation) throws Exception { Map map = ProxyMapCreator.createProxyMap(annotation, info); DefaultValueAnnotationValidator reader = new DefaultValueAnnotationValidator(); reader.validate(map, annotation); AnnotationProxy proxyHandler = new AnnotationProxy(annotation, map); return java.lang.reflect.Proxy.newProxyInstance(annotation.getClassLoader(), new Class[]{annotation}, proxyHandler); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/javassist/DefaultValueAnnotationValidator.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/javassist/DefaultVal0000644000175000017500000001110310756326650033356 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.javassist; import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Map; import org.jboss.annotation.factory.AnnotationValidationException; import org.jboss.annotation.factory.AnnotationValidator; import javassist.ClassPool; import javassist.CtClass; import javassist.CtMethod; import javassist.NotFoundException; import javassist.bytecode.AnnotationDefaultAttribute; import javassist.bytecode.MethodInfo; import javassist.bytecode.annotation.MemberValue; import javassist.scopedpool.ScopedClassPoolRepository; import javassist.scopedpool.ScopedClassPoolRepositoryImpl; /** * Validates if all attributes have been filled in for an annotation. * Attempts to read default values where they exist * * @author Kabir Khan * @version $Revision: 69888 $ */ public class DefaultValueAnnotationValidator implements AnnotationValidator { ScopedClassPoolRepository repository = ScopedClassPoolRepositoryImpl.getInstance(); public void validate(Map map, Class annotation) { ArrayList notAssignedAttributes = null; CtClass ctClass = null; Method[] methods = getDeclaredMethods(annotation); for (int i = 0 ; i < methods.length ; i++) { if (map.get(methods[i].getName()) == null) { if (ctClass == null) { ctClass = getCtClass(annotation); } CtMethod method; try { method = ctClass.getDeclaredMethod(methods[i].getName()); } catch (NotFoundException e) { throw new RuntimeException("Unable to find method " + methods[i].getName() + " for " + annotation.getName()); } Object defaultValue = null; MethodInfo minfo = method.getMethodInfo2(); AnnotationDefaultAttribute defAttr = (AnnotationDefaultAttribute)minfo.getAttribute(AnnotationDefaultAttribute.tag); if (defAttr != null) { MemberValue value = defAttr.getDefaultValue(); // default value of age MemberValueGetter getter = new MemberValueGetter(methods[i]); value.accept(getter); defaultValue = getter.getValue(); } if (defaultValue != null) { map.put(methods[i].getName(), defaultValue); } else { if (notAssignedAttributes == null) { notAssignedAttributes = new ArrayList(); } notAssignedAttributes.add(methods[i].getName()); } } } if (notAssignedAttributes != null) { throw new AnnotationValidationException("Unable to fill in default attributes for " + annotation + " " + notAssignedAttributes); } } CtClass getCtClass(Class clazz) { try { ClassPool pool = repository.findClassPool(clazz.getClassLoader()); return pool.get(clazz.getName()); } catch (NotFoundException e) { throw new RuntimeException("Unable to load CtClass for " + clazz, e); } } private Method[] getDeclaredMethods(final Class clazz) { return AccessController.doPrivileged(new PrivilegedAction() { public Method[] run() { return clazz.getDeclaredMethods(); }; }); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/javassist/ProxyMapCreator.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/javassist/ProxyMapCr0000644000175000017500000001662210756326650033406 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.javassist; import java.lang.reflect.Array; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import javassist.bytecode.annotation.AnnotationMemberValue; import javassist.bytecode.annotation.ArrayMemberValue; import javassist.bytecode.annotation.BooleanMemberValue; import javassist.bytecode.annotation.ByteMemberValue; import javassist.bytecode.annotation.CharMemberValue; import javassist.bytecode.annotation.ClassMemberValue; import javassist.bytecode.annotation.DoubleMemberValue; import javassist.bytecode.annotation.EnumMemberValue; import javassist.bytecode.annotation.FloatMemberValue; import javassist.bytecode.annotation.IntegerMemberValue; import javassist.bytecode.annotation.LongMemberValue; import javassist.bytecode.annotation.MemberValue; import javassist.bytecode.annotation.MemberValueVisitor; import javassist.bytecode.annotation.ShortMemberValue; import javassist.bytecode.annotation.StringMemberValue; /** * Comment * * @author Bill Burke * @version $Revision: 69888 $ */ public class ProxyMapCreator implements MemberValueVisitor { public Object value; private Class type; public ProxyMapCreator(Class type) { this.type = type; } public void visitAnnotationMemberValue(AnnotationMemberValue annotationMemberValue) { try { value = AnnotationProxy.createProxy(annotationMemberValue.getValue()); } catch (Exception e) { throw new RuntimeException(e); } } public void visitArrayMemberValue(ArrayMemberValue arrayMemberValue) { Class baseType = type.getComponentType(); int size = 0; if (arrayMemberValue.getValue() != null) { size = arrayMemberValue.getValue().length; } value = Array.newInstance(baseType, size); MemberValue[] elements = arrayMemberValue.getValue(); for (int i = 0; i < size; i++) { ProxyMapCreator creator = new ProxyMapCreator(baseType); elements[i].accept(creator); Array.set(value, i, creator.value); } } public void visitBooleanMemberValue(BooleanMemberValue booleanMemberValue) { value = new Boolean(booleanMemberValue.getValue()); } public void visitByteMemberValue(ByteMemberValue byteMemberValue) { value = new Byte(byteMemberValue.getValue()); } public void visitCharMemberValue(CharMemberValue charMemberValue) { value = new Character(charMemberValue.getValue()); } public void visitDoubleMemberValue(DoubleMemberValue doubleMemberValue) { value = new Double(doubleMemberValue.getValue()); } public void visitEnumMemberValue(EnumMemberValue enumMemberValue) { try { Field enumVal = type.getField(enumMemberValue.getValue()); value = enumVal.get(null); } catch (NoSuchFieldException e) { throw new RuntimeException(e); } catch (SecurityException e) { throw new RuntimeException(e); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } public void visitFloatMemberValue(FloatMemberValue floatMemberValue) { value = new Float(floatMemberValue.getValue()); } public void visitIntegerMemberValue(IntegerMemberValue integerMemberValue) { value = new Integer(integerMemberValue.getValue()); } public void visitLongMemberValue(LongMemberValue longMemberValue) { value = new Long(longMemberValue.getValue()); } public void visitShortMemberValue(ShortMemberValue shortMemberValue) { value = new Short(shortMemberValue.getValue()); } public void visitStringMemberValue(StringMemberValue stringMemberValue) { value = stringMemberValue.getValue(); } public void visitClassMemberValue(ClassMemberValue classMemberValue) { try { String classname = classMemberValue.getValue(); if (classname.equals("void")) { value = void.class; } else if (classname.equals("int")) { value = int.class; } else if (classname.equals("byte")) { value = byte.class; } else if (classname.equals("long")) { value = long.class; } else if (classname.equals("double")) { value = double.class; } else if (classname.equals("float")) { value = float.class; } else if (classname.equals("char")) { value = char.class; } else if (classname.equals("short")) { value = short.class; } else if (classname.equals("boolean")) { value = boolean.class; } else { ClassLoader loader = Thread.currentThread().getContextClassLoader(); value = Class.forName(classMemberValue.getValue(), false, loader); } } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } public static Class getMemberType(Class annotation, String member) { Method[] methods = annotation.getMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(member)) { return methods[i].getReturnType(); } } throw new RuntimeException("unable to determine member type for annotation: " + annotation.getName() + "." + member); } @SuppressWarnings("unchecked") public static Map createProxyMap(Class annotation, javassist.bytecode.annotation.Annotation info) { Map map = new HashMap(); if (info.getMemberNames() == null) return map; Set members = info.getMemberNames(); Iterator it = members.iterator(); while (it.hasNext()) { String name = (String) it.next(); MemberValue mv = info.getMemberValue(name); ProxyMapCreator creator = new ProxyMapCreator(getMemberType(annotation, name)); mv.accept(creator); map.put(name, creator.value); } return map; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/javassist/MemberValueGetter.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/javassist/MemberValu0000644000175000017500000001142310756326650033373 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.javassist; import java.lang.reflect.Array; import java.lang.reflect.Method; import javassist.bytecode.annotation.Annotation; import javassist.bytecode.annotation.AnnotationMemberValue; import javassist.bytecode.annotation.ArrayMemberValue; import javassist.bytecode.annotation.BooleanMemberValue; import javassist.bytecode.annotation.ByteMemberValue; import javassist.bytecode.annotation.CharMemberValue; import javassist.bytecode.annotation.ClassMemberValue; import javassist.bytecode.annotation.DoubleMemberValue; import javassist.bytecode.annotation.EnumMemberValue; import javassist.bytecode.annotation.FloatMemberValue; import javassist.bytecode.annotation.IntegerMemberValue; import javassist.bytecode.annotation.LongMemberValue; import javassist.bytecode.annotation.MemberValue; import javassist.bytecode.annotation.MemberValueVisitor; import javassist.bytecode.annotation.ShortMemberValue; import javassist.bytecode.annotation.StringMemberValue; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * * @author Kabir Khan * @version $Revision: 69888 $ */ public class MemberValueGetter implements MemberValueVisitor { Object value; Method method; static TypeInfoFactory typeFactory = new IntrospectionTypeInfoFactory(); public MemberValueGetter(Method method) { this.method = method; } public Object getValue() { return value; } public void visitAnnotationMemberValue(AnnotationMemberValue node) { try { Annotation ann = node.getValue(); value = AnnotationProxy.createProxy(ann); } catch (Exception e) { throw new RuntimeException(e); } } public void visitArrayMemberValue(ArrayMemberValue node) { MemberValue[] values = node.getValue(); value = node.getValue(); Object vals = Array.newInstance(getAttributeType(), values.length); for (int i = 0 ; i < values.length ; i++) { values[i].accept(this); Array.set(vals, i, value); } value = vals; } public void visitBooleanMemberValue(BooleanMemberValue node) { value = new Boolean(node.getValue()); } public void visitByteMemberValue(ByteMemberValue node) { value = new Byte(node.getValue()); } public void visitCharMemberValue(CharMemberValue node) { value = new Character(node.getValue()); } public void visitDoubleMemberValue(DoubleMemberValue node) { value = new Double(node.getValue()); } @SuppressWarnings("unchecked") public void visitEnumMemberValue(EnumMemberValue node) { value = Enum.valueOf(getAttributeType(), node.getValue()); } public void visitFloatMemberValue(FloatMemberValue node) { value = new Float(node.getValue()); } public void visitIntegerMemberValue(IntegerMemberValue node) { value = new Integer(node.getValue()); } public void visitLongMemberValue(LongMemberValue node) { value = new Long(node.getValue()); } public void visitShortMemberValue(ShortMemberValue node) { value = new Short(node.getValue()); } public void visitStringMemberValue(StringMemberValue node) { value = node.getValue(); } public void visitClassMemberValue(ClassMemberValue node) { try { value = Class.forName(node.getValue()); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } @SuppressWarnings("unchecked") private Class getAttributeType() { Class rtn = method.getReturnType(); while (rtn.isArray()) { rtn = rtn.getComponentType(); } return rtn; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/SimpleAnnotationValidator.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/SimpleAnnotationVali0000644000175000017500000000466410756326650033436 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory; import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Map; /** * Validates if all attributes have been filled in for an annotation. * Makes no attempt to read default values * * @author Kabir Khan * @version $Revision: 69888 $ */ public class SimpleAnnotationValidator implements AnnotationValidator { public void validate(Map map, Class annotation) { ArrayList notAssignedAttributes = null; Method[] methods = getDeclaredMethods(annotation); for (int i = 0 ; i < methods.length ; i++) { if (map.get(methods[i].getName()) == null) { if (notAssignedAttributes == null) { notAssignedAttributes = new ArrayList(); } notAssignedAttributes.add(methods[i].getName()); } } if (notAssignedAttributes != null) { throw new AnnotationValidationException("Unable to fill in default attributes for " + annotation + " " + notAssignedAttributes); } } private Method[] getDeclaredMethods(final Class clazz) { return AccessController.doPrivileged(new PrivilegedAction() { public Method[] run() { return clazz.getDeclaredMethods(); }; }); } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/0000755000175000017500000000000011620305603030152 5ustar twernertwerner././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/TokenMgrError.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/TokenMgrError.ja0000644000175000017500000001244110533536206033237 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class TokenMgrError extends Error { /** The serialVersionUID */ private static final long serialVersionUID = -8256510811060336766L; /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occured. */ static final int LEXICAL_ERROR = 0; /** * An attempt wass made to create a second instance of a static token manager. */ static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have * one of the above 4 values. */ int errorCode; /** * Replaces unprintable characters by their espaced (or unicode escaped) * equivalents in the given string * * @param str * @return the replaced character */ protected static final String addEscapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. * Parameters : * @param EOFSeen : indicates if EOF caused the lexicl error * @param lexState : lexical state in which this error occured * @param errorLine : line number when the error occured * @param errorColumn : column number when the error occured * @param errorAfter : prefix that was seen before this error occured * @param curChar : the offending character * @return the detailed message * Note: You can customize the lexical error message by modifying this method. */ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\""); } /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ public TokenMgrError() { } public TokenMgrError(String message, int reason) { super(message); errorCode = reason; } public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/SimpleCharStream.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/SimpleCharStream0000644000175000017500000002474510533536206033323 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ public class SimpleCharStream { public static final boolean staticFlag = false; int bufsize; int available; int tokenBegin; public int bufpos = -1; protected int bufline[]; protected int bufcolumn[]; protected int column = 0; protected int line = 1; protected boolean prevCharIsCR = false; protected boolean prevCharIsLF = false; protected java.io.Reader inputStream; protected char[] buffer; protected int maxNextCharInd = 0; protected int inBuf = 0; protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (8 - (column & 07)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return (c); } /** * @deprecated * @see #getEndColumn * * @return the column */ public int getColumn() { return bufcolumn[bufpos]; } /** * @deprecated * @see #getEndLine * * @return the line */ public int getLine() { return bufline[bufpos]; } public int getEndColumn() { return bufcolumn[bufpos]; } public int getEndLine() { return bufline[bufpos]; } public int getBeginColumn() { return bufcolumn[tokenBegin]; } public int getBeginLine() { return bufline[tokenBegin]; } public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); } public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); } public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } public void Done() { buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token. * * @param newLine * @param newCol */ public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/Token.java0000644000175000017500000000715610533536206032115 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; /** * Describes the input token stream. */ public class Token { /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; /** * beginLine and beginColumn describe the position of the first character * of this token; endLine and endColumn describe the position of the * last character of this token. */ public int beginLine, beginColumn, endLine, endColumn; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * Returns the image. */ public String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simlpy add something like : * * case MyParserConstants.ID : return new IDToken(); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use it in your lexical actions. * * @param ofKind * @return the new token */ public static final Token newToken(int ofKind) { switch(ofKind) { default : return new Token(); } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTMemberValue.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTMemberValue.j0000644000175000017500000000257710504503510033111 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class ASTMemberValue extends SimpleNode { public ASTMemberValue(int id) { super(id); } public ASTMemberValue(AnnotationParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) { return visitor.visit(this, data); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTAnnotation.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTAnnotation.ja0000644000175000017500000000310310504503510033142 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class ASTAnnotation extends ASTMemberValue { public ASTAnnotation(int id) { super(id); } public ASTAnnotation(AnnotationParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) { return visitor.visit(this, data); } private String identifier; public String getIdentifier() { return identifier; } public void setIdentifier(String identifier) { this.identifier = identifier; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/AnnotationParser.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/AnnotationParser0000644000175000017500000004752510756326650033417 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class AnnotationParser/*@bgen(jjtree)*/implements AnnotationParserTreeConstants, AnnotationParserConstants {/*@bgen(jjtree)*/ protected JJTAnnotationParserState jjtree = new JJTAnnotationParserState(); final public ASTStart Start() throws ParseException { /*@bgen(jjtree) Start */ ASTStart jjtn000 = new ASTStart(JJTSTART); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { Annotation(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 7: jj_consume_token(7); break; case 8: jj_consume_token(8); break; case 0: jj_consume_token(0); break; default: jj_la1[0] = jj_gen; jj_consume_token(-1); throw new ParseException(); } jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } throw new Error("Missing return statement in function"); } final public void Annotation() throws ParseException { /*@bgen(jjtree) Annotation */ ASTAnnotation jjtn000 = new ASTAnnotation(JJTANNOTATION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token tok; try { jj_consume_token(9); tok = jj_consume_token(IDENTIFIER); jjtn000.setIdentifier(tok.image); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 10: jj_consume_token(10); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: case CHARACTER: case STRING: case 9: case 14: if (jj_2_1(2)) { MemberValuePairs(); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: case CHARACTER: case STRING: case 9: case 14: SingleMemberValue(); break; default: jj_la1[1] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } break; default: jj_la1[2] = jj_gen; ; } jj_consume_token(11); break; default: jj_la1[3] = jj_gen; ; } } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void SingleMemberValue() throws ParseException { /*@bgen(jjtree) SingleMemberValue */ ASTSingleMemberValue jjtn000 = new ASTSingleMemberValue(JJTSINGLEMEMBERVALUE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { MemberValue(); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void MemberValuePairs() throws ParseException { /*@bgen(jjtree) MemberValuePairs */ ASTMemberValuePairs jjtn000 = new ASTMemberValuePairs(JJTMEMBERVALUEPAIRS); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { MemberValuePair(); label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 12: ; break; default: jj_la1[4] = jj_gen; break label_1; } jj_consume_token(12); MemberValuePair(); } } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void MemberValuePair() throws ParseException { /*@bgen(jjtree) MemberValuePair */ ASTMemberValuePair jjtn000 = new ASTMemberValuePair(JJTMEMBERVALUEPAIR); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); //Token specialToken; try { Identifier(); jj_consume_token(13); MemberValue(); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void MemberValue() throws ParseException { //Token tok; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 9: Annotation(); break; case 14: MemberValueArrayInitializer(); break; case STRING: String(); break; case CHARACTER: Char(); break; case IDENTIFIER: Identifier(); break; default: jj_la1[5] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } final public void MemberValueArrayInitializer() throws ParseException { /*@bgen(jjtree) MemberValueArrayInitializer */ ASTMemberValueArrayInitializer jjtn000 = new ASTMemberValueArrayInitializer(JJTMEMBERVALUEARRAYINITIALIZER); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(14); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: case CHARACTER: case STRING: case 9: case 14: MemberValue(); label_2: while (true) { if (jj_2_2(2)) { ; } else { break label_2; } jj_consume_token(12); MemberValue(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 12: jj_consume_token(12); break; default: jj_la1[6] = jj_gen; ; } break; default: jj_la1[7] = jj_gen; ; } jj_consume_token(15); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void Identifier() throws ParseException { /*@bgen(jjtree) Identifier */ ASTIdentifier jjtn000 = new ASTIdentifier(JJTIDENTIFIER); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token tok; try { tok = jj_consume_token(IDENTIFIER); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.setValue(tok.image); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void String() throws ParseException { /*@bgen(jjtree) String */ ASTString jjtn000 = new ASTString(JJTSTRING); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token tok; try { tok = jj_consume_token(STRING); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.setValue(tok.image); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void Char() throws ParseException { /*@bgen(jjtree) Char */ ASTChar jjtn000 = new ASTChar(JJTCHAR); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token tok; try { tok = jj_consume_token(CHARACTER); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.setValue(tok.image); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final private boolean jj_2_1(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_1(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); } } final private boolean jj_2_2(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_2(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(1, xla); } } final private boolean jj_3R_4() { Token xsp; xsp = jj_scanpos; if (jj_3R_6()) { jj_scanpos = xsp; if (jj_3R_7()) { jj_scanpos = xsp; if (jj_3R_8()) { jj_scanpos = xsp; if (jj_3R_9()) { jj_scanpos = xsp; if (jj_3R_10()) return true; } } } } return false; } final private boolean jj_3R_6() { if (jj_3R_12()) return true; return false; } final private boolean jj_3_1() { if (jj_3R_3()) return true; return false; } final private boolean jj_3R_14() { if (jj_scan_token(STRING)) return true; return false; } final private boolean jj_3R_13() { if (jj_scan_token(14)) return true; return false; } final private boolean jj_3R_5() { if (jj_3R_11()) return true; if (jj_scan_token(13)) return true; return false; } final private boolean jj_3_2() { if (jj_scan_token(12)) return true; if (jj_3R_4()) return true; return false; } final private boolean jj_3R_10() { if (jj_3R_11()) return true; return false; } final private boolean jj_3R_9() { if (jj_3R_15()) return true; return false; } final private boolean jj_3R_12() { if (jj_scan_token(9)) return true; return false; } final private boolean jj_3R_11() { if (jj_scan_token(IDENTIFIER)) return true; return false; } final private boolean jj_3R_15() { if (jj_scan_token(CHARACTER)) return true; return false; } final private boolean jj_3R_8() { if (jj_3R_14()) return true; return false; } final private boolean jj_3R_3() { if (jj_3R_5()) return true; return false; } final private boolean jj_3R_7() { if (jj_3R_13()) return true; return false; } public AnnotationParserTokenManager token_source; SimpleCharStream jj_input_stream; public Token token, jj_nt; private int jj_ntk; private Token jj_scanpos, jj_lastpos; private int jj_la; public boolean lookingAhead = false; //private boolean jj_semLA; private int jj_gen; final private int[] jj_la1 = new int[8]; static private int[] jj_la1_0; static { jj_la1_0(); } private static void jj_la1_0() { jj_la1_0 = new int[] {0x181,0x4268,0x4268,0x400,0x1000,0x4268,0x1000,0x4268,}; } final private JJCalls[] jj_2_rtns = new JJCalls[2]; private boolean jj_rescan = false; private int jj_gc = 0; public AnnotationParser(java.io.InputStream stream) { jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new AnnotationParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 8; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } public void ReInit(java.io.InputStream stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jjtree.reset(); jj_gen = 0; for (int i = 0; i < 8; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } public AnnotationParser(java.io.Reader stream) { jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new AnnotationParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 8; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jjtree.reset(); jj_gen = 0; for (int i = 0; i < 8; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } public AnnotationParser(AnnotationParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 8; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } public void ReInit(AnnotationParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jjtree.reset(); jj_gen = 0; for (int i = 0; i < 8; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } final private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < jj_2_rtns.length; i++) { JJCalls c = jj_2_rtns[i]; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } static private final class LookaheadSuccess extends java.lang.Error { /** The serialVersionUID */ private static final long serialVersionUID = 1L; } final private LookaheadSuccess jj_ls = new LookaheadSuccess(); final private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_scanpos.next; } if (jj_rescan) { int i = 0; Token tok = token; while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } if (tok != null) jj_add_error_token(kind, i); } if (jj_scanpos.kind != kind) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; return false; } final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; return token; } final public Token getToken(int index) { Token t = lookingAhead ? jj_scanpos : token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } final private int jj_ntk() { if ((jj_nt=token.next) == null) return (jj_ntk = (token.next=token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } private java.util.Vector jj_expentries = new java.util.Vector(); private int[] jj_expentry; private int jj_kind = -1; private int[] jj_lasttokens = new int[100]; private int jj_endpos; @SuppressWarnings("unchecked") private void jj_add_error_token(int kind, int pos) { if (pos >= 100) return; if (pos == jj_endpos + 1) { jj_lasttokens[jj_endpos++] = kind; } else if (jj_endpos != 0) { jj_expentry = new int[jj_endpos]; for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; } boolean exists = false; for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) { int[] oldentry = (int[])(e.nextElement()); if (oldentry.length == jj_expentry.length) { exists = true; for (int i = 0; i < jj_expentry.length; i++) { if (oldentry[i] != jj_expentry[i]) { exists = false; break; } } if (exists) break; } } if (!exists) jj_expentries.addElement(jj_expentry); if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; } } @SuppressWarnings("unchecked") public ParseException generateParseException() { jj_expentries.removeAllElements(); boolean[] la1tokens = new boolean[16]; for (int i = 0; i < 16; i++) { la1tokens[i] = false; } if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 8; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1< jj_gen) { jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; switch (i) { case 0: jj_3_1(); break; case 1: jj_3_2(); break; } } p = p.next; } while (p != null); } jj_rescan = false; } final private void jj_save(int index, int xla) { JJCalls p = jj_2_rtns[index]; while (p.gen > jj_gen) { if (p.next == null) { p = p.next = new JJCalls(); break; } p = p.next; } p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; } static final class JJCalls { int gen; Token first; int arg; JJCalls next; } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/Node.java0000644000175000017500000000423210533536206031712 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public interface Node { /** This method is called after the node has been made the current node. It indicates that child nodes can now be added to it. */ public void jjtOpen(); /** This method is called after all the child nodes have been added. */ public void jjtClose(); /** This pair of methods are used to inform the node of its * parent. * * @param n */ public void jjtSetParent(Node n); public Node jjtGetParent(); /** This method tells the node to add its argument to the node's * list of children. * @param n * @param i */ public void jjtAddChild(Node n, int i); /** This method returns a child node. The children are numbered * from zero, left to right. * * @param i * @return the node */ public Node jjtGetChild(int i); /** Return the number of children the node has. * @return the number of children */ public int jjtGetNumChildren(); /** Accept the visitor. * @param visitor the visitor * @param data the data * @return ? */ public Object jjtAccept(AnnotationParserVisitor visitor, Object data); } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/AnnotationParserTester.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/AnnotationParser0000644000175000017500000001022710504503510033363 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class AnnotationParserTester implements AnnotationParserVisitor { private int indent = 0; private String indentString() { StringBuffer sb = new StringBuffer(); for (int i = 0; i < indent; ++i) { sb.append(" "); } return sb.toString(); } public Object visit(ASTSingleMemberValue node, Object data) { System.out.println(indentString() + node); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public Object visit(SimpleNode node, Object data) { System.out.println(indentString() + node + ": acceptor not unimplemented in subclass?"); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public Object visit(ASTStart node, Object data) { System.out.println(indentString() + node); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public Object visit(ASTAnnotation node, Object data) { System.out.println(indentString() + node); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public Object visit(ASTMemberValuePairs node, Object data) { System.out.println(indentString() + node); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public Object visit(ASTMemberValuePair node, Object data) { System.out.println(indentString() + node); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public Object visit(ASTMemberValueArrayInitializer node, Object data) { System.out.println(indentString() + node); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public Object visit(ASTIdentifier node, Object data) { System.out.println(indentString() + node); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public Object visit(ASTString node, Object data) { System.out.println(indentString() + node); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public Object visit(ASTChar node, Object data) { System.out.println(indentString() + node); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public static void main(String args[]) { // System.out.println("----" + args[0]); // StringReader reader = new StringReader(args[0]); System.out.println("Reading from stdin"); AnnotationParser t = new AnnotationParser(System.in); //PointcutExpressionParser t = new PointcutExpressionParser(System.in); try { ASTStart n = t.Start(); AnnotationParserVisitor v = new AnnotationParserTester(); n.jjtAccept(v, null); } catch (Exception e) { System.out.println("Oops."); System.out.println(e.getMessage()); e.printStackTrace(); } } } /*end*/ ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTSingleMemberValue.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTSingleMemberV0000644000175000017500000000320410504503510033140 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class ASTSingleMemberValue extends SimpleNode { public ASTSingleMemberValue(int id) { super(id); } public ASTSingleMemberValue(AnnotationParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) { return visitor.visit(this, data); } private ASTMemberValue value; public void jjtAddChild(Node n, int i) { if (n instanceof ASTMemberValue) value = (ASTMemberValue) n; } public ASTMemberValue getValue() { return value; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/AnnotationParserVisitor.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/AnnotationParser0000644000175000017500000000324410504503510033364 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public interface AnnotationParserVisitor { public Object visit(SimpleNode node, Object data); public Object visit(ASTStart node, Object data); public Object visit(ASTAnnotation node, Object data); public Object visit(ASTSingleMemberValue node, Object data); public Object visit(ASTMemberValuePairs node, Object data); public Object visit(ASTMemberValuePair node, Object data); public Object visit(ASTMemberValueArrayInitializer node, Object data); public Object visit(ASTIdentifier node, Object data); public Object visit(ASTString node, Object data); public Object visit(ASTChar node, Object data); } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTMemberValuePair.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTMemberValuePa0000644000175000017500000000352210504503510033131 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class ASTMemberValuePair extends SimpleNode { public ASTMemberValuePair(int id) { super(id); } public ASTMemberValuePair(AnnotationParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) { return visitor.visit(this, data); } private ASTIdentifier identifier; private ASTMemberValue value; public void jjtAddChild(Node n, int i) { if ((n instanceof ASTIdentifier) && i == 0) { identifier = (ASTIdentifier)n; return; } if (n instanceof ASTMemberValue) value = (ASTMemberValue)n; } public ASTIdentifier getIdentifier() { return identifier; } public ASTMemberValue getValue() { return value; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/AnnotationParserTreeConstants.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/AnnotationParser0000644000175000017500000000324210504503510033362 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public interface AnnotationParserTreeConstants { public int JJTSTART = 0; public int JJTANNOTATION = 1; public int JJTSINGLEMEMBERVALUE = 2; public int JJTMEMBERVALUEPAIRS = 3; public int JJTMEMBERVALUEPAIR = 4; public int JJTVOID = 5; public int JJTMEMBERVALUEARRAYINITIALIZER = 6; public int JJTIDENTIFIER = 7; public int JJTSTRING = 8; public int JJTCHAR = 9; public String[] jjtNodeName = { "Start", "Annotation", "SingleMemberValue", "MemberValuePairs", "MemberValuePair", "void", "MemberValueArrayInitializer", "Identifier", "String", "Char", }; } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTMemberValuePairs.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTMemberValuePa0000644000175000017500000000261610504503510033134 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class ASTMemberValuePairs extends SimpleNode { public ASTMemberValuePairs(int id) { super(id); } public ASTMemberValuePairs(AnnotationParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) { return visitor.visit(this, data); } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTStart.java0000644000175000017500000000255510504503510032466 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class ASTStart extends SimpleNode { public ASTStart(int id) { super(id); } public ASTStart(AnnotationParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) { return visitor.visit(this, data); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/AnnotationParserConstants.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/AnnotationParser0000644000175000017500000000274410504503510033370 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public interface AnnotationParserConstants { int EOF = 0; int IDENTIFIER = 3; int LETTER = 4; int CHARACTER = 5; int STRING = 6; int DEFAULT = 0; String[] tokenImage = { "", "\" \"", "\"\\t\"", "", "", "", "", "\"\\r\\n\"", "\"\\n\"", "\"@\"", "\"(\"", "\")\"", "\",\"", "\"=\"", "\"{\"", "\"}\"", }; } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTString.java0000644000175000017500000000303610504503510032632 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class ASTString extends ASTMemberValue { public ASTString(int id) { super(id); } public ASTString(AnnotationParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) { return visitor.visit(this, data); } private String value; public void setValue(String val) { value = val.substring(1, val.length() - 1); } public String getValue() { return value; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTIdentifier.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTIdentifier.ja0000644000175000017500000000303010504503510033111 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class ASTIdentifier extends ASTMemberValue { public ASTIdentifier(int id) { super(id); } public ASTIdentifier(AnnotationParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) { return visitor.visit(this, data); } String value; public String getValue() { return value; } public void setValue(String value) { this.value = value; } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/annotation.jjt0000644000175000017500000000407610457142306033052 0ustar twernertwerner/** * */ options { MULTI=true; VISITOR=true; NODE_DEFAULT_VOID=false; STATIC=false; } PARSER_BEGIN(AnnotationParser) package org.jboss.aop.annotation.ast; public class AnnotationParser { } PARSER_END(AnnotationParser) SKIP : { " " | "\t" } TOKEN : { < IDENTIFIER: ()+ > | < #LETTER: ["$","_","a"-"z","A"-"Z","0"-"9","."] > | < CHARACTER : "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","v","b","r","f","a","\\","?","'","\""] | "0" (["0"-"7"])* | ["1"-"9"] (["0"-"9"])* | ("0x" | "0X") (["0"-"9","a"-"f","A"-"F"])+ ) ) ) "'" > | < STRING : "\"" ( ( ~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","v","b","r","f","a","\\","?","'","\""] | "0" (["0"-"7"])* | ["1"-"9"] (["0"-"9"])* | ("0x" | "0X") (["0"-"9","a"-"f","A"-"F"])+ ) ) )* "\"" > } ASTStart Start() #Start : {} { Annotation() ("\r\n" | "\n" | ) { return jjtThis; } } void Annotation() : { Token tok; } { "@" tok= { jjtThis.setIdentifier(tok.image); } [ "(" [ LOOKAHEAD(2) MemberValuePairs() | SingleMemberValue() ] ")" ] } void SingleMemberValue() : { } { MemberValue() } void MemberValuePairs() : { } { MemberValuePair() ( "," MemberValuePair() )* } void MemberValuePair() : { Token specialToken; } { Identifier() "=" MemberValue() } void MemberValue() #void : { Token tok; } { Annotation() | MemberValueArrayInitializer() | String() | Char() | Identifier() } void MemberValueArrayInitializer() : { } { "{" [ MemberValue() ( LOOKAHEAD(2) "," MemberValue() )* [ "," ] ] "}" } void Identifier() : { Token tok; } { tok= { jjtThis.setValue(tok.image); } } void String() : { Token tok; } { tok= { jjtThis.setValue(tok.image); } } void Char() : { Token tok; } { tok= { jjtThis.setValue(tok.image); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTMemberValueArrayInitializer.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTMemberValueAr0000644000175000017500000000266310504503510033140 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class ASTMemberValueArrayInitializer extends ASTMemberValue { public ASTMemberValueArrayInitializer(int id) { super(id); } public ASTMemberValueArrayInitializer(AnnotationParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) { return visitor.visit(this, data); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/AnnotationParserTokenManager.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/AnnotationParser0000644000175000017500000003446410533536206033406 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class AnnotationParserTokenManager implements AnnotationParserConstants { public java.io.PrintStream debugStream = System.out; public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } private final int jjStopStringLiteralDfa_0(int pos, long active0) { switch (pos) { default : return -1; } } private final int jjStartNfa_0(int pos, long active0) { return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); } private final int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; jjmatchedPos = pos; return pos + 1; } /* private final int jjStartNfaWithStates_0(int pos, int kind, int state) { jjmatchedKind = kind; jjmatchedPos = pos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return pos + 1; } return jjMoveNfa_0(state, pos + 1); } */ private final int jjMoveStringLiteralDfa0_0() { switch(curChar) { case 10: return jjStopAtPos(0, 8); case 13: return jjMoveStringLiteralDfa1_0(0x80L); case 40: return jjStopAtPos(0, 10); case 41: return jjStopAtPos(0, 11); case 44: return jjStopAtPos(0, 12); case 61: return jjStopAtPos(0, 13); case 64: return jjStopAtPos(0, 9); case 123: return jjStopAtPos(0, 14); case 125: return jjStopAtPos(0, 15); default : return jjMoveNfa_0(1, 0); } } private final int jjMoveStringLiteralDfa1_0(long active0) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(0, active0); return 1; } switch(curChar) { case 10: if ((active0 & 0x80L) != 0L) return jjStopAtPos(1, 7); break; default : break; } return jjStartNfa_0(0, active0); } private final void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) { jjstateSet[jjnewStateCnt++] = state; jjrounds[state] = jjround; } } private final void jjAddStates(int start, int end) { do { jjstateSet[jjnewStateCnt++] = jjnextStates[start]; } while (start++ != end); } private final void jjCheckNAddTwoStates(int state1, int state2) { jjCheckNAdd(state1); jjCheckNAdd(state2); } private final void jjCheckNAddStates(int start, int end) { do { jjCheckNAdd(jjnextStates[start]); } while (start++ != end); } /* private final void jjCheckNAddStates(int start) { jjCheckNAdd(jjnextStates[start]); jjCheckNAdd(jjnextStates[start + 1]); } */ static final long[] jjbitVec0 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; private final int jjMoveNfa_0(int startState, int curPos) { //int[] nextStates; int startsAt = 0; jjnewStateCnt = 27; int i = 1; jjstateSet[0] = startState; //int j; int kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << curChar; //MatchLoop: do { switch(jjstateSet[--i]) { case 1: if ((0x3ff401000000000L & l) != 0L) { if (kind > 3) kind = 3; jjCheckNAdd(0); } else if (curChar == 34) jjCheckNAddStates(0, 2); else if (curChar == 39) jjAddStates(3, 4); break; case 0: if ((0x3ff401000000000L & l) == 0L) break; if (kind > 3) kind = 3; jjCheckNAdd(0); break; case 2: if ((0xffffff7fffffdbffL & l) != 0L) jjCheckNAdd(3); break; case 3: if (curChar == 39 && kind > 5) kind = 5; break; case 5: if ((0x8000008400000000L & l) != 0L) jjCheckNAdd(3); break; case 6: if (curChar == 48) jjCheckNAddTwoStates(7, 3); break; case 7: if ((0xff000000000000L & l) != 0L) jjCheckNAddTwoStates(7, 3); break; case 8: if ((0x3fe000000000000L & l) != 0L) jjCheckNAddTwoStates(9, 3); break; case 9: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(9, 3); break; case 10: if (curChar == 48) jjAddStates(5, 6); break; case 12: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(12, 3); break; case 14: if (curChar == 34) jjCheckNAddStates(0, 2); break; case 15: if ((0xfffffffbffffdbffL & l) != 0L) jjCheckNAddStates(0, 2); break; case 17: if ((0x8000008400000000L & l) != 0L) jjCheckNAddStates(0, 2); break; case 18: if (curChar == 34 && kind > 6) kind = 6; break; case 19: if (curChar == 48) jjCheckNAddStates(7, 10); break; case 20: if ((0xff000000000000L & l) != 0L) jjCheckNAddStates(7, 10); break; case 21: if ((0x3fe000000000000L & l) != 0L) jjCheckNAddStates(11, 14); break; case 22: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(11, 14); break; case 23: if (curChar == 48) jjAddStates(15, 16); break; case 25: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(17, 20); break; default : break; } } while(i != startsAt); } else if (curChar < 128) { long l = 1L << (curChar & 077); //MatchLoop: do { switch(jjstateSet[--i]) { case 1: case 0: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 3) kind = 3; jjCheckNAdd(0); break; case 2: if ((0xffffffffefffffffL & l) != 0L) jjCheckNAdd(3); break; case 4: if (curChar == 92) jjAddStates(21, 24); break; case 5: if ((0x54404610000000L & l) != 0L) jjCheckNAdd(3); break; case 11: if (curChar == 120) jjCheckNAdd(12); break; case 12: if ((0x7e0000007eL & l) != 0L) jjCheckNAddTwoStates(12, 3); break; case 13: if (curChar == 88) jjCheckNAdd(12); break; case 15: if ((0xffffffffefffffffL & l) != 0L) jjCheckNAddStates(0, 2); break; case 16: if (curChar == 92) jjAddStates(25, 28); break; case 17: if ((0x54404610000000L & l) != 0L) jjCheckNAddStates(0, 2); break; case 24: if (curChar == 120) jjCheckNAdd(25); break; case 25: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(17, 20); break; case 26: if (curChar == 88) jjCheckNAdd(25); break; default : break; } } while(i != startsAt); } else { int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); //MatchLoop: do { switch(jjstateSet[--i]) { case 2: if ((jjbitVec0[i2] & l2) != 0L) jjstateSet[jjnewStateCnt++] = 3; break; case 15: if ((jjbitVec0[i2] & l2) != 0L) jjAddStates(0, 2); break; default : break; } } while(i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 27 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } } static final int[] jjnextStates = { 15, 16, 18, 2, 4, 11, 13, 15, 16, 20, 18, 15, 16, 22, 18, 24, 26, 15, 16, 25, 18, 5, 6, 8, 10, 17, 19, 21, 23, }; public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, "\15\12", "\12", "\100", "\50", "\51", "\54", "\75", "\173", "\175", }; public static final String[] lexStateNames = { "DEFAULT", }; static final long[] jjtoToken = { 0xffe9L, }; static final long[] jjtoSkip = { 0x6L, }; protected SimpleCharStream input_stream; private final int[] jjrounds = new int[27]; private final int[] jjstateSet = new int[54]; protected char curChar; public AnnotationParserTokenManager(SimpleCharStream stream) { if (SimpleCharStream.staticFlag) throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); input_stream = stream; } public AnnotationParserTokenManager(SimpleCharStream stream, int lexState) { this(stream); SwitchTo(lexState); } public void ReInit(SimpleCharStream stream) { jjmatchedPos = jjnewStateCnt = 0; curLexState = defaultLexState; input_stream = stream; ReInitRounds(); } private final void ReInitRounds() { int i; jjround = 0x80000001; for (i = 27; i-- > 0;) jjrounds[i] = 0x80000000; } public void ReInit(SimpleCharStream stream, int lexState) { ReInit(stream); SwitchTo(lexState); } public void SwitchTo(int lexState) { if (lexState >= 1 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; } protected Token jjFillToken() { Token t = Token.newToken(jjmatchedKind); t.kind = jjmatchedKind; String im = jjstrLiteralImages[jjmatchedKind]; t.image = (im == null) ? input_stream.GetImage() : im; t.beginLine = input_stream.getBeginLine(); t.beginColumn = input_stream.getBeginColumn(); t.endLine = input_stream.getEndLine(); t.endColumn = input_stream.getEndColumn(); return t; } int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; int jjround; int jjmatchedPos; int jjmatchedKind; public Token getNextToken() { //int kind; //Token specialToken = null; Token matchedToken; int curPos = 0; EOFLoop : for (;;) { try { curChar = input_stream.BeginToken(); } catch(java.io.IOException e) { jjmatchedKind = 0; matchedToken = jjFillToken(); return matchedToken; } try { input_stream.backup(0); while (curChar <= 32 && (0x100000200L & (1L << curChar)) != 0L) curChar = input_stream.BeginToken(); } catch (java.io.IOException e1) { continue EOFLoop; } jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_0(); if (jjmatchedKind != 0x7fffffff) { if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1); if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { matchedToken = jjFillToken(); return matchedToken; } else { continue EOFLoop; } } int error_line = input_stream.getEndLine(); int error_column = input_stream.getEndColumn(); String error_after = null; boolean EOFSeen = false; try { input_stream.readChar(); input_stream.backup(1); } catch (java.io.IOException e1) { EOFSeen = true; error_after = curPos <= 1 ? "" : input_stream.GetImage(); if (curChar == '\n' || curChar == '\r') { error_line++; error_column = 0; } else error_column++; } if (!EOFSeen) { input_stream.backup(1); error_after = curPos <= 1 ? "" : input_stream.GetImage(); } throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ParseException.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ParseException.j0000644000175000017500000001656110533536206033276 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; /** * This exception is thrown when parse errors are encountered. * You can explicitly create objects of this exception type by * calling the method generateParseException in the generated * parser. * * You can modify this class to customize your error reporting * mechanisms so long as you retain the public fields. */ public class ParseException extends Exception { private static final long serialVersionUID = 1L; /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", * "expectedTokenSequences", and "tokenImage" set. The boolean * flag "specialConstructor" is also set to true to indicate that * this constructor was used to create this object. * This constructor calls its super class with the empty string * to force the "toString" method of parent class "Throwable" to * print the error message in the form: * ParseException: * * @param currentTokenVal * @param expectedTokenSequencesVal * @param tokenImageVal */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { super(""); specialConstructor = true; currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; } /** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(); specialConstructor = false; } public ParseException(String message) { super(message); specialConstructor = false; } /** * This variable determines which constructor was used to create * this object and thereby affects the semantics of the * "getMessage" method (see below). */ protected boolean specialConstructor; /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token * followng this token will (therefore) be the first error token. */ public Token currentToken; /** * Each entry in this array is an array of integers. Each array * of integers represents a sequence of tokens (by their ordinal * values) that is expected at this point of the parse. */ public int[][] expectedTokenSequences; /** * This is a reference to the "tokenImage" array of the generated * parser within which the parse error occurred. This array is * defined in the generated ...Constants interface. */ public String[] tokenImage; /** * This method has the standard behavior when this object has been * created using the standard constructors. Otherwise, it uses * "currentToken" and "expectedTokenSequences" to generate a parse * error message and returns it. If this object has been created * due to a parse error, and you do not catch it (it gets thrown * from the parser), then this method is called during the printing * of the final stack trace, and hence the correct error message * gets displayed. */ public String getMessage() { if (!specialConstructor) { return super.getMessage(); } String expected = ""; int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { expected += tokenImage[expectedTokenSequences[i][j]] + " "; } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected += "..."; } expected += eol + " "; } String retval = "Encountered \""; Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { if (i != 0) retval += " "; if (tok.kind == 0) { retval += tokenImage[0]; break; } retval += add_escapes(tok.image); tok = tok.next; } retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; retval += "." + eol; if (expectedTokenSequences.length == 1) { retval += "Was expecting:" + eol + " "; } else { retval += "Was expecting one of:" + eol + " "; } retval += expected; return retval; } /** * The end of line string for this machine. */ protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII * string literal. * * @param str * @return the escaped string */ protected String add_escapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/ASTChar.java0000644000175000017500000000302510504503510032237 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class ASTChar extends ASTMemberValue { public ASTChar(int id) { super(id); } public ASTChar(AnnotationParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) { return visitor.visit(this, data); } private char value; public void setValue(String val) { value = val.charAt(1); } public char getValue() { return value; } } libjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/SimpleNode.java0000644000175000017500000000627610533536206033076 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; public class SimpleNode implements Node { protected Node parent; protected Node[] children; protected int id; protected AnnotationParser parser; public SimpleNode(int i) { id = i; } public SimpleNode(AnnotationParser p, int i) { this(i); parser = p; } public void jjtOpen() { } public void jjtClose() { } public void jjtSetParent(Node n) { parent = n; } public Node jjtGetParent() { return parent; } public void jjtAddChild(Node n, int i) { if (children == null) { children = new Node[i + 1]; } else if (i >= children.length) { Node c[] = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } children[i] = n; } public Node jjtGetChild(int i) { return children[i]; } public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } /** Accept the visitor. **/ public Object jjtAccept(AnnotationParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** Accept the visitor. * @param visitor * @param data * @return ? */ public Object childrenAccept(AnnotationParserVisitor visitor, Object data) { if (children != null) { for (int i = 0; i < children.length; ++i) { children[i].jjtAccept(visitor, data); } } return data; } /* You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the tree is dumped. If your output uses more than one line you should override toString(String), otherwise overriding toString() is probably all you need to do. */ public String toString() { return AnnotationParserTreeConstants.jjtNodeName[id]; } public String toString(String prefix) { return prefix + toString(); } /* Override this method if you want to customize how the node dumps out its children. */ public void dump(String prefix) { System.out.println(toString(prefix)); if (children != null) { for (int i = 0; i < children.length; ++i) { SimpleNode n = (SimpleNode)children[i]; if (n != null) { n.dump(prefix + " "); } } } } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/JJTAnnotationParserState.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/ast/JJTAnnotationPar0000644000175000017500000000773410756326650033253 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory.ast; class JJTAnnotationParserState { private java.util.Stack nodes; private java.util.Stack marks; private int sp; // number of nodes on stack private int mk; // current mark private boolean node_created; JJTAnnotationParserState() { nodes = new java.util.Stack(); marks = new java.util.Stack(); sp = 0; mk = 0; } /* Determines whether the current node was actually closed and pushed. This should only be called in the final user action of a node scope. */ boolean nodeCreated() { return node_created; } /* Call this to reinitialize the node stack. It is called automatically by the parser's ReInit() method. */ void reset() { nodes.removeAllElements(); marks.removeAllElements(); sp = 0; mk = 0; } /* Returns the root node of the AST. It only makes sense to call this after a successful parse. */ Node rootNode() { return nodes.elementAt(0); } /* Pushes a node on to the stack. */ @SuppressWarnings("unchecked") void pushNode(Node n) { nodes.push(n); ++sp; } /* Returns the node on the top of the stack, and remove it from the stack. */ Node popNode() { if (--sp < mk) { mk = marks.pop().intValue(); } return nodes.pop(); } /* Returns the node currently on the top of the stack. */ Node peekNode() { return nodes.peek(); } /* Returns the number of children on the stack in the current node scope. */ int nodeArity() { return sp - mk; } void clearNodeScope(Node n) { while (sp > mk) { popNode(); } mk = marks.pop().intValue(); } @SuppressWarnings("unchecked") void openNodeScope(Node n) { marks.push(new Integer(mk)); mk = sp; n.jjtOpen(); } /* A definite node is constructed from a specified number of children. That number of nodes are popped from the stack and made the children of the definite node. Then the definite node is pushed on to the stack. */ void closeNodeScope(Node n, int num) { mk = marks.pop().intValue(); while (num-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, num); } n.jjtClose(); pushNode(n); node_created = true; } /* A conditional node is constructed if its condition is true. All the nodes that have been pushed since the node was opened are made children of the the conditional node, which is then pushed on to the stack. If the condition is false the node is not constructed and they are left on the stack. */ void closeNodeScope(Node n, boolean condition) { if (condition) { int a = nodeArity(); mk = marks.pop().intValue(); while (a-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, a); } n.jjtClose(); pushNode(n); node_created = true; } else { mk = marks.pop().intValue(); node_created = false; } } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/AnnotationCreator.javalibjboss-metadata-java-2.0.3.GA.orig/src/main/java/org/jboss/annotation/factory/AnnotationCreator.ja0000644000175000017500000004043211203040760033331 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.annotation.factory; import java.io.StringReader; import java.lang.reflect.Array; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.Properties; import org.jboss.annotation.factory.ast.ASTAnnotation; import org.jboss.annotation.factory.ast.ASTChar; import org.jboss.annotation.factory.ast.ASTIdentifier; import org.jboss.annotation.factory.ast.ASTMemberValueArrayInitializer; import org.jboss.annotation.factory.ast.ASTMemberValuePair; import org.jboss.annotation.factory.ast.ASTMemberValuePairs; import org.jboss.annotation.factory.ast.ASTSingleMemberValue; import org.jboss.annotation.factory.ast.ASTStart; import org.jboss.annotation.factory.ast.ASTString; import org.jboss.annotation.factory.ast.AnnotationParser; import org.jboss.annotation.factory.ast.AnnotationParserVisitor; import org.jboss.annotation.factory.ast.Node; import org.jboss.annotation.factory.ast.SimpleNode; import org.jboss.annotation.factory.javassist.DefaultValueAnnotationValidator; import org.jboss.logging.Logger; import org.jboss.util.StringPropertyReplacer; /** * Comment * * @author Bill Burke * @author Kabir Khan * @author Ales Justin * @version $Revision: 88879 $ */ public class AnnotationCreator implements AnnotationParserVisitor { private static final Logger log = Logger.getLogger(AnnotationCreator.class); private Class annotation; private Class type; public Object typeValue; private ClassLoader loader; static final AnnotationValidator defaultAnnotationReader; static { boolean haveJavassist = false; try { Class.forName("javassist.CtClass"); haveJavassist = true; } catch(ClassNotFoundException ignore) { } if (haveJavassist) { defaultAnnotationReader = new DefaultValueAnnotationValidator(); } else { defaultAnnotationReader = new SimpleAnnotationValidator(); } } public AnnotationCreator(Class annotation, Class type, ClassLoader loader) { this.type = type; this.annotation = annotation; this.loader = loader; } public AnnotationCreator(Class annotation, Class type) { this.type = type; this.annotation = annotation; this.loader = Thread.currentThread().getContextClassLoader(); } public Object visit(ASTMemberValuePairs node, Object data) { node.childrenAccept(this, data); return null; } public Object visit(ASTMemberValuePair node, Object data) { String name = node.getIdentifier().getValue(); node.getValue().jjtAccept(this, name); return data; } public Object visit(ASTSingleMemberValue node, Object data) { node.getValue().jjtAccept(this, "value"); return data; } public Object visit(ASTIdentifier node, Object data) { try { if (type.equals(Class.class)) { String classname = node.getValue(); if (classname.endsWith(".class")) { classname = classname.substring(0, classname.indexOf(".class")); } if (classname.equals("void")) { typeValue = void.class; } else if (classname.equals("int")) { typeValue = int.class; } else if (classname.equals("byte")) { typeValue = byte.class; } else if (classname.equals("long")) { typeValue = long.class; } else if (classname.equals("double")) { typeValue = double.class; } else if (classname.equals("float")) { typeValue = float.class; } else if (classname.equals("char")) { typeValue = char.class; } else if (classname.equals("short")) { typeValue = short.class; } else if (classname.equals("boolean")) { typeValue = boolean.class; } else { typeValue = Class.forName(classname, false, loader); } } else if (type.isPrimitive()) { if (type.equals(boolean.class)) { typeValue = Boolean.valueOf(node.getValue()); } else if (type.equals(short.class)) { typeValue = Short.valueOf(node.getValue()); } else if (type.equals(float.class)) { typeValue = Float.valueOf(node.getValue()); } else if (type.equals(double.class)) { typeValue = Double.valueOf(node.getValue()); } else if (type.equals(long.class)) { typeValue = Long.valueOf(node.getValue()); } else if (type.equals(byte.class)) { typeValue = new Byte(node.getValue()); } else if (type.equals(int.class)) { typeValue = new Integer(node.getValue()); } } else // its an enum { int index = node.getValue().lastIndexOf('.'); if (index == -1) throw new RuntimeException("Enum must be fully qualified: " + node.getValue()); String className = node.getValue().substring(0, index); String en = node.getValue().substring(index + 1); Class enumClass = loader.loadClass(className); Class superClass = enumClass.getSuperclass(); if ("java.lang.Enum".equals(superClass.getName())) { Method valueOf = superClass.getMethod("valueOf", Class.class, String.class); Object[] args = {enumClass, en}; typeValue = valueOf.invoke(null, args); } else { Field field = enumClass.getField(en); typeValue = field.get(null); } } } catch (ClassNotFoundException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } catch (NoSuchFieldException e) { throw new RuntimeException(e); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } return null; } public Object visit(ASTString node, Object data) { if (!type.equals(String.class)) throw new RuntimeException(annotation.getName() + "." + data + " is not an String"); typeValue = node.getValue(); return null; } public Object visit(ASTChar node, Object data) { if (!type.equals(char.class)) throw new RuntimeException(annotation.getName() + "." + data + " is not an char"); typeValue = node.getValue(); return null; } public Object visit(ASTMemberValueArrayInitializer node, Object data) { if (!type.isArray()) throw new RuntimeException(annotation.getName() + "." + data + " is not an array"); Class baseType = type.getComponentType(); int size = node.jjtGetNumChildren(); typeValue = Array.newInstance(baseType, size); for (int i = 0; i < size; i++) { AnnotationCreator creator = new AnnotationCreator(annotation, baseType, loader); node.jjtGetChild(i).jjtAccept(creator, null); Array.set(typeValue, i, creator.typeValue); } return null; } public Object visit(ASTAnnotation node, Object data) { try { Class subAnnotation = loader.loadClass(node.getIdentifier()); typeValue = createAnnotation(node, subAnnotation); } catch (Exception e) { throw new RuntimeException(e); } return null; } // Unneeded public Object visit(SimpleNode node, Object data) { return null; } public Object visit(ASTStart node, Object data) { return null; } private static Class getMemberType(Class annotation, String member) { Method[] methods = annotation.getMethods(); for (Method method : methods) { if (method.getName().equals(member)) { return method.getReturnType(); } } throw new RuntimeException("unable to determine member type for annotation: " + annotation.getName() + "." + member); } private static ASTAnnotation getRootExpr(final String annotationExpr) throws Exception { return getRootExpr(annotationExpr, null, false); } private static ASTAnnotation getRootExpr(final String annotationExpr, final Properties properties) throws Exception { return getRootExpr(annotationExpr, properties, null); } private static ASTAnnotation getRootExpr(final String annotationExpr, final Properties properties, final Boolean replace) throws Exception { try { return AccessController.doPrivileged(new PrivilegedExceptionAction() { public ASTAnnotation run() throws Exception { String expr; if (properties != null && properties.isEmpty() == false) expr = StringPropertyReplacer.replaceProperties(annotationExpr, properties); else if (replace != null && replace) expr = StringPropertyReplacer.replaceProperties(annotationExpr); else expr = annotationExpr; AnnotationParser parser = new AnnotationParser(new StringReader(expr)); ASTStart start = parser.Start(); return (ASTAnnotation)start.jjtGetChild(0); } }); } catch (PrivilegedActionException e) { throw new RuntimeException("Error getting root expression " + annotationExpr, e.getException()); } } public static Object createAnnotation(ASTAnnotation node, Class annotation, ClassLoader cl) throws Exception { HashMap map = new HashMap(); ClassLoader loader; if (cl != null) { loader = cl; } else { String info = (annotation != null) ? annotation.getName() : node.getIdentifier(); if (log.isTraceEnabled()) log.trace("No ClassLoader provided, using TCCL: " + info); loader = Thread.currentThread().getContextClassLoader(); } if (annotation == null) { annotation = loader.loadClass(node.getIdentifier()); } if (node.jjtGetNumChildren() > 0) { Node contained = node.jjtGetChild(0); if (contained instanceof ASTSingleMemberValue) { Class type = getMemberType(annotation, "value"); AnnotationCreator creator = new AnnotationCreator(annotation, type, loader); contained.jjtAccept(creator, "value"); map.put("value", creator.typeValue); } else { ASTMemberValuePairs pairs = (ASTMemberValuePairs) contained; for (int i = 0; i < pairs.jjtGetNumChildren(); i++) { ASTMemberValuePair member = (ASTMemberValuePair) pairs.jjtGetChild(i); Class type = getMemberType(annotation, member.getIdentifier().getValue()); AnnotationCreator creator = new AnnotationCreator(annotation, type, loader); member.jjtAccept(creator, null); map.put(member.getIdentifier().getValue(), creator.typeValue); } } } defaultAnnotationReader.validate(map, annotation); return AnnotationProxy.createProxy(map, annotation); } /** * Create annotation. * * @param node the ast annotation node * @param annotation the annotation class * @return new annotation instance * @throws Exception for any error */ public static Object createAnnotation(ASTAnnotation node, Class annotation) throws Exception { return createAnnotation(node, annotation, null); } /** * Create annotation. * * @param annotationExpr the annotation expression * @param annotation the annotation class * @return new annotation instance * @throws Exception for any error */ public static Object createAnnotation(final String annotationExpr, final Class annotation) throws Exception { return createAnnotation(getRootExpr(annotationExpr), annotation, null); } /** * Create annotation. * * @param annotationExpr the annotation expression * @param cl the classloader to use * @return new annotation instance * @throws Exception for any error */ public static Object createAnnotation(String annotationExpr, ClassLoader cl) throws Exception { return createAnnotation(getRootExpr(annotationExpr), null, cl); } /** * Create annotation. * * @param annotationExpr the annotation expression * @param annotation the annotation class * @param replace should we replace possible properties in expression * @return new annotation instance * @throws Exception for any error */ public static Object createAnnotation(final String annotationExpr, final Class annotation, boolean replace) throws Exception { return createAnnotation(getRootExpr(annotationExpr, null, replace), annotation, null); } /** * Create annotation. * * @param annotationExpr the annotation expression * @param cl the classloader to use * @param replace should we replace possible properties in expression * @return new annotation instance * @throws Exception for any error */ public static Object createAnnotation(String annotationExpr, ClassLoader cl, boolean replace) throws Exception { return createAnnotation(getRootExpr(annotationExpr, null, replace), null, cl); } /** * Create annotation. * * @param annotationExpr the annotation expression * @param annotation the annotation class * @param properties the properties to use for replacement * @return new annotation instance * @throws Exception for any error */ public static Object createAnnotation(final String annotationExpr, final Class annotation, Properties properties) throws Exception { return createAnnotation(getRootExpr(annotationExpr, properties), annotation, null); } /** * Create annotation. * * @param annotationExpr the annotation expression * @param cl the classloader to use * @param properties the properties to use for replacement * @return new annotation instance * @throws Exception for any error */ public static Object createAnnotation(String annotationExpr, ClassLoader cl, Properties properties) throws Exception { return createAnnotation(getRootExpr(annotationExpr, properties), null, cl); } } libjboss-metadata-java-2.0.3.GA.orig/.settings/0000755000175000017500000000000011620305603021115 5ustar twernertwernerlibjboss-metadata-java-2.0.3.GA.orig/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000000032010762775672026121 0ustar twernertwerner#Fri Sep 21 17:48:03 BST 2007 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.source=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 libjboss-metadata-java-2.0.3.GA.orig/.project0000644000175000017500000000050610770737737020675 0ustar twernertwerner jboss-mdr JBoss MetaData Repository org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature