minor structure polishing / naming conventions
This commit is contained in:
@@ -3,10 +3,10 @@ package org.springframework.faces.config;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.faces.expression.LegacyJSFELExpressionParser;
|
||||
import org.springframework.faces.model.converter.FacesConversionService;
|
||||
import org.springframework.faces.webflow.JSFMockHelper;
|
||||
import org.springframework.faces.webflow.JsfViewFactoryCreator;
|
||||
import org.springframework.faces.webflow.JsfManagedBeanAwareELExpressionParser;
|
||||
import org.springframework.webflow.engine.builder.support.FlowBuilderServices;
|
||||
import org.springframework.webflow.expression.el.WebFlowELExpressionParser;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class FacesFlowBuilderServicesBeanDefinitionParserTests extends TestCase
|
||||
public void testEnableManagedBeans() {
|
||||
builderServices = (FlowBuilderServices) context.getBean("flowBuilderServicesLegacy");
|
||||
assertNotNull(builderServices);
|
||||
assertTrue(builderServices.getExpressionParser() instanceof LegacyJSFELExpressionParser);
|
||||
assertTrue(builderServices.getExpressionParser() instanceof JsfManagedBeanAwareELExpressionParser);
|
||||
assertTrue(builderServices.getViewFactoryCreator() instanceof JsfViewFactoryCreator);
|
||||
assertTrue(builderServices.getConversionService() instanceof FacesConversionService);
|
||||
}
|
||||
|
||||
@@ -6,17 +6,11 @@ import java.io.StringWriter;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.shale.test.mock.MockResponseWriter;
|
||||
import org.easymock.EasyMock;
|
||||
import org.springframework.faces.webflow.JSFMockHelper;
|
||||
import org.springframework.webflow.context.ExternalContext;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
import org.springframework.webflow.execution.RequestContextHolder;
|
||||
|
||||
public class FlowResourceHelperTests extends TestCase {
|
||||
|
||||
RequestContext requestContext = (RequestContext) EasyMock.createMock(RequestContext.class);
|
||||
ExternalContext externalContext = (ExternalContext) EasyMock.createMock(ExternalContext.class);
|
||||
FlowResourceHelper resourceHelper = new FlowResourceHelper();
|
||||
ResourceHelper resourceHelper = new ResourceHelper();
|
||||
|
||||
StringWriter writer = new StringWriter();
|
||||
|
||||
@@ -24,9 +18,8 @@ public class FlowResourceHelperTests extends TestCase {
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
jsf.setUp();
|
||||
// TODO figure out how to set the context path
|
||||
jsf.facesContext().setResponseWriter(new MockResponseWriter(writer, "text/html", "UTF-8"));
|
||||
EasyMock.expect(requestContext.getExternalContext()).andStubReturn(externalContext);
|
||||
RequestContextHolder.setRequestContext(requestContext);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@@ -36,17 +29,11 @@ public class FlowResourceHelperTests extends TestCase {
|
||||
public final void testRenderScriptLink() throws IOException {
|
||||
|
||||
String scriptPath = "/dojo/dojo.js";
|
||||
String expectedUrl = "/context/resources/dojo/dojo.js";
|
||||
|
||||
EasyMock.expect(externalContext.getContextPath()).andReturn("/context");
|
||||
|
||||
EasyMock.replay(new Object[] { requestContext, externalContext });
|
||||
String expectedUrl = "null/resources/dojo/dojo.js";
|
||||
|
||||
resourceHelper.renderScriptLink(jsf.facesContext(), scriptPath);
|
||||
resourceHelper.renderScriptLink(jsf.facesContext(), scriptPath);
|
||||
|
||||
EasyMock.verify(new Object[] { externalContext });
|
||||
|
||||
String expectedOutput = "<script type=\"text/javascript\" src=\"" + expectedUrl + "\"/>";
|
||||
|
||||
assertEquals(expectedOutput, writer.toString());
|
||||
@@ -56,17 +43,11 @@ public class FlowResourceHelperTests extends TestCase {
|
||||
public final void testRenderStyleLink() throws IOException {
|
||||
|
||||
String scriptPath = "/dijit/themes/dijit.css";
|
||||
String expectedUrl = "/context/resources/dijit/themes/dijit.css";
|
||||
|
||||
EasyMock.expect(externalContext.getContextPath()).andReturn("/context");
|
||||
|
||||
EasyMock.replay(new Object[] { requestContext, externalContext });
|
||||
String expectedUrl = "null/resources/dijit/themes/dijit.css";
|
||||
|
||||
resourceHelper.renderStyleLink(jsf.facesContext(), scriptPath);
|
||||
resourceHelper.renderStyleLink(jsf.facesContext(), scriptPath);
|
||||
|
||||
EasyMock.verify(new Object[] { externalContext });
|
||||
|
||||
String expectedOutput = "<link type=\"text/css\" rel=\"stylesheet\" href=\"" + expectedUrl + "\"/>";
|
||||
|
||||
assertEquals(expectedOutput, writer.toString());
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
package org.springframework.webflow.engine.builder.xml;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.beans.factory.support.StaticListableBeanFactory;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.faces.webflow.JSFMockHelper;
|
||||
import org.springframework.faces.webflow.JsfViewFactoryCreator;
|
||||
import org.springframework.webflow.engine.Flow;
|
||||
import org.springframework.webflow.engine.builder.FlowAssembler;
|
||||
import org.springframework.webflow.test.MockFlowBuilderContext;
|
||||
|
||||
public class JsfXmlFlowBuilderTests extends TestCase {
|
||||
|
||||
private XmlFlowBuilder builder;
|
||||
private JSFMockHelper jsf = new JSFMockHelper();
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
jsf.setUp();
|
||||
StaticListableBeanFactory beanFactory = new StaticListableBeanFactory();
|
||||
beanFactory.addBean("bean", new Object());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
jsf.tearDown();
|
||||
}
|
||||
|
||||
public final void testBuildJsfFlow() {
|
||||
ClassPathResource resource = new ClassPathResource("jsf-flow.xml", getClass());
|
||||
builder = new XmlFlowBuilder(resource);
|
||||
MockFlowBuilderContext builderContext = new MockFlowBuilderContext("jsf-flow");
|
||||
builderContext.getFlowBuilderServices().setViewFactoryCreator(new JsfViewFactoryCreator());
|
||||
FlowAssembler assembler = new FlowAssembler(builder, builderContext);
|
||||
Flow flow = assembler.assembleFlow();
|
||||
assertEquals("jsf-flow", flow.getId());
|
||||
assertEquals("viewState1", flow.getStartState().getId());
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
|
||||
|
||||
<view-state id="viewState1" view="view1">
|
||||
<transition on="event1" to="endState1"/>
|
||||
</view-state>
|
||||
|
||||
<end-state id="endState1" view="endView1"/>
|
||||
|
||||
</flow>
|
||||
Reference in New Issue
Block a user