use of org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.HandlerConfig in project carbon-apimgt by wso2.
the class HandlerConfigTest method testHandlerConfig.
@Test
public void testHandlerConfig() throws Exception {
Map<String, String> properties = new HashMap<String, String>();
properties.put("key", "value");
HandlerConfig handlerConfig = new HandlerConfig("test", properties);
Assert.assertTrue("test".equalsIgnoreCase(handlerConfig.getClassName()));
Assert.assertTrue(handlerConfig.getProperties().get("key").equalsIgnoreCase("value"));
handlerConfig.setClassName("HandlerConfigTest");
Assert.assertTrue("HandlerConfigTest".equalsIgnoreCase(handlerConfig.getClassName()));
properties.put("key1", "value1");
handlerConfig.setProperties(properties);
Assert.assertTrue(handlerConfig.hasProperties());
Assert.assertTrue(handlerConfig.getProperties().get("key1").equalsIgnoreCase("value1"));
properties.clear();
handlerConfig.setProperties(properties);
Assert.assertFalse(handlerConfig.hasProperties());
}
use of org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.HandlerConfig in project carbon-apimgt by wso2.
the class HandlerConfigContextTest method testHandlerConfigContex.
@Test
public void testHandlerConfigContex() throws Exception {
API api = new API(new APIIdentifier("admin", "TestAPI", "1.0.0"));
api.setStatus(APIConstants.CREATED);
api.setContextTemplate("/");
ConfigContext configcontext = new APIConfigContext(api);
List<HandlerConfig> handlers = new ArrayList<HandlerConfig>();
HandlerConfigContex handlerConfigContex = new HandlerConfigContex(configcontext, handlers);
Assert.assertNotNull(handlerConfigContex.getContext().get("handlers"));
}
Aggregations