Author: alexsmirnov
Date: 2010-11-24 18:17:41 -0500 (Wed, 24 Nov 2010)
New Revision: 20164
Added:
branches/RF-8742-1/ui/common/api/build/
branches/RF-8742-1/ui/common/api/build/classes/
branches/RF-8742-1/ui/common/api/src/META-INF/
branches/RF-8742-1/ui/common/api/src/META-INF/MANIFEST.MF
branches/RF-8742-1/ui/common/ui/build/
branches/RF-8742-1/ui/common/ui/build/classes/
branches/RF-8742-1/ui/common/ui/src/META-INF/
branches/RF-8742-1/ui/common/ui/src/META-INF/MANIFEST.MF
branches/RF-8742-1/ui/validator/api/build/
branches/RF-8742-1/ui/validator/api/build/classes/
branches/RF-8742-1/ui/validator/api/src/META-INF/
branches/RF-8742-1/ui/validator/api/src/META-INF/MANIFEST.MF
branches/RF-8742-1/ui/validator/ui/build/
branches/RF-8742-1/ui/validator/ui/build/classes/
branches/RF-8742-1/ui/validator/ui/src/META-INF/
branches/RF-8742-1/ui/validator/ui/src/META-INF/MANIFEST.MF
Modified:
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/ClientScriptServiceImpl.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/ClientServiceConfigParser.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/LibraryFunctionImplementation.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/Bean.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/UIValidatorScriptCollectionTest.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/ClientScriptServiceTest.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/ServiceConfigParserTest.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java
Log:
CODING IN PROGRESS - issue RF-9799: CSV code review
https://jira.jboss.org/browse/RF-9799
Added: branches/RF-8742-1/ui/common/api/src/META-INF/MANIFEST.MF
===================================================================
--- branches/RF-8742-1/ui/common/api/src/META-INF/MANIFEST.MF (rev
0)
+++ branches/RF-8742-1/ui/common/api/src/META-INF/MANIFEST.MF 2010-11-24 23:17:41 UTC (rev
20164)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Property changes on: branches/RF-8742-1/ui/common/api/src/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/RF-8742-1/ui/common/ui/src/META-INF/MANIFEST.MF
===================================================================
--- branches/RF-8742-1/ui/common/ui/src/META-INF/MANIFEST.MF (rev
0)
+++ branches/RF-8742-1/ui/common/ui/src/META-INF/MANIFEST.MF 2010-11-24 23:17:41 UTC (rev
20164)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Property changes on: branches/RF-8742-1/ui/common/ui/src/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/RF-8742-1/ui/validator/api/src/META-INF/MANIFEST.MF
===================================================================
--- branches/RF-8742-1/ui/validator/api/src/META-INF/MANIFEST.MF
(rev 0)
+++ branches/RF-8742-1/ui/validator/api/src/META-INF/MANIFEST.MF 2010-11-24 23:17:41 UTC
(rev 20164)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Property changes on: branches/RF-8742-1/ui/validator/api/src/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/RF-8742-1/ui/validator/ui/src/META-INF/MANIFEST.MF
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/META-INF/MANIFEST.MF
(rev 0)
+++ branches/RF-8742-1/ui/validator/ui/src/META-INF/MANIFEST.MF 2010-11-24 23:17:41 UTC
(rev 20164)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Property changes on: branches/RF-8742-1/ui/validator/ui/src/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/ClientScriptServiceImpl.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/ClientScriptServiceImpl.java 2010-11-24
19:07:35 UTC (rev 20163)
+++
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/ClientScriptServiceImpl.java 2010-11-24
23:17:41 UTC (rev 20164)
@@ -52,7 +52,7 @@
private LibraryFunction getScriptFromAnnotation(Class<?> javaClass) throws
ScriptNotFoundException {
if (javaClass.isAnnotationPresent(ClientSideScript.class)) {
ClientSideScript clientSideScript =
javaClass.getAnnotation(ClientSideScript.class);
- return new LibraryFunctionImplementation(clientSideScript.library(),
clientSideScript.resource(), clientSideScript.function());
+ return new LibraryFunctionImplementation(clientSideScript.function(),
clientSideScript.resource(), clientSideScript.library());
} else {
throw new ScriptNotFoundException();
}
@@ -65,7 +65,7 @@
Resource facesResource = resourceHandler.createResource(resourceName,
ORG_RICHFACES_CSV, TEXT_JAVASCRIPT);
if (null != facesResource) {
final String functionName =
Strings.firstToLowerCase(javaClass.getSimpleName());
- return new LibraryFunctionImplementation(ORG_RICHFACES_CSV,resourceName,
functionName);
+ return new LibraryFunctionImplementation(functionName,resourceName,
ORG_RICHFACES_CSV);
} else {
throw new ScriptNotFoundException();
}
Modified:
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/ClientServiceConfigParser.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/ClientServiceConfigParser.java 2010-11-24
19:07:35 UTC (rev 20163)
+++
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/ClientServiceConfigParser.java 2010-11-24
23:17:41 UTC (rev 20164)
@@ -52,8 +52,8 @@
ClientSideScripts clientSideScripts = JAXB.unmarshal(url,
ClientSideScripts.class);
for (Component component : clientSideScripts.getComponent()) {
Class<?> componentClass = loader.loadClass(component.getType());
- LibraryFunctionImplementation function = new
LibraryFunctionImplementation(component.getLibrary(),
- component.getResource(), component.getFunction());
+ LibraryFunctionImplementation function = new
LibraryFunctionImplementation(component.getFunction(),
+ component.getResource(), component.getLibrary());
result.put(componentClass, function);
}
} catch (ClassNotFoundException e) {
Modified:
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/LibraryFunctionImplementation.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/LibraryFunctionImplementation.java 2010-11-24
19:07:35 UTC (rev 20163)
+++
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/LibraryFunctionImplementation.java 2010-11-24
23:17:41 UTC (rev 20164)
@@ -7,13 +7,13 @@
private final ResourceKey library;
private final String functionName;
- LibraryFunctionImplementation(ResourceKey library, String functionName) {
+ LibraryFunctionImplementation(String functionName, ResourceKey library) {
this.library = library;
this.functionName = functionName;
}
- LibraryFunctionImplementation(String library, String resource, String functionName)
{
- this.library = new ResourceKey(library, resource);
+ LibraryFunctionImplementation(String functionName, String resource, String library)
{
+ this.library = ResourceKey.create(resource,library);
this.functionName = functionName;
}
Modified:
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/Bean.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/Bean.java 2010-11-24
19:07:35 UTC (rev 20163)
+++
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/Bean.java 2010-11-24
23:17:41 UTC (rev 20164)
@@ -10,8 +10,8 @@
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
-import org.richfaces.javascript.LibraryResource;
import org.richfaces.renderkit.html.ComponentValidatorScript;
+import org.richfaces.resource.ResourceKey;
/**
* @author asmirnov
@@ -29,7 +29,7 @@
public static final String TEST_SCRIPT = "function " + FOO +
"(id){alert(id);}";
- private static final LibraryResource TEST_RESOURCE = new LibraryResource(FOO_BAR,
TEST_SCRIPT_NAME + ".js");
+ private static final ResourceKey TEST_RESOURCE = ResourceKey.create(TEST_SCRIPT_NAME
+ ".js",FOO_BAR);
private static final ComponentValidatorScript SCRIPT = new ComponentValidatorScript()
{
@@ -49,7 +49,7 @@
}
}
- public Collection<LibraryResource> getResources() {
+ public Collection<ResourceKey> getResources() {
return Collections.singleton(TEST_RESOURCE);
}
Modified:
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/UIValidatorScriptCollectionTest.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/UIValidatorScriptCollectionTest.java 2010-11-24
19:07:35 UTC (rev 20163)
+++
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/UIValidatorScriptCollectionTest.java 2010-11-24
23:17:41 UTC (rev 20164)
@@ -6,10 +6,10 @@
import java.util.Collection;
import org.junit.Test;
-import org.richfaces.javascript.LibraryResource;
import org.richfaces.javascript.LibraryScriptString;
import org.richfaces.renderkit.html.ClientOnlyScript;
import org.richfaces.renderkit.html.ComponentValidatorScript;
+import org.richfaces.resource.ResourceKey;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
@@ -21,7 +21,7 @@
*/
public class UIValidatorScriptCollectionTest {
- static final LibraryResource FOO_RESOURCE = new LibraryResource("org.rf",
"foo");
+ static final ResourceKey FOO_RESOURCE =
ResourceKey.create("foo","org.rf");
@Test
Modified:
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/ClientScriptServiceTest.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/ClientScriptServiceTest.java 2010-11-24
19:07:35 UTC (rev 20163)
+++
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/ClientScriptServiceTest.java 2010-11-24
23:17:41 UTC (rev 20164)
@@ -89,7 +89,7 @@
public void testGetScriptAsJsfResource() throws Exception {
LibraryFunction script = getScript(resource, ValidatorWithFacesResource.class);
assertEquals(RESOURCE_NAME, script.getResource().getResourceName());
- assertEquals(ORG_RICHFACES_CSV, script.getResource().getLibrary());
+ assertEquals(ORG_RICHFACES_CSV, script.getResource().getLibraryName());
assertEquals("validatorWithFacesResource", script.getName());
}
@@ -97,7 +97,7 @@
public void testGetScriptFromAnnotation() throws Exception {
LibraryFunction script = getScript(null, ValidatorWithFacesResource.class);
assertEquals("baz.js", script.getResource().getResourceName());
- assertEquals("bar", script.getResource().getLibrary());
+ assertEquals("bar", script.getResource().getLibraryName());
assertEquals("foo", script.getName());
}
Modified:
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/ServiceConfigParserTest.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/ServiceConfigParserTest.java 2010-11-24
19:07:35 UTC (rev 20163)
+++
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/ServiceConfigParserTest.java 2010-11-24
23:17:41 UTC (rev 20164)
@@ -30,7 +30,7 @@
LibraryFunction libraryFunction = parseConfig.get(String.class);
assertEquals("stringConverter", libraryFunction.getName());
assertEquals("csv.js",
libraryFunction.getResource().getResourceName());
- assertEquals("org.richfaces",
libraryFunction.getResource().getLibrary());
+ assertEquals("org.richfaces",
libraryFunction.getResource().getLibraryName());
}
@Test(expected=FacesException.class)
Modified:
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java 2010-11-24
19:07:35 UTC (rev 20163)
+++
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java 2010-11-24
23:17:41 UTC (rev 20164)
@@ -1,12 +1,9 @@
package org.richfaces.renderkit.html;
-import static org.easymock.EasyMock.expect;
-import static org.hamcrest.CoreMatchers.allOf;
-import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.containsString;
-import static org.junit.matchers.JUnitMatchers.hasItem;
+import static org.easymock.EasyMock.*;
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+import static org.junit.matchers.JUnitMatchers.*;
import java.util.ArrayList;
import java.util.Collection;
@@ -28,7 +25,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.javascript.LibraryFunction;
-import org.richfaces.javascript.LibraryResource;
import org.richfaces.javascript.LibraryScriptString;
import org.richfaces.javascript.ScriptNotFoundException;
import org.richfaces.resource.ResourceKey;
@@ -45,12 +41,12 @@
private static final String NUMBER_CONVERTER = "numConverter";
- private static final Matcher<LibraryResource> CORE_LIBRARY_MATCHER = new
BaseMatcher<LibraryResource>() {
+ private static final Matcher<ResourceKey> CORE_LIBRARY_MATCHER = new
BaseMatcher<ResourceKey>() {
public boolean matches(Object arg0) {
- if (arg0 instanceof LibraryResource) {
- LibraryResource resource = (LibraryResource) arg0;
- return ORG_RICHFACES.equals(resource.getLibrary())
+ if (arg0 instanceof ResourceKey) {
+ ResourceKey resource = (ResourceKey) arg0;
+ return ORG_RICHFACES.equals(resource.getLibraryName())
&& CLIENT_VALIDATORS_JS.equals(resource.getResourceName());
}
return false;
Modified:
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java 2010-11-24
19:07:35 UTC (rev 20163)
+++
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java 2010-11-24
23:17:41 UTC (rev 20164)
@@ -7,7 +7,7 @@
import org.jboss.test.faces.mock.Mock;
import org.richfaces.component.behavior.BehaviorTestBase;
import org.richfaces.component.behavior.ClientValidatorBehavior;
-import org.richfaces.javascript.LibraryResource;
+import org.richfaces.resource.ResourceKey;
import com.google.common.collect.ImmutableMap;
@@ -18,7 +18,7 @@
protected static final String REGEX_VALIDATOR = "regexValidator";
protected static final FacesMessage VALIDATOR_MESSAGE = new
FacesMessage("Validator Message");
protected static final Map<String, ? extends Object> VALIDATOR_PARAMS =
ImmutableMap.of("foo", "value", "bar", 10);
- protected static final LibraryResource CLIENT_VALIDATOR_LIBRARY = new
LibraryResource(ORG_RICHFACES, CLIENT_VALIDATORS_JS);
+ protected static final ResourceKey CLIENT_VALIDATOR_LIBRARY =
ResourceKey.create(CLIENT_VALIDATORS_JS,ORG_RICHFACES);
protected ClientValidatorRenderer renderer = new ClientValidatorRenderer();