Skip to content

Commit

Permalink
Commnunication Mechanism for JS
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Jain <varunudr@amazon.com>
  • Loading branch information
vibrantvarun committed Dec 30, 2022
1 parent c9933e6 commit ff9e493
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public String getName() {
return GET_JOB_TYPE_ACTION;
}

public RestGetJobTypeAction() {}

public RestGetJobTypeAction(Map<String, JobDetails> indexToJobDetails) {
this.indexToJobDetails = indexToJobDetails;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public static GetJobIndexRequest parse(XContentParser parser) throws IOException
}

}
GetJobIndexRequest request = new GetJobIndexRequest(jobIndex, jobParserAction, jobRunnerAction, extensionId);
return request;
return new GetJobIndexRequest(jobIndex, jobParserAction, jobRunnerAction, extensionId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public static GetJobTypeRequest parse(XContentParser parser) throws IOException
}

}
GetJobTypeRequest request = new GetJobTypeRequest(jobType, extensionId);
return request;
return new GetJobTypeRequest(jobType, extensionId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import org.opensearch.client.node.NodeClient;
import org.opensearch.common.bytes.BytesArray;
import org.opensearch.common.xcontent.XContentType;

import org.opensearch.jobscheduler.JobSchedulerPlugin;
import org.opensearch.jobscheduler.model.JobDetails;
import org.opensearch.rest.RestHandler;
import org.opensearch.rest.RestRequest;
Expand All @@ -22,8 +24,8 @@
import java.io.IOException;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
import java.util.List;

import static org.hamcrest.Matchers.equalTo;
import static org.mockito.Mockito.mock;

Expand All @@ -40,7 +42,7 @@ public void setUp() throws Exception {
super.setUp();
indexToJobDetails = new HashMap<>();
action = new RestGetJobIndexAction(indexToJobDetails);
getJobIndexPath = action.routes().get(0).getPath();
getJobIndexPath = String.format(Locale.ROOT, "%s/%s", JobSchedulerPlugin.JS_BASE_URI, "_get/_job_index");
}

public void testGetNames() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.opensearch.client.node.NodeClient;
import org.opensearch.common.bytes.BytesArray;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.jobscheduler.JobSchedulerPlugin;
import org.opensearch.jobscheduler.model.JobDetails;
import org.opensearch.rest.RestHandler;
import org.opensearch.rest.RestRequest;
Expand All @@ -22,6 +23,7 @@
import java.io.IOException;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
import java.util.List;

import static org.hamcrest.Matchers.equalTo;
Expand All @@ -40,7 +42,7 @@ public void setUp() throws Exception {
super.setUp();
indexToJobDetails = new HashMap<>();
action = new RestGetJobTypeAction(indexToJobDetails);
getJobTypePath = action.routes().get(0).getPath();
getJobTypePath = String.format(Locale.ROOT, "%s/%s", JobSchedulerPlugin.JS_BASE_URI, "_get/_job_type");
}

public void testGetNames() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void onResponse(GetJobDetailsResponse jobDetailsResponse) {
public void onFailure(Exception e) {
// As the onFailure method is not triggered from the execution of doExecute method, therefore assertFalse condition is
// defined.
assertFalse(true);
fail("On failure method is not triggered from the test written below");
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void onResponse(GetJobDetailsResponse jobDetailsResponse) {
public void onFailure(Exception e) {
// As the onFailure method is not triggered from the execution of doExecute method, therefore assertFalse condition is
// defined.
assertFalse(true);
fail("On failure method is not triggered from the test written below");
}
};

Expand Down

0 comments on commit ff9e493

Please sign in to comment.