@@ -0,0 +1,3409 @@
+/*%0A*  Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.%0A*%0A*  WSO2 Inc. licenses this file to you under the Apache License,%0A*  Version 2.0 (the %22License%22); you may not use this file except%0A*  in compliance with the License.%0A*  You may obtain a copy of the License at%0A*%0A*  http://www.apache.org/licenses/LICENSE-2.0%0A*%0A*  Unless required by applicable law or agreed to in writing,%0A*  software distributed under the License is distributed on an%0A*  %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY%0A*  KIND, either express or implied.  See the License for the%0A*  specific language governing permissions and limitations%0A*  under the License.%0A*/%0A%0Apackage org.wso2.am.integration.tests.publisher;%0A%0Aimport org.json.JSONObject;%0A%0Aimport org.testng.annotations.AfterClass;%0Aimport org.testng.annotations.BeforeClass;%0Aimport org.testng.annotations.DataProvider;%0Aimport org.testng.annotations.Factory;%0Aimport org.testng.annotations.Test;%0Aimport org.wso2.am.integration.test.utils.base.APIMIntegrationBaseTest;%0Aimport org.wso2.am.integration.test.utils.bean.APIRequest;%0Aimport org.wso2.am.integration.test.utils.clients.APIPublisherRestClient;%0Aimport org.wso2.carbon.automation.engine.context.TestUserMode;%0Aimport org.wso2.carbon.automation.test.utils.http.client.HttpResponse;%0A%0Aimport java.net.URL;%0A%0Aimport static org.testng.Assert.assertEquals;%0Aimport static org.testng.Assert.assertTrue;%0A%0Apublic class APIMANAGER5834APICreationWithInvalidInputsTestCase extends APIMIntegrationBaseTest %7B%0A    private final String apiNameTest = %22APIM18PublisherTest%22;%0A    private APIPublisherRestClient apiPublisher;%0A%0A    @Factory(dataProvider = %22userModeDataProvider%22)%0A    public APIMANAGER5834APICreationWithInvalidInputsTestCase(TestUserMode userMode) %7B%0A        this.userMode = userMode;%0A    %7D%0A%0A    @DataProvider%0A    public static Object%5B%5D%5B%5D userModeDataProvider() %7B%0A        return new Object%5B%5D%5B%5D%7B%0A                new Object%5B%5D%7BTestUserMode.SUPER_TENANT_ADMIN%7D,%0A                new Object%5B%5D%7BTestUserMode.TENANT_ADMIN%7D,%0A        %7D;%0A    %7D%0A%0A    @BeforeClass(alwaysRun = true)%0A    public void setEnvironment() throws Exception %7B%0A        super.init(userMode);%0A        String publisherURLHttp = publisherUrls.getWebAppURLHttp();%0A        apiPublisher = new APIPublisherRestClient(publisherURLHttp);%0A        apiPublisher.login(publisherContext.getContextTenant().getContextUser().getUserName(),%0A                publisherContext.getContextTenant().getContextUser().getPassword());%0A%0A    %7D%0A%0A    @Test(groups = %7B %22wso2.am%22 %7D, description = %22Test API creation with invalid context%22)%0A    public void testAPICreationWithInvalidContext() throws Exception %7B%0A        String backendEndPoint = getBackendEndServiceEndPointHttp(%22jaxrs_basic/services/customers/customerservice%22);%0A        APIRequest apiRequest = new APIRequest(apiNameTest, %22/%22, new URL(backendEndPoint));%0A        HttpResponse serviceResponse = apiPublisher.addAPI(apiRequest);%0A        JSONObject apiResponse = new JSONObject(serviceResponse.getData());%0A        assertTrue(apiResponse.getBoolean(%22error%22), %22API creation should get an error when creating an API with / context.%22);%0A        assertEquals(apiResponse.get(%22message%22), %22 Context cannot end with '/' character%22 , %22API creation should get an error when creating an API with / context.%22);%0A    %7D%0A%0A    @AfterClass(alwaysRun = true)%0A    public void destroyAPIs() throws Exception %7B%0A        super.cleanUp();%0A    %7D%0A%7D

Add test case for https://support.wso2.com/jira/browse/CLOUDPROD-445