Search in sources :

Example 1 with HandlerConfig

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());
}
Also used : HandlerConfig(org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.HandlerConfig) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 2 with HandlerConfig

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"));
}
Also used : HandlerConfigContex(org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.HandlerConfigContex) HandlerConfig(org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.HandlerConfig) ArrayList(java.util.ArrayList) API(org.wso2.carbon.apimgt.api.model.API) APIIdentifier(org.wso2.carbon.apimgt.api.model.APIIdentifier) APIConfigContext(org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.APIConfigContext) ConfigContext(org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.ConfigContext) APIConfigContext(org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.APIConfigContext) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 HandlerConfig (org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.HandlerConfig)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 API (org.wso2.carbon.apimgt.api.model.API)1 APIIdentifier (org.wso2.carbon.apimgt.api.model.APIIdentifier)1 APIConfigContext (org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.APIConfigContext)1 ConfigContext (org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.ConfigContext)1 HandlerConfigContex (org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.HandlerConfigContex)1