You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/06/13 19:10:16 UTC

svn commit: r1135178 [3/3] - in /commons/sandbox/meiyo/trunk: ./ src/ src/changes/ src/main/ src/main/assembly/ src/main/java/ src/main/java/org/ src/main/java/org/nnsoft/ src/main/java/org/nnsoft/commons/ src/main/java/org/nnsoft/commons/meiyo/ src/ma...

Added: commons/sandbox/meiyo/trunk/src/main/java/org/nnsoft/commons/meiyo/classvisitor/package-info.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/nnsoft/commons/meiyo/classvisitor/package-info.java?rev=1135178&view=auto
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/nnsoft/commons/meiyo/classvisitor/package-info.java (added)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/nnsoft/commons/meiyo/classvisitor/package-info.java Mon Jun 13 17:10:13 2011
@@ -0,0 +1,20 @@
+/**
+ * Annotated elements scanner DSL.
+ */
+package org.nnsoft.commons.meiyo.classvisitor;
+
+/*
+ *    Copyright 2010-2011 The 99 Software Foundation
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */

Propchange: commons/sandbox/meiyo/trunk/src/main/java/org/nnsoft/commons/meiyo/classvisitor/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/meiyo/trunk/src/main/java/org/nnsoft/commons/meiyo/classvisitor/package-info.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/meiyo/trunk/src/main/java/org/nnsoft/commons/meiyo/classvisitor/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/meiyo/trunk/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/site/apt/index.apt?rev=1135178&view=auto
==============================================================================
--- commons/sandbox/meiyo/trunk/src/site/apt/index.apt (added)
+++ commons/sandbox/meiyo/trunk/src/site/apt/index.apt Mon Jun 13 17:10:13 2011
@@ -0,0 +1,46 @@
+                                    ------
+                                    Home
+                                    ------
+                                    The 99 Software Foundation
+                                    ------
+                                     2010
+
+~~
+~~   Copyright 2010 The Meiyo Team
+~~
+~~   Licensed under the Apache License, Version 2.0 (the "License");
+~~   you may not use this file except in compliance with the License.
+~~   You may obtain a copy of the License at
+~~
+~~       http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~   Unless required by applicable law or agreed to in writing, software
+~~   distributed under the License is distributed on an "AS IS" BASIS,
+~~   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+~~   See the License for the specific language governing permissions and
+~~   limitations under the License.
+~~
+
+Welcome to Meiyo!
+
+  False modesty a part, Meiyo is THE classpath class scanner for Java. Why?
+  Simply because provides even-based alike APIs that allow users perform
+  efficient and lightweight classpath scan operation without storing any data.
+
+  Meiyo is a Japanes word that means "Honour".
+
+Before starting
+
+  Meiyo is available on the Maven Central repo, you just need to add the dependency below in your <<<pom.xml>>> file:
+
++--------------------------------------+
+<dependencies>
+    ...
+    <dependency>
+        <groupId>org.99soft.commons</groupId>
+        <artifactId>meiyo</artifactId>
+        <version>XX.XX</version>
+    </dependency>
+    ...
+</dependencies>
++--------------------------------------+

Propchange: commons/sandbox/meiyo/trunk/src/site/apt/index.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/meiyo/trunk/src/site/apt/index.apt
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/meiyo/trunk/src/site/apt/index.apt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/meiyo/trunk/src/site/resources/images/logo.png
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/site/resources/images/logo.png?rev=1135178&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/sandbox/meiyo/trunk/src/site/resources/images/logo.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: commons/sandbox/meiyo/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/site/site.xml?rev=1135178&view=auto
==============================================================================
--- commons/sandbox/meiyo/trunk/src/site/site.xml (added)
+++ commons/sandbox/meiyo/trunk/src/site/site.xml Mon Jun 13 17:10:13 2011
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ |  Copyright 2010-2011 The 99 Software Foundation
+ |
+ |  Licensed under the Apache License, Version 2.0 (the "License");
+ |  you may not use this file except in compliance with the License.
+ |  You may obtain a copy of the License at
+ |
+ |      http://www.apache.org/licenses/LICENSE-2.0
+ |
+ |  Unless required by applicable law or agreed to in writing, software
+ |  distributed under the License is distributed on an "AS IS" BASIS,
+ |  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ |  See the License for the specific language governing permissions and
+ |  limitations under the License.
+-->
+<project name="${project.name}">
+
+    <bannerLeft>
+        <name>${project.description}</name>
+        <src>images/logo.png</src>
+        <href>${project.url}/index.html</href>
+    </bannerLeft>
+
+    <version position="left"/>
+
+    <body>
+        <menu name="${project.name}">
+            <item name="Home" href="index.html" />
+        </menu>
+
+        <menu name="External Links">
+            <item name="Project Page" href="https://github.com/99soft/meiyo/" />
+        </menu>
+    </body>
+
+</project>

Propchange: commons/sandbox/meiyo/trunk/src/site/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/meiyo/trunk/src/site/site.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/sandbox/meiyo/trunk/src/site/site.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/ClassPathTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/ClassPathTestCase.java?rev=1135178&view=auto
==============================================================================
--- commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/ClassPathTestCase.java (added)
+++ commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/ClassPathTestCase.java Mon Jun 13 17:10:13 2011
@@ -0,0 +1,89 @@
+/*
+ *    Copyright 2010-2011 The 99 Software Foundation
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+package org.nnsoft.commons.meiyo.classpath;
+
+import static org.nnsoft.commons.meiyo.classpath.MeiyoScanner.createClassPathFromJVM;
+import static org.nnsoft.commons.meiyo.classpath.filter.Filters.any;
+import static org.nnsoft.commons.meiyo.classpath.filter.Filters.classNameMatches;
+import static org.nnsoft.commons.meiyo.classpath.filter.Filters.inSubpackage;
+import static org.nnsoft.commons.meiyo.classpath.filter.Filters.isAbstract;
+import static org.nnsoft.commons.meiyo.classpath.filter.Filters.isAnnotation;
+import static org.nnsoft.commons.meiyo.classpath.filter.Filters.isPublic;
+import static org.nnsoft.commons.meiyo.classpath.filter.Filters.not;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.testng.annotations.Test;
+
+/**
+ * FILL ME
+ */
+public final class ClassPathTestCase
+{
+
+    @Test
+    public void justPrint()
+    {
+        final List<Class<?>> classes = new ArrayList<Class<?>>();
+
+        createClassPathFromJVM().withConfiguration( new AbstractHandlerConfiguration()
+        {
+
+            @Override
+            public void configure()
+            {
+                ifMatches( inSubpackage( "org.nnsoft.commons.meiyo.classpath" ).
+                               and( isPublic() )
+                               .and( not( isAbstract() ) )
+                               .and( not( isAnnotation() ) )
+                               .and( not( classNameMatches( ".*TestCase" ) ) ) )
+                         .handleWith( new ClassPathEntryHandler()
+                         {
+
+                             public void doHandle( String path, Class<?> classPathEntry )
+                             {
+                                 classes.add( classPathEntry );
+                             }
+
+                         },
+                         new ClassPathEntryHandler()
+                         {
+
+                             public void doHandle( String path, Class<?> classPathEntry )
+                             {
+                                 System.out.println( ">>>> " + classPathEntry );
+                             }
+
+                         } );
+
+                ifMatches( any() ).handleWith( new ClassPathEntryHandler()
+                {
+
+                    public void doHandle( String path, Class<?> classPathEntry )
+                    {
+                        System.out.println( "[INFO] found " + classPathEntry );
+                    }
+
+                } );
+            }
+
+        } ).usingDefaultClassLoader().scan();
+
+        assert 0 < classes.size();
+    }
+
+}

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/ClassPathTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/ClassPathTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/ClassPathTestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/DummyAnnotation.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/DummyAnnotation.java?rev=1135178&view=auto
==============================================================================
--- commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/DummyAnnotation.java (added)
+++ commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/DummyAnnotation.java Mon Jun 13 17:10:13 2011
@@ -0,0 +1,31 @@
+/*
+ *    Copyright 2010-2011 The 99 Software Foundation
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+package org.nnsoft.commons.meiyo.classpath.filter;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @version $Id$
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( ElementType.TYPE )
+public @interface DummyAnnotation
+{
+
+}

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/DummyAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/DummyAnnotation.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/DummyAnnotation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/FiltersTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/FiltersTestCase.java?rev=1135178&view=auto
==============================================================================
--- commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/FiltersTestCase.java (added)
+++ commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/FiltersTestCase.java Mon Jun 13 17:10:13 2011
@@ -0,0 +1,94 @@
+/*
+ *    Copyright 2010-2011 The 99 Software Foundation
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+package org.nnsoft.commons.meiyo.classpath.filter;
+
+import static org.nnsoft.commons.meiyo.classpath.filter.Filters.annotatedWithType;
+import static org.nnsoft.commons.meiyo.classpath.filter.Filters.containsMethod;
+import static org.nnsoft.commons.meiyo.classpath.filter.Filters.inPackage;
+import static org.nnsoft.commons.meiyo.classpath.filter.Filters.inSubpackage;
+import static org.nnsoft.commons.meiyo.classpath.filter.Filters.isAbstract;
+import static org.nnsoft.commons.meiyo.classpath.filter.Filters.isInterface;
+
+import java.util.List;
+
+import org.nnsoft.commons.meiyo.classpath.Matcher;
+import org.nnsoft.commons.meiyo.classpath.ClassLoaderBuilder;
+import org.nnsoft.commons.meiyo.classpath.MeiyoScanner;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+/**
+ * @version $Id$
+ */
+@Test
+public final class FiltersTestCase
+{
+
+    public void matchesAnnotatedWithType()
+    {
+        assert annotatedWithType( Test.class ).matches( this.getClass() );
+        assert !annotatedWithType( Parameters.class ).matches( this.getClass() );
+    }
+
+    @Test( expectedExceptions = { IllegalArgumentException.class } )
+    public void noRuntimeRetention()
+    {
+        annotatedWithType( NoRuntimeRetention.class );
+    }
+
+    public void matchesInPackage()
+    {
+        Filter inMeiyoPackage = inPackage( "org.nnsoft.commons.meiyo.classpath" );
+        assert inMeiyoPackage.matches( MeiyoScanner.class );
+        assert !inMeiyoPackage.matches( List.class );
+    }
+
+    public void matchesInSubPackage()
+    {
+        Filter inMeiyoPackage = inSubpackage( "org.nnsoft.commons.meiyo.classpath" );
+        assert inMeiyoPackage.matches( Filters.class );
+        assert !inMeiyoPackage.matches( List.class );
+    }
+
+    public void matchesInterface()
+    {
+        Filter isInterface = isInterface();
+        assert !isInterface.matches( DummyAnnotation.class );
+        assert isInterface.matches( Matcher.class );
+    }
+
+    public void matchesAbstract()
+    {
+        Filter isAbstract = isAbstract();
+        assert isAbstract.matches( AbstractFilter.class );
+        assert !isAbstract.matches( Filter.class );
+    }
+
+    public void matchesContainsMethodWithNoArguments()
+    {
+        Filter containsMethod = containsMethod( "usingDefaultClassLoader" );
+        assert containsMethod.matches( ClassLoaderBuilder.class );
+        assert !containsMethod.matches( Filter.class );
+    }
+
+    public void matchesContainsMethodWithArguments()
+    {
+        Filter containsMethod = containsMethod( "matches", Class.class );
+        assert containsMethod.matches( Filter.class );
+        assert !containsMethod.matches( MeiyoScanner.class );
+    }
+
+}

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/FiltersTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/FiltersTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/FiltersTestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/NoRuntimeRetention.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/NoRuntimeRetention.java?rev=1135178&view=auto
==============================================================================
--- commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/NoRuntimeRetention.java (added)
+++ commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/NoRuntimeRetention.java Mon Jun 13 17:10:13 2011
@@ -0,0 +1,15 @@
+package org.nnsoft.commons.meiyo.classpath.filter;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention( RetentionPolicy.CLASS )
+@Target( ElementType.TYPE )
+public @interface NoRuntimeRetention
+{
+
+    String value();
+
+}

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/NoRuntimeRetention.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/NoRuntimeRetention.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classpath/filter/NoRuntimeRetention.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/AnnotatedBean.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/AnnotatedBean.java?rev=1135178&view=auto
==============================================================================
--- commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/AnnotatedBean.java (added)
+++ commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/AnnotatedBean.java Mon Jun 13 17:10:13 2011
@@ -0,0 +1,19 @@
+package org.nnsoft.commons.meiyo.classvisitor;
+
+@ClassAnnotation
+final class AnnotatedBean
+{
+
+    @ConstructorAnnotation
+    public AnnotatedBean()
+    {
+
+    }
+
+    @MethodAnnotation
+    public void doNothing()
+    {
+
+    }
+
+}

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/AnnotatedBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/AnnotatedBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/AnnotatedBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ClassAnnotation.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ClassAnnotation.java?rev=1135178&view=auto
==============================================================================
--- commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ClassAnnotation.java (added)
+++ commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ClassAnnotation.java Mon Jun 13 17:10:13 2011
@@ -0,0 +1,13 @@
+package org.nnsoft.commons.meiyo.classvisitor;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention( RetentionPolicy.RUNTIME )
+@Target( ElementType.TYPE )
+public @interface ClassAnnotation
+{
+
+}

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ClassAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ClassAnnotation.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ClassAnnotation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ClassVisitorTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ClassVisitorTestCase.java?rev=1135178&view=auto
==============================================================================
--- commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ClassVisitorTestCase.java (added)
+++ commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ClassVisitorTestCase.java Mon Jun 13 17:10:13 2011
@@ -0,0 +1,96 @@
+/*
+ *    Copyright 2010-2011 The 99 Software Foundation
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+package org.nnsoft.commons.meiyo.classvisitor;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * FILL ME.
+ */
+public final class ClassVisitorTestCase
+{
+
+    private boolean foundClassAnnotation = false;
+
+    private boolean foundConstructorAnnotation = false;
+
+    private boolean foundMethodAnnotation = false;
+
+    @BeforeClass
+    public void setUp()
+    {
+        MeiyoVisitor.createVisitor( new AbstractVisitorConfiguration()
+        {
+
+            @Override
+            public void configure()
+            {
+                handleType().annotatedWith( ClassAnnotation.class ).withHandler( new AnnotationHandler<Class, ClassAnnotation>()
+                                                                                 {
+                                                                                     public void handle( Class annnotatedElement,
+                                                                                                         ClassAnnotation annotation )
+                                                                                     {
+                                                                                         foundClassAnnotation = true;
+                                                                                     }
+                                                                                 } );
+
+                handleConstructor().annotatedWith( ConstructorAnnotation.class ).withHandler( new AnnotationHandler<Constructor, ConstructorAnnotation>()
+                                                                                              {
+                                                                                                  public void handle( Constructor annnotatedElement,
+                                                                                                                      ConstructorAnnotation annotation )
+                                                                                                  {
+                                                                                                      foundConstructorAnnotation =
+                                                                                                          true;
+                                                                                                  }
+                                                                                              } );
+
+                handleMethod().annotatedWith( MethodAnnotation.class ).withHandler( new AnnotationHandler<Method, MethodAnnotation>()
+                                                                                    {
+                                                                                        public void handle( Method annnotatedElement,
+                                                                                                            MethodAnnotation annotation )
+                                                                                        {
+                                                                                            foundMethodAnnotation =
+                                                                                                true;
+                                                                                        }
+                                                                                    } );
+            }
+
+        } ).visit( AnnotatedBean.class );
+    }
+
+    @Test
+    public void verifyClassAnnotationsFound()
+    {
+        assert this.foundClassAnnotation;
+    }
+
+    @Test
+    public void verifyConstructorAnnotationsFound()
+    {
+        assert this.foundConstructorAnnotation;
+    }
+
+    @Test
+    public void verifyMethodAnnotationsFound()
+    {
+        assert this.foundMethodAnnotation;
+    }
+
+}

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ClassVisitorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ClassVisitorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ClassVisitorTestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ConstructorAnnotation.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ConstructorAnnotation.java?rev=1135178&view=auto
==============================================================================
--- commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ConstructorAnnotation.java (added)
+++ commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ConstructorAnnotation.java Mon Jun 13 17:10:13 2011
@@ -0,0 +1,13 @@
+package org.nnsoft.commons.meiyo.classvisitor;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention( RetentionPolicy.RUNTIME )
+@Target( ElementType.CONSTRUCTOR )
+public @interface ConstructorAnnotation
+{
+
+}

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ConstructorAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ConstructorAnnotation.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/ConstructorAnnotation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/MethodAnnotation.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/MethodAnnotation.java?rev=1135178&view=auto
==============================================================================
--- commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/MethodAnnotation.java (added)
+++ commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/MethodAnnotation.java Mon Jun 13 17:10:13 2011
@@ -0,0 +1,13 @@
+package org.nnsoft.commons.meiyo.classvisitor;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention( RetentionPolicy.RUNTIME )
+@Target( ElementType.METHOD )
+public @interface MethodAnnotation
+{
+
+}

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/MethodAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/MethodAnnotation.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/meiyo/trunk/src/test/java/org/nnsoft/commons/meiyo/classvisitor/MethodAnnotation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain