Skip to content

Commit

Permalink
Merge pull request #15439 from cdapio/bugfix/CDAP-20900-handle-url-en…
Browse files Browse the repository at this point in the history
…coded-params-in-router

[CDAP-20900] Checkstyle Fixes
  • Loading branch information
arjan-bal authored Nov 20, 2023
2 parents 85d3031 + 2adbca5 commit 135cdb5
Show file tree
Hide file tree
Showing 38 changed files with 383 additions and 357 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -134,7 +134,7 @@ private void setAndTestRuntimeArgs(Id.Program programId, Map<String, String> arg
String argString = GSON.toJson(args, new TypeToken<Map<String, String>>() {
}.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);

Expand Down Expand Up @@ -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<String, DatasetSpecificationSummary> getWorkflowLocalDatasets(ProgramId workflowId, String runId)
Expand Down Expand Up @@ -633,7 +633,7 @@ private Map<String, WorkflowNodeStateDetail> 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);
}

Expand Down Expand Up @@ -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<WorkflowTokenDetail>() { }.getType(), GSON);
Expand All @@ -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<WorkflowTokenNodeDetail>() { }.getType(), GSON);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Loading

0 comments on commit 135cdb5

Please sign in to comment.