List of usage examples for org.springframework.mock.web MockServletContext addInitParameter
public void addInitParameter(String name, String value)
From source file:gov.nih.nci.protexpress.ui.actions.registration.test.RegistrationActionTest.java
public void testPrepare() throws Exception { MockServletContext context = (MockServletContext) ServletActionContext.getServletContext(); context.addInitParameter("some.other.param", "false"); registrationAction.prepare();/*w ww . java 2 s . co m*/ assertNotNull(registrationAction.getRegistrationRequest()); assertTrue(registrationAction.getLdapAuthenticate()); //need to stub out ProtExpressRegistry.getRegistrationService() before we can assert number of entries //assertEquals(50,registrationAction.getStateList().size()); //assertEquals(1,registrationAction.getCountryList().size()); }
From source file:com.xemantic.tadedon.guice.servlet.GuiceServletsTest.java
@Test public void shouldGetProductionStageWhenProductionIsSpecified() throws Exception { // given// w w w.ja va 2 s . c om MockServletContext context = new MockServletContext(); context.addInitParameter(GuiceServlets.STAGE_PARAMETER, "PRODUCTION"); // when Stage stage = GuiceServlets.getStage(context); // then assertThat(stage, is(Stage.PRODUCTION)); }
From source file:com.xemantic.tadedon.guice.servlet.GuiceServletsTest.java
@Test public void shouldGetDevelopmentStageWhenDevelopmentIsSpecified() throws Exception { // given// w w w. ja v a2 s . c o m MockServletContext context = new MockServletContext(); context.addInitParameter(GuiceServlets.STAGE_PARAMETER, "DEVELOPMENT"); // when Stage stage = GuiceServlets.getStage(context); // then assertThat(stage, is(Stage.DEVELOPMENT)); }
From source file:com.xemantic.tadedon.guice.servlet.GuiceServletsTest.java
@Test public void shouldGetDevelopmentStageWhenJunkIsSpecified() throws Exception { // given//from www . j a v a2s. c o m MockServletContext context = new MockServletContext(); context.addInitParameter(GuiceServlets.STAGE_PARAMETER, "${application.stage}"); // will be filtered later // when Stage stage = GuiceServlets.getStage(context); // then assertThat(stage, is(Stage.DEVELOPMENT)); }
From source file:com.xemantic.tadedon.guice.servlet.GuiceServletsTest.java
@Test public void shouldGetProductionStageWhenFooParamProcutionIsSpecified() throws Exception { // given//from ww w.java 2 s . co m MockServletContext context = new MockServletContext(); context.addInitParameter("fooParam", "PRODUCTION"); // when Stage stage = GuiceServlets.getStage(context, "fooParam"); // then assertThat(stage, is(Stage.PRODUCTION)); }
From source file:com.xemantic.tadedon.guice.servlet.GuiceServletsTest.java
@Test public void shouldGetDevelopmentStageWhenFooParamDevelopmentIsSpecified() throws Exception { // given//w w w . ja va2 s. co m MockServletContext context = new MockServletContext(); context.addInitParameter("fooParam", "DEVELOPMENT"); // when Stage stage = GuiceServlets.getStage(context, "fooParam"); // then assertThat(stage, is(Stage.DEVELOPMENT)); }
From source file:com.xemantic.tadedon.guice.servlet.GuiceServletsTest.java
@Test public void shouldGetDevelopmentStageWhenFooParamJunkIsSpecified() throws Exception { // given/*w w w . ja va 2 s . c om*/ MockServletContext context = new MockServletContext(); context.addInitParameter("fooParam", "${application.stage}"); // will be filtered later // when Stage stage = GuiceServlets.getStage(context, "fooParam"); // then assertThat(stage, is(Stage.DEVELOPMENT)); }
From source file:org.settings4j.helper.web.DefaultPropertiesLoaderTest.java
private MockServletContext prepareServletContext() { final StringBuffer propertiesString = new StringBuffer(); propertiesString.append("test1=value1\n"); propertiesString.append(" test2=value2\n"); // with whiteSpaces propertiesString.append("\ttest3=value3\n"); // with Tabs propertiesString.append("\t a/b/test4=value4\n"); // with taps, Whitespace and prefixPath propertiesString.append("test5=value5\n"); final MockServletContext servletContext = new MockServletContext(); servletContext.addInitParameter(DefaultPropertiesLoader.DEFAULT_PROPERTIES, propertiesString.toString()); return servletContext; }
From source file:org.jasig.cas.client.configuration.WebXmlConfigurationStrategyImplTests.java
@Test public void servletConfigValueForBoolean() { final ConfigurationKey<Boolean> key = ConfigurationKeys.ACCEPT_ANY_PROXY; final Boolean value = Boolean.TRUE; final MockServletContext context = (MockServletContext) this.filterConfig.getServletContext(); context.addInitParameter(key.getName(), value.toString()); assertEquals(value, this.impl.getBoolean(key)); }
From source file:org.jasig.cas.client.configuration.WebXmlConfigurationStrategyImplTests.java
@Test public void servletConfigValueForString() { final ConfigurationKey<String> key = ConfigurationKeys.ARTIFACT_PARAMETER_NAME; final String value = "foobar"; final MockServletContext context = (MockServletContext) this.filterConfig.getServletContext(); context.addInitParameter(key.getName(), value); assertEquals(value, this.impl.getString(key)); }