use of com.mockrunner.mock.web.MockFilterConfig in project cayenne by apache.
the class WebConfigurationTest method testFilterOtherParameters.
@Test
public void testFilterOtherParameters() {
MockFilterConfig config1 = new MockFilterConfig();
config1.setFilterName("cayenne-x");
config1.setInitParameter(WebConfiguration.CONFIGURATION_LOCATION_PARAMETER, "cayenne-y.xml");
config1.setInitParameter(WebConfiguration.EXTRA_MODULES_PARAMETER, "M1,M2");
config1.setInitParameter("test", "xxx");
WebConfiguration configuration1 = new WebConfiguration(config1);
Map<String, String> parameters = configuration1.getOtherParameters();
assertNotSame(parameters, configuration1.getOtherParameters());
assertEquals(parameters, configuration1.getOtherParameters());
assertEquals(1, parameters.size());
assertEquals("xxx", parameters.get("test"));
}
use of com.mockrunner.mock.web.MockFilterConfig in project cayenne by apache.
the class WebConfigurationTest method testFilterParameters.
@Test
public void testFilterParameters() {
MockFilterConfig config1 = new MockFilterConfig();
config1.setFilterName("cayenne-x");
config1.setInitParameter(WebConfiguration.CONFIGURATION_LOCATION_PARAMETER, "cayenne-y.xml");
config1.setInitParameter("test", "xxx");
WebConfiguration configuration1 = new WebConfiguration(config1);
Map<String, String> parameters = configuration1.getParameters();
assertNotSame(parameters, configuration1.getParameters());
assertEquals(parameters, configuration1.getParameters());
assertEquals(2, parameters.size());
assertEquals("cayenne-y.xml", parameters.get(WebConfiguration.CONFIGURATION_LOCATION_PARAMETER));
assertEquals("xxx", parameters.get("test"));
}
use of com.mockrunner.mock.web.MockFilterConfig in project cayenne by apache.
the class WebConfigurationTest method testFilterConfigurationLocation_Parameter.
@Test
public void testFilterConfigurationLocation_Parameter() {
MockFilterConfig config1 = new MockFilterConfig();
config1.setFilterName("cayenne-x");
config1.setInitParameter(WebConfiguration.CONFIGURATION_LOCATION_PARAMETER, "cayenne-y.xml");
WebConfiguration configuration1 = new WebConfiguration(config1);
assertEquals("cayenne-y.xml", configuration1.getConfigurationLocation());
}
use of com.mockrunner.mock.web.MockFilterConfig in project cayenne by apache.
the class CayenneFilterTest method testInitWithCustomDomainName.
@Test
public void testInitWithCustomDomainName() throws Exception {
MockFilterConfig config = new MockFilterConfig();
config.setFilterName("abc");
config.setInitParameter(WebConfiguration.DATA_DOMAIN_NAME_PARAMETER, "custom");
MockServletContext context = new MockServletContext();
config.setupServletContext(context);
CayenneFilter filter = new CayenneFilter();
filter.init(config);
CayenneRuntime runtime = WebUtil.getCayenneRuntime(context);
assertNotNull(runtime);
String domainName = runtime.getInjector().getInstance(Key.getMapOf(String.class, String.class, Constants.PROPERTIES_MAP)).get(Constants.SERVER_DOMAIN_NAME_PROPERTY);
assertEquals("custom", domainName);
}
use of com.mockrunner.mock.web.MockFilterConfig in project cayenne by apache.
the class CayenneFilterTest method testInitWithMultipleLocations.
@Test
public void testInitWithMultipleLocations() throws Exception {
MockFilterConfig config = new MockFilterConfig();
config.setFilterName("abc");
config.setInitParameter(WebConfiguration.CONFIGURATION_LOCATION_PARAMETER, "xyz,abc,\tdef, \n ghi");
MockServletContext context = new MockServletContext();
config.setupServletContext(context);
CayenneFilter filter = new CayenneFilter();
filter.init(config);
CayenneRuntime runtime = WebUtil.getCayenneRuntime(context);
assertNotNull(runtime);
List<String> locations = runtime.getInjector().getInstance(Key.getListOf(String.class, Constants.SERVER_PROJECT_LOCATIONS_LIST));
assertEquals(Arrays.asList("xyz", "abc", "def", "ghi"), locations);
}
Aggregations