protected internal virtual void assertMediaTypes(WebResource resource, bool postSupported, MediaType expectedMediaType, params string[] acceptMediaTypes) { // test GET request ClientResponse response = resource.accept(acceptMediaTypes).get(typeof(ClientResponse)); assertMediaType(response, expectedMediaType); response.close(); if (postSupported) { // test POST request response = resource.accept(acceptMediaTypes).entity(Collections.EMPTY_MAP, MediaType.APPLICATION_JSON_TYPE).post(typeof(ClientResponse)); assertMediaType(response, expectedMediaType); response.close(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testScenario() throws org.codehaus.jettison.json.JSONException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testScenario() { // FIXME: cannot do this on JBoss AS7, see https://app.camunda.com/jira/browse/CAM-787 // get list of process engines // log.info("Checking " + APP_BASE_PATH + ENGINES_PATH); // WebResource resource = client.resource(APP_BASE_PATH + ENGINES_PATH); // ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); // // Assert.assertEquals(200, response.getStatus()); // // JSONArray enginesJson = response.getEntity(JSONArray.class); // Assert.assertEquals(1, enginesJson.length()); // // JSONObject engineJson = enginesJson.getJSONObject(0); // Assert.assertEquals("default", engineJson.getString("name")); // // response.close(); // get process definitions for default engine log.info("Checking " + APP_BASE_PATH + PROCESS_DEFINITION_PATH); WebResource resource = client.resource(APP_BASE_PATH + PROCESS_DEFINITION_PATH); ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(typeof(ClientResponse)); assertEquals(200, response.Status); JSONArray definitionsJson = response.getEntity(typeof(JSONArray)); // invoice example assertEquals(2, definitionsJson.length()); JSONObject definitionJson = definitionsJson.getJSONObject(0); assertEquals("invoice", definitionJson.getString("key")); assertEquals("http://www.omg.org/spec/BPMN/20100524/MODEL", definitionJson.getString("category")); assertEquals("Invoice Receipt", definitionJson.getString("name")); Assert.assertTrue(definitionJson.isNull("description")); Assert.assertTrue(definitionJson.getString("resource").contains("invoice.v1.bpmn")); assertFalse(definitionJson.getBoolean("suspended")); definitionJson = definitionsJson.getJSONObject(1); assertEquals("invoice", definitionJson.getString("key")); assertEquals("http://www.omg.org/spec/BPMN/20100524/MODEL", definitionJson.getString("category")); assertEquals("Invoice Receipt", definitionJson.getString("name")); Assert.assertTrue(definitionJson.isNull("description")); Assert.assertTrue(definitionJson.getString("resource").contains("invoice.v2.bpmn")); assertFalse(definitionJson.getBoolean("suspended")); response.close(); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: private com.sun.jersey.api.client.WebResource.Builder builder(String path, final javax.ws.rs.core.MediaType accept) private WebResource.Builder Builder(string path, MediaType accept) { WebResource resource = _client.resource(Uri(PathOrAbsolute(path))); WebResource.Builder builder = resource.accept(accept); if (_headers.Count > 0) { foreach (KeyValuePair <string, string> header in _headers.SetOfKeyValuePairs()) { builder = builder.header(header.Key, header.Value); } } return(builder); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDelayedJobDefinitionSuspension() public virtual void testDelayedJobDefinitionSuspension() { log.info("Checking " + APP_BASE_PATH + JOB_DEFINITION_PATH + "/suspended"); WebResource resource = client.resource(APP_BASE_PATH + JOB_DEFINITION_PATH + "/suspended"); IDictionary <string, object> requestBody = new Dictionary <string, object>(); requestBody["processDefinitionKey"] = "jobExampleProcess"; requestBody["suspended"] = true; requestBody["includeJobs"] = true; requestBody["executionDate"] = "2014-08-25T13:55:45"; ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON).put(typeof(ClientResponse), requestBody); assertEquals(204, response.Status); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void assertJodaTimePresent() public virtual void assertJodaTimePresent() { log.info("Checking " + APP_BASE_PATH + TASK_PATH); WebResource resource = client.resource(APP_BASE_PATH + TASK_PATH); resource.queryParam("dueAfter", "2000-01-01T00-00-00"); ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(typeof(ClientResponse)); assertEquals(200, response.Status); JSONArray definitionsJson = response.getEntity(typeof(JSONArray)); assertEquals(6, definitionsJson.length()); response.close(); }