diff --git a/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/WorkflowHttpHandlerTest.java b/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/WorkflowHttpHandlerTest.java index 14428f6c0770..1847219eac6e 100644 --- a/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/WorkflowHttpHandlerTest.java +++ b/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/WorkflowHttpHandlerTest.java @@ -117,7 +117,7 @@ private Integer runningProgramCount(Id.Program program, String runId) throws Exc private void waitForStatusCode(final String path, final Id.Program program, final int expectedStatusCode) throws Exception { Tasks.waitFor(true, () -> { - HttpResponse response = doPost(getVersionedAPIPath(path, Constants.Gateway.API_VERSION_3_TOKEN, + HttpResponse response = doPost(getVersionedApiPath(path, Constants.Gateway.API_VERSION_3_TOKEN, program.getNamespaceId())); return expectedStatusCode == response.getResponseCode(); }, 60, TimeUnit.SECONDS); @@ -134,7 +134,7 @@ private void setAndTestRuntimeArgs(Id.Program programId, Map arg String argString = GSON.toJson(args, new TypeToken>() { }.getType()); String path = String.format("apps/%s/workflows/%s/runtimeargs", programId.getApplicationId(), programId.getId()); - String versionedRuntimeArgsUrl = getVersionedAPIPath(path, Constants.Gateway.API_VERSION_3_TOKEN, + String versionedRuntimeArgsUrl = getVersionedApiPath(path, Constants.Gateway.API_VERSION_3_TOKEN, programId.getNamespaceId()); response = doPut(versionedRuntimeArgsUrl, argString); @@ -174,7 +174,7 @@ private String getLocalDatasetPath(ProgramId workflowId, String runId) { String path = String.format("apps/%s/workflows/%s/runs/%s/localdatasets", workflowId.getApplication(), workflowId.getProgram(), runId); - return getVersionedAPIPath(path, Constants.Gateway.API_VERSION_3_TOKEN, workflowId.getNamespace()); + return getVersionedApiPath(path, Constants.Gateway.API_VERSION_3_TOKEN, workflowId.getNamespace()); } private Map getWorkflowLocalDatasets(ProgramId workflowId, String runId) @@ -633,7 +633,7 @@ private Map getWorkflowNodeStates(ProgramId wor private HttpResponse getWorkflowNodeStatesResponse(ProgramId workflowId, String runId) throws Exception { String path = String.format("apps/%s/workflows/%s/runs/%s/nodes/state", workflowId.getApplication(), workflowId.getProgram(), runId); - path = getVersionedAPIPath(path, Constants.Gateway.API_VERSION_3_TOKEN, workflowId.getNamespace()); + path = getVersionedApiPath(path, Constants.Gateway.API_VERSION_3_TOKEN, workflowId.getNamespace()); return doGet(path); } @@ -1212,7 +1212,7 @@ private WorkflowTokenDetail getWorkflowToken(Id.Workflow workflowId, String runI @Nullable String key) throws Exception { String workflowTokenUrl = String.format("apps/%s/workflows/%s/runs/%s/token", workflowId.getApplicationId(), workflowId.getId(), runId); - String versionedUrl = getVersionedAPIPath(appendScopeAndKeyToUrl(workflowTokenUrl, scope, key), + String versionedUrl = getVersionedApiPath(appendScopeAndKeyToUrl(workflowTokenUrl, scope, key), Constants.Gateway.API_VERSION_3_TOKEN, workflowId.getNamespaceId()); HttpResponse response = doGet(versionedUrl); return readResponse(response, new TypeToken() { }.getType(), GSON); @@ -1223,7 +1223,7 @@ private WorkflowTokenNodeDetail getWorkflowToken(Id.Workflow workflowId, String @Nullable String key) throws Exception { String workflowTokenUrl = String.format("apps/%s/workflows/%s/runs/%s/nodes/%s/token", workflowId.getApplicationId(), workflowId.getId(), runId, nodeName); - String versionedUrl = getVersionedAPIPath(appendScopeAndKeyToUrl(workflowTokenUrl, scope, key), + String versionedUrl = getVersionedApiPath(appendScopeAndKeyToUrl(workflowTokenUrl, scope, key), Constants.Gateway.API_VERSION_3_TOKEN, workflowId.getNamespaceId()); HttpResponse response = doGet(versionedUrl); return readResponse(response, new TypeToken() { }.getType(), GSON); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/TransactionServiceManager.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/TransactionServiceManager.java index 5bf113850134..af3021d2d3b3 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/TransactionServiceManager.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/TransactionServiceManager.java @@ -44,12 +44,12 @@ public class TransactionServiceManager extends AbstractMasterServiceManager { @Override public boolean isServiceEnabled() { - return getCConf().getBoolean(Constants.Transaction.TX_ENABLED); + return getCconf().getBoolean(Constants.Transaction.TX_ENABLED); } @Override public int getMaxInstances() { - return getCConf().getInt(Constants.Transaction.Container.MAX_INSTANCES); + return getCconf().getInt(Constants.Transaction.Container.MAX_INSTANCES); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/AbstractServiceRoutingHandler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/AbstractServiceRoutingHandler.java index de7ae54da8fe..3b49421b5dd5 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/AbstractServiceRoutingHandler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/AbstractServiceRoutingHandler.java @@ -20,9 +20,9 @@ import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.io.Closeables; +import io.cdap.cdap.api.service.ServiceUnavailableException; import io.cdap.cdap.common.BadRequestException; import io.cdap.cdap.common.ServiceException; -import io.cdap.cdap.api.service.ServiceUnavailableException; import io.cdap.cdap.common.discovery.EndpointStrategy; import io.cdap.cdap.common.discovery.RandomEndpointStrategy; import io.cdap.cdap.common.discovery.URIScheme; diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/namespace/DefaultNamespaceAdminTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/namespace/DefaultNamespaceAdminTest.java index 5bf73b4885b3..a2515c5cf3b5 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/namespace/DefaultNamespaceAdminTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/namespace/DefaultNamespaceAdminTest.java @@ -55,7 +55,7 @@ public class DefaultNamespaceAdminTest extends AppFabricTestBase { @BeforeClass public static void beforeClass() throws Exception { - cConf = createBasicCConf(); + cConf = createBasicCconf(); // we enable Kerberos for these unit tests, so we can test namespace group permissions (see testDataDirCreation). cConf.set(Constants.Security.KERBEROS_ENABLED, Boolean.toString(true)); cConf.set(Constants.Security.CFG_CDAP_MASTER_KRB_PRINCIPAL, "cdap"); diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/monitor/InternalServiceRoutingHandlerTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/monitor/InternalServiceRoutingHandlerTest.java index 8797f66e53ed..78cec40bab7f 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/monitor/InternalServiceRoutingHandlerTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/monitor/InternalServiceRoutingHandlerTest.java @@ -214,9 +214,8 @@ public void testUrlEncodedGetQueryParam() // handles URL encoded string correctly. HttpMethod method = HttpMethod.GET; HttpRequest request = remoteClient.requestBuilder(method, - String.format("services/%s/mock/%s/%d", - MOCK_SERVICE, method.name().toLowerCase(), 200) + - "?queryParam=abc%20d") + String.format("services/%s/mock/%s/%d", MOCK_SERVICE, + method.name().toLowerCase(), 200) + "?queryParam=abc%20d") .build(); HttpResponse response = remoteClient.execute(request); diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/ProgramLifecycleServiceTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/ProgramLifecycleServiceTest.java index e1d60d39e5c1..546198425f35 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/ProgramLifecycleServiceTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/ProgramLifecycleServiceTest.java @@ -71,7 +71,7 @@ public class ProgramLifecycleServiceTest extends AppFabricTestBase { @BeforeClass public static void beforeClass() throws Throwable { - cConf = createBasicCConf(); + cConf = createBasicCconf(); initializeAndStartServices(cConf); Injector injector = getInjector(); programLifecycleService = injector.getInstance(ProgramLifecycleService.class); diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/SourceControlManagementServiceTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/SourceControlManagementServiceTest.java index 0ce6f99b9b6c..91a85f4193a6 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/SourceControlManagementServiceTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/SourceControlManagementServiceTest.java @@ -89,7 +89,7 @@ public class SourceControlManagementServiceTest extends AppFabricTestBase { @BeforeClass public static void beforeClass() throws Exception { - cConf = createBasicCConf(); + cConf = createBasicCconf(); initializeAndStartServices(cConf); namespaceAdmin = getInjector().getInstance(NamespaceAdmin.class); sourceControlService = diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/AppFabricTestBase.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/AppFabricTestBase.java index 2d1e646724ea..abf6a5a1c8ef 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/AppFabricTestBase.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/AppFabricTestBase.java @@ -232,7 +232,7 @@ public abstract class AppFabricTestBase { @BeforeClass public static void beforeClass() throws Throwable { - cConf = createBasicCConf(); + cConf = createBasicCconf(); initializeAndStartServices(cConf); } @@ -325,7 +325,7 @@ public static void afterClass() { Closeables.closeQuietly(metadataStorage); } - protected static CConfiguration createBasicCConf() throws IOException { + protected static CConfiguration createBasicCconf() throws IOException { CConfiguration cConf = CConfiguration.create(); cConf.set(Constants.Service.MASTER_SERVICES_BIND_ADDRESS, InetAddress.getLoopbackAddress().getHostAddress()); cConf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder("data").getAbsolutePath()); @@ -466,21 +466,22 @@ protected HttpResponse addPluginArtifact(Id.Artifact artifactId, Class cls, /** * Adds a plugin artifact. This method is present for testing invalid plugin class json and it usage is not * recommended. + * * @param artifactId the artifact id * @param cls the application class * @param manifest manifest * @param parents parents range of artifact - * @param pluginClassesJSON JSON representation for plugin classes + * @param pluginClassesJson JSON representation for plugin classes * @return {@link HttpResponse} recieved response * @throws Exception if failed to add the plugin artifact */ protected HttpResponse addPluginArtifact(Id.Artifact artifactId, Class cls, Manifest manifest, @Nullable Set parents, - @Nullable String pluginClassesJSON) throws Exception { + @Nullable String pluginClassesJson) throws Exception { Location appJar = PluginJarHelper.createPluginJar(locationFactory, manifest, cls); try { - return addArtifact(artifactId, Locations.newInputSupplier(appJar), parents, pluginClassesJSON); + return addArtifact(artifactId, Locations.newInputSupplier(appJar), parents, pluginClassesJson); } finally { appJar.delete(); } @@ -496,9 +497,9 @@ protected HttpResponse addArtifact(Id.Artifact artifactId, InputSupplier artifactContents, - Set parents, @Nullable String pluginClassesJSON) + Set parents, @Nullable String pluginClassesJson) throws Exception { - String path = getVersionedAPIPath("artifacts/" + artifactId.getName(), artifactId.getNamespace().getId()); + String path = getVersionedApiPath("artifacts/" + artifactId.getName(), artifactId.getNamespace().getId()); HttpRequest.Builder builder = HttpRequest.post(getEndPoint(path).toURL()) .addHeader(Constants.Gateway.API_KEY, "api-key-example") .addHeader("Artifact-Version", artifactId.getVersion().getVersion()); @@ -509,8 +510,8 @@ private HttpResponse addArtifact(Id.Artifact artifactId, InputSupplier application, int expectedCode, @Nullable protected HttpResponse deploy(Id.Application appId, AppRequest appRequest) throws Exception { - String deployPath = getVersionedAPIPath("apps/" + appId.getId(), appId.getNamespaceId()); + String deployPath = getVersionedApiPath("apps/" + appId.getId(), appId.getNamespaceId()); return executeDeploy(HttpRequest.put(getEndPoint(deployPath).toURL()), appRequest); } protected HttpResponse deployWithoutMarkingLatest(Id.Application appId, AppRequest appRequest) throws Exception { - String deployPath = getVersionedInternalAPIPath( + String deployPath = getVersionedInternalApiPath( "apps/" + appId.getId() + "?skipMarkingLatest=true", appId.getNamespaceId()); return executeDeploy(HttpRequest.put(getEndPoint(deployPath).toURL()), appRequest); } protected HttpResponse deploy(ApplicationId appId, AppRequest appRequest) throws Exception { - String deployPath = getVersionedAPIPath(String.format("apps/%s/versions/%s/create", appId.getApplication(), + String deployPath = getVersionedApiPath(String.format("apps/%s/versions/%s/create", appId.getApplication(), appId.getVersion()), appId.getNamespace()); return executeDeploy(HttpRequest.post(getEndPoint(deployPath).toURL()), appRequest); } - private HttpResponse executeDeploy(HttpRequest.Builder requestBuilder, - AppRequest appRequest) throws Exception { - requestBuilder.addHeader(Constants.Gateway.API_KEY, "api-key-example"); - requestBuilder.addHeader(HttpHeaderNames.CONTENT_TYPE.toString(), MediaType.APPLICATION_JSON); - requestBuilder.withBody(GSON.toJson(appRequest)); - return HttpRequests.execute(requestBuilder.build(), httpRequestConfig); - } - /** * Deploys an application with (optionally) a defined app name and app version */ protected HttpResponse deploy(Class application, int expectedCode, @Nullable String apiVersion, - @Nullable String namespace, @Nullable String artifactVersion, - @Nullable Config appConfig, @Nullable String ownerPrincipal) throws Exception { + @Nullable String namespace, @Nullable String artifactVersion, + @Nullable Config appConfig, @Nullable String ownerPrincipal) throws Exception { namespace = namespace == null ? Id.Namespace.DEFAULT.getId() : namespace; apiVersion = apiVersion == null ? Constants.Gateway.API_VERSION_3_TOKEN : apiVersion; artifactVersion = artifactVersion == null ? String.format("1.0.%d", System.currentTimeMillis()) : artifactVersion; @@ -583,11 +576,11 @@ protected HttpResponse deploy(Class application, int expectedCode, @Nullable File artifactJar = buildAppArtifact(application, application.getSimpleName(), manifest); - String versionedApiPath = getVersionedAPIPath("apps/", apiVersion, namespace); + String versionedApiPath = getVersionedApiPath("apps/", apiVersion, namespace); HttpRequest.Builder builder = HttpRequest.post(getEndPoint(versionedApiPath).toURL()) - .addHeader(Constants.Gateway.API_KEY, "api-key-example") - .addHeader(AbstractAppFabricHttpHandler.ARCHIVE_NAME_HEADER, - String.format("%s-%s.jar", application.getSimpleName(), artifactVersion)); + .addHeader(Constants.Gateway.API_KEY, "api-key-example") + .addHeader(AbstractAppFabricHttpHandler.ARCHIVE_NAME_HEADER, + String.format("%s-%s.jar", application.getSimpleName(), artifactVersion)); if (appConfig != null) { builder.addHeader(AbstractAppFabricHttpHandler.APP_CONFIG_HEADER, GSON.toJson(appConfig)); @@ -602,22 +595,25 @@ protected HttpResponse deploy(Class application, int expectedCode, @Nullable Assert.fail( String.format( "Expected response code %d but got %d when trying to deploy app '%s' in namespace '%s'. " - + "Response message = '%s'", expectedCode, response.getResponseCode(), + + "Response message = '%s'", expectedCode, response.getResponseCode(), application.getName(), namespace, response.getResponseMessage())); } return response; } - protected String getVersionedAPIPath(String nonVersionedApiPath, String namespace) { - return getVersionedAPIPath(nonVersionedApiPath, Constants.Gateway.API_VERSION_3_TOKEN, namespace); + private HttpResponse executeDeploy(HttpRequest.Builder requestBuilder, + AppRequest appRequest) throws Exception { + requestBuilder.addHeader(Constants.Gateway.API_KEY, "api-key-example"); + requestBuilder.addHeader(HttpHeaderNames.CONTENT_TYPE.toString(), MediaType.APPLICATION_JSON); + requestBuilder.withBody(GSON.toJson(appRequest)); + return HttpRequests.execute(requestBuilder.build(), httpRequestConfig); } - protected String getVersionedInternalAPIPath(String nonVersionedApiPath, String namespace) { - Preconditions.checkArgument(namespace != null, "Namespace cannot be null for v3internal APIs."); - return String.format("/%s/namespaces/%s/%s", Gateway.INTERNAL_API_VERSION_3_TOKEN, namespace, nonVersionedApiPath); + protected String getVersionedApiPath(String nonVersionedApiPath, String namespace) { + return getVersionedApiPath(nonVersionedApiPath, Constants.Gateway.API_VERSION_3_TOKEN, namespace); } - protected String getVersionedAPIPath(String nonVersionedApiPath, String version, String namespace) { + protected String getVersionedApiPath(String nonVersionedApiPath, String version, String namespace) { if (!Constants.Gateway.API_VERSION_3_TOKEN.equals(version)) { throw new IllegalArgumentException( String.format("Unsupported version '%s'. Only v3 is supported.", version)); @@ -626,8 +622,13 @@ protected String getVersionedAPIPath(String nonVersionedApiPath, String version, return String.format("/%s/namespaces/%s/%s", version, namespace, nonVersionedApiPath); } + protected String getVersionedInternalApiPath(String nonVersionedApiPath, String namespace) { + Preconditions.checkArgument(namespace != null, "Namespace cannot be null for v3internal APIs."); + return String.format("/%s/namespaces/%s/%s", Gateway.INTERNAL_API_VERSION_3_TOKEN, namespace, nonVersionedApiPath); + } + protected List getAppList(String namespace) throws Exception { - HttpResponse response = doGet(getVersionedAPIPath("apps/?latestOnly=false", + HttpResponse response = doGet(getVersionedApiPath("apps/?latestOnly=false", Constants.Gateway.API_VERSION_3_TOKEN, namespace)); assertResponseCode(200, response); return readResponse(response, LIST_JSON_OBJECT_TYPE); @@ -674,7 +675,7 @@ protected JsonObject getAppListForPaginatedApi(String namespace, int pageSize, S uri += ("&sortCreationTime=" + sortCreationTime); } - HttpResponse response = doGet(getVersionedAPIPath(uri, + HttpResponse response = doGet(getVersionedApiPath(uri, Constants.Gateway.API_VERSION_3_TOKEN, namespace)); assertResponseCode(200, response); return readResponse(response, JsonObject.class); @@ -694,7 +695,7 @@ protected List getAppDetails(String namespace, ? Collections.singletonMap("appId", e.getFirst()) : ImmutableMap.of("appId", e.getFirst(), "version", e.getSecond())) .collect(Collectors.toList()); - HttpResponse response = doPost(getVersionedAPIPath("appdetail", Constants.Gateway.API_VERSION_3_TOKEN, namespace), + HttpResponse response = doPost(getVersionedApiPath("appdetail", Constants.Gateway.API_VERSION_3_TOKEN, namespace), GSON.toJson(request)); assertResponseCode(200, response); Assert.assertEquals("application/json", getFirstHeaderValue(response, HttpHeaderNames.CONTENT_TYPE.toString())); @@ -709,17 +710,19 @@ protected ApplicationDetail getAppDetails(String namespace, String appName) thro } protected HttpResponse getAppResponse(String namespace, String appName) throws Exception { - return doGet(getVersionedAPIPath(String.format("apps/%s", appName), + return doGet(getVersionedApiPath(String.format("apps/%s", appName), Constants.Gateway.API_VERSION_3_TOKEN, namespace)); } protected HttpResponse getAppResponse(String namespace, String appName, String appVersion) throws Exception { - return doGet(getVersionedAPIPath(String.format("apps/%s/versions/%s", appName, appVersion), + return doGet( + getVersionedApiPath(String.format("apps/%s/versions/%s", appName, appVersion), Constants.Gateway.API_VERSION_3_TOKEN, namespace)); } protected Set getAppVersions(String namespace, String appName) throws Exception { - HttpResponse response = doGet(getVersionedAPIPath(String.format("apps/%s/versions", appName), + HttpResponse response = doGet( + getVersionedApiPath(String.format("apps/%s/versions", appName), Constants.Gateway.API_VERSION_3_TOKEN, namespace)); assertResponseCode(200, response); Assert.assertEquals("application/json", getFirstHeaderValue(response, HttpHeaderNames.CONTENT_TYPE.toString())); @@ -739,10 +742,10 @@ protected ApplicationDetail getAppDetails(String namespace, String appName, Stri protected void assertSchedule(final Id.Program program, final String scheduleName, boolean scheduled, long timeout, TimeUnit timeoutUnit) throws Exception { Tasks.waitFor(scheduled, () -> { - String statusURL = getVersionedAPIPath(String.format("apps/%s/schedules/%s/status", + String statusUrl = getVersionedApiPath(String.format("apps/%s/schedules/%s/status", program.getApplicationId(), scheduleName), Constants.Gateway.API_VERSION_3_TOKEN, program.getNamespaceId()); - HttpResponse response = doGet(statusURL); + HttpResponse response = doGet(statusUrl); Preconditions.checkState(200 == response.getResponseCode()); Map result = GSON.fromJson(response.getResponseBodyAsString(), MAP_STRING_STRING_TYPE); return result != null && "SCHEDULED".equals(result.get("status")); @@ -750,27 +753,29 @@ protected void assertSchedule(final Id.Program program, final String scheduleNam } protected void deleteApp(Id.Application app, int expectedResponseCode) throws Exception { - HttpResponse response = doDelete(getVersionedAPIPath("apps/" + app.getId(), app.getNamespaceId())); + HttpResponse response = doDelete( + getVersionedApiPath("apps/" + app.getId(), app.getNamespaceId())); assertResponseCode(expectedResponseCode, response); } protected void deleteApp(ApplicationId app, int expectedResponseCode) throws Exception { // Changing to non version specific app deletion - since version specific app deletion isn't supported after LCM. - HttpResponse response = doDelete(getVersionedAPIPath( + HttpResponse response = doDelete(getVersionedApiPath( String.format("/apps/%s", app.getApplication()), app.getNamespace())); assertResponseCode(expectedResponseCode, response); } protected void deleteApp(final Id.Application app, int expectedResponseCode, long timeout, TimeUnit timeoutUnit) throws Exception { - String apiPath = getVersionedAPIPath("apps/" + app.getId(), app.getNamespaceId()); + String apiPath = getVersionedApiPath("apps/" + app.getId(), app.getNamespaceId()); Tasks.waitFor(expectedResponseCode, () -> doDelete(apiPath).getResponseCode(), timeout, timeoutUnit, 100, TimeUnit.MILLISECONDS); } protected void deleteArtifact(Id.Artifact artifact, int expectedResponseCode) throws Exception { String path = String.format("artifacts/%s/versions/%s", artifact.getName(), artifact.getVersion().getVersion()); - HttpResponse response = doDelete(getVersionedAPIPath(path, artifact.getNamespace().getId())); + HttpResponse response = doDelete( + getVersionedApiPath(path, artifact.getNamespace().getId())); assertResponseCode(expectedResponseCode, response); } @@ -932,7 +937,7 @@ protected void startProgram(ProgramId program, int expectedStatusCode) throws Ex */ protected void startProgram(String path, String namespaceId, Map args, int expectedStatusCode) throws Exception { - HttpResponse response = doPost(getVersionedAPIPath(path, namespaceId), GSON.toJson(args)); + HttpResponse response = doPost(getVersionedApiPath(path, namespaceId), GSON.toJson(args)); assertResponseCode(expectedStatusCode, response); } @@ -944,7 +949,7 @@ protected int restartPrograms(ApplicationId applicationId, long startTimeSeconds String path = String.format("apps/%s/versions/%s/restart-programs?start-time-seconds=%d&end-time-seconds=%d", applicationId.getApplication(), applicationId.getVersion(), startTimeSeconds, endTimeSeconds); - String versionedPath = getVersionedAPIPath(path, Constants.Gateway.API_VERSION_3_TOKEN, + String versionedPath = getVersionedApiPath(path, Constants.Gateway.API_VERSION_3_TOKEN, applicationId.getNamespace()); HttpResponse response = doPut(versionedPath, null); return response.getResponseCode(); @@ -958,7 +963,7 @@ protected void debugProgram(Id.Program program, int expectedStatusCode) throws E program.getApplicationId(), program.getType().getCategoryName(), program.getId()); - HttpResponse response = doPost(getVersionedAPIPath(path, program.getNamespaceId()), + HttpResponse response = doPost(getVersionedApiPath(path, program.getNamespaceId()), GSON.toJson(ImmutableMap.of())); assertResponseCode(expectedStatusCode, response); } @@ -971,7 +976,7 @@ protected void debugProgram(ProgramId programId, int expectedStatusCode) throws programId.getApplication(), programId.getType().getCategoryName(), programId.getProgram()); - HttpResponse response = doPost(getVersionedAPIPath(path, programId.getNamespace()), + HttpResponse response = doPost(getVersionedApiPath(path, programId.getNamespace()), GSON.toJson(ImmutableMap.of())); assertResponseCode(expectedStatusCode, response); } @@ -1030,7 +1035,7 @@ protected void stopProgram(ProgramId program, @Nullable String runId, int expect private void stopProgram(String path, String namespaceId, int expectedStatusCode, String expectedMessage) throws Exception { - HttpResponse response = doPost(getVersionedAPIPath(path, namespaceId)); + HttpResponse response = doPost(getVersionedApiPath(path, namespaceId)); assertResponseCode(expectedStatusCode, response); if (expectedMessage != null) { Assert.assertEquals(expectedMessage, response.getResponseBodyAsString()); @@ -1045,7 +1050,7 @@ protected void performInvalidProgramAction(Id.Program program, int expectedStatu program.getApplicationId(), program.getType().getCategoryName(), program.getId()); - HttpResponse response = doPost(getVersionedAPIPath(path, program.getNamespaceId()), + HttpResponse response = doPost(getVersionedApiPath(path, program.getNamespaceId()), GSON.toJson(ImmutableMap.of())); assertResponseCode(expectedStatusCode, response); } @@ -1058,7 +1063,7 @@ protected void waitState(final Id.Program programId, String state) throws Except String path = String.format("apps/%s/%s/%s/status", programId.getApplicationId(), programId.getType().getCategoryName(), programId.getId()); - HttpResponse response = doGet(getVersionedAPIPath(path, programId.getNamespaceId())); + HttpResponse response = doGet(getVersionedApiPath(path, programId.getNamespaceId())); if (response.getResponseCode() == 404) { return null; } @@ -1079,7 +1084,7 @@ protected void waitState(final ProgramId programId, String state) throws Excepti programId.getApplication(), programId.getVersion(), programId.getType().getCategoryName(), programId.getProgram()); - HttpResponse response = doGet(getVersionedAPIPath(path, programId.getNamespace())); + HttpResponse response = doGet(getVersionedApiPath(path, programId.getNamespace())); if (response.getResponseCode() == 404) { return null; } @@ -1105,18 +1110,6 @@ protected String getProgramStatus(Id.Program program) throws Exception { return getStatus(programStatus(program)); } - protected void programStatus(Id.Program program, int expectedStatus) throws Exception { - assertResponseCode(expectedStatus, programStatus(program)); - } - - private HttpResponse programStatus(Id.Program program) throws Exception { - String path = String.format("apps/%s/%s/%s/status", - program.getApplicationId(), - program.getType().getCategoryName(), - program.getId()); - return doGet(getVersionedAPIPath(path, program.getNamespaceId())); - } - /** * Waits for the given program to transit to the given state. */ @@ -1127,12 +1120,24 @@ protected String getProgramStatus(final ProgramId programId) throws Exception { programId.getVersion(), programId.getType().getCategoryName(), programId.getProgram()); - HttpResponse response = doGet(getVersionedAPIPath(path, programId.getNamespace())); + HttpResponse response = doGet(getVersionedApiPath(path, programId.getNamespace())); assertResponseCode(200, response); Map o = GSON.fromJson(response.getResponseBodyAsString(), MAP_STRING_STRING_TYPE); return o.get("status"); } + protected void programStatus(Id.Program program, int expectedStatus) throws Exception { + assertResponseCode(expectedStatus, programStatus(program)); + } + + private HttpResponse programStatus(Id.Program program) throws Exception { + String path = String.format("apps/%s/%s/%s/status", + program.getApplicationId(), + program.getType().getCategoryName(), + program.getId()); + return doGet(getVersionedApiPath(path, program.getNamespaceId())); + } + private String getStatus(HttpResponse response) { assertResponseCode(200, response); Map o = GSON.fromJson(response.getResponseBodyAsString(), MAP_STRING_STRING_TYPE); @@ -1142,7 +1147,7 @@ private String getStatus(HttpResponse response) { protected int reEnableSchedules(String namespace, long startTimeMillis, long endTimeMillis) throws Exception { String scheduleSuspend = String.format("schedules/re-enable?start-time-millis=%d&end-time-millis=%d", startTimeMillis, endTimeMillis); - String versionedScheduledSuspend = getVersionedAPIPath(scheduleSuspend, Constants.Gateway.API_VERSION_3_TOKEN, + String versionedScheduledSuspend = getVersionedApiPath(scheduleSuspend, Constants.Gateway.API_VERSION_3_TOKEN, namespace); HttpResponse response = doPut(versionedScheduledSuspend, null); return response.getResponseCode(); @@ -1151,7 +1156,7 @@ protected int reEnableSchedules(String namespace, long startTimeMillis, long end // suspend the latest version schedule protected int suspendSchedule(String namespace, String appName, String schedule) throws Exception { String scheduleSuspend = String.format("apps/%s/schedules/%s/suspend", appName, schedule); - String versionedScheduledSuspend = getVersionedAPIPath(scheduleSuspend, Constants.Gateway.API_VERSION_3_TOKEN, + String versionedScheduledSuspend = getVersionedApiPath(scheduleSuspend, Constants.Gateway.API_VERSION_3_TOKEN, namespace); HttpResponse response = doPost(versionedScheduledSuspend); return response.getResponseCode(); @@ -1160,7 +1165,7 @@ protected int suspendSchedule(String namespace, String appName, String schedule) // resume the latest version schedule protected int resumeSchedule(String namespace, String appName, String schedule) throws Exception { String scheduleResume = String.format("apps/%s/schedules/%s/resume", appName, schedule); - HttpResponse response = doPost(getVersionedAPIPath(scheduleResume, Constants.Gateway.API_VERSION_3_TOKEN, + HttpResponse response = doPost(getVersionedApiPath(scheduleResume, Constants.Gateway.API_VERSION_3_TOKEN, namespace)); return response.getResponseCode(); } @@ -1169,7 +1174,7 @@ protected int resumeSchedule(String namespace, String appName, String schedule) protected void performInvalidScheduleAction(String namespace, String appName, String schedule, int expectedStatusCode) throws Exception { String scheduleResume = String.format("apps/%s/schedules/%s/invalidAction", appName, schedule); - HttpResponse response = doPost(getVersionedAPIPath(scheduleResume, Constants.Gateway.API_VERSION_3_TOKEN, + HttpResponse response = doPost(getVersionedApiPath(scheduleResume, Constants.Gateway.API_VERSION_3_TOKEN, namespace)); Assert.assertEquals(expectedStatusCode, response.getResponseCode()); } @@ -1243,7 +1248,7 @@ protected List getSchedules(String namespace, String appName, St } private List doGetSchedules(String namespace, String schedulesUrl) throws Exception { - String versionedUrl = getVersionedAPIPath(schedulesUrl, namespace); + String versionedUrl = getVersionedApiPath(schedulesUrl, namespace); HttpResponse response = doGet(versionedUrl); assertResponseCode(HttpResponseStatus.OK.code(), response); return readResponse(response, Schedulers.SCHEDULE_DETAILS_TYPE); @@ -1252,39 +1257,39 @@ private List doGetSchedules(String namespace, String schedulesUr protected HttpResponse addSchedule(String namespace, String appName, String scheduleName, ScheduleDetail schedule) throws Exception { String path = String.format("apps/%s/schedules/%s", appName, scheduleName); - return doPut(getVersionedAPIPath(path, namespace), GSON.toJson(schedule)); + return doPut(getVersionedApiPath(path, namespace), GSON.toJson(schedule)); } protected HttpResponse enableSchedule(String namespace, String appName, @Nullable String appVersion, String scheduleName) throws Exception { appVersion = appVersion == null ? ApplicationId.DEFAULT_VERSION : appVersion; String path = String.format("apps/%s/versions/%s/schedules/%s/enable", appName, appVersion, scheduleName); - return doPost(getVersionedAPIPath(path, namespace)); + return doPost(getVersionedApiPath(path, namespace)); } protected HttpResponse deleteSchedule(String namespace, String appName, String scheduleName) throws Exception { String path = String.format("apps/%s/schedules/%s", appName, scheduleName); - return doDelete(getVersionedAPIPath(path, namespace)); + return doDelete(getVersionedApiPath(path, namespace)); } protected HttpResponse updateSchedule(String namespace, String appName, String scheduleName, ScheduleDetail scheduleDetail) throws Exception { String path = String.format("apps/%s/schedules/%s/update", appName, scheduleName); - return doPost(getVersionedAPIPath(path, namespace), GSON.toJson(scheduleDetail)); + return doPost(getVersionedApiPath(path, namespace), GSON.toJson(scheduleDetail)); } protected ScheduleDetail getSchedule(String namespace, String appName, @Nullable String appVersion, String scheduleName) throws Exception { appVersion = appVersion == null ? ApplicationId.DEFAULT_VERSION : appVersion; String path = String.format("apps/%s/versions/%s/schedules/%s", appName, appVersion, scheduleName); - HttpResponse response = doGet(getVersionedAPIPath(path, namespace)); + HttpResponse response = doGet(getVersionedApiPath(path, namespace)); assertResponseCode(HttpResponseStatus.OK.code(), response); return readResponse(response, ScheduleDetail.class); } protected ScheduleDetail getSchedule(String namespace, String appName, String scheduleName) throws Exception { String path = String.format("apps/%s/schedules/%s", appName, scheduleName); - HttpResponse response = doGet(getVersionedAPIPath(path, namespace)); + HttpResponse response = doGet(getVersionedApiPath(path, namespace)); assertResponseCode(HttpResponseStatus.OK.code(), response); return readResponse(response, ScheduleDetail.class); } @@ -1298,7 +1303,7 @@ protected ScheduleDetail getSchedule(String namespace, String appName, String sc protected List getScheduledRunTimes(ProgramId programId, boolean next) throws Exception { String nextRunTimeUrl = String.format("apps/%s/workflows/%s/%sruntime", programId.getApplication(), programId.getProgram(), next ? "next" : "previous"); - String versionedUrl = getVersionedAPIPath(nextRunTimeUrl, Constants.Gateway.API_VERSION_3_TOKEN, + String versionedUrl = getVersionedApiPath(nextRunTimeUrl, Constants.Gateway.API_VERSION_3_TOKEN, programId.getNamespace()); HttpResponse response = doGet(versionedUrl); assertResponseCode(200, response); @@ -1319,7 +1324,7 @@ protected List getScheduledRunTimes(String namespace, Assert.assertTrue(programIds.stream().map(ProgramId::getNamespace).allMatch(namespace::equals)); String url = String.format("%sruntime", next ? "next" : "previous"); - String versionedUrl = getVersionedAPIPath(url, Constants.Gateway.API_VERSION_3_TOKEN, namespace); + String versionedUrl = getVersionedApiPath(url, Constants.Gateway.API_VERSION_3_TOKEN, namespace); List batchPrograms = programIds.stream() .map(id -> new BatchProgram(id.getApplication(), id.getType(), id.getProgram())) @@ -1371,12 +1376,20 @@ protected void verifyProgramRuns(final Id.Program program, final ProgramRunStatu Tasks.waitFor(true, () -> getProgramRuns(program, status).size() > expected, 60, TimeUnit.SECONDS); } + protected void verifyProgramRuns(final ProgramId program, ProgramRunStatus status) throws Exception { + verifyProgramRuns(program, status, 0); + } + + private void verifyProgramRuns(ProgramId program, ProgramRunStatus status, int expected) throws Exception { + Tasks.waitFor(true, () -> getProgramRuns(program, status).size() > expected, 60, TimeUnit.SECONDS); + } + protected List getProgramRuns(NamespaceId namespace, List programs) throws Exception { List request = programs.stream() .map(program -> new BatchProgram(program.getApplication(), program.getType(), program.getProgram())) .collect(Collectors.toList()); - HttpResponse response = doPost(getVersionedAPIPath("runs", namespace.getNamespace()), GSON.toJson(request)); + HttpResponse response = doPost(getVersionedApiPath("runs", namespace.getNamespace()), GSON.toJson(request)); assertResponseCode(200, response); return GSON.fromJson(response.getResponseBodyAsString(), BATCH_PROGRAM_RUNS_TYPE); } @@ -1384,7 +1397,7 @@ protected List getProgramRuns(NamespaceId namespace, List

getProgramRuns(Id.Program program, ProgramRunStatus status) throws Exception { String path = String.format("apps/%s/%s/%s/runs?status=%s", program.getApplicationId(), program.getType().getCategoryName(), program.getId(), status.name()); - HttpResponse response = doGet(getVersionedAPIPath(path, program.getNamespaceId())); + HttpResponse response = doGet(getVersionedApiPath(path, program.getNamespaceId())); assertResponseCode(200, response); return GSON.fromJson(response.getResponseBodyAsString(), LIST_RUN_RECORD_TYPE); } @@ -1392,14 +1405,14 @@ protected List getProgramRuns(Id.Program program, ProgramRunStatus st protected int getProgramRunRecord(Id.Program program, String runId) throws Exception { String path = String.format("apps/%s/%s/%s/runs/%s", program.getApplicationId(), program.getType().getCategoryName(), program.getId(), runId); - HttpResponse response = doGet(getVersionedAPIPath(path, program.getNamespaceId())); + HttpResponse response = doGet(getVersionedApiPath(path, program.getNamespaceId())); return response.getResponseCode(); } protected long getProgramRunCount(ProgramReference programRef) throws Exception { String path = String.format("apps/%s/%s/%s/runcount", programRef.getApplication(), programRef.getType().getCategoryName(), programRef.getProgram()); - HttpResponse response = doGet(getVersionedAPIPath(path, programRef.getNamespace())); + HttpResponse response = doGet(getVersionedApiPath(path, programRef.getNamespace())); Assert.assertEquals(200, response.getResponseCode()); return Long.parseLong(response.getResponseBodyAsString()); } @@ -1407,7 +1420,7 @@ protected long getProgramRunCount(ProgramReference programRef) throws Exception protected long getProgramRunCount(ProgramId programId) throws Exception { String path = String.format("apps/%s/versions/%s/%s/%s/runcount", programId.getApplication(), programId.getVersion(), programId.getType().getCategoryName(), programId.getProgram()); - HttpResponse response = doGet(getVersionedAPIPath(path, programId.getNamespace())); + HttpResponse response = doGet(getVersionedApiPath(path, programId.getNamespace())); Assert.assertEquals(200, response.getResponseCode()); return Long.parseLong(response.getResponseBodyAsString()); } @@ -1417,15 +1430,7 @@ protected void validateProgramRunCountResponse(ProgramReference programRef, int String path = String.format("apps/%s/%s/%s/runcount", programRef.getApplication(), programRef.getType().getCategoryName(), programRef.getProgram()); Assert.assertEquals(expectedStatusCode, - doGet(getVersionedAPIPath(path, programRef.getNamespace())).getResponseCode()); - } - - protected void verifyProgramRuns(final ProgramId program, ProgramRunStatus status) throws Exception { - verifyProgramRuns(program, status, 0); - } - - private void verifyProgramRuns(ProgramId program, ProgramRunStatus status, int expected) throws Exception { - Tasks.waitFor(true, () -> getProgramRuns(program, status).size() > expected, 60, TimeUnit.SECONDS); + doGet(getVersionedApiPath(path, programRef.getNamespace())).getResponseCode()); } protected void assertProgramRuns(final ProgramId program, final ProgramRunStatus status, final int expected) @@ -1437,7 +1442,7 @@ protected List getProgramRuns(ProgramId program, ProgramRunStatus sta String path = String.format("apps/%s/versions/%s/%s/%s/runs?status=%s", program.getApplication(), program.getVersion(), program.getType().getCategoryName(), program.getProgram(), status.toString()); - HttpResponse response = doGet(getVersionedAPIPath(path, program.getNamespace())); + HttpResponse response = doGet(getVersionedApiPath(path, program.getNamespace())); assertResponseCode(200, response); return GSON.fromJson(response.getResponseBodyAsString(), LIST_RUN_RECORD_TYPE); } @@ -1502,20 +1507,20 @@ protected HttpResponse listApplicationsFromRepository(String namespace) throws E return doGet(String.format("%s/namespaces/%s/repository/apps", Constants.Gateway.API_VERSION_3, namespace)); } - protected String getPreferenceURI() { + protected String getPreferenceUri() { return ""; } - protected String getPreferenceURI(String namespace) { - return String.format("%s/namespaces/%s", getPreferenceURI(), namespace); + protected String getPreferenceUri(String namespace) { + return String.format("%s/namespaces/%s", getPreferenceUri(), namespace); } - protected String getPreferenceURI(String namespace, String appId) { - return String.format("%s/apps/%s", getPreferenceURI(namespace), appId); + protected String getPreferenceUri(String namespace, String appId) { + return String.format("%s/apps/%s", getPreferenceUri(namespace), appId); } - protected String getPreferenceURI(String namespace, String appId, String programType, String programId) { - return String.format("%s/%s/%s", getPreferenceURI(namespace, appId), programType, programId); + protected String getPreferenceUri(String namespace, String appId, String programType, String programId) { + return String.format("%s/%s/%s", getPreferenceUri(namespace, appId), programType, programId); } protected void setPreferences(String uri, Map props, int expectedStatus) throws Exception { diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/AppLifecycleHttpHandlerTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/AppLifecycleHttpHandlerTest.java index 4ec5c6e71aa6..1ab8a7f8bddb 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/AppLifecycleHttpHandlerTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/AppLifecycleHttpHandlerTest.java @@ -111,7 +111,7 @@ public class AppLifecycleHttpHandlerTest extends AppFabricTestBase { @BeforeClass public static void beforeClass() throws Throwable { - cConf = createBasicCConf(); + cConf = createBasicCconf(); initializeAndStartServices(cConf); } @@ -168,7 +168,7 @@ public void testDeployNonExistingNamespace() throws Exception { @Test public void testDeployValid() throws Exception { deploy(AllProgramsApp.class, 200, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1); - HttpResponse response = doDelete(getVersionedAPIPath("apps/", + HttpResponse response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); } @@ -263,7 +263,7 @@ public void testDeployUsingArtifact() throws Exception { Assert.assertEquals(GSON.toJson(config), appDetails.getConfiguration()); Assert.assertEquals(200, - doDelete(getVersionedAPIPath("apps/" + appId.getId(), appId.getNamespaceId())).getResponseCode()); + doDelete(getVersionedApiPath("apps/" + appId.getId(), appId.getNamespaceId())).getResponseCode()); } @Test @@ -316,7 +316,7 @@ public void testOwnerUsingArtifact() throws Exception { // clean up the app Assert.assertEquals(200, - doDelete(getVersionedAPIPath("apps/" + applicationId.getApplication(), + doDelete(getVersionedApiPath("apps/" + applicationId.getApplication(), applicationId.getNamespace())).getResponseCode()); // deletion of app should delete the dataset owner information as they themselves are not deleted @@ -342,7 +342,7 @@ public void testOwnerInHeaders() throws Exception { // cleanup app Assert.assertEquals(200, - doDelete(getVersionedAPIPath("apps/" + applicationId.getApplication(), + doDelete(getVersionedApiPath("apps/" + applicationId.getApplication(), applicationId.getNamespace())).getResponseCode()); // cleanup @@ -631,7 +631,7 @@ public void testDeployInvalid() throws Exception { public void testDeployFailure() throws Exception { deploy(AppWithDataset.class, 200, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1); deploy(AppWithDatasetDuplicate.class, 400, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1); - HttpResponse response = doDelete(getVersionedAPIPath("apps/", + HttpResponse response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); List apps = getAppList(TEST_NAMESPACE1); @@ -640,7 +640,7 @@ public void testDeployFailure() throws Exception { @Test public void testListNonExistentNamespace() throws Exception { - HttpResponse response = doGet(getVersionedAPIPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, + HttpResponse response = doGet(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, NONEXISTENT_NAMESPACE)); Assert.assertEquals(404, response.getResponseCode()); } @@ -679,7 +679,7 @@ public void testListAndGetForPaginatedAPI() throws Exception { Assert.assertFalse(emptyListReceived); //delete app in testnamespace1 - HttpResponse response = doDelete(getVersionedAPIPath("apps/", + HttpResponse response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); List apps = getAppList(TEST_NAMESPACE1); @@ -720,7 +720,7 @@ public void testListAndGetForPaginatedAPIWithEmptyLastPage() throws Exception { Assert.assertTrue(emptyListReceived); //delete app in testnamespace1 - HttpResponse response = doDelete(getVersionedAPIPath("apps/", + HttpResponse response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); List apps = getAppList(TEST_NAMESPACE1); @@ -766,7 +766,7 @@ public void testListAndGetForPaginatedAPIWithFiltering() throws Exception { Assert.assertTrue(emptyListReceived); //delete app in testnamespace1 - HttpResponse response = doDelete(getVersionedAPIPath("apps/", + HttpResponse response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); List apps = getAppList(TEST_NAMESPACE1); @@ -808,7 +808,7 @@ public void testListAndGetForPaginatedAPIWithNameFilterType() throws Exception { Assert.assertEquals(2, currentResultSize2); //delete app in testnamespace1 - HttpResponse response = doDelete(getVersionedAPIPath("apps/", + HttpResponse response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); List apps = getAppList(TEST_NAMESPACE1); @@ -875,7 +875,7 @@ public void testListAndGetForPaginatedAPIWithLatestOnlyLCMFlagEnabled() throws E Assert.assertEquals(2, currentResultSize); //delete app in testnamespace1 - HttpResponse response = doDelete(getVersionedAPIPath("apps/", + HttpResponse response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); List apps = getAppList(TEST_NAMESPACE1); @@ -938,7 +938,7 @@ public void testListAndGetLCMFlagEnabledForVersionHistory() throws Exception { Assert.assertEquals(creationTimeDescSorted, creationTimeList); //delete app in testnamespace1 - HttpResponse response = doDelete(getVersionedAPIPath("apps/", + HttpResponse response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); List apps = getAppList(TEST_NAMESPACE1); @@ -1013,13 +1013,13 @@ public void testListAndGet() throws Exception { Assert.assertEquals(ns2AppName, apps.get(0).get("name").getAsString()); //delete app in testnamespace1 - response = doDelete(getVersionedAPIPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); + response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); apps = getAppList(TEST_NAMESPACE1); Assert.assertTrue(apps.isEmpty()); //delete app in testnamespace2 - response = doDelete(getVersionedAPIPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); + response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); Assert.assertEquals(200, response.getResponseCode()); deleteArtifact(ns2ArtifactId, 200); @@ -1099,13 +1099,13 @@ public void testListAndGetLCMFlagEnabled() throws Exception { Assert.assertEquals(2, ns2Apps.get(ns2AppName).size()); //delete app in testnamespace1 - response = doDelete(getVersionedAPIPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); + response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); apps = getAppList(TEST_NAMESPACE1); Assert.assertTrue(apps.isEmpty()); //delete app in testnamespace2 - response = doDelete(getVersionedAPIPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); + response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); Assert.assertEquals(200, response.getResponseCode()); deleteArtifact(ns2ArtifactId, 200); @@ -1137,7 +1137,7 @@ public void testListAndGetWithScanApplicationsException() throws Exception { @Test public void testDelete() throws Exception { // Delete an non-existing app - HttpResponse response = doDelete(getVersionedAPIPath("apps/XYZ", Constants.Gateway.API_VERSION_3_TOKEN, + HttpResponse response = doDelete(getVersionedApiPath("apps/XYZ", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(404, response.getResponseCode()); @@ -1160,7 +1160,8 @@ public void testDelete() throws Exception { startProgram(program); waitState(program, "RUNNING"); // Try to delete an App while its service is running - response = doDelete(getVersionedAPIPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, + response = doDelete( + getVersionedApiPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(409, response.getResponseCode()); Assert.assertEquals("'" + appReference @@ -1174,7 +1175,7 @@ public void testDelete() throws Exception { startProgram(program); waitState(program, "RUNNING"); // Try to delete all Apps while service is running - response = doDelete(getVersionedAPIPath("apps", Constants.Gateway.API_VERSION_3_TOKEN, + response = doDelete(getVersionedApiPath("apps", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(409, response.getResponseCode()); Assert.assertEquals("'" + program.getNamespace() @@ -1187,12 +1188,12 @@ public void testDelete() throws Exception { // Delete the app in the wrong namespace response = doDelete( - getVersionedAPIPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, + getVersionedApiPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); Assert.assertEquals(404, response.getResponseCode()); // Delete an non-existing app with version - response = doDelete(getVersionedAPIPath("apps/XYZ/versions/" + VERSION1, + response = doDelete(getVersionedApiPath("apps/XYZ/versions/" + VERSION1, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(404, response.getResponseCode()); @@ -1211,7 +1212,7 @@ public void testDelete() throws Exception { startProgram(program1, 200); waitState(program1, "RUNNING"); // Try to delete an App while its service is running - response = doDelete(getVersionedAPIPath( + response = doDelete(getVersionedApiPath( String.format("apps/%s/versions/%s", appId.getApplication(), appId.getVersion()), Constants.Gateway.API_VERSION_3_TOKEN, appId.getNamespace())); Assert.assertEquals(409, response.getResponseCode()); @@ -1223,31 +1224,34 @@ public void testDelete() throws Exception { waitState(program1, "STOPPED"); // Delete the app with version in the wrong namespace - response = doDelete(getVersionedAPIPath( + response = doDelete(getVersionedApiPath( String.format("apps/%s/versions/%s", appId.getApplication(), appId.getVersion()), Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); Assert.assertEquals(404, response.getResponseCode()); //Delete the app with version after stopping the service - response = doDelete(getVersionedAPIPath( + response = doDelete(getVersionedApiPath( String.format("apps/%s/versions/%s", appId.getApplication(), appId.getVersion()), Constants.Gateway.API_VERSION_3_TOKEN, appId.getNamespace())); Assert.assertEquals(200, response.getResponseCode()); - response = doDelete(getVersionedAPIPath( + response = doDelete(getVersionedApiPath( String.format("apps/%s/versions/%s", appId.getApplication(), appId.getVersion()), Constants.Gateway.API_VERSION_3_TOKEN, appId.getNamespace())); Assert.assertEquals(404, response.getResponseCode()); //Delete the App after stopping the service - response = doDelete(getVersionedAPIPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, + response = doDelete( + getVersionedApiPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); - response = doDelete(getVersionedAPIPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, + response = doDelete( + getVersionedApiPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(404, response.getResponseCode()); // deleting the app should not delete the artifact - response = doGet(getVersionedAPIPath("artifacts/" + artifactId.getName(), Constants.Gateway.API_VERSION_3_TOKEN, + response = doGet( + getVersionedApiPath("artifacts/" + artifactId.getName(), Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); @@ -1280,7 +1284,7 @@ public void testDeleteState() throws Exception { Assert.assertEquals(testDataString, new String(state.get(), StandardCharsets.UTF_8)); // delete state String deleteStateUrl = String.format("apps/%s/state", AllProgramsApp.NAME); - String versionedStateDeletePath = getVersionedAPIPath(deleteStateUrl, + String versionedStateDeletePath = getVersionedApiPath(deleteStateUrl, Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1); doDelete(versionedStateDeletePath); // verify that state does not exist @@ -1290,7 +1294,7 @@ public void testDeleteState() throws Exception { // cleanup Assert.assertEquals(200, - doDelete(getVersionedAPIPath("apps/" + AllProgramsApp.NAME, + doDelete(getVersionedApiPath("apps/" + AllProgramsApp.NAME, TEST_NAMESPACE1)).getResponseCode()); } @@ -1301,7 +1305,7 @@ public void testDeleteState() throws Exception { public void testDeleteLCMFlagEnabled() throws Exception { setLCMFlag(true); // Delete an non-existing app - HttpResponse response = doDelete(getVersionedAPIPath("apps/XYZ", Constants.Gateway.API_VERSION_3_TOKEN, + HttpResponse response = doDelete(getVersionedApiPath("apps/XYZ", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(404, response.getResponseCode()); @@ -1319,7 +1323,8 @@ public void testDeleteLCMFlagEnabled() throws Exception { startProgram(program); waitState(program, "RUNNING"); // Try to delete an App while its service is running - response = doDelete(getVersionedAPIPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, + response = doDelete( + getVersionedApiPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(409, response.getResponseCode()); Assert.assertEquals("'" + applicationId @@ -1333,7 +1338,7 @@ public void testDeleteLCMFlagEnabled() throws Exception { startProgram(program); waitState(program, "RUNNING"); // Try to delete all Apps while service is running - response = doDelete(getVersionedAPIPath("apps", Constants.Gateway.API_VERSION_3_TOKEN, + response = doDelete(getVersionedApiPath("apps", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(409, response.getResponseCode()); Assert.assertEquals("'" + program.getNamespace() @@ -1346,12 +1351,12 @@ public void testDeleteLCMFlagEnabled() throws Exception { // Delete the app in the wrong namespace response = doDelete( - getVersionedAPIPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, + getVersionedApiPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); Assert.assertEquals(404, response.getResponseCode()); // Delete an non-existing app with version - response = doDelete(getVersionedAPIPath("apps/XYZ", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); + response = doDelete(getVersionedApiPath("apps/XYZ", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(404, response.getResponseCode()); // Deploy an app with version @@ -1369,7 +1374,7 @@ public void testDeleteLCMFlagEnabled() throws Exception { startProgram(program1, 200); waitState(program1, "RUNNING"); // Try to delete an App while its service is running - response = doDelete(getVersionedAPIPath( + response = doDelete(getVersionedApiPath( String.format("apps/%s", appId.getApplication()), Constants.Gateway.API_VERSION_3_TOKEN, appId.getNamespace())); Assert.assertEquals(409, response.getResponseCode()); @@ -1384,31 +1389,34 @@ public void testDeleteLCMFlagEnabled() throws Exception { waitState(program1, "STOPPED"); // Delete the app with version in the wrong namespace - response = doDelete(getVersionedAPIPath( + response = doDelete(getVersionedApiPath( String.format("apps/%s", appId.getApplication()), Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); Assert.assertEquals(404, response.getResponseCode()); //Delete the app with version after stopping the service - response = doDelete(getVersionedAPIPath( + response = doDelete(getVersionedApiPath( String.format("apps/%s", appId.getApplication()), Constants.Gateway.API_VERSION_3_TOKEN, appId.getNamespace())); Assert.assertEquals(200, response.getResponseCode()); - response = doDelete(getVersionedAPIPath( + response = doDelete(getVersionedApiPath( String.format("apps/%s", appId.getApplication()), Constants.Gateway.API_VERSION_3_TOKEN, appId.getNamespace())); Assert.assertEquals(404, response.getResponseCode()); //Delete the App after stopping the service - response = doDelete(getVersionedAPIPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, + response = doDelete( + getVersionedApiPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); - response = doDelete(getVersionedAPIPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, + response = doDelete( + getVersionedApiPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(404, response.getResponseCode()); // deleting the app should not delete the artifact - response = doGet(getVersionedAPIPath("artifacts/" + artifactId.getName(), Constants.Gateway.API_VERSION_3_TOKEN, + response = doGet( + getVersionedApiPath("artifacts/" + artifactId.getName(), Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); @@ -1430,7 +1438,7 @@ public void testDeleteVersionedAppLCMEnabled() throws Exception { deploy(AllProgramsApp.class, 200, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1); ApplicationDetail appDetails = getAppDetails(TEST_NAMESPACE1, AllProgramsApp.NAME); - HttpResponse response = doDelete(getVersionedAPIPath( + HttpResponse response = doDelete(getVersionedApiPath( String.format("apps/%s/versions/%s", AllProgramsApp.NAME, appDetails.getAppVersion()), Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(403, response.getResponseCode()); @@ -1491,6 +1499,6 @@ private static class ExtraConfig extends Config { } protected HttpResponse getAppListResponseWhenFailingWithException(String namespace) throws Exception { - return doGet(getVersionedAPIPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, namespace)); + return doGet(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, namespace)); } } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/PreferencesHttpHandlerInternalTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/PreferencesHttpHandlerInternalTest.java index 13cc80c823fa..50ed53a9db23 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/PreferencesHttpHandlerInternalTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/PreferencesHttpHandlerInternalTest.java @@ -114,9 +114,9 @@ public void testInstance() throws Exception { @Test public void testNamespace() throws Exception { - String uriInstance = getPreferenceURI(); - String uriNamespace1 = getPreferenceURI(TEST_NAMESPACE1); - String uriNamespace2 = getPreferenceURI(TEST_NAMESPACE2); + String uriInstance = getPreferenceUri(); + String uriNamespace1 = getPreferenceUri(TEST_NAMESPACE1); + String uriNamespace2 = getPreferenceUri(TEST_NAMESPACE2); PreferencesDetail detail1 = null; PreferencesDetail detail2 = null; @@ -212,7 +212,7 @@ public void testNamespace() throws Exception { Assert.assertEquals(detail1, detail2); // Get preferences on invalid namespace should succeed, but get back a PreferencesDetail with empty property. - PreferencesDetail detail = getPreferencesInternal(getPreferenceURI("invalidNamespace"), false, + PreferencesDetail detail = getPreferencesInternal(getPreferenceUri("invalidNamespace"), false, HttpResponseStatus.OK); Assert.assertTrue(detail.getProperties().isEmpty()); Assert.assertFalse(detail.getResolved()); @@ -223,14 +223,15 @@ public void testNamespace() throws Exception { public void testApplication() throws Exception { String appName = AllProgramsApp.NAME; String namespace1 = TEST_NAMESPACE1; - String uriInstance = getPreferenceURI(); - String uriNamespace1 = getPreferenceURI(namespace1); - String uriApp = getPreferenceURI(namespace1, appName); + String uriInstance = getPreferenceUri(); + String uriNamespace1 = getPreferenceUri(namespace1); + String uriApp = getPreferenceUri(namespace1, appName); PreferencesDetail detail; Map combinedProperties = Maps.newHashMap(); // Application not created yet. Get preferences should succeed and get back one with empty properties. - detail = getPreferencesInternal(getPreferenceURI(namespace1, "some_non_existing_app"), false, + detail = getPreferencesInternal( + getPreferenceUri(namespace1, "some_non_existing_app"), false, HttpResponseStatus.OK); Assert.assertTrue(detail.getProperties().isEmpty()); Assert.assertFalse(detail.getResolved()); @@ -241,7 +242,7 @@ public void testApplication() throws Exception { Map propMap = Maps.newHashMap(); Assert.assertEquals(propMap, getPreferences(uriApp, false, 200)); Assert.assertEquals(propMap, getPreferences(uriApp, true, 200)); - getPreferences(getPreferenceURI(namespace1, "InvalidAppName"), false, 404); + getPreferences(getPreferenceUri(namespace1, "InvalidAppName"), false, 404); // Application created but no preferences created yet. API call still succeeds but result is empty. detail = getPreferencesInternal(uriApp, false, HttpResponseStatus.OK); @@ -315,10 +316,10 @@ public void testApplication() throws Exception { @Test public void testProgram() throws Exception { - String uriInstance = getPreferenceURI(); + String uriInstance = getPreferenceUri(); String namespace2 = TEST_NAMESPACE2; String appName = AllProgramsApp.NAME; - String uriNamespace2Service = getPreferenceURI(namespace2, appName, "services", AllProgramsApp.NoOpService.NAME); + String uriNamespace2Service = getPreferenceUri(namespace2, appName, "services", AllProgramsApp.NoOpService.NAME); PreferencesDetail detail; Map programProperties = Maps.newHashMap(); @@ -326,11 +327,12 @@ public void testProgram() throws Exception { addApplication(namespace2, new AllProgramsApp()); // Get preferences on invalid program type - getPreferencesInternal(getPreferenceURI( + getPreferencesInternal(getPreferenceUri( namespace2, appName, "invalidType", "somename"), false, HttpResponseStatus.BAD_REQUEST); // Get preferences on non-existing program id. Should succeed and get back a PreferencesDetail with empty properites - detail = getPreferencesInternal(getPreferenceURI(namespace2, appName, "services", "somename"), + detail = getPreferencesInternal( + getPreferenceUri(namespace2, appName, "services", "somename"), false, HttpResponseStatus.OK); Assert.assertTrue(detail.getProperties().isEmpty()); diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/PreferencesHttpHandlerTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/PreferencesHttpHandlerTest.java index 13d4e68254a1..ab5a1c7718b2 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/PreferencesHttpHandlerTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/PreferencesHttpHandlerTest.java @@ -61,60 +61,60 @@ private void addApplication(String namespace, Application app) throws ConflictEx @Test public void testInstance() throws Exception { Map propMap = Maps.newHashMap(); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(), false, 200)); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(), true, 200)); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(), false, 200)); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(), true, 200)); propMap.put("k1", "3@#3"); propMap.put("@#$#ljfds", "231@#$"); - setPreferences(getPreferenceURI(), propMap, 200); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(), false, 200)); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(), true, 200)); + setPreferences(getPreferenceUri(), propMap, 200); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(), false, 200)); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(), true, 200)); propMap.clear(); - deletePreferences(getPreferenceURI(), 200); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(), false, 200)); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(), true, 200)); + deletePreferences(getPreferenceUri(), 200); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(), false, 200)); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(), true, 200)); } @Test public void testNamespace() throws Exception { Map propMap = Maps.newHashMap(); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(TEST_NAMESPACE1), false, 200)); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(TEST_NAMESPACE2), false, 200)); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(TEST_NAMESPACE1), true, 200)); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(TEST_NAMESPACE2), true, 200)); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(TEST_NAMESPACE1), false, 200)); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(TEST_NAMESPACE2), false, 200)); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(TEST_NAMESPACE1), true, 200)); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(TEST_NAMESPACE2), true, 200)); propMap.put("k1", "3@#3"); propMap.put("@#$#ljfds", "231@#$"); - setPreferences(getPreferenceURI(TEST_NAMESPACE1), propMap, 200); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(TEST_NAMESPACE1), false, 200)); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(TEST_NAMESPACE1), true, 200)); + setPreferences(getPreferenceUri(TEST_NAMESPACE1), propMap, 200); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(TEST_NAMESPACE1), false, 200)); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(TEST_NAMESPACE1), true, 200)); Map instanceMap = Maps.newHashMap(); instanceMap.put("k1", "432432*#######"); - setPreferences(getPreferenceURI(), instanceMap, 200); - Assert.assertEquals(instanceMap, getPreferences(getPreferenceURI(), true, 200)); - Assert.assertEquals(instanceMap, getPreferences(getPreferenceURI(TEST_NAMESPACE2), true, 200)); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(TEST_NAMESPACE1), true, 200)); + setPreferences(getPreferenceUri(), instanceMap, 200); + Assert.assertEquals(instanceMap, getPreferences(getPreferenceUri(), true, 200)); + Assert.assertEquals(instanceMap, getPreferences(getPreferenceUri(TEST_NAMESPACE2), true, 200)); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(TEST_NAMESPACE1), true, 200)); instanceMap.put("k2", "(93424"); - setPreferences(getPreferenceURI(), instanceMap, 200); + setPreferences(getPreferenceUri(), instanceMap, 200); instanceMap.putAll(propMap); - Assert.assertEquals(instanceMap, getPreferences(getPreferenceURI(TEST_NAMESPACE1), true, 200)); + Assert.assertEquals(instanceMap, getPreferences(getPreferenceUri(TEST_NAMESPACE1), true, 200)); - deletePreferences(getPreferenceURI(TEST_NAMESPACE1), 200); - deletePreferences(getPreferenceURI(TEST_NAMESPACE2), 200); + deletePreferences(getPreferenceUri(TEST_NAMESPACE1), 200); + deletePreferences(getPreferenceUri(TEST_NAMESPACE2), 200); instanceMap.clear(); instanceMap.put("*&$kjh", "*(&*1"); - setPreferences(getPreferenceURI(), instanceMap, 200); - Assert.assertEquals(instanceMap, getPreferences(getPreferenceURI(TEST_NAMESPACE2), true, 200)); - Assert.assertEquals(instanceMap, getPreferences(getPreferenceURI(TEST_NAMESPACE1), true, 200)); + setPreferences(getPreferenceUri(), instanceMap, 200); + Assert.assertEquals(instanceMap, getPreferences(getPreferenceUri(TEST_NAMESPACE2), true, 200)); + Assert.assertEquals(instanceMap, getPreferences(getPreferenceUri(TEST_NAMESPACE1), true, 200)); instanceMap.clear(); - Assert.assertEquals(instanceMap, getPreferences(getPreferenceURI(TEST_NAMESPACE2), false, 200)); - Assert.assertEquals(instanceMap, getPreferences(getPreferenceURI(TEST_NAMESPACE1), false, 200)); + Assert.assertEquals(instanceMap, getPreferences(getPreferenceUri(TEST_NAMESPACE2), false, 200)); + Assert.assertEquals(instanceMap, getPreferences(getPreferenceUri(TEST_NAMESPACE1), false, 200)); - deletePreferences(getPreferenceURI(), 200); - Assert.assertEquals(instanceMap, getPreferences(getPreferenceURI(TEST_NAMESPACE2), true, 200)); - Assert.assertEquals(instanceMap, getPreferences(getPreferenceURI(TEST_NAMESPACE1), true, 200)); - getPreferences(getPreferenceURI("invalidNamespace"), true, 404); + deletePreferences(getPreferenceUri(), 200); + Assert.assertEquals(instanceMap, getPreferences(getPreferenceUri(TEST_NAMESPACE2), true, 200)); + Assert.assertEquals(instanceMap, getPreferences(getPreferenceUri(TEST_NAMESPACE1), true, 200)); + getPreferences(getPreferenceUri("invalidNamespace"), true, 404); } @Test @@ -123,34 +123,37 @@ public void testApplication() throws Exception { addApplication(TEST_NAMESPACE1, new AllProgramsApp()); Map propMap = Maps.newHashMap(); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(TEST_NAMESPACE1, appName), false, 200)); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(TEST_NAMESPACE1, appName), true, 200)); - getPreferences(getPreferenceURI(TEST_NAMESPACE1, "InvalidAppName"), false, 404); - setPreferences(getPreferenceURI(), ImmutableMap.of("k1", "instance"), 200); - setPreferences(getPreferenceURI(TEST_NAMESPACE1), ImmutableMap.of("k1", "namespace"), 200); - setPreferences(getPreferenceURI(TEST_NAMESPACE1, appName), ImmutableMap.of("k1", "application"), 200); + Assert.assertEquals(propMap, getPreferences( + getPreferenceUri(TEST_NAMESPACE1, appName), false, 200)); + Assert.assertEquals(propMap, getPreferences( + getPreferenceUri(TEST_NAMESPACE1, appName), true, 200)); + getPreferences(getPreferenceUri(TEST_NAMESPACE1, "InvalidAppName"), false, 404); + setPreferences(getPreferenceUri(), ImmutableMap.of("k1", "instance"), 200); + setPreferences( + getPreferenceUri(TEST_NAMESPACE1), ImmutableMap.of("k1", "namespace"), 200); + setPreferences(getPreferenceUri(TEST_NAMESPACE1, appName), ImmutableMap.of("k1", "application"), 200); Assert.assertEquals("application", - getPreferences(getPreferenceURI(TEST_NAMESPACE1, appName), false, 200).get("k1")); + getPreferences(getPreferenceUri(TEST_NAMESPACE1, appName), false, 200).get("k1")); Assert.assertEquals("application", - getPreferences(getPreferenceURI(TEST_NAMESPACE1, appName), true, 200).get("k1")); - Assert.assertEquals("namespace", getPreferences(getPreferenceURI(TEST_NAMESPACE1), false, 200).get("k1")); - Assert.assertEquals("namespace", getPreferences(getPreferenceURI(TEST_NAMESPACE1), true, 200).get("k1")); - Assert.assertEquals("instance", getPreferences(getPreferenceURI(), true, 200).get("k1")); - Assert.assertEquals("instance", getPreferences(getPreferenceURI(), false, 200).get("k1")); - deletePreferences(getPreferenceURI(TEST_NAMESPACE1, appName), 200); + getPreferences(getPreferenceUri(TEST_NAMESPACE1, appName), true, 200).get("k1")); + Assert.assertEquals("namespace", getPreferences(getPreferenceUri(TEST_NAMESPACE1), false, 200).get("k1")); + Assert.assertEquals("namespace", getPreferences(getPreferenceUri(TEST_NAMESPACE1), true, 200).get("k1")); + Assert.assertEquals("instance", getPreferences(getPreferenceUri(), true, 200).get("k1")); + Assert.assertEquals("instance", getPreferences(getPreferenceUri(), false, 200).get("k1")); + deletePreferences(getPreferenceUri(TEST_NAMESPACE1, appName), 200); Assert.assertEquals("namespace", - getPreferences(getPreferenceURI(TEST_NAMESPACE1, appName), true, 200).get("k1")); - Assert.assertNull(getPreferences(getPreferenceURI(TEST_NAMESPACE1, appName), false, 200).get("k1")); - deletePreferences(getPreferenceURI(TEST_NAMESPACE1), 200); + getPreferences(getPreferenceUri(TEST_NAMESPACE1, appName), true, 200).get("k1")); + Assert.assertNull(getPreferences(getPreferenceUri(TEST_NAMESPACE1, appName), false, 200).get("k1")); + deletePreferences(getPreferenceUri(TEST_NAMESPACE1), 200); Assert.assertEquals("instance", - getPreferences(getPreferenceURI(TEST_NAMESPACE1, appName), true, 200).get("k1")); + getPreferences(getPreferenceUri(TEST_NAMESPACE1, appName), true, 200).get("k1")); Assert.assertEquals("instance", - getPreferences(getPreferenceURI(TEST_NAMESPACE1), true, 200).get("k1")); - Assert.assertNull(getPreferences(getPreferenceURI(TEST_NAMESPACE1), false, 200).get("k1")); - deletePreferences(getPreferenceURI(), 200); - Assert.assertNull(getPreferences(getPreferenceURI(), true, 200).get("k1")); - Assert.assertNull(getPreferences(getPreferenceURI(TEST_NAMESPACE1), true, 200).get("k1")); - Assert.assertNull(getPreferences(getPreferenceURI(TEST_NAMESPACE1, appName), true, 200).get("k1")); + getPreferences(getPreferenceUri(TEST_NAMESPACE1), true, 200).get("k1")); + Assert.assertNull(getPreferences(getPreferenceUri(TEST_NAMESPACE1), false, 200).get("k1")); + deletePreferences(getPreferenceUri(), 200); + Assert.assertNull(getPreferences(getPreferenceUri(), true, 200).get("k1")); + Assert.assertNull(getPreferences(getPreferenceUri(TEST_NAMESPACE1), true, 200).get("k1")); + Assert.assertNull(getPreferences(getPreferenceUri(TEST_NAMESPACE1, appName), true, 200).get("k1")); } @Test @@ -161,30 +164,35 @@ public void testProgram() throws Exception { addApplication(TEST_NAMESPACE2, new AllProgramsApp()); Map propMap = Maps.newHashMap(); Assert.assertEquals(propMap, getPreferences( - getPreferenceURI(TEST_NAMESPACE2, appName, "services", serviceName), false, 200)); - getPreferences(getPreferenceURI(TEST_NAMESPACE2, appName, "invalidType", "somename"), false, 400); - getPreferences(getPreferenceURI(TEST_NAMESPACE2, appName, "services", "somename"), false, 404); + getPreferenceUri(TEST_NAMESPACE2, appName, "services", serviceName), false, 200)); + getPreferences( + getPreferenceUri(TEST_NAMESPACE2, appName, "invalidType", "somename"), false, 400); + getPreferences( + getPreferenceUri(TEST_NAMESPACE2, appName, "services", "somename"), false, 404); propMap.put("k1", "k349*&#$"); - setPreferences(getPreferenceURI(TEST_NAMESPACE2, appName, "services", serviceName), propMap, 200); + setPreferences( + getPreferenceUri(TEST_NAMESPACE2, appName, "services", serviceName), propMap, 200); Assert.assertEquals(propMap, getPreferences( - getPreferenceURI(TEST_NAMESPACE2, appName, "services", serviceName), false, 200)); + getPreferenceUri(TEST_NAMESPACE2, appName, "services", serviceName), false, 200)); propMap.put("k1", "instance"); - setPreferences(getPreferenceURI(), propMap, 200); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(), true, 200)); + setPreferences(getPreferenceUri(), propMap, 200); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(), true, 200)); propMap.put("k1", "k349*&#$"); Assert.assertEquals(propMap, getPreferences( - getPreferenceURI(TEST_NAMESPACE2, appName, "services", serviceName), false, 200)); - deletePreferences(getPreferenceURI(TEST_NAMESPACE2, appName, "services", serviceName), 200); + getPreferenceUri(TEST_NAMESPACE2, appName, "services", serviceName), false, 200)); + deletePreferences( + getPreferenceUri(TEST_NAMESPACE2, appName, "services", serviceName), 200); propMap.put("k1", "instance"); - Assert.assertEquals(0, getPreferences(getPreferenceURI(TEST_NAMESPACE2, appName, "services", serviceName), + Assert.assertEquals(0, getPreferences( + getPreferenceUri(TEST_NAMESPACE2, appName, "services", serviceName), false, 200).size()); Assert.assertEquals(propMap, getPreferences( - getPreferenceURI(TEST_NAMESPACE2, appName, "services", serviceName), true, 200)); - deletePreferences(getPreferenceURI(), 200); + getPreferenceUri(TEST_NAMESPACE2, appName, "services", serviceName), true, 200)); + deletePreferences(getPreferenceUri(), 200); propMap.clear(); Assert.assertEquals(propMap, getPreferences( - getPreferenceURI(TEST_NAMESPACE2, appName, "services", serviceName), false, 200)); - Assert.assertEquals(propMap, getPreferences(getPreferenceURI(), false, 200)); + getPreferenceUri(TEST_NAMESPACE2, appName, "services", serviceName), false, 200)); + Assert.assertEquals(propMap, getPreferences(getPreferenceUri(), false, 200)); } @Test @@ -199,20 +207,20 @@ public void testSetPreferenceWithProfiles() throws Exception { properties.put("2nd key", "2nd value"); properties.put(SystemArguments.PROFILE_NAME, "USER:MyProfile"); Map expected = ImmutableMap.copyOf(properties); - setPreferences(getPreferenceURI(TEST_NAMESPACE1), properties, 200); - Assert.assertEquals(expected, getPreferences(getPreferenceURI(TEST_NAMESPACE1), false, 200)); + setPreferences(getPreferenceUri(TEST_NAMESPACE1), properties, 200); + Assert.assertEquals(expected, getPreferences(getPreferenceUri(TEST_NAMESPACE1), false, 200)); // put some property with non-existing profile, it should fail with 404 properties.put(SystemArguments.PROFILE_NAME, "NonExisting"); - setPreferences(getPreferenceURI(TEST_NAMESPACE1), properties, 404); - Assert.assertEquals(expected, getPreferences(getPreferenceURI(TEST_NAMESPACE1), false, 200)); + setPreferences(getPreferenceUri(TEST_NAMESPACE1), properties, 404); + Assert.assertEquals(expected, getPreferences(getPreferenceUri(TEST_NAMESPACE1), false, 200)); // disable the profile and put again, it should fail with 409 disableProfile(myProfile, 200); properties.put(SystemArguments.PROFILE_NAME, "USER:MyProfile"); - setPreferences(getPreferenceURI(TEST_NAMESPACE1), properties, 409); - Assert.assertEquals(expected, getPreferences(getPreferenceURI(TEST_NAMESPACE1), false, 200)); + setPreferences(getPreferenceUri(TEST_NAMESPACE1), properties, 409); + Assert.assertEquals(expected, getPreferences(getPreferenceUri(TEST_NAMESPACE1), false, 200)); - deletePreferences(getPreferenceURI(TEST_NAMESPACE1), 200); + deletePreferences(getPreferenceUri(TEST_NAMESPACE1), 200); } } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProfileHttpHandlerTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProfileHttpHandlerTest.java index 73864f65f098..e75c67daab3d 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProfileHttpHandlerTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProfileHttpHandlerTest.java @@ -81,7 +81,8 @@ public class ProfileHttpHandlerTest extends AppFabricTestBase { @BeforeClass public static void beforeClass() throws Exception { - CConfiguration cConf = AppFabricTestHelper.enableAuthorization(createBasicCConf(), TEMPORARY_FOLDER); + CConfiguration cConf = AppFabricTestHelper.enableAuthorization( + createBasicCconf(), TEMPORARY_FOLDER); initializeAndStartServices(cConf); PermissionManager permissionManager = getInjector().getInstance(PermissionManager.class); permissionManager.grant(Authorizable.fromEntityId(NamespaceId.SYSTEM, EntityType.PROFILE), READ_WRITE_USER, diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramLifecycleHttpHandlerInternalTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramLifecycleHttpHandlerInternalTest.java index f0e96ec70b50..a0f811af7baa 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramLifecycleHttpHandlerInternalTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramLifecycleHttpHandlerInternalTest.java @@ -81,7 +81,7 @@ public void testGetRunRecordMeta() throws Exception { Assert.assertEquals(ProfileId.NATIVE, runRecordMeta.getProfileId()); // cleanup - HttpResponse response = doDelete(getVersionedAPIPath("apps/", + HttpResponse response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, namespace)); Assert.assertEquals(200, response.getResponseCode()); } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramLifecycleHttpHandlerTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramLifecycleHttpHandlerTest.java index a1e525a65869..e88cc83c14f9 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramLifecycleHttpHandlerTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramLifecycleHttpHandlerTest.java @@ -130,7 +130,7 @@ public class ProgramLifecycleHttpHandlerTest extends AppFabricTestBase { @BeforeClass public static void beforeClass() throws Throwable { - cConf = createBasicCConf(); + cConf = createBasicCconf(); initializeAndStartServices(cConf); } @@ -273,10 +273,10 @@ public void testProgramStartStopStatus() throws Exception { Assert.assertTrue(service2Run.getRuns().isEmpty()); // cleanup - HttpResponse response = doDelete(getVersionedAPIPath("apps/", + HttpResponse response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); - response = doDelete(getVersionedAPIPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); + response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); Assert.assertEquals(200, response.getResponseCode()); } @@ -411,7 +411,7 @@ public void testProgramStartStopStatusErrors() throws Exception { runId, 400); // active run not found // cleanup - HttpResponse response = doDelete(getVersionedAPIPath("apps/", + HttpResponse response = doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); Assert.assertEquals(200, response.getResponseCode()); } @@ -422,7 +422,7 @@ public void testProgramStartStopStatusErrors() throws Exception { @Category(XSlowTests.class) @Test public void testMapreduceHistory() throws Exception { - doDelete(getVersionedAPIPath("apps/", + doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); testHistory(DummyAppWithTrackingTable.class); } @@ -433,10 +433,12 @@ public void testMapreduceHistory() throws Exception { @Test public void testNonExistingProgramHistory() throws Exception { deploy(DummyAppWithTrackingTable.class, 200, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2); - int historyStatus = doPost(getVersionedAPIPath("apps/" + DUMMY_APP_ID + ProgramType.MAPREDUCE + "/NonExisting", + int historyStatus = doPost( + getVersionedApiPath("apps/" + DUMMY_APP_ID + ProgramType.MAPREDUCE + "/NonExisting", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)).getResponseCode(); - int deleteStatus = doDelete(getVersionedAPIPath("apps/" + DUMMY_APP_ID, Constants.Gateway.API_VERSION_3_TOKEN, + int deleteStatus = doDelete( + getVersionedApiPath("apps/" + DUMMY_APP_ID, Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)).getResponseCode(); Assert.assertTrue("Unexpected history status " + historyStatus + " and/or deleteStatus " + deleteStatus, historyStatus == 404 && deleteStatus == 200); @@ -481,7 +483,7 @@ public void testWorkflowHistory() throws Exception { sleepWorkflow1.getApplicationId(), sleepWorkflow1.getType().getCategoryName(), sleepWorkflow1.getId(), ProgramRunStatus.COMPLETED, 1, 0, Integer.MAX_VALUE); Assert.assertEquals(HttpResponseStatus.BAD_REQUEST.code(), - doGet(getVersionedAPIPath(path, sleepWorkflow1.getNamespaceId())).getResponseCode()); + doGet(getVersionedApiPath(path, sleepWorkflow1.getNamespaceId())).getResponseCode()); // second run @@ -599,8 +601,8 @@ public void testMapreduceRuntimeArgs() throws Exception { @Test public void testBatchStatus() throws Exception { - final String statusUrl1 = getVersionedAPIPath("status", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1); - final String statusUrl2 = getVersionedAPIPath("status", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2); + final String statusUrl1 = getVersionedApiPath("status", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1); + final String statusUrl2 = getVersionedApiPath("status", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2); // invalid json must return 400 Assert.assertEquals(400, doPost(statusUrl1, "").getResponseCode()); @@ -736,7 +738,7 @@ public void testBatchStatus() throws Exception { @Test public void testBatchInstances() throws Exception { - String instancesUrl1 = getVersionedAPIPath("instances", Constants.Gateway.API_VERSION_3_TOKEN, + String instancesUrl1 = getVersionedApiPath("instances", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1); Assert.assertEquals(400, doPost(instancesUrl1, "").getResponseCode()); @@ -811,7 +813,7 @@ public void testBatchInstances() throws Exception { Assert.assertEquals(1, returnedBody.get(0).get("provisioned").getAsInt()); // Increase service instances to 2 - String setInstanceUrl = getVersionedAPIPath( + String setInstanceUrl = getVersionedApiPath( String.format("apps/%s/services/%s/instances", AllProgramsApp.NAME, AllProgramsApp.NoOpService.NAME), Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1); Assert.assertEquals(200, doPut(setInstanceUrl, gson.toJson(new Instances(2))).getResponseCode()); @@ -1559,9 +1561,9 @@ private void testUpdateSchedule(ApplicationId appV2Id) throws Exception { @Test public void testBatchStartStop() throws Exception { - final String batchStartUrl = getVersionedAPIPath("start", Constants.Gateway.API_VERSION_3_TOKEN, + final String batchStartUrl = getVersionedApiPath("start", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1); - final String batchStopUrl = getVersionedAPIPath("stop", Constants.Gateway.API_VERSION_3_TOKEN, + final String batchStopUrl = getVersionedApiPath("stop", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1); // invalid json must return 400 @@ -1628,7 +1630,7 @@ public void testBatchStartStop() throws Exception { @Test public void testGetRunCount() throws Exception { - final String batchRunCount = getVersionedAPIPath("runcount", Constants.Gateway.API_VERSION_3_TOKEN, + final String batchRunCount = getVersionedApiPath("runcount", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1); // deploy, check the status @@ -1711,8 +1713,8 @@ public void testVersionedGetRunCount() throws Exception { @After public void cleanup() throws Exception { - doDelete(getVersionedAPIPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); - doDelete(getVersionedAPIPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); + doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE1)); + doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); } private void setLCMFlag(boolean lcmFlag) { @@ -1721,7 +1723,7 @@ private void setLCMFlag(boolean lcmFlag) { private HttpResponse getServiceAvailability(Id.Service serviceId) throws Exception { String activeUrl = String.format("apps/%s/services/%s/available", serviceId.getApplicationId(), serviceId.getId()); - String versionedActiveUrl = getVersionedAPIPath(activeUrl, Constants.Gateway.API_VERSION_3_TOKEN, + String versionedActiveUrl = getVersionedApiPath(activeUrl, Constants.Gateway.API_VERSION_3_TOKEN, serviceId.getNamespaceId()); return doGet(versionedActiveUrl); } @@ -1729,7 +1731,7 @@ private HttpResponse getServiceAvailability(Id.Service serviceId) throws Excepti private ServiceInstances getServiceInstances(Id.Service serviceId) throws Exception { String instanceUrl = String.format("apps/%s/services/%s/instances", serviceId.getApplicationId(), serviceId.getId()); - String versionedInstanceUrl = getVersionedAPIPath(instanceUrl, Constants.Gateway.API_VERSION_3_TOKEN, + String versionedInstanceUrl = getVersionedApiPath(instanceUrl, Constants.Gateway.API_VERSION_3_TOKEN, serviceId.getNamespaceId()); HttpResponse response = doGet(versionedInstanceUrl); Assert.assertEquals(200, response.getResponseCode()); @@ -1739,7 +1741,7 @@ private ServiceInstances getServiceInstances(Id.Service serviceId) throws Except private int setServiceInstances(Id.Service serviceId, int instances) throws Exception { String instanceUrl = String.format("apps/%s/services/%s/instances", serviceId.getApplicationId(), serviceId.getId()); - String versionedInstanceUrl = getVersionedAPIPath(instanceUrl, Constants.Gateway.API_VERSION_3_TOKEN, + String versionedInstanceUrl = getVersionedApiPath(instanceUrl, Constants.Gateway.API_VERSION_3_TOKEN, serviceId.getNamespaceId()); String instancesBody = GSON.toJson(new Instances(instances)); return doPut(versionedInstanceUrl, instancesBody).getResponseCode(); @@ -1748,7 +1750,7 @@ private int setServiceInstances(Id.Service serviceId, int instances) throws Exce private HttpResponse callService(Id.Service serviceId, HttpMethod method, String endpoint) throws Exception { String serviceUrl = String.format("apps/%s/service/%s/methods/%s", serviceId.getApplicationId(), serviceId.getId(), endpoint); - String versionedServiceUrl = getVersionedAPIPath(serviceUrl, Constants.Gateway.API_VERSION_3_TOKEN, + String versionedServiceUrl = getVersionedApiPath(serviceUrl, Constants.Gateway.API_VERSION_3_TOKEN, serviceId.getNamespaceId()); if (HttpMethod.GET.equals(method)) { return doGet(versionedServiceUrl); @@ -1780,13 +1782,13 @@ private int getProgramSpecificationResponseCode(String namespace, String appId, private HttpResponse requestProgramSpecification(String namespace, String appId, String programType, String programId) throws Exception { - String uri = getVersionedAPIPath(String.format("apps/%s/%s/%s", appId, programType, programId), + String uri = getVersionedApiPath(String.format("apps/%s/%s/%s", appId, programType, programId), Constants.Gateway.API_VERSION_3_TOKEN, namespace); return doGet(uri); } private void testListInitialState(String namespace, ProgramType programType) throws Exception { - HttpResponse response = doGet(getVersionedAPIPath(programType.getCategoryName(), + HttpResponse response = doGet(getVersionedApiPath(programType.getCategoryName(), Constants.Gateway.API_VERSION_3_TOKEN, namespace)); Assert.assertEquals(200, response.getResponseCode()); Assert.assertEquals(EMPTY_ARRAY_JSON, response.getResponseBodyAsString()); @@ -1816,12 +1818,12 @@ private int getAppFDetailResponseCode(String namespace, @Nullable String appName private HttpResponse requestProgramList(String namespace, String programType) throws Exception { - return doGet(getVersionedAPIPath(programType, Constants.Gateway.API_VERSION_3_TOKEN, namespace)); + return doGet(getVersionedApiPath(programType, Constants.Gateway.API_VERSION_3_TOKEN, namespace)); } private HttpResponse requestAppDetail(String namespace, String appName) throws Exception { - String uri = getVersionedAPIPath(String.format("apps/%s", appName), + String uri = getVersionedApiPath(String.format("apps/%s", appName), Constants.Gateway.API_VERSION_3_TOKEN, namespace); return doGet(uri); } @@ -1895,7 +1897,7 @@ private void historyStatusWithRetry(ProgramId program, ProgramRunStatus status, String basePath = String.format("apps/%s%s/%s/%s/runs", program.getApplication(), urlAppVersionPart, program.getType().getCategoryName(), program.getProgram()); - String runsUrl = getVersionedAPIPath(basePath + "?status=" + status.name(), + String runsUrl = getVersionedApiPath(basePath + "?status=" + status.name(), Constants.Gateway.API_VERSION_3_TOKEN, program.getNamespace()); int trials = 0; while (trials++ < 5) { @@ -1904,7 +1906,7 @@ private void historyStatusWithRetry(ProgramId program, ProgramRunStatus status, LIST_OF_RUN_RECORD); if (result != null && result.size() >= size) { for (RunRecord m : result) { - String runUrl = getVersionedAPIPath(basePath + "/" + m.getPid(), Constants.Gateway.API_VERSION_3_TOKEN, + String runUrl = getVersionedApiPath(basePath + "/" + m.getPid(), Constants.Gateway.API_VERSION_3_TOKEN, program.getNamespace()); response = doGet(runUrl); RunRecord actualRunRecord = GSON.fromJson(response.getResponseBodyAsString(), RunRecord.class); @@ -1918,10 +1920,10 @@ private void historyStatusWithRetry(ProgramId program, ProgramRunStatus status, } private void testVersionedProgramRuntimeArgs(ProgramId programId) throws Exception { - String versionedRuntimeArgsUrl = getVersionedAPIPath("apps/" + programId.getApplication() - + "/versions/" + programId.getVersion() - + "/" + programId.getType().getCategoryName() - + "/" + programId.getProgram() + "/runtimeargs", + String versionedRuntimeArgsUrl = getVersionedApiPath("apps/" + programId.getApplication() + + "/versions/" + programId.getVersion() + + "/" + programId.getType().getCategoryName() + + "/" + programId.getProgram() + "/runtimeargs", Constants.Gateway.API_VERSION_3_TOKEN, programId.getNamespace()); verifyRuntimeArgs(versionedRuntimeArgsUrl); @@ -1932,17 +1934,17 @@ private void testRuntimeArgs(Class app, String namespace, String appId, Strin deploy(app, 200, Constants.Gateway.API_VERSION_3_TOKEN, namespace); ApplicationDetail appDetails = getAppDetails(namespace, appId); - String versionedRuntimeArgsUrl = getVersionedAPIPath( + String versionedRuntimeArgsUrl = getVersionedApiPath( "apps/" + appId + "/" + programType + "/" + programId + "/runtimeargs", Constants.Gateway.API_VERSION_3_TOKEN, namespace); verifyRuntimeArgs(versionedRuntimeArgsUrl); - String versionedRuntimeArgsAppVersionUrl = getVersionedAPIPath("apps/" + appId - + "/versions/" - + appDetails.getAppVersion() - + "/" + programType - + "/" + programId + "/runtimeargs", + String versionedRuntimeArgsAppVersionUrl = getVersionedApiPath("apps/" + appId + + "/versions/" + + appDetails.getAppVersion() + + "/" + programType + + "/" + programId + "/runtimeargs", Constants.Gateway.API_VERSION_3_TOKEN, namespace); verifyRuntimeArgs(versionedRuntimeArgsAppVersionUrl); } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramRunLimitTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramRunLimitTest.java index 738165e49704..439d44af804e 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramRunLimitTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramRunLimitTest.java @@ -48,7 +48,7 @@ public class ProgramRunLimitTest extends AppFabricTestBase { @BeforeClass public static void beforeClass() throws Exception { - CConfiguration cConf = createBasicCConf(); + CConfiguration cConf = createBasicCconf(); // we enable Kerberos for these unit tests, so we can test namespace group permissions (see // testDataDirCreation). cConf.setInt(Constants.AppFabric.MAX_CONCURRENT_RUNS, 2); diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/SourceControlManagementHttpHandlerTests.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/SourceControlManagementHttpHandlerTests.java index 5dceb237b273..209c86887d8e 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/SourceControlManagementHttpHandlerTests.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/SourceControlManagementHttpHandlerTests.java @@ -90,7 +90,7 @@ public class SourceControlManagementHttpHandlerTests extends AppFabricTestBase { @BeforeClass public static void beforeClass() throws Throwable { - cConf = createBasicCConf(); + cConf = createBasicCconf(); initializeAndStartServices(cConf); sourceControlService = getInjector().getInstance(SourceControlManagementService.class); } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/sourcecontrol/ApplicationManagerTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/sourcecontrol/ApplicationManagerTest.java index f33ed743fea7..6da14413e59a 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/sourcecontrol/ApplicationManagerTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/sourcecontrol/ApplicationManagerTest.java @@ -99,7 +99,7 @@ public void testDeployApp() throws Exception { ); // fetch and validate the application version is created - HttpResponse response = doGet(getVersionedAPIPath( + HttpResponse response = doGet(getVersionedApiPath( String.format("apps/%s/versions/%s", deployedAppId.getApplication(), deployedAppId.getVersion()), Constants.Gateway.API_VERSION_3_TOKEN, namespace)); @@ -113,7 +113,7 @@ public void testDeployApp() throws Exception { // Delete the application Assert.assertEquals( 200, - doDelete(getVersionedAPIPath("apps/", + doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, namespace)).getResponseCode()); } @@ -134,7 +134,7 @@ public void testMarkAppVersionsLatest() throws Exception { // fetch and validate the application version is created // fetch and validate the application version is created - HttpResponse response = doGet(getVersionedAPIPath( + HttpResponse response = doGet(getVersionedApiPath( String.format("apps/%s/versions/%s", deployedAppId.getApplication(), deployedAppId.getVersion()), Constants.Gateway.API_VERSION_3_TOKEN, namespace)); @@ -148,7 +148,7 @@ public void testMarkAppVersionsLatest() throws Exception { // Delete the application Assert.assertEquals( 200, - doDelete(getVersionedAPIPath("apps/", + doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, namespace)).getResponseCode()); } @@ -176,7 +176,7 @@ public void testUpdateSourceControlMeta() throws Exception { // fetch and validate the application version is created // fetch and validate the application version is created - HttpResponse response = doGet(getVersionedAPIPath( + HttpResponse response = doGet(getVersionedApiPath( String.format("apps/%s/versions/%s", deployedAppId.getApplication(), deployedAppId.getVersion()), Constants.Gateway.API_VERSION_3_TOKEN, namespace)); @@ -190,7 +190,7 @@ public void testUpdateSourceControlMeta() throws Exception { // Delete the application Assert.assertEquals( 200, - doDelete(getVersionedAPIPath("apps/", + doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, namespace)).getResponseCode()); } } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/profile/ProfileMetadataTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/profile/ProfileMetadataTest.java index 823356bdd1c3..2e118e21b7ab 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/profile/ProfileMetadataTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/profile/ProfileMetadataTest.java @@ -107,7 +107,7 @@ public void testProfileMetadata() throws Exception { 10, TimeUnit.SECONDS, 100, TimeUnit.MILLISECONDS); // set it through preferences - setPreferences(getPreferenceURI(TEST_NAMESPACE1), + setPreferences(getPreferenceUri(TEST_NAMESPACE1), Collections.singletonMap(SystemArguments.PROFILE_NAME, "USER:MyProfile"), 200); // Verify the workflow, schedule, mapreduce, spark, worker has been updated to my profile @@ -125,7 +125,7 @@ public void testProfileMetadata() throws Exception { 10, TimeUnit.SECONDS, 100, TimeUnit.MILLISECONDS); // set it at app level through preferences - setPreferences(getPreferenceURI(TEST_NAMESPACE1, defaultAppId.getApplication()), + setPreferences(getPreferenceUri(TEST_NAMESPACE1, defaultAppId.getApplication()), Collections.singletonMap(SystemArguments.PROFILE_NAME, "USER:MyProfile2"), 200); // Verify the workflow, schedule, mapreduce, spark, worker has been updated to my profile 2 @@ -143,7 +143,7 @@ public void testProfileMetadata() throws Exception { 10, TimeUnit.SECONDS, 100, TimeUnit.MILLISECONDS); // delete app level pref, metadata should point to ns level - deletePreferences(getPreferenceURI(TEST_NAMESPACE1, defaultAppId.getApplication()), 200); + deletePreferences(getPreferenceUri(TEST_NAMESPACE1, defaultAppId.getApplication()), 200); // Verify the workflow, schedule, mapreduce, spark, worker has been updated to my profile Tasks.waitFor(myProfile.getScopedName(), () -> getMetadataProperties(programId).get("profile"), @@ -160,7 +160,7 @@ public void testProfileMetadata() throws Exception { 10, TimeUnit.SECONDS, 100, TimeUnit.MILLISECONDS); // delete at ns level should let the program use native profile since no profile is set at instance level - deletePreferences(getPreferenceURI(TEST_NAMESPACE1), 200); + deletePreferences(getPreferenceUri(TEST_NAMESPACE1), 200); // Verify the workflow, schedule, mapreduce, spark, worker has been updated to native profile Tasks.waitFor(ProfileId.NATIVE.getScopedName(), () -> getMetadataProperties(programId).get("profile"), @@ -177,7 +177,7 @@ public void testProfileMetadata() throws Exception { 10, TimeUnit.SECONDS, 100, TimeUnit.MILLISECONDS); // set it at instance level through preferences - setPreferences(getPreferenceURI(), + setPreferences(getPreferenceUri(), Collections.singletonMap(SystemArguments.PROFILE_NAME, "SYSTEM:MyProfile3"), 200); // Verify the workflow, schedule, mapreduce, spark, worker has been updated to profile 3 @@ -194,7 +194,7 @@ public void testProfileMetadata() throws Exception { Tasks.waitFor(myProfile3.getScopedName(), () -> getMetadataProperties(scheduleId2).get("profile"), 10, TimeUnit.SECONDS, 100, TimeUnit.MILLISECONDS); - deletePreferences(getPreferenceURI(), 200); + deletePreferences(getPreferenceUri(), 200); deleteApp(defaultAppId, 200); // Verify the workflow, schedule, mapreduce, spark, worker metadata has been deleted diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/ApplicationDetailFetcherTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/ApplicationDetailFetcherTest.java index c4898604ee83..4fc17106b9ee 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/ApplicationDetailFetcherTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/ApplicationDetailFetcherTest.java @@ -120,7 +120,7 @@ public void testGetApplication() throws Exception { // Delete the application Assert.assertEquals( 200, - doDelete(getVersionedAPIPath("apps/", + doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, namespace)).getResponseCode()); } @@ -169,7 +169,7 @@ public void testGetAllApplicationsUsingScan() throws Exception { // Delete the application Assert.assertEquals( 200, - doDelete(getVersionedAPIPath("apps/", + doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, namespace)).getResponseCode()); } } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/LineageLimitingTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/LineageLimitingTest.java index 3e74e0f065aa..e2b66ea284d0 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/LineageLimitingTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/LineageLimitingTest.java @@ -74,7 +74,7 @@ public class LineageLimitingTest extends AppFabricTestBase { @BeforeClass public static void beforeClass() throws Throwable { - CConfiguration cConfiguration = createBasicCConf(); + CConfiguration cConfiguration = createBasicCconf(); // use a fast retry strategy with not too many retries, to speed up the test String prefix = "system.metadata."; cConfiguration.set(prefix + Constants.Retry.TYPE, RetryStrategyType.FIXED_DELAY.toString()); diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/MetadataSubscriberServiceTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/MetadataSubscriberServiceTest.java index a61d28a4f9f8..d2949a562f56 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/MetadataSubscriberServiceTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/MetadataSubscriberServiceTest.java @@ -136,7 +136,7 @@ public class MetadataSubscriberServiceTest extends AppFabricTestBase { @BeforeClass public static void beforeClass() throws Throwable { - CConfiguration cConfiguration = createBasicCConf(); + CConfiguration cConfiguration = createBasicCconf(); // use a fast retry strategy with not too many retries, to speed up the test String prefix = "system.metadata."; cConfiguration.set(prefix + Constants.Retry.TYPE, RetryStrategyType.FIXED_DELAY.toString()); diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/PreferencesFetcherInternalTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/PreferencesFetcherInternalTest.java index dafbffb87cbb..266b9e633768 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/PreferencesFetcherInternalTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/PreferencesFetcherInternalTest.java @@ -89,8 +89,8 @@ public void testGetPreferences() throws Exception { // Set preferences on instance and fetch again. Map instanceProperties = ImmutableMap.of("instance-key1", "instance-val1"); - setPreferences(getPreferenceURI(), instanceProperties, 200); - preferenceURIList.add(getPreferenceURI()); + setPreferences(getPreferenceUri(), instanceProperties, 200); + preferenceURIList.add(getPreferenceUri()); entityId = new InstanceId(""); preferences = fetcher.get(entityId, false); Assert.assertEquals(instanceProperties, preferences.getProperties()); @@ -117,8 +117,8 @@ public void testGetPreferences() throws Exception { // Set preferences on application and fetch again, resolved preferences should be returned. Map appProperties = ImmutableMap.of("app-key1", "app-val1"); - setPreferences(getPreferenceURI(namespace, appName), appProperties, 200); - preferenceURIList.add(getPreferenceURI(namespace, appName)); + setPreferences(getPreferenceUri(namespace, appName), appProperties, 200); + preferenceURIList.add(getPreferenceUri(namespace, appName)); preferences = fetcher.get(entityId, true); Map resolvedProperites = new HashMap<>(); resolvedProperites.putAll(instanceProperties); @@ -135,7 +135,7 @@ public void testGetPreferences() throws Exception { // Cleanup: delete the app Assert.assertEquals( 200, - doDelete(getVersionedAPIPath("apps/", + doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, namespace)).getResponseCode()); } } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/ScheduleFetcherTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/ScheduleFetcherTest.java index f91ce8c48cb5..302b0b57397f 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/ScheduleFetcherTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/metadata/ScheduleFetcherTest.java @@ -89,7 +89,7 @@ public void testGetScheduleNotFound() throws Exception { // Delete the application Assert.assertEquals( 200, - doDelete(getVersionedAPIPath("apps/", + doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, namespace)).getResponseCode()); } } @@ -113,7 +113,7 @@ public void testGetSchedule() throws Exception { // Delete the application Assert.assertEquals( 200, - doDelete(getVersionedAPIPath("apps/", + doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, namespace)).getResponseCode()); } @@ -142,7 +142,7 @@ public void testListSchedules() throws Exception { // Delete the application Assert.assertEquals( 200, - doDelete(getVersionedAPIPath("apps/", + doDelete(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, namespace)).getResponseCode()); } } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/scheduler/CoreSchedulerServiceTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/scheduler/CoreSchedulerServiceTest.java index 5216371e86a9..9095855c80f4 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/scheduler/CoreSchedulerServiceTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/scheduler/CoreSchedulerServiceTest.java @@ -496,7 +496,7 @@ private WorkflowTokenDetail getWorkflowToken(ProgramId workflowId, String runId, @Nullable String key) throws Exception { String workflowTokenUrl = String.format("apps/%s/workflows/%s/runs/%s/token", workflowId.getApplication(), workflowId.getProgram(), runId); - String versionedUrl = getVersionedAPIPath(appendScopeAndKeyToUrl(workflowTokenUrl, scope, key), + String versionedUrl = getVersionedApiPath(appendScopeAndKeyToUrl(workflowTokenUrl, scope, key), Constants.Gateway.API_VERSION_3_TOKEN, workflowId.getNamespace()); HttpResponse response = doGet(versionedUrl); return readResponse(response, new TypeToken() { }.getType(), GSON); diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/twill/AbstractMasterServiceManager.java b/cdap-common/src/main/java/io/cdap/cdap/common/twill/AbstractMasterServiceManager.java index e26b6b9f1eb5..76c4257328b4 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/twill/AbstractMasterServiceManager.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/twill/AbstractMasterServiceManager.java @@ -80,7 +80,7 @@ protected AbstractMasterServiceManager(CConfiguration cConf, /** * Returns the {@link CConfiguration}. */ - protected final CConfiguration getCConf() { + protected final CConfiguration getCconf() { return cConf; } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/DatasetExecutorServiceManager.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/DatasetExecutorServiceManager.java index e5893a4ab7f7..5ebfc76260c5 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/DatasetExecutorServiceManager.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/DatasetExecutorServiceManager.java @@ -36,7 +36,7 @@ public class DatasetExecutorServiceManager extends AbstractMasterServiceManager @Override public int getMaxInstances() { - return getCConf().getInt(Constants.Dataset.Executor.MAX_INSTANCES); + return getCconf().getInt(Constants.Dataset.Executor.MAX_INSTANCES); } @Override diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/MetadataServiceManager.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/MetadataServiceManager.java index ea7e4bff3e64..a1c4c81cda43 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/MetadataServiceManager.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/MetadataServiceManager.java @@ -38,7 +38,7 @@ public class MetadataServiceManager extends AbstractMasterServiceManager { @Override public int getMaxInstances() { - return getCConf().getInt(Constants.Dataset.Executor.MAX_INSTANCES); + return getCconf().getInt(Constants.Dataset.Executor.MAX_INSTANCES); } @Override diff --git a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/handlers/log/LogHttpHandlerTest.java b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/handlers/log/LogHttpHandlerTest.java index d0de6f811567..0a00bade17c0 100644 --- a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/handlers/log/LogHttpHandlerTest.java +++ b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/handlers/log/LogHttpHandlerTest.java @@ -357,7 +357,7 @@ private List getLogs(String namespaceId, String appId, String programTy String endPoint, int expectedStatusCode) throws IOException { String path = String.format("apps/%s/%s/%s/runs/%s/logs/%s?max=1000", appId, programType, programName, runId, endPoint); - HttpResponse response = doGet(getVersionedAPIPath(path, namespaceId)); + HttpResponse response = doGet(getVersionedApiPath(path, namespaceId)); Assert.assertEquals(expectedStatusCode, response.getResponseCode()); if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) { return ImmutableList.of(); @@ -429,7 +429,7 @@ public void testNativeMethodField() throws Exception { RunRecord runRecord = mockLogReader.getRunRecord(programId); String logsUrl = String.format("apps/%s/%s/%s/runs/%s/logs/next?format=json", "testTemplate1", "workflows", "testWorkflow1", runRecord.getPid()); - HttpResponse response = doGet(getVersionedAPIPath(logsUrl, MockLogReader.TEST_NAMESPACE)); + HttpResponse response = doGet(getVersionedApiPath(logsUrl, MockLogReader.TEST_NAMESPACE)); Assert.assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); List logDataOffsetList = GSON.fromJson(response.getResponseBodyAsString(), LIST_LOGDATA_OFFSET_TYPE); Assert.assertEquals(logDataOffsetList.size(), 15); @@ -467,7 +467,7 @@ public void testFilterWithEmptyResult() throws Exception { String logsUrl = String.format("apps/%s/%s/%s/runs/%s/logs?format=json&filter=MDC:asdf=nothing", appId, entityType, entityId, runRecord.getPid()); - HttpResponse response = doGet(getVersionedAPIPath(logsUrl, namespace)); + HttpResponse response = doGet(getVersionedApiPath(logsUrl, namespace)); verifyLogs(response, entityId, "json", true, true, true, 0, 0); } @@ -476,7 +476,7 @@ private void testNext(String appId, String entityType, String entityId, boolean for (String format : FORMATS) { String nextUrl = String.format("apps/%s/%s/%s/logs/next?fromOffset=%s&max=10&escape=%s&format=%s", appId, entityType, entityId, getFromOffset(5), escape, format); - HttpResponse response = doGet(getVersionedAPIPath(nextUrl, namespace)); + HttpResponse response = doGet(getVersionedApiPath(nextUrl, namespace)); verifyLogs(response, entityId, format, false, false, escape, 10, 5); } } @@ -485,7 +485,7 @@ private void testNextNoMax(String appId, String entityType, String entityId, Str for (String format : FORMATS) { String nextNoMaxUrl = String.format("apps/%s/%s/%s/logs/next?fromOffset=%s&format=%s", appId, entityType, entityId, getFromOffset(10), format); - HttpResponse response = doGet(getVersionedAPIPath(nextNoMaxUrl, namespace)); + HttpResponse response = doGet(getVersionedApiPath(nextNoMaxUrl, namespace)); verifyLogs(response, entityId, format, false, false, true, 50, 10); } } @@ -495,7 +495,7 @@ private void testNextFilter(String appId, String entityType, String entityId, St String nextFilterUrl = String.format("apps/%s/%s/%s/logs/next?fromOffset=%s&max=16&filter=loglevel=ERROR&format=%s", appId, entityType, entityId, getFromOffset(12), format); - HttpResponse response = doGet(getVersionedAPIPath(nextFilterUrl, namespace)); + HttpResponse response = doGet(getVersionedApiPath(nextFilterUrl, namespace)); verifyLogs(response, entityId, format, true, false, true, 8, 12); } } @@ -503,7 +503,7 @@ private void testNextFilter(String appId, String entityType, String entityId, St private void testNextNoFrom(String appId, String entityType, String entityId, String namespace) throws Exception { for (String format : FORMATS) { String nextNoFromUrl = String.format("apps/%s/%s/%s/logs/next?format=%s", appId, entityType, entityId, format); - HttpResponse response = doGet(getVersionedAPIPath(nextNoFromUrl, namespace)); + HttpResponse response = doGet(getVersionedApiPath(nextNoFromUrl, namespace)); verifyLogs(response, entityId, format, false, false, true, 50, 30); } } @@ -527,7 +527,7 @@ private void testNextRunId(String appId, String entityType, String entityId, Str nextNoFromUrl = String.format("apps/%s/%s/%s/runs/%s/logs/next?format=%s&max=100&suppress=%s", appId, entityType, entityId, runRecord.getPid(), format, fieldsToSuppress); } - HttpResponse response = doGet(getVersionedAPIPath(nextNoFromUrl, namespace)); + HttpResponse response = doGet(getVersionedApiPath(nextNoFromUrl, namespace)); verifyLogs(response, entityId, format, true, false, true, expectedEvents, 20, suppress); } @@ -535,7 +535,7 @@ private void testPrev(String appId, String entityType, String entityId, String n for (String format : FORMATS) { String prevUrl = String.format("apps/%s/%s/%s/logs/prev?fromOffset=%s&max=10&format=%s", appId, entityType, entityId, getToOffset(25), format); - HttpResponse response = doGet(getVersionedAPIPath(prevUrl, namespace)); + HttpResponse response = doGet(getVersionedApiPath(prevUrl, namespace)); verifyLogs(response, entityId, format, false, false, true, 10, 15); } } @@ -560,7 +560,7 @@ private void testPrevRunId(String appId, String entityType, String entityId, Str appId, entityType, entityId, runRecord.getPid(), format, fieldsToSuppress); } - HttpResponse response = doGet(getVersionedAPIPath(prevRunIdUrl, namespace)); + HttpResponse response = doGet(getVersionedApiPath(prevRunIdUrl, namespace)); verifyLogs(response, entityId, format, true, false, true, expectedEvents, 20, suppress); } @@ -586,7 +586,7 @@ private void testPrevNoMax(String appId, String entityType, String entityId, Str for (String format : FORMATS) { String prevNoMaxUrl = String.format("apps/%s/%s/%s/logs/prev?fromOffset=%s&format=%s", appId, entityType, entityId, getToOffset(70), format); - HttpResponse response = doGet(getVersionedAPIPath(prevNoMaxUrl, namespace)); + HttpResponse response = doGet(getVersionedApiPath(prevNoMaxUrl, namespace)); verifyLogs(response, entityId, format, false, false, true, 50, 20); } } @@ -596,14 +596,14 @@ private void testPrevFilter(String appId, String entityType, String entityId, St String prevFilterUrl = String.format("apps/%s/%s/%s/logs/prev?fromOffset=%s&max=16&format=%s&filter=loglevel=ERROR", appId, entityType, entityId, getToOffset(41), format); - HttpResponse response = doGet(getVersionedAPIPath(prevFilterUrl, namespace)); + HttpResponse response = doGet(getVersionedApiPath(prevFilterUrl, namespace)); verifyLogs(response, entityId, format, true, false, true, 8, 26); } } private void testPrevNoFrom(String appId, String entityType, String entityId, String namespace) throws Exception { String prevNoFrom = String.format("apps/%s/%s/%s/logs/prev", appId, entityType, entityId); - HttpResponse response = doGet(getVersionedAPIPath(prevNoFrom, namespace)); + HttpResponse response = doGet(getVersionedApiPath(prevNoFrom, namespace)); verifyLogs(response, entityId, "text", false, false, true, 50, 30); } @@ -628,7 +628,7 @@ private void testLogsRunId(String appId, String entityType, String entityId, Str appId, entityType, entityId, runRecord.getPid(), format, startTime, stopTime, fieldsToSuppress); } - HttpResponse response = doGet(getVersionedAPIPath(nextNoFromUrl, namespace)); + HttpResponse response = doGet(getVersionedApiPath(nextNoFromUrl, namespace)); verifyLogs(response, entityId, format, true, true, true, expectedEvents, 20, suppress); } @@ -638,13 +638,13 @@ private void testLogs(String appId, String entityType, String entityId, String n for (String format : FORMATS) { String logsUrl = String.format("apps/%s/%s/%s/logs?start=%s&stop=%s&format=%s", appId, entityType, entityId, startTime, stopTime, format); - HttpResponse response = doGet(getVersionedAPIPath(logsUrl, namespace)); + HttpResponse response = doGet(getVersionedApiPath(logsUrl, namespace)); verifyLogs(response, entityId, format, false, true, true, 15, 20); // Try with invalid time range -> start > stop logsUrl = String.format("apps/%s/%s/%s/logs?start=%s&stop=%s&format=%s", appId, entityType, entityId, 350, 300, format); - response = doGet(getVersionedAPIPath(logsUrl, namespace)); + response = doGet(getVersionedApiPath(logsUrl, namespace)); Assert.assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, response.getResponseCode()); } } @@ -655,20 +655,21 @@ private void testLogsFilter(String appId, String entityType, String entityId, St for (String format : FORMATS) { String logsFilterUrl = String.format("apps/%s/%s/%s/logs?start=%s&stop=%s&format=%s&filter=loglevel=ERROR", appId, entityType, entityId, startTime, stopTime, format); - HttpResponse response = doGet(getVersionedAPIPath(logsFilterUrl, namespace)); + HttpResponse response = doGet(getVersionedApiPath(logsFilterUrl, namespace)); verifyLogs(response, entityId, format, true, true, true, 8, 20); // Test origin filter String originFilterUrl = String.format("apps/%s/%s/%s/logs?start=%s&stop=%s&format=%s&filter=.origin=plugin", appId, entityType, entityId, startTime, stopTime, format); // There are 2 logs with .origin=plugin and loglevel=ERROR starting from 24 - response = doGet(getVersionedAPIPath(originFilterUrl + "%20AND%20loglevel=ERROR", namespace)); + response = doGet( + getVersionedApiPath(originFilterUrl + "%20AND%20loglevel=ERROR", namespace)); verifyLogs(response, entityId, format, 6, true, true, 2, 24, ImmutableList.of()); // There are 3 logs with .origin=program and MDC:eventType=lifeCycle starting from 22 originFilterUrl = String.format("apps/%s/%s/%s/logs?start=%s&stop=%s&format=%s&filter=.origin=program", appId, entityType, entityId, startTime, stopTime, format); - response = doGet(getVersionedAPIPath(originFilterUrl + "%20AND%20MDC:eventType=lifecycle", namespace)); + response = doGet(getVersionedApiPath(originFilterUrl + "%20AND%20MDC:eventType=lifecycle", namespace)); verifyLogs(response, entityId, format, 6, true, true, 3, 22, ImmutableList.of()); originFilterUrl = String.format("apps/%s/%s/%s/logs?start=%s&stop=%s&format=%s&filter=loglevel=ERROR", appId, @@ -677,7 +678,7 @@ private void testLogsFilter(String appId, String entityType, String entityId, St // Therefore, ".origin=plugin OR .origin=program OR .origin=system" is first combined to a single OrFilter, // which all logs can pass. Then loglevel=ERROR is combined with this OrFilter to form an AndFilter. // The whole filter therefore filters out logs with loglevel=ERROR. - response = doGet(getVersionedAPIPath( + response = doGet(getVersionedApiPath( originFilterUrl + "%20AND%20.origin=plugin%20OR%20.origin=program%20OR%20.origin=system", namespace)); verifyLogs(response, entityId, format, 2, true, true, 8, 20, ImmutableList.of()); } @@ -823,7 +824,7 @@ private String getSuppressStr(List suppress) { * @param nonVersionedApiPath API path without version * @param namespace the namespace */ - private static String getVersionedAPIPath(String nonVersionedApiPath, String namespace) { + private static String getVersionedApiPath(String nonVersionedApiPath, String namespace) { String version = Constants.Gateway.API_VERSION_3_TOKEN; return String.format("/%s/namespaces/%s/%s", version, namespace, nonVersionedApiPath); } diff --git a/cdap-support-bundle/src/test/java/io/cdap/cdap/SupportBundleTestBase.java b/cdap-support-bundle/src/test/java/io/cdap/cdap/SupportBundleTestBase.java index 71213de73ccd..6dd5019febb6 100644 --- a/cdap-support-bundle/src/test/java/io/cdap/cdap/SupportBundleTestBase.java +++ b/cdap-support-bundle/src/test/java/io/cdap/cdap/SupportBundleTestBase.java @@ -150,7 +150,7 @@ public abstract class SupportBundleTestBase { @BeforeClass public static void beforeClass() throws Throwable { - initializeAndStartServices(createBasicCConf()); + initializeAndStartServices(createBasicCconf()); } protected static void initializeAndStartServices(CConfiguration cConf) throws Exception { @@ -246,7 +246,7 @@ public static void afterClass() throws IOException { supportBundleInternalService.stopAndWait(); } - protected static CConfiguration createBasicCConf() throws IOException { + protected static CConfiguration createBasicCconf() throws IOException { CConfiguration cConf = CConfiguration.create(); cConf.set(Constants.Service.MASTER_SERVICES_BIND_ADDRESS, InetAddress.getLoopbackAddress().getHostAddress()); cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder("data").getAbsolutePath()); @@ -269,7 +269,7 @@ protected static Injector getInjector() { protected static URI getEndPoint(String path) { Discoverable discoverable = appFabricEndpointStrategy.pick(5, TimeUnit.SECONDS); Assert.assertNotNull("SupportBundle endpoint is missing, service may not be running.", discoverable); - return URIScheme.createURI(discoverable,"%s", path); + return URIScheme.createURI(discoverable, "%s", path); } protected static HttpResponse doGet(String resource) throws Exception { @@ -329,7 +329,7 @@ protected HttpResponse deploy(Class application, int expectedCode, @Nullable File artifactJar = buildAppArtifact(application, application.getSimpleName(), manifest); - String versionedApiPath = getVersionedAPIPath("apps/", apiVersion, namespace); + String versionedApiPath = getVersionedApiPath("apps/", apiVersion, namespace); HttpRequest.Builder builder = HttpRequest.post(getEndPoint(versionedApiPath).toURL()) .addHeader(Constants.Gateway.API_KEY, "api-key-example") .addHeader(AbstractAppFabricHttpHandler.ARCHIVE_NAME_HEADER, @@ -353,11 +353,11 @@ protected HttpResponse deploy(Class application, int expectedCode, @Nullable return response; } - protected String getVersionedAPIPath(String nonVersionedApiPath, String namespace) { - return getVersionedAPIPath(nonVersionedApiPath, Constants.Gateway.API_VERSION_3_TOKEN, namespace); + protected String getVersionedApiPath(String nonVersionedApiPath, String namespace) { + return getVersionedApiPath(nonVersionedApiPath, Constants.Gateway.API_VERSION_3_TOKEN, namespace); } - protected String getVersionedAPIPath(String nonVersionedApiPath, String version, String namespace) { + protected String getVersionedApiPath(String nonVersionedApiPath, String version, String namespace) { if (!Constants.Gateway.API_VERSION_3_TOKEN.equals(version)) { throw new IllegalArgumentException(String.format("Unsupported version '%s'. Only v3 is supported.", version)); } @@ -369,7 +369,7 @@ protected List getProgramRuns(ProgramId program, ProgramRunStatus sta String path = String.format("apps/%s/versions/%s/%s/%s/runs?status=%s", program.getApplication(), program.getVersion(), program.getType().getCategoryName(), program.getProgram(), status.toString()); - HttpResponse response = doGet(getVersionedAPIPath(path, program.getNamespace())); + HttpResponse response = doGet(getVersionedApiPath(path, program.getNamespace())); assertResponseCode(200, response); return GSON.fromJson(response.getResponseBodyAsString(), LIST_RUN_RECORD_TYPE); } diff --git a/cdap-support-bundle/src/test/java/io/cdap/cdap/support/job/SupportBundleJobTest.java b/cdap-support-bundle/src/test/java/io/cdap/cdap/support/job/SupportBundleJobTest.java index 3d197b695baa..f46711f20030 100644 --- a/cdap-support-bundle/src/test/java/io/cdap/cdap/support/job/SupportBundleJobTest.java +++ b/cdap-support-bundle/src/test/java/io/cdap/cdap/support/job/SupportBundleJobTest.java @@ -144,7 +144,7 @@ private void generateWorkflowLog() throws Exception { long startTime = System.currentTimeMillis(); HttpResponse appsResponse = - doGet(getVersionedAPIPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, + doGet(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, NAMESPACE.getNamespace())); Assert.assertEquals(200, appsResponse.getResponseCode()); String version = getResponseApplicationRecordVersion(appsResponse.getResponseBodyAsString()); diff --git a/cdap-support-bundle/src/test/java/io/cdap/cdap/support/services/SupportBundleGeneratorTest.java b/cdap-support-bundle/src/test/java/io/cdap/cdap/support/services/SupportBundleGeneratorTest.java index 58457a2ee7d4..4b5738f9c826 100644 --- a/cdap-support-bundle/src/test/java/io/cdap/cdap/support/services/SupportBundleGeneratorTest.java +++ b/cdap-support-bundle/src/test/java/io/cdap/cdap/support/services/SupportBundleGeneratorTest.java @@ -111,7 +111,7 @@ public void testSupportBundleService() throws Exception { long startTime = System.currentTimeMillis(); HttpResponse appsResponse = - doGet(getVersionedAPIPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, + doGet(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, NAMESPACE.getNamespace())); Assert.assertEquals(200, appsResponse.getResponseCode()); String version = getResponseApplicationRecordVersion(appsResponse.getResponseBodyAsString()); diff --git a/cdap-support-bundle/src/test/java/io/cdap/cdap/support/tasks/SupportBundlePipelineInfoTaskTest.java b/cdap-support-bundle/src/test/java/io/cdap/cdap/support/tasks/SupportBundlePipelineInfoTaskTest.java index 72132429fafb..6931098b6ed9 100644 --- a/cdap-support-bundle/src/test/java/io/cdap/cdap/support/tasks/SupportBundlePipelineInfoTaskTest.java +++ b/cdap-support-bundle/src/test/java/io/cdap/cdap/support/tasks/SupportBundlePipelineInfoTaskTest.java @@ -196,7 +196,7 @@ private String generateWorkflowLog() throws Exception { long startTime = System.currentTimeMillis(); HttpResponse appsResponse = - doGet(getVersionedAPIPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, + doGet(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, NAMESPACE.getNamespace())); Assert.assertEquals(200, appsResponse.getResponseCode()); String version = getResponseApplicationRecordVersion(appsResponse.getResponseBodyAsString()); diff --git a/cdap-support-bundle/src/test/java/io/cdap/cdap/support/tasks/SupportBundleSystemLogTaskTest.java b/cdap-support-bundle/src/test/java/io/cdap/cdap/support/tasks/SupportBundleSystemLogTaskTest.java index 21c67937407c..a020080cdcb6 100644 --- a/cdap-support-bundle/src/test/java/io/cdap/cdap/support/tasks/SupportBundleSystemLogTaskTest.java +++ b/cdap-support-bundle/src/test/java/io/cdap/cdap/support/tasks/SupportBundleSystemLogTaskTest.java @@ -103,7 +103,7 @@ private String generateWorkflowLog() throws Exception { long startTime = System.currentTimeMillis(); HttpResponse appsResponse = - doGet(getVersionedAPIPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, + doGet(getVersionedApiPath("apps/", Constants.Gateway.API_VERSION_3_TOKEN, NAMESPACE.getNamespace())); Assert.assertEquals(200, appsResponse.getResponseCode()); String version = getResponseApplicationRecordVersion(appsResponse.getResponseBodyAsString()); diff --git a/cdap-tms/src/main/java/io/cdap/cdap/messaging/distributed/MessagingServiceManager.java b/cdap-tms/src/main/java/io/cdap/cdap/messaging/distributed/MessagingServiceManager.java index c8396f1974dc..440d1beec8a9 100644 --- a/cdap-tms/src/main/java/io/cdap/cdap/messaging/distributed/MessagingServiceManager.java +++ b/cdap-tms/src/main/java/io/cdap/cdap/messaging/distributed/MessagingServiceManager.java @@ -42,6 +42,6 @@ public String getDescription() { @Override public int getMaxInstances() { - return getCConf().getInt(Constants.MessagingSystem.MAX_INSTANCES); + return getCconf().getInt(Constants.MessagingSystem.MAX_INSTANCES); } } diff --git a/cdap-ui b/cdap-ui index f0c322017cfb..e8bca76e4686 160000 --- a/cdap-ui +++ b/cdap-ui @@ -1 +1 @@ -Subproject commit f0c322017cfb9b41d383f279f50f984959ebfdab +Subproject commit e8bca76e4686fe1d07ae74aa3c95d6bcc757ab42 diff --git a/cdap-watchdog/src/main/java/io/cdap/cdap/logging/run/LogSaverServiceManager.java b/cdap-watchdog/src/main/java/io/cdap/cdap/logging/run/LogSaverServiceManager.java index 6ca8a66166b4..c79e9a6c5140 100644 --- a/cdap-watchdog/src/main/java/io/cdap/cdap/logging/run/LogSaverServiceManager.java +++ b/cdap-watchdog/src/main/java/io/cdap/cdap/logging/run/LogSaverServiceManager.java @@ -36,7 +36,7 @@ public class LogSaverServiceManager extends AbstractMasterServiceManager { @Override public int getMaxInstances() { - return getCConf().getInt(Constants.LogSaver.MAX_INSTANCES); + return getCconf().getInt(Constants.LogSaver.MAX_INSTANCES); } @Override diff --git a/cdap-watchdog/src/main/java/io/cdap/cdap/metrics/runtime/MetricsProcessorStatusServiceManager.java b/cdap-watchdog/src/main/java/io/cdap/cdap/metrics/runtime/MetricsProcessorStatusServiceManager.java index c0e5c12fbf30..c4b5017cfb45 100644 --- a/cdap-watchdog/src/main/java/io/cdap/cdap/metrics/runtime/MetricsProcessorStatusServiceManager.java +++ b/cdap-watchdog/src/main/java/io/cdap/cdap/metrics/runtime/MetricsProcessorStatusServiceManager.java @@ -36,7 +36,7 @@ public class MetricsProcessorStatusServiceManager extends AbstractMasterServiceM @Override public int getMaxInstances() { - return getCConf().getInt(Constants.MetricsProcessor.MAX_INSTANCES); + return getCconf().getInt(Constants.MetricsProcessor.MAX_INSTANCES); } @Override diff --git a/cdap-watchdog/src/main/java/io/cdap/cdap/metrics/runtime/MetricsServiceManager.java b/cdap-watchdog/src/main/java/io/cdap/cdap/metrics/runtime/MetricsServiceManager.java index 15d19660ed82..801516d5b6cb 100644 --- a/cdap-watchdog/src/main/java/io/cdap/cdap/metrics/runtime/MetricsServiceManager.java +++ b/cdap-watchdog/src/main/java/io/cdap/cdap/metrics/runtime/MetricsServiceManager.java @@ -36,7 +36,7 @@ public class MetricsServiceManager extends AbstractMasterServiceManager { @Override public int getMaxInstances() { - return getCConf().getInt(Constants.Metrics.MAX_INSTANCES); + return getCconf().getInt(Constants.Metrics.MAX_INSTANCES); } @Override