Author: alexsmirnov
Date: 2009-08-06 22:01:19 -0400 (Thu, 06 Aug 2009)
New Revision: 15126
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/InvalidNameException.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Name.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/NamingConventions.java
root/cdk/trunk/plugins/generator/src/main/javadoc/org/
root/cdk/trunk/plugins/generator/src/main/javadoc/org/richfaces/
root/cdk/trunk/plugins/generator/src/main/javadoc/org/richfaces/cdk/
root/cdk/trunk/plugins/generator/src/main/javadoc/org/richfaces/cdk/generatedClasses.dia
root/cdk/trunk/plugins/generator/src/main/javadoc/org/richfaces/cdk/generatedClasses.png
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/NameTest.java
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkContext.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/LibraryBuilder.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassDescription.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ProcessorTest.java
root/cdk/trunk/plugins/maven-javascript-plugin/pom.xml
Log:
naming conventions utils
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkContext.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkContext.java 2009-08-06
17:26:35 UTC (rev 15125)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/CdkContext.java 2009-08-07
02:01:19 UTC (rev 15126)
@@ -2,27 +2,62 @@
import java.io.File;
-import org.richfaces.cdk.model.ComponentLibrary;
/**
- * <p class="changed_added_4_0">That interface defines context for all
CDK operations</p>
+ * <p class="changed_added_4_0">
+ * That interface defines context for all CDK operations
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
public interface CdkContext {
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * Tools classloader.
+ * </p>
+ *
* @return the loader
*/
public ClassLoader getLoader();
+ /**
+ * <p class="changed_added_4_0">
+ * Output folder for generated resources.
+ * </p>
+ *
+ * @return
+ */
public abstract File getResourceOutput();
+ /**
+ * <p class="changed_added_4_0">
+ * Output folder for generated Java sources.
+ * </p>
+ *
+ * @return
+ */
public abstract File getJavaSourceOutput();
+ /**
+ * <p class="changed_added_4_0">
+ * Java source folder.
+ * </p>
+ *
+ * @return
+ */
public abstract File getJavaSource();
-
+
+ /**
+ * <p class="changed_added_4_0">
+ * Base name for generated JSF library, as described in the CDK <a href=
+ * "http://www.jboss.org/community/wiki/RichFacesCDKnamingconventions"
+ * >naming conventions</a>
+ * </p>
+ *
+ * @return
+ */
public String getBaseName();
}
\ No newline at end of file
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/LibraryBuilder.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/LibraryBuilder.java 2009-08-06
17:26:35 UTC (rev 15125)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/LibraryBuilder.java 2009-08-07
02:01:19 UTC (rev 15126)
@@ -31,11 +31,11 @@
import org.richfaces.cdk.model.ComponentLibrary;
/**
- * <p class="changed_added_4_0">That class builds JSF library model from
different sources</p>
+ * <p class="changed_added_4_0">That class builds JSF library model from
different sources. It acts as "controller" for whole CDK generation
process.</p>
* @author asmirnov(a)exadel.com
*
*/
-public class LibraryBuilder {
+public final class LibraryBuilder {
/**
* <p class="changed_added_4_0">Current CDK context</p>
@@ -46,7 +46,7 @@
* <p class="changed_added_4_0"></p>
* @param context
*/
- public LibraryBuilder(CdkContext context) {
+ LibraryBuilder(CdkContext context) {
this.context = context;
}
@@ -60,8 +60,8 @@
/**
* <p class="changed_added_4_0">Parse source files for annotations and
populate CDK-related information into model.</p>
- * @param context
- * @param sources
+ * @param sources Java Source files.
+ * @return generated library model.
* @throws CdkException
*/
public ComponentLibrary buildModelFromAnnotations(Iterable<File> sources) throws
CdkException {
@@ -77,8 +77,9 @@
* @param templates
* @throws CdkException
*/
- public void compileRendererTemplates(Iterable<File> templates) throws CdkException
{
-
+ public ComponentLibrary compileRendererTemplates(Iterable<File> templates) throws
CdkException {
+ ComponentLibrary library = createLibrary();
+ return library;
}
/**
* <p class="changed_added_4_0">Append configuration from
faces-config.xml to existing library.</p>
@@ -89,8 +90,9 @@
public void applyFacesConfigToModel(Iterable<File> configs) throws CdkException {
}
- public void buildModelFromFacesConfig(Iterable<File> configs) throws CdkException
{
- // Read faces-config.xml and build a new model.
+ public ComponentLibrary buildModelFromFacesConfig(Iterable<File> configs) throws
CdkException {
+ ComponentLibrary library = createLibrary();
+ return library;
}
@@ -103,7 +105,7 @@
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">Getter for the current CDK
context</p>
* @return the context
*/
protected CdkContext getContext() {
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassDescription.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassDescription.java 2009-08-06
17:26:35 UTC (rev 15125)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassDescription.java 2009-08-07
02:01:19 UTC (rev 15126)
@@ -34,6 +34,10 @@
private boolean exists;
+ private boolean primitive;
+
+ private String boxingClassName;
+
private ClassDescription superClass;
/**
@@ -83,6 +87,38 @@
public String getName() {
return name;
}
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the primitive
+ */
+ public boolean isPrimitive() {
+ return primitive;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param primitive the primitive to set
+ */
+ public void setPrimitive(boolean primitive) {
+ this.primitive = primitive;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the boxingClassName
+ */
+ public String getBoxingClassName() {
+ return primitive?boxingClassName:name;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param boxingClassName the boxingClassName to set
+ */
+ public void setBoxingClassName(String boxingClassName) {
+ this.boxingClassName = boxingClassName;
+ }
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2009-08-06
17:26:35 UTC (rev 15125)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2009-08-07
02:01:19 UTC (rev 15126)
@@ -40,6 +40,25 @@
public class ComponentLibrary {
+ final class RichFacesConventions implements NamingConventions {
+ @Override
+ public String getComponentType(String className) throws InvalidNameException {
+ // check parameters.
+ if(null == className || className.length()==0){
+ throw new IllegalArgumentException();
+ }
+ Name.create(className);
+ //
+ return null;
+ }
+
+ @Override
+ public String getComponentClass(String componentType) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ }
/**
* <p class="changed_added_4_0">JSF components in that
library</p>
*/
@@ -69,6 +88,8 @@
* <p class="changed_added_4_0"></p>
*/
private final String baseName;
+
+ private NamingConventions namingConventions = new RichFacesConventions();
@@ -159,6 +180,17 @@
public TagLibrary getTagLibrary() {
return tagLibrary;
}
+
+ public NamingConventions getNamingUtils(){
+ return namingConventions;
+ }
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the baseName
+ */
+ protected String getBaseName() {
+ return baseName;
+ }
}
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/InvalidNameException.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/InvalidNameException.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/InvalidNameException.java 2009-08-07
02:01:19 UTC (rev 15126)
@@ -0,0 +1,70 @@
+/*
+ * $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.model;
+
+import org.richfaces.cdk.CdkException;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class InvalidNameException extends CdkException {
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ */
+ public InvalidNameException() {
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param message
+ */
+ public InvalidNameException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param cause
+ */
+ public InvalidNameException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param message
+ * @param cause
+ */
+ public InvalidNameException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Name.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Name.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Name.java 2009-08-07
02:01:19 UTC (rev 15126)
@@ -0,0 +1,177 @@
+/*
+ * $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.model;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * <p class="changed_added_4_0">Represents parts of component
type/family/classname according to CDK naming conventions.</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class Name {
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+ public enum Classifier {
+ component,
+ renderkit,
+ event,
+ taglib;
+ }
+
+ private static final Pattern namePattern = Pattern.compile("^(?:(.+)\\.)?(?:("
+ Classifier.component
+ + "|" + Classifier.renderkit + "|" + Classifier.event +
"|" + Classifier.taglib + ")\\.)?([^\\.]+)$");
+
+ /**
+ * <p class="changed_added_4_0">represents library part prefix of
name.</p>
+ */
+ private String prefix;
+
+ /**
+ * <p class="changed_added_4_0">Element type classifier -
"component","event","renderkit","taglib"</p>
+ */
+ private Classifier classifier;
+
+ /**
+ * <p class="changed_added_4_0">Markup-specific part of name (
"html","xhtml","wml" ... )</p>
+ */
+ private String markup;
+
+ /**
+ * <p class="changed_added_4_0">Simple name ( last word after a period
).</p>
+ */
+ private String simpleName;
+
+ /**
+ * <p class="changed_added_4_0">Creates RichFaces name representation
from string.</p>
+ * @param name
+ * @return
+ * @throws InvalidNameException
+ */
+ public static Name create(String name) throws InvalidNameException {
+ Matcher matcher = namePattern.matcher(name);
+ if(matcher.matches()){
+ Name cdkName = new Name();
+ int groups = matcher.groupCount();
+ for(int i=0;i<=groups;i++){
+ System.out.println("Group "+i+": "+matcher.group(i));
+ }
+ cdkName.setSimpleName(matcher.group(groups));
+ if (groups > 2) {
+ cdkName.setPrefix(matcher.group(2));
+ }
+ if (groups > 4) {
+ String classifierGroup = matcher.group(3);
+ if (null != classifierGroup) {
+ cdkName.setClassifier(Classifier.valueOf(classifierGroup));
+
+ }
+ }
+ if (groups > 6) {
+ String markupGroup = matcher.group(5);
+ cdkName.setMarkup(markupGroup);
+ }
+ return cdkName;
+ } else {
+ throw new InvalidNameException("Name "+name+" does not match CDK naming
conventions");
+ }
+ }
+
+ public static Name create(String prefix,String name) throws InvalidNameException {
+ return new Name();
+ }
+
+ public static Name create(String prefix, Classifier classifier, String name) throws
InvalidNameException {
+ return new Name();
+ }
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the prefix
+ */
+ public String getPrefix() {
+ return prefix;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param prefix the prefix to set
+ */
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the classifier
+ */
+ public Classifier getClassifier() {
+ return classifier;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param classifier the classifier to set
+ */
+ public void setClassifier(Classifier classifier) {
+ this.classifier = classifier;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the markup
+ */
+ public String getMarkup() {
+ return markup;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param markup the markup to set
+ */
+ public void setMarkup(String markup) {
+ this.markup = markup;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the simpleName
+ */
+ public String getSimpleName() {
+ return simpleName;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param simpleName the simpleName to set
+ */
+ public void setSimpleName(String simpleName) {
+ this.simpleName = simpleName;
+ }
+
+}
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/NamingConventions.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/NamingConventions.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/NamingConventions.java 2009-08-07
02:01:19 UTC (rev 15126)
@@ -0,0 +1,61 @@
+/*
+ * $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.model;
+
+/**
+ * <p class="changed_added_4_0">
+ * That interface defines methods that calculates names according to <a
+ *
href="http://www.jboss.org/community/docs/DOC-13693">CDK naming
+ * conventions</>
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface NamingConventions {
+
+ /**
+ * <p class="changed_added_4_0">Calculates component type from the base
class name.</p>
+ * <ul>
+ *
<li><code><prefix>.component.Abstract<Name></code>
=> <code><prefix>.<Name></code>
</li>
+ *
<li><code><prefix>.component.<Name>Base</code>
=> <code><prefix>.<Name></code>
</li>
+ *
<li><code><prefix>.component.UI<Name></code>
=> <code><prefix>.<Name></code>
</li>
+ * </ul>
+ * @param className
+ * @return
+ * @throws InvalidNameException if className does not match naming conventions.
+ */
+ public String getComponentType(String className) throws InvalidNameException;
+
+ /**
+ * <p class="changed_added_4_0">Calculates component base class from
type.</p>
+ * <ul>
+ * <li><code><prefix>.<Name></code>
=> <code><prefix>.component.UI<Name></code>
</li>
+ * </ul>
+ * @param className
+ * @return
+ */
+ public String getComponentClass(String componentType);
+
+}
Added:
root/cdk/trunk/plugins/generator/src/main/javadoc/org/richfaces/cdk/generatedClasses.dia
===================================================================
(Binary files differ)
Property changes on:
root/cdk/trunk/plugins/generator/src/main/javadoc/org/richfaces/cdk/generatedClasses.dia
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
root/cdk/trunk/plugins/generator/src/main/javadoc/org/richfaces/cdk/generatedClasses.png
===================================================================
(Binary files differ)
Property changes on:
root/cdk/trunk/plugins/generator/src/main/javadoc/org/richfaces/cdk/generatedClasses.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ProcessorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ProcessorTest.java 2009-08-06
17:26:35 UTC (rev 15125)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ProcessorTest.java 2009-08-07
02:01:19 UTC (rev 15126)
@@ -56,6 +56,7 @@
import javax.lang.model.SourceVersion;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.Name;
@@ -133,35 +134,54 @@
// Get all classes annotated by "component"
Set<? extends Element> annotatedWith =
environment.getElementsAnnotatedWith(Component.class);
numOfComponents = annotatedWith.size();
- for (Element element : annotatedWith) {
- Component annotation = element.getAnnotation(Component.class);
+ for (Element element : annotatedWith) {
+ if (ElementKind.CLASS.equals(element.getKind())) {
+ TypeElement classElement = (TypeElement) element;
+ Component annotation = element
+ .getAnnotation(Component.class);
String type = annotation.type();
- //TODO - infer type for an empty one. Is thart method for library or for
environment ?
- if(isEmpty(type)){
-
+ // TODO - infer type for an empty one. Is thart method
+ // for library or for environment ?
+ if (isEmpty(type)) {
+ classElement.getQualifiedName().toString();
}
- org.richfaces.cdk.model.Component component = library.getComponent(type,true);
+ org.richfaces.cdk.model.Component component = library
+ .getComponent(type, true);
Elements elementUtils = processingEnv.getElementUtils();
Types typeUtils = processingEnv.getTypeUtils();
- component.setDescription(elementUtils.getDocComment(element));
- List<ExecutableElement> methodsIn =
ElementFilter.methodsIn(elementUtils.getAllMembers((TypeElement) element));
+ component.setDescription(elementUtils
+ .getDocComment(element));
+ List<ExecutableElement> methodsIn = ElementFilter
+ .methodsIn(elementUtils
+ .getAllMembers(classElement));
for (ExecutableElement method : methodsIn) {
- Attribute attribute = method.getAnnotation(Attribute.class);
- if(null != attribute){
+ Attribute attribute = method
+ .getAnnotation(Attribute.class);
+ if (null != attribute) {
TypeMirror returnType = method.getReturnType();
- String methodName = method.getSimpleName().toString();
- List<? extends VariableElement> parameters = method.getParameters();
+ String methodName = method.getSimpleName()
+ .toString();
+ List<? extends VariableElement> parameters = method
+ .getParameters();
Set<Modifier> modifiers = method.getModifiers();
- if(methodName.startsWith("get") && parameters.isEmpty()
&& modifiers.contains(Modifier.PUBLIC)){
+ if (methodName.startsWith("get")
+ && parameters.isEmpty()
+ && modifiers.contains(Modifier.PUBLIC)) {
// Bean getter method.
- String attributeName =
methodName.substring(3,4).toLowerCase()+methodName.substring(4);
- Property atribute = component.addAtribute(attributeName);
- atribute.setDescription(elementUtils.getDocComment(method));
+ String attributeName = methodName
+ .substring(3, 4).toLowerCase()
+ + methodName.substring(4);
+ Property atribute = component
+ .addAtribute(attributeName);
+ atribute.setDescription(elementUtils
+ .getDocComment(method));
}
}
+
}
}
}
+ }
return true;
}
Added:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/NameTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/NameTest.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/NameTest.java 2009-08-07
02:01:19 UTC (rev 15126)
@@ -0,0 +1,109 @@
+/*
+ * $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.model;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class NameTest {
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.cdk.model.Name#create(java.lang.String)}.
+ * @throws Exception
+ */
+ @Test
+ public void testCreateString() throws Exception {
+ Name name = Name.create("foo.bar.component.wml.WmlFoo");
+ assertEquals("foo.bar", name.getPrefix());
+ assertEquals(Name.Classifier.component, name.getClassifier());
+ assertEquals("wml", name.getMarkup());
+ assertEquals("WmlFoo", name.getSimpleName());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.cdk.model.Name#create(java.lang.String)}.
+ * @throws Exception
+ */
+ @Test
+ public void testCreateString1() throws Exception {
+ Name name = Name.create("foo.bar.wml.WmlFoo");
+ assertEquals("foo.bar.wml", name.getPrefix());
+ assertNull(name.getClassifier());
+ assertNull(name.getMarkup());
+ assertEquals("WmlFoo", name.getSimpleName());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.cdk.model.Name#create(java.lang.String)}.
+ * @throws Exception
+ */
+ @Test
+ public void testCreateString2() throws Exception {
+ Name name = Name.create("foo.bar.component.Foo");
+ assertEquals("foo.bar", name.getPrefix());
+ assertEquals(Name.Classifier.component, name.getClassifier());
+ assertNull( name.getMarkup());
+ assertEquals("Foo", name.getSimpleName());
+ }
+ /**
+ * Test method for {@link org.richfaces.cdk.model.Name#create(java.lang.String,
java.lang.String)}.
+ */
+ @Test
+ public void testCreateStringString() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link org.richfaces.cdk.model.Name#create(java.lang.String,
org.richfaces.cdk.model.Name.Classifier, java.lang.String)}.
+ */
+ @Test
+ public void testCreateStringClassifierString() {
+ fail("Not yet implemented");
+ }
+
+}
Modified: root/cdk/trunk/plugins/maven-javascript-plugin/pom.xml
===================================================================
--- root/cdk/trunk/plugins/maven-javascript-plugin/pom.xml 2009-08-06 17:26:35 UTC (rev
15125)
+++ root/cdk/trunk/plugins/maven-javascript-plugin/pom.xml 2009-08-07 02:01:19 UTC (rev
15126)
@@ -36,7 +36,16 @@
</dependency>
</dependencies>
<build>
- <plugins />
+ <plugins >
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
</build>
<reporting>
<plugins>