Author: alexsmirnov
Date: 2010-04-26 16:43:19 -0400 (Mon, 26 Apr 2010)
New Revision: 16812
Added:
root/cdk/trunk/plugins/commons/
root/cdk/trunk/plugins/commons/pom.xml
root/cdk/trunk/plugins/commons/src/
root/cdk/trunk/plugins/commons/src/main/
root/cdk/trunk/plugins/commons/src/main/java/
root/cdk/trunk/plugins/commons/src/main/java/org/
root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/
root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/
root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/Implementation.java
root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/JavaLogger.java
root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/Logger.java
root/cdk/trunk/plugins/commons/src/test/
root/cdk/trunk/plugins/commons/src/test/java/
root/cdk/trunk/plugins/commons/src/test/java/org/
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/As.java
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/AsProvider.java
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/CdkTestRunner.java
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/Mock.java
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/MockController.java
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/Stub.java
Removed:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Implementation.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/JavaLogger.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/As.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/AsProvider.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestRunner.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Mock.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/MockController.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/RunnerTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Stub.java
Modified:
root/cdk/trunk/bom/pom.xml
root/cdk/trunk/plugins/generator/pom.xml
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/xml-configured-component/
root/cdk/trunk/plugins/pom.xml
Log:
RESOLVED - issue RF-7750: Create a Bill Of Materials for CDK
https://jira.jboss.org/jira/browse/RF-7750
Modified: root/cdk/trunk/bom/pom.xml
===================================================================
--- root/cdk/trunk/bom/pom.xml 2010-04-26 16:45:15 UTC (rev 16811)
+++ root/cdk/trunk/bom/pom.xml 2010-04-26 20:43:19 UTC (rev 16812)
@@ -23,6 +23,18 @@
<
developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root...
<
url>http://fisheye.jboss.org/browse/Richfaces/cdk/trunk/bom</url>
</scm>
+ <build>
+ <!-- Define CDK plugin that is used by JSF component projects -->
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
<dependencyManagement>
<dependencies>
<!-- JSF -->
@@ -191,6 +203,18 @@
<version>1.1.2</version>
</dependency>
<!-- Projects -->
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>commons</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>commons</artifactId>
+ <classifier>tests</classifier>
+ <scope>test</scope>
+ <version>4.0.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.richfaces.cdk</groupId>
<artifactId>attributes</artifactId>
Property changes on: root/cdk/trunk/plugins/commons
___________________________________________________________________
Name: svn:ignore
+ target
.settings
.project
.classpath
.clover
bin
Added: root/cdk/trunk/plugins/commons/pom.xml
===================================================================
--- root/cdk/trunk/plugins/commons/pom.xml (rev 0)
+++ root/cdk/trunk/plugins/commons/pom.xml 2010-04-26 20:43:19 UTC (rev 16812)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
+
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>maven-plugins</artifactId>
+ <groupId>org.richfaces.cdk</groupId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>commons</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>commons</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Copied: root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/Implementation.java
(from rev 16811,
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Implementation.java)
===================================================================
--- root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/Implementation.java
(rev 0)
+++
root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/Implementation.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -0,0 +1,49 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+
+/**
+ * <p class="changed_added_4_0">
+ * This annotation can be applied to any injection classifier annotation to define
implementation class that should be
+ * used to call {@link
com.google.inject.binder.AnnotatedBindingBuilder#annotatedWith(Annotation)}
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+@Target(ANNOTATION_TYPE)
+@Retention(RUNTIME)
+@Documented
+public @interface Implementation {
+ public Class<? extends Annotation> value();
+}
Property changes on:
root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/Implementation.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Copied: root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/JavaLogger.java
(from rev 16811,
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/JavaLogger.java)
===================================================================
--- root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/JavaLogger.java
(rev 0)
+++
root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/JavaLogger.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -0,0 +1,192 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk;
+
+import java.util.logging.Level;
+
+/**
+ * <p class="changed_added_4_0">That logger delegates all calls to the
JDK {@link java.util.logging.Logger}</p>
+ *
+ * @author asmirnov(a)exadel.com
+ */
+public class JavaLogger implements Logger {
+
+ public static final String CDK_LOG = "org.richfaces.cdk";
+
+ private int errorCount = 0;
+
+ private java.util.logging.Logger jdkLogger =
java.util.logging.Logger.getLogger(CDK_LOG);
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#debug(java.lang.CharSequence)
+ */
+ @Override
+ public void debug(CharSequence content) {
+ jdkLogger.fine(String.valueOf(content));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#debug(java.lang.CharSequence, java.lang.Throwable)
+ */
+ @Override
+ public void debug(CharSequence content, Throwable error) {
+ jdkLogger.log(Level.FINE, String.valueOf(content), error);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#debug(java.lang.Throwable)
+ */
+ @Override
+ public void debug(Throwable error) {
+ jdkLogger.log(Level.FINE, "", error);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#error(java.lang.CharSequence)
+ */
+ @Override
+ public void error(CharSequence content) {
+ errorCount++;
+ jdkLogger.severe(String.valueOf(content));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#error(java.lang.CharSequence, java.lang.Throwable)
+ */
+ @Override
+ public void error(CharSequence content, Throwable error) {
+ errorCount++;
+ jdkLogger.log(Level.SEVERE, String.valueOf(content), error);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#error(java.lang.Throwable)
+ */
+ @Override
+ public void error(Throwable error) {
+ errorCount++;
+ jdkLogger.log(Level.SEVERE, "", error);
+ }
+
+ @Override
+ public int getErrorCount() {
+ return errorCount;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#info(java.lang.CharSequence)
+ */
+ @Override
+ public void info(CharSequence content) {
+ jdkLogger.info(String.valueOf(content));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#info(java.lang.CharSequence, java.lang.Throwable)
+ */
+ @Override
+ public void info(CharSequence content, Throwable error) {
+ jdkLogger.log(Level.INFO, String.valueOf(content), error);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#info(java.lang.Throwable)
+ */
+ @Override
+ public void info(Throwable error) {
+ jdkLogger.log(Level.INFO, "", error);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#isDebugEnabled()
+ */
+ @Override
+ public boolean isDebugEnabled() {
+ return jdkLogger.isLoggable(Level.FINE);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#isErrorEnabled()
+ */
+ @Override
+ public boolean isErrorEnabled() {
+ return jdkLogger.isLoggable(Level.SEVERE);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#isInfoEnabled()
+ */
+ @Override
+ public boolean isInfoEnabled() {
+ return jdkLogger.isLoggable(Level.INFO);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#isWarnEnabled()
+ */
+ @Override
+ public boolean isWarnEnabled() {
+ return jdkLogger.isLoggable(Level.WARNING);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#warn(java.lang.CharSequence)
+ */
+ @Override
+ public void warn(CharSequence content) {
+ jdkLogger.warning(String.valueOf(content));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#warn(java.lang.CharSequence, java.lang.Throwable)
+ */
+ @Override
+ public void warn(CharSequence content, Throwable error) {
+ jdkLogger.log(Level.WARNING, String.valueOf(content), error);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#warn(java.lang.Throwable)
+ */
+ @Override
+ public void warn(Throwable error) {
+ jdkLogger.log(Level.WARNING, "", error);
+ }
+}
Property changes on:
root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/JavaLogger.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Copied: root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/Logger.java (from
rev 16811, root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java)
===================================================================
--- root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/Logger.java
(rev 0)
+++ root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/Logger.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -0,0 +1,68 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * That interface hides current logging system from generator classes.
+ * Concrete tools ( Maven, Ant, JUnit ) should provide appropriate logger instance that
delegates
+ * messages to the current log system.
+ *
+ * @author shura
+ */
+(a)ImplementedBy(JavaLogger.class)
+public interface Logger {
+ public boolean isDebugEnabled();
+
+ public void debug(CharSequence content);
+
+ public void debug(CharSequence content, Throwable error);
+
+ public void debug(Throwable error);
+
+ public boolean isInfoEnabled();
+
+ public void info(CharSequence content);
+
+ public void info(CharSequence content, Throwable error);
+
+ public void info(Throwable error);
+
+ public boolean isWarnEnabled();
+
+ public void warn(CharSequence content);
+
+ public void warn(CharSequence content, Throwable error);
+
+ public void warn(Throwable error);
+
+ public boolean isErrorEnabled();
+
+ public void error(CharSequence content);
+
+ public void error(CharSequence content, Throwable error);
+
+ public void error(Throwable error);
+
+ public int getErrorCount();
+}
Property changes on:
root/cdk/trunk/plugins/commons/src/main/java/org/richfaces/cdk/Logger.java
___________________________________________________________________
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Copied: root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/As.java (from rev
16811, root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/As.java)
===================================================================
--- root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/As.java
(rev 0)
+++ root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/As.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -0,0 +1,42 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD })
+public @interface As {
+ public Class<?> value();
+}
Property changes on:
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/As.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Copied: root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/AsProvider.java
(from rev 16811,
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/AsProvider.java)
===================================================================
--- root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/AsProvider.java
(rev 0)
+++
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/AsProvider.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -0,0 +1,44 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import com.google.inject.Provider;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD })
+public @interface AsProvider {
+ public Class<? extends Provider<?>> value();
+}
Property changes on:
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/AsProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Copied: root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/CdkTestRunner.java
(from rev 16811,
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestRunner.java)
===================================================================
--- root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/CdkTestRunner.java
(rev 0)
+++
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/CdkTestRunner.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -0,0 +1,242 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.easymock.EasyMock;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.BindingAnnotation;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+import com.google.inject.Provider;
+import com.google.inject.TypeLiteral;
+import com.google.inject.binder.AnnotatedBindingBuilder;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class CdkTestRunner extends BlockJUnit4ClassRunner {
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param klass
+ * @throws InitializationError
+ * @throws InitializationError
+ */
+ public CdkTestRunner(Class<?> klass) throws InitializationError {
+ super(klass);
+ }
+
+ /**
+ * Gets all declared fields and all inherited fields.
+ */
+ protected Set<Field> getFields(Class<?> c) {
+ Set<Field> fields = new
HashSet<Field>(Arrays.asList(c.getDeclaredFields()));
+ while ((c = c.getSuperclass()) != null) {
+ for (Field f : c.getDeclaredFields()) {
+ if (!Modifier.isStatic(f.getModifiers()) &&
!Modifier.isPrivate(f.getModifiers())) {
+ fields.add(f);
+ }
+ }
+ }
+ return fields;
+ }
+
+ @Override
+ protected void runChild(FrameworkMethod method, RunNotifier notifier) {
+ super.runChild(method, notifier);
+ }
+
+ @Override
+ protected Object createTest() throws Exception {
+ Class<?> c = getTestClass().getJavaClass();
+ Set<Field> testFields = getFields(c);
+
+ // make sure we have one (and only one) @Unit field
+ // Field unitField = getUnitField(testFields);
+ // if ( unitField.getAnnotation(Mock.class) != null ) {
+ // throw new IncompatibleAnnotationException(Unit.class, Mock.class);
+ // }
+ //
+ final Map<Field, Binding> fieldValues = getMockValues(testFields);
+ // if ( fieldValues.containsKey(unitField)) {
+ // throw new IncompatibleAnnotationException(Unit.class, unitField.getType());
+ // }
+
+ Object test = createTest(c, fieldValues);
+
+ // any field values created by AtUnit but not injected by the container are
injected here.
+ for (Field field : fieldValues.keySet()) {
+ Binding binding = fieldValues.get(field);
+ field.setAccessible(true);
+ if (null != binding.value && field.get(test) == null) {
+ field.set(test, binding.value);
+ }
+ }
+
+ return test;
+ }
+
+ private Object createTest(Class<?> testClass, Map<Field, Binding>
fieldValues) throws Exception {
+ FieldModule fields = new FieldModule(fieldValues);
+
+ Injector injector;
+ if (Module.class.isAssignableFrom(testClass)) {
+ injector = Guice.createInjector(fields, (Module) testClass.newInstance());
+ } else {
+ injector = Guice.createInjector(fields);
+ }
+ return injector.getInstance(testClass);
+ }
+
+ protected static final class FieldModule extends AbstractModule implements
MockController {
+ final Map<Field, Binding> fields;
+
+ public FieldModule(Map<Field, Binding> fields) {
+ this.fields = fields;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void configure() {
+ // Bind mock controllet to this instance, to automatically replay/verify all
mocks created by runner.
+ bind(MockController.class).toInstance(this);
+ // map field values by type
+ for (Field field : fields.keySet()) {
+ TypeLiteral literal = TypeLiteral.get(field.getGenericType());
+ AnnotatedBindingBuilder builder = bind(literal);
+ // Check field annotations.
+ Annotation[] fieldAnnotations = field.getAnnotations();
+ for (Annotation annotation : fieldAnnotations) {
+ Class<? extends Annotation> annotationType =
annotation.annotationType();
+ if (/* annotationType.isAnnotationPresent(Qualifier.class)||
*/annotationType
+ .isAnnotationPresent(BindingAnnotation.class)) {
+ Implementation implementation =
annotationType.getAnnotation(Implementation.class);
+ if (null != implementation) {
+ try {
+ Annotation value =
+
implementation.value().getConstructor(annotationType).newInstance(annotation);
+ builder.annotatedWith(value);
+ } catch (SecurityException e) {
+ throw new RuntimeException(e);
+ } catch (NoSuchMethodException e) {
+ builder.annotatedWith(annotationType);
+ } catch (IllegalArgumentException e) {
+ throw new RuntimeException(e);
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ } else {
+ builder.annotatedWith(annotationType);
+ }
+ }
+ }
+ Binding binding = fields.get(field);
+ if (null != binding.value) {
+ builder.toInstance(binding.value);
+ } else if (null != binding.implementation) {
+ builder.to(binding.implementation);
+ } else if (null != binding.provider) {
+ builder.toProvider(binding.provider);
+ }
+ }
+ }
+
+ @Override
+ public void replay() {
+ for (Binding field : fields.values()) {
+ if(null != field.value){
+ EasyMock.replay(field.value);
+ }
+ }
+ }
+
+ @Override
+ public void verify() {
+ for (Binding field : fields.values()) {
+ if(null != field.value){
+ EasyMock.verify(field.value);
+ }
+ }
+ }
+ }
+
+ protected static final class Binding {
+ private Object value;
+ private Class<?> implementation;
+ private Class<? extends Provider<?>> provider;
+ }
+
+ private Map<Field, Binding> getMockValues(Set<Field> testFields) {
+ Map<Field, Binding> mocksAndStubs = new HashMap<Field, Binding>();
+ // TODO - create annotation attribute that tells runner to use the scme Mock
Controller to create related mocks.
+ for (Field field : testFields) {
+ if (field.getAnnotation(Mock.class) != null) {
+ Binding bind = new Binding();
+ bind.value = EasyMock.createStrictMock(field.getType());
+ mocksAndStubs.put(field, bind);
+ } else if (field.getAnnotation(Stub.class) != null) {
+ Binding bind = new Binding();
+ bind.value = EasyMock.createNiceMock(field.getType());
+ mocksAndStubs.put(field, bind);
+ } else if (null != field.getAnnotation(As.class)) {
+ Binding bind = new Binding();
+ bind.implementation = field.getAnnotation(As.class).value();
+ mocksAndStubs.put(field, bind);
+ } else if (null != field.getAnnotation(AsProvider.class)) {
+ Binding bind = new Binding();
+ bind.provider = field.getAnnotation(AsProvider.class).value();
+ mocksAndStubs.put(field, bind);
+ }
+ }
+
+ return mocksAndStubs;
+ }
+
+}
Property changes on:
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/CdkTestRunner.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Copied: root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/Mock.java (from rev
16811, root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Mock.java)
===================================================================
--- root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/Mock.java
(rev 0)
+++ root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/Mock.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -0,0 +1,42 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD })
+public @interface Mock {
+
+}
Property changes on:
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/Mock.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Copied: root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/MockController.java
(from rev 16811,
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/MockController.java)
===================================================================
--- root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/MockController.java
(rev 0)
+++
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/MockController.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -0,0 +1,43 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk;
+
+/**
+ * <p class="changed_added_4_0">Instance of an Object implemented this
interface can be injected into test class to simplify mock objects
manipulations.</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface MockController {
+
+ /**
+ * <p class="changed_added_4_0">Repaly all mock objects created by
the {@link CdkTestRunner}</p>
+ */
+ public void replay();
+
+ /**
+ * <p class="changed_added_4_0">Verify all mock objects created by
the {@link CdkTestRunner}</p>
+ */
+ public void verify();
+
+}
Property changes on:
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/MockController.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/Stub.java (from rev
16811, root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Stub.java)
===================================================================
--- root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/Stub.java
(rev 0)
+++ root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/Stub.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -0,0 +1,42 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD })
+public @interface Stub {
+
+}
Property changes on:
root/cdk/trunk/plugins/commons/src/test/java/org/richfaces/cdk/Stub.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Modified: root/cdk/trunk/plugins/generator/pom.xml
===================================================================
--- root/cdk/trunk/plugins/generator/pom.xml 2010-04-26 16:45:15 UTC (rev 16811)
+++ root/cdk/trunk/plugins/generator/pom.xml 2010-04-26 20:43:19 UTC (rev 16812)
@@ -1,203 +1,212 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.richfaces.cdk</groupId>
- <artifactId>maven-plugins</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.cdk</groupId>
- <artifactId>generator</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <name>Java Server Faces component generator</name>
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-plugins</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>generator</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>Java Server Faces component generator</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.camel</groupId>
- <artifactId>guice-maven-plugin</artifactId>
- <!--<configuration>-->
-
<!--<mainClass>mypackage.boot.camel.CamelStartup</mainClass>-->
- <!--</configuration>-->
- </plugin>
- <plugin>
- <groupId>org.codehaus.groovy.maven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-resources</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <properties>
-
<sourceSchema>src/main/resources/META-INF/schema/xhtml-el.xsd</sourceSchema>
-
<
targetNamespace>http://richfaces.org/cdk/xhtml-el</targetNamespace>
-
<outputFile>generated-resources/META-INF/cdk/attributes/xhtml-el.xml</outputFile>
- </properties>
- <classpath>
- <element>
- <groupId>com.sun.xsom</groupId>
- <artifactId>xsom</artifactId>
- </element>
- <element>
-
<groupId>com.google.collections</groupId>
-
<artifactId>google-collections</artifactId>
- </element>
- </classpath>
-
<source>${project.basedir}/src/main/script/SchemaAttributesParserTask.groovy</source>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <useManifestOnlyJar>false</useManifestOnlyJar>
- <useSystemClassLoader>true</useSystemClassLoader>
- </configuration>
- </plugin>
- <!--
- plugin> <groupId>org.codehaus.mojo</groupId>
- <artifactId>jaxb2-maven-plugin</artifactId>
<executions> <execution>
- <goals> <goal>xjc</goal> </goals>
</execution> </executions>
- <configuration>
<packageName>org.richfaces.cdk.model</packageName>
- </configuration> </plugin
- -->
- </plugins>
- <resources>
- <resource>
- <directory>
- src/main/resources
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>guice-maven-plugin</artifactId>
+ <!--<configuration>-->
+ <!--<mainClass>mypackage.boot.camel.CamelStartup</mainClass>-->
+ <!--</configuration>-->
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <properties>
+ <sourceSchema>src/main/resources/META-INF/schema/xhtml-el.xsd</sourceSchema>
+ <
targetNamespace>http://richfaces.org/cdk/xhtml-el</targetNamespace>
+ <outputFile>generated-resources/META-INF/cdk/attributes/xhtml-el.xml</outputFile>
+ </properties>
+ <classpath>
+ <element>
+ <groupId>com.sun.xsom</groupId>
+ <artifactId>xsom</artifactId>
+ </element>
+ <element>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
+ </element>
+ </classpath>
+ <source>${project.basedir}/src/main/script/SchemaAttributesParserTask.groovy</source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <useManifestOnlyJar>false</useManifestOnlyJar>
+ <useSystemClassLoader>true</useSystemClassLoader>
+ </configuration>
+ </plugin>
+ <!--
+ plugin> <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxb2-maven-plugin</artifactId> <executions>
<execution>
+ <goals> <goal>xjc</goal> </goals> </execution>
</executions>
+ <configuration> <packageName>org.richfaces.cdk.model</packageName>
+ </configuration> </plugin
+ -->
+ </plugins>
+ <resources>
+ <resource>
+ <directory>
+ src/main/resources
</directory>
- </resource>
- <resource>
- <directory>
- ${project.build.directory}/generated-resources
+ </resource>
+ <resource>
+ <directory>
+ ${project.build.directory}/generated-resources
</directory>
- </resource>
- </resources>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-guice</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
- </dependency>
+ </resource>
+ </resources>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.freemarker</groupId>
+ <artifactId>freemarker</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>commons</artifactId>
+ </dependency>
<dependency>
- <groupId>org.freemarker</groupId>
- <artifactId>freemarker</artifactId>
- </dependency>
- <dependency>
<groupId>org.richfaces.cdk</groupId>
- <artifactId>annotations</artifactId>
+ <artifactId>commons</artifactId>
+ <classifier>tests</classifier>
+ <scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.richfaces.cdk</groupId>
- <artifactId>attributes</artifactId>
- </dependency>
- <dependency>
- <groupId>org.richfaces.cdk</groupId>
- <artifactId>xinclude</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.el</groupId>
- <artifactId>jboss-el</artifactId>
- </dependency>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </dependency>
- <!--
- <dependency> <groupId>com.google.collections</groupId>
- <artifactId>google-collections</artifactId>
- <version>1.0-rc2</version> </dependency>
<dependency>
- <groupId>org.w3c.css</groupId>
<artifactId>sac</artifactId>
- <version>1.3</version> </dependency>
- -->
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.collections</groupId>
- <artifactId>google-collections</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.xsom</groupId>
- <artifactId>xsom</artifactId>
- </dependency>
- <dependency>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-core</artifactId>
- </dependency>
-<!-- <dependency>
- <groupId>com.google.code.guice</groupId>
- <artifactId>guice</artifactId>
- <version>1.0</version>
- </dependency>-->
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>attributes</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>xinclude</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.el</groupId>
+ <artifactId>jboss-el</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </dependency>
+ <!--
+ <dependency> <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
+ <version>1.0-rc2</version> </dependency> <dependency>
+ <groupId>org.w3c.css</groupId> <artifactId>sac</artifactId>
+ <version>1.3</version> </dependency>
+ -->
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xsom</groupId>
+ <artifactId>xsom</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ </dependency>
+ <!--
+ <dependency> <groupId>com.google.code.guice</groupId>
+ <artifactId>guice</artifactId> <version>1.0</version>
</dependency>
+ -->
-<!-- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- <version>1</version>
- </dependency>-->
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- </dependency>
-<!-- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-grapher</artifactId>
- </dependency>-->
- <!-- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-assisted-inject</artifactId>
- </dependency>-->
- </dependencies>
+ <!--
+ <dependency> <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId> <version>1</version>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ </dependency>
+ <!--
+ <dependency> <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-grapher</artifactId> </dependency>
+ -->
+ <!--
+ <dependency> <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-assisted-inject</artifactId> </dependency>
+ -->
+ </dependencies>
</project>
\ No newline at end of file
Deleted:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Implementation.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Implementation.java 2010-04-26
16:45:15 UTC (rev 16811)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Implementation.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -1,44 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk;
-
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
-
-import java.lang.annotation.Annotation;
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-@Target(ANNOTATION_TYPE)
-@Retention(RUNTIME)
-@Documented
-public @interface Implementation {
- public Class<? extends Annotation> value();
-}
Deleted: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/JavaLogger.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/JavaLogger.java 2010-04-26
16:45:15 UTC (rev 16811)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/JavaLogger.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -1,192 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk;
-
-import java.util.logging.Level;
-
-/**
- * <p class="changed_added_4_0">That logger delegates all calls to the
JDK {@link java.util.logging.Logger}</p>
- *
- * @author asmirnov(a)exadel.com
- */
-public class JavaLogger implements Logger {
-
- public static final String CDK_LOG = "org.richfaces.cdk";
-
- private int errorCount = 0;
-
- private java.util.logging.Logger jdkLogger =
java.util.logging.Logger.getLogger(CDK_LOG);
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#debug(java.lang.CharSequence)
- */
- @Override
- public void debug(CharSequence content) {
- jdkLogger.fine(String.valueOf(content));
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#debug(java.lang.CharSequence, java.lang.Throwable)
- */
- @Override
- public void debug(CharSequence content, Throwable error) {
- jdkLogger.log(Level.FINE, String.valueOf(content), error);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#debug(java.lang.Throwable)
- */
- @Override
- public void debug(Throwable error) {
- jdkLogger.log(Level.FINE, "", error);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#error(java.lang.CharSequence)
- */
- @Override
- public void error(CharSequence content) {
- errorCount++;
- jdkLogger.severe(String.valueOf(content));
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#error(java.lang.CharSequence, java.lang.Throwable)
- */
- @Override
- public void error(CharSequence content, Throwable error) {
- errorCount++;
- jdkLogger.log(Level.SEVERE, String.valueOf(content), error);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#error(java.lang.Throwable)
- */
- @Override
- public void error(Throwable error) {
- errorCount++;
- jdkLogger.log(Level.SEVERE, "", error);
- }
-
- @Override
- public int getErrorCount() {
- return errorCount;
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#info(java.lang.CharSequence)
- */
- @Override
- public void info(CharSequence content) {
- jdkLogger.info(String.valueOf(content));
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#info(java.lang.CharSequence, java.lang.Throwable)
- */
- @Override
- public void info(CharSequence content, Throwable error) {
- jdkLogger.log(Level.INFO, String.valueOf(content), error);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#info(java.lang.Throwable)
- */
- @Override
- public void info(Throwable error) {
- jdkLogger.log(Level.INFO, "", error);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#isDebugEnabled()
- */
- @Override
- public boolean isDebugEnabled() {
- return jdkLogger.isLoggable(Level.FINE);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#isErrorEnabled()
- */
- @Override
- public boolean isErrorEnabled() {
- return jdkLogger.isLoggable(Level.SEVERE);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#isInfoEnabled()
- */
- @Override
- public boolean isInfoEnabled() {
- return jdkLogger.isLoggable(Level.INFO);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#isWarnEnabled()
- */
- @Override
- public boolean isWarnEnabled() {
- return jdkLogger.isLoggable(Level.WARNING);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#warn(java.lang.CharSequence)
- */
- @Override
- public void warn(CharSequence content) {
- jdkLogger.warning(String.valueOf(content));
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#warn(java.lang.CharSequence, java.lang.Throwable)
- */
- @Override
- public void warn(CharSequence content, Throwable error) {
- jdkLogger.log(Level.WARNING, String.valueOf(content), error);
- }
-
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.Logger#warn(java.lang.Throwable)
- */
- @Override
- public void warn(Throwable error) {
- jdkLogger.log(Level.WARNING, "", error);
- }
-}
Deleted: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java 2010-04-26
16:45:15 UTC (rev 16811)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -1,68 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk;
-
-import com.google.inject.ImplementedBy;
-
-/**
- * That interface hides current logging system from generator classes.
- * Concrete tools ( Maven, Ant, JUnit ) should provide appropriate logger instance that
delegates
- * messages to the current log system.
- *
- * @author shura
- */
-(a)ImplementedBy(JavaLogger.class)
-public interface Logger {
- public boolean isDebugEnabled();
-
- public void debug(CharSequence content);
-
- public void debug(CharSequence content, Throwable error);
-
- public void debug(Throwable error);
-
- public boolean isInfoEnabled();
-
- public void info(CharSequence content);
-
- public void info(CharSequence content, Throwable error);
-
- public void info(Throwable error);
-
- public boolean isWarnEnabled();
-
- public void warn(CharSequence content);
-
- public void warn(CharSequence content, Throwable error);
-
- public void warn(Throwable error);
-
- public boolean isErrorEnabled();
-
- public void error(CharSequence content);
-
- public void error(CharSequence content, Throwable error);
-
- public void error(Throwable error);
-
- public int getErrorCount();
-}
Deleted: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/As.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/As.java 2010-04-26
16:45:15 UTC (rev 16811)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/As.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -1,42 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-(a)Retention(RetentionPolicy.RUNTIME)
-@Target( { ElementType.FIELD })
-public @interface As {
- public Class<?> value();
-}
Deleted: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/AsProvider.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/AsProvider.java 2010-04-26
16:45:15 UTC (rev 16811)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/AsProvider.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -1,44 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import com.google.inject.Provider;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-(a)Retention(RetentionPolicy.RUNTIME)
-@Target( { ElementType.FIELD })
-public @interface AsProvider {
- public Class<? extends Provider<?>> value();
-}
Deleted:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestRunner.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestRunner.java 2010-04-26
16:45:15 UTC (rev 16811)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestRunner.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -1,241 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Modifier;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.easymock.EasyMock;
-import org.junit.runner.notification.RunNotifier;
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-
-import com.google.common.collect.Sets;
-import com.google.inject.AbstractModule;
-import com.google.inject.BindingAnnotation;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-import com.google.inject.Provider;
-import com.google.inject.TypeLiteral;
-import com.google.inject.binder.AnnotatedBindingBuilder;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-public class CdkTestRunner extends BlockJUnit4ClassRunner {
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param klass
- * @throws InitializationError
- * @throws InitializationError
- */
- public CdkTestRunner(Class<?> klass) throws InitializationError {
- super(klass);
- }
-
- /**
- * Gets all declared fields and all inherited fields.
- */
- protected Set<Field> getFields(Class<?> c) {
- Set<Field> fields = Sets.newHashSet(c.getDeclaredFields());
- while ((c = c.getSuperclass()) != null) {
- for (Field f : c.getDeclaredFields()) {
- if (!Modifier.isStatic(f.getModifiers()) &&
!Modifier.isPrivate(f.getModifiers())) {
- fields.add(f);
- }
- }
- }
- return fields;
- }
-
- @Override
- protected void runChild(FrameworkMethod method, RunNotifier notifier) {
- super.runChild(method, notifier);
- }
-
- @Override
- protected Object createTest() throws Exception {
- Class<?> c = getTestClass().getJavaClass();
- Set<Field> testFields = getFields(c);
-
- // make sure we have one (and only one) @Unit field
- // Field unitField = getUnitField(testFields);
- // if ( unitField.getAnnotation(Mock.class) != null ) {
- // throw new IncompatibleAnnotationException(Unit.class, Mock.class);
- // }
- //
- final Map<Field, Binding> fieldValues = getMockValues(testFields);
- // if ( fieldValues.containsKey(unitField)) {
- // throw new IncompatibleAnnotationException(Unit.class, unitField.getType());
- // }
-
- Object test = createTest(c, fieldValues);
-
- // any field values created by AtUnit but not injected by the container are
injected here.
- for (Field field : fieldValues.keySet()) {
- Binding binding = fieldValues.get(field);
- field.setAccessible(true);
- if (null != binding.value && field.get(test) == null) {
- field.set(test, binding.value);
- }
- }
-
- return test;
- }
-
- private Object createTest(Class<?> testClass, Map<Field, Binding>
fieldValues) throws Exception {
- FieldModule fields = new FieldModule(fieldValues);
-
- Injector injector;
- if (Module.class.isAssignableFrom(testClass)) {
- injector = Guice.createInjector(fields, (Module) testClass.newInstance());
- } else {
- injector = Guice.createInjector(fields);
- }
- return injector.getInstance(testClass);
- }
-
- protected static final class FieldModule extends AbstractModule implements
MockController {
- final Map<Field, Binding> fields;
-
- public FieldModule(Map<Field, Binding> fields) {
- this.fields = fields;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected void configure() {
- // Bind mock controllet to this instance, to automatically replay/verify all
mocks created by runner.
- bind(MockController.class).toInstance(this);
- // map field values by type
- for (Field field : fields.keySet()) {
- TypeLiteral literal = TypeLiteral.get(field.getGenericType());
- AnnotatedBindingBuilder builder = bind(literal);
- // Check field annotations.
- Annotation[] fieldAnnotations = field.getAnnotations();
- for (Annotation annotation : fieldAnnotations) {
- Class<? extends Annotation> annotationType =
annotation.annotationType();
- if (/* annotationType.isAnnotationPresent(Qualifier.class)||
*/annotationType
- .isAnnotationPresent(BindingAnnotation.class)) {
- Implementation implementation =
annotationType.getAnnotation(Implementation.class);
- if (null != implementation) {
- try {
- Annotation value =
-
implementation.value().getConstructor(annotationType).newInstance(annotation);
- builder.annotatedWith(value);
- } catch (SecurityException e) {
- throw new RuntimeException(e);
- } catch (NoSuchMethodException e) {
- builder.annotatedWith(annotationType);
- } catch (IllegalArgumentException e) {
- throw new RuntimeException(e);
- } catch (InstantiationException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- } else {
- builder.annotatedWith(annotationType);
- }
- }
- }
- Binding binding = fields.get(field);
- if (null != binding.value) {
- builder.toInstance(binding.value);
- } else if (null != binding.implementation) {
- builder.to(binding.implementation);
- } else if (null != binding.provider) {
- builder.toProvider(binding.provider);
- }
- }
- }
-
- @Override
- public void replay() {
- for (Binding field : fields.values()) {
- if(null != field.value){
- EasyMock.replay(field.value);
- }
- }
- }
-
- @Override
- public void verify() {
- for (Binding field : fields.values()) {
- if(null != field.value){
- EasyMock.verify(field.value);
- }
- }
- }
- }
-
- protected static final class Binding {
- private Object value;
- private Class<?> implementation;
- private Class<? extends Provider<?>> provider;
- }
-
- private Map<Field, Binding> getMockValues(Set<Field> testFields) {
- Map<Field, Binding> mocksAndStubs = new HashMap<Field, Binding>();
- // TODO - create annotation attribute that tells runner to use the scme Mock
Controller to create related mocks.
- for (Field field : testFields) {
- if (field.getAnnotation(Mock.class) != null) {
- Binding bind = new Binding();
- bind.value = EasyMock.createStrictMock(field.getType());
- mocksAndStubs.put(field, bind);
- } else if (field.getAnnotation(Stub.class) != null) {
- Binding bind = new Binding();
- bind.value = EasyMock.createNiceMock(field.getType());
- mocksAndStubs.put(field, bind);
- } else if (null != field.getAnnotation(As.class)) {
- Binding bind = new Binding();
- bind.implementation = field.getAnnotation(As.class).value();
- mocksAndStubs.put(field, bind);
- } else if (null != field.getAnnotation(AsProvider.class)) {
- Binding bind = new Binding();
- bind.provider = field.getAnnotation(AsProvider.class).value();
- mocksAndStubs.put(field, bind);
- }
- }
-
- return mocksAndStubs;
- }
-
-}
Deleted: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Mock.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Mock.java 2010-04-26
16:45:15 UTC (rev 16811)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Mock.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -1,42 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-(a)Retention(RetentionPolicy.RUNTIME)
-@Target( { ElementType.FIELD })
-public @interface Mock {
-
-}
Deleted:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/MockController.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/MockController.java 2010-04-26
16:45:15 UTC (rev 16811)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/MockController.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -1,43 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk;
-
-/**
- * <p class="changed_added_4_0">Instance of an Object implemented this
interface can be injected into test class to simplify mock objects
manipulations.</p>
- * @author asmirnov(a)exadel.com
- *
- */
-public interface MockController {
-
- /**
- * <p class="changed_added_4_0">Repaly all mock objects created by
the {@link CdkTestRunner}</p>
- */
- public void replay();
-
- /**
- * <p class="changed_added_4_0">Verify all mock objects created by
the {@link CdkTestRunner}</p>
- */
- public void verify();
-
-}
Deleted: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/RunnerTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/RunnerTest.java 2010-04-26
16:45:15 UTC (rev 16811)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/RunnerTest.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -1,35 +0,0 @@
-package org.richfaces.cdk;
-
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-(a)RunWith(CdkTestRunner.class)
-public class RunnerTest {
-
- @Mock
- private Logger log;
-
- @Stub
- @Source(Sources.JAVA_SOURCES)
- FileManager sources;
-
- @Test
- public void easyMockInjections() throws Exception {
- assertNotNull(log);
- assertNotNull(sources);
- replay(log, sources);
- verify(log, sources);
- }
-
- @Test
- public void easyMockInjections2() throws Exception {
- assertNotNull(log);
- assertNotNull(sources);
- replay(log, sources);
- verify(log, sources);
- }
-
-}
Deleted: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Stub.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Stub.java 2010-04-26
16:45:15 UTC (rev 16811)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/Stub.java 2010-04-26
20:43:19 UTC (rev 16812)
@@ -1,42 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-(a)Retention(RetentionPolicy.RUNTIME)
-@Target( { ElementType.FIELD })
-public @interface Stub {
-
-}
Property changes on: root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component
___________________________________________________________________
Name: svn:ignore
+ target
.settings
.project
.classpath
.clover
bin
Property changes on:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/xml-configured-component
___________________________________________________________________
Name: svn:ignore
+ target
.settings
.project
.classpath
.clover
bin
Modified: root/cdk/trunk/plugins/pom.xml
===================================================================
--- root/cdk/trunk/plugins/pom.xml 2010-04-26 16:45:15 UTC (rev 16811)
+++ root/cdk/trunk/plugins/pom.xml 2010-04-26 20:43:19 UTC (rev 16812)
@@ -28,6 +28,7 @@
</build>
<modules>
+ <module>commons</module>
<module>annotations</module>
<module>attributes</module>
<module>xinclude</module>