http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITLabelAccessControl.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITLabelAccessControl.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITLabelAccessControl.java index 4b233cf..35af389 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITLabelAccessControl.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITLabelAccessControl.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.integration.accesscontrol; -import com.sun.jersey.api.client.ClientResponse; import org.apache.nifi.integration.util.NiFiTestAuthorizer; import org.apache.nifi.integration.util.NiFiTestUser; import org.apache.nifi.web.api.dto.LabelDTO; @@ -28,6 +27,7 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import javax.ws.rs.core.Response; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -124,7 +124,7 @@ public class ITLabelAccessControl { entity.getComponent().setLabel("Updated Label"); // perform the request - final ClientResponse response = updateLabel(helper.getReadUser(), entity); + final Response response = updateLabel(helper.getReadUser(), entity); // ensure forbidden response assertEquals(403, response.getStatus()); @@ -150,13 +150,13 @@ public class ITLabelAccessControl { entity.getComponent().setLabel(updatedLabel); // perform the request - final ClientResponse response = updateLabel(helper.getReadWriteUser(), entity); + final Response response = updateLabel(helper.getReadWriteUser(), entity); // ensure successful response assertEquals(200, response.getStatus()); // get the response - final LabelEntity responseEntity = response.getEntity(LabelEntity.class); + final LabelEntity responseEntity = response.readEntity(LabelEntity.class); // verify assertEquals(READ_WRITE_CLIENT_ID, responseEntity.getRevision().getClientId()); @@ -181,13 +181,13 @@ public class ITLabelAccessControl { entity.getComponent().setLabel(updatedLabel); // perform the request - final ClientResponse response = updateLabel(helper.getReadWriteUser(), entity); + final Response response = updateLabel(helper.getReadWriteUser(), entity); // ensure successful response assertEquals(200, response.getStatus()); // get the response - final LabelEntity responseEntity = response.getEntity(LabelEntity.class); + final LabelEntity responseEntity = response.readEntity(LabelEntity.class); // verify assertEquals(AccessControlHelper.READ_WRITE_CLIENT_ID, responseEntity.getRevision().getClientId()); @@ -225,13 +225,13 @@ public class ITLabelAccessControl { requestEntity.setComponent(requestDto); // perform the request - final ClientResponse response = updateLabel(helper.getWriteUser(), requestEntity); + final Response response = updateLabel(helper.getWriteUser(), requestEntity); // ensure successful response assertEquals(200, response.getStatus()); // get the response - final LabelEntity responseEntity = response.getEntity(LabelEntity.class); + final LabelEntity responseEntity = response.readEntity(LabelEntity.class); // verify assertEquals(WRITE_CLIENT_ID, responseEntity.getRevision().getClientId()); @@ -268,7 +268,7 @@ public class ITLabelAccessControl { requestEntity.setComponent(requestDto); // perform the request - final ClientResponse response = updateLabel(helper.getNoneUser(), requestEntity); + final Response response = updateLabel(helper.getNoneUser(), requestEntity); // ensure forbidden response assertEquals(403, response.getStatus()); @@ -318,13 +318,13 @@ public class ITLabelAccessControl { final String url = helper.getBaseUrl() + "/flow/process-groups/root"; // get the labels - final ClientResponse response = user.testGet(url); + final Response response = user.testGet(url); // ensure the response was successful assertEquals(200, response.getStatus()); // unmarshal - final ProcessGroupFlowEntity flowEntity = response.getEntity(ProcessGroupFlowEntity.class); + final ProcessGroupFlowEntity flowEntity = response.readEntity(ProcessGroupFlowEntity.class); final FlowDTO flowDto = flowEntity.getProcessGroupFlow().getFlow(); final Set<LabelEntity> labels = flowDto.getLabels(); @@ -337,7 +337,7 @@ public class ITLabelAccessControl { return labelIter.next(); } - private ClientResponse updateLabel(final NiFiTestUser user, final LabelEntity entity) throws Exception { + private Response updateLabel(final NiFiTestUser user, final LabelEntity entity) throws Exception { final String url = helper.getBaseUrl() + "/labels/" + entity.getId(); // perform the request @@ -362,13 +362,13 @@ public class ITLabelAccessControl { entity.setComponent(label); // perform the request - ClientResponse response = helper.getReadWriteUser().testPost(url, entity); + Response response = helper.getReadWriteUser().testPost(url, entity); // ensure the request is successful assertEquals(201, response.getStatus()); // get the entity body - entity = response.getEntity(LabelEntity.class); + entity = response.readEntity(LabelEntity.class); // verify creation label = entity.getComponent(); @@ -387,7 +387,7 @@ public class ITLabelAccessControl { queryParams.put("clientId", clientId); // perform the request - ClientResponse response = user.testDelete(entity.getUri(), queryParams); + Response response = user.testDelete(entity.getUri(), queryParams); // ensure the request is failed with a forbidden status code assertEquals(responseCode, response.getStatus());
http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITOutputPortAccessControl.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITOutputPortAccessControl.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITOutputPortAccessControl.java index 3bf6a1b..29200bf 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITOutputPortAccessControl.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITOutputPortAccessControl.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.integration.accesscontrol; -import com.sun.jersey.api.client.ClientResponse; import org.apache.nifi.integration.util.NiFiTestAuthorizer; import org.apache.nifi.integration.util.NiFiTestUser; import org.apache.nifi.web.api.dto.PortDTO; @@ -28,6 +27,7 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import javax.ws.rs.core.Response; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -125,7 +125,7 @@ public class ITOutputPortAccessControl { entity.getComponent().setName("Updated Name" + count++); // perform the request - final ClientResponse response = updateOutputPort(helper.getReadUser(), entity); + final Response response = updateOutputPort(helper.getReadUser(), entity); // ensure forbidden response assertEquals(403, response.getStatus()); @@ -151,13 +151,13 @@ public class ITOutputPortAccessControl { entity.getComponent().setName(updatedName); // perform the request - final ClientResponse response = updateOutputPort(helper.getReadWriteUser(), entity); + final Response response = updateOutputPort(helper.getReadWriteUser(), entity); // ensure successful response assertEquals(200, response.getStatus()); // get the response - final PortEntity responseEntity = response.getEntity(PortEntity.class); + final PortEntity responseEntity = response.readEntity(PortEntity.class); // verify assertEquals(READ_WRITE_CLIENT_ID, responseEntity.getRevision().getClientId()); @@ -182,13 +182,13 @@ public class ITOutputPortAccessControl { entity.getComponent().setName(updatedName); // perform the request - final ClientResponse response = updateOutputPort(helper.getReadWriteUser(), entity); + final Response response = updateOutputPort(helper.getReadWriteUser(), entity); // ensure successful response assertEquals(200, response.getStatus()); // get the response - final PortEntity responseEntity = response.getEntity(PortEntity.class); + final PortEntity responseEntity = response.readEntity(PortEntity.class); // verify assertEquals(AccessControlHelper.READ_WRITE_CLIENT_ID, responseEntity.getRevision().getClientId()); @@ -226,13 +226,13 @@ public class ITOutputPortAccessControl { requestEntity.setComponent(requestDto); // perform the request - final ClientResponse response = updateOutputPort(helper.getWriteUser(), requestEntity); + final Response response = updateOutputPort(helper.getWriteUser(), requestEntity); // ensure successful response assertEquals(200, response.getStatus()); // get the response - final PortEntity responseEntity = response.getEntity(PortEntity.class); + final PortEntity responseEntity = response.readEntity(PortEntity.class); // verify assertEquals(WRITE_CLIENT_ID, responseEntity.getRevision().getClientId()); @@ -269,7 +269,7 @@ public class ITOutputPortAccessControl { requestEntity.setComponent(requestDto); // perform the request - final ClientResponse response = updateOutputPort(helper.getNoneUser(), requestEntity); + final Response response = updateOutputPort(helper.getNoneUser(), requestEntity); // ensure forbidden response assertEquals(403, response.getStatus()); @@ -319,13 +319,13 @@ public class ITOutputPortAccessControl { final String url = helper.getBaseUrl() + "/flow/process-groups/root"; // get the output ports - final ClientResponse response = user.testGet(url); + final Response response = user.testGet(url); // ensure the response was successful assertEquals(200, response.getStatus()); // unmarshal - final ProcessGroupFlowEntity flowEntity = response.getEntity(ProcessGroupFlowEntity.class); + final ProcessGroupFlowEntity flowEntity = response.readEntity(ProcessGroupFlowEntity.class); final FlowDTO flowDto = flowEntity.getProcessGroupFlow().getFlow(); final Set<PortEntity> outputPorts = flowDto.getOutputPorts(); @@ -338,7 +338,7 @@ public class ITOutputPortAccessControl { return outputPortIter.next(); } - private ClientResponse updateOutputPort(final NiFiTestUser user, final PortEntity entity) throws Exception { + private Response updateOutputPort(final NiFiTestUser user, final PortEntity entity) throws Exception { final String url = helper.getBaseUrl() + "/output-ports/" + entity.getId(); // perform the request @@ -365,13 +365,13 @@ public class ITOutputPortAccessControl { entity.setComponent(outputPort); // perform the request - ClientResponse response = helper.getReadWriteUser().testPost(url, entity); + Response response = helper.getReadWriteUser().testPost(url, entity); // ensure the request is successful assertEquals(201, response.getStatus()); // get the entity body - entity = response.getEntity(PortEntity.class); + entity = response.readEntity(PortEntity.class); // verify creation outputPort = entity.getComponent(); @@ -390,7 +390,7 @@ public class ITOutputPortAccessControl { queryParams.put("clientId", clientId); // perform the request - ClientResponse response = user.testDelete(entity.getUri(), queryParams); + Response response = user.testDelete(entity.getUri(), queryParams); // ensure the request is failed with a forbidden status code assertEquals(responseCode, response.getStatus()); http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessGroupAccessControl.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessGroupAccessControl.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessGroupAccessControl.java index 36be2d3..2b3f42c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessGroupAccessControl.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessGroupAccessControl.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.integration.accesscontrol; -import com.sun.jersey.api.client.ClientResponse; import org.apache.nifi.integration.util.NiFiTestAuthorizer; import org.apache.nifi.integration.util.NiFiTestUser; import org.apache.nifi.web.api.dto.ProcessGroupDTO; @@ -28,6 +27,7 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import javax.ws.rs.core.Response; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -125,7 +125,7 @@ public class ITProcessGroupAccessControl { entity.getComponent().setName("Updated Name" + count++); // perform the request - final ClientResponse response = updateProcessGroup(helper.getReadUser(), entity); + final Response response = updateProcessGroup(helper.getReadUser(), entity); // ensure forbidden response assertEquals(403, response.getStatus()); @@ -151,13 +151,13 @@ public class ITProcessGroupAccessControl { entity.getComponent().setName(updatedName); // perform the request - final ClientResponse response = updateProcessGroup(helper.getReadWriteUser(), entity); + final Response response = updateProcessGroup(helper.getReadWriteUser(), entity); // ensure successful response assertEquals(200, response.getStatus()); // get the response - final ProcessGroupEntity responseEntity = response.getEntity(ProcessGroupEntity.class); + final ProcessGroupEntity responseEntity = response.readEntity(ProcessGroupEntity.class); // verify assertEquals(READ_WRITE_CLIENT_ID, responseEntity.getRevision().getClientId()); @@ -182,13 +182,13 @@ public class ITProcessGroupAccessControl { entity.getComponent().setName(updatedName); // perform the request - final ClientResponse response = updateProcessGroup(helper.getReadWriteUser(), entity); + final Response response = updateProcessGroup(helper.getReadWriteUser(), entity); // ensure successful response assertEquals(200, response.getStatus()); // get the response - final ProcessGroupEntity responseEntity = response.getEntity(ProcessGroupEntity.class); + final ProcessGroupEntity responseEntity = response.readEntity(ProcessGroupEntity.class); // verify assertEquals(AccessControlHelper.READ_WRITE_CLIENT_ID, responseEntity.getRevision().getClientId()); @@ -226,13 +226,13 @@ public class ITProcessGroupAccessControl { requestEntity.setComponent(requestDto); // perform the request - final ClientResponse response = updateProcessGroup(helper.getWriteUser(), requestEntity); + final Response response = updateProcessGroup(helper.getWriteUser(), requestEntity); // ensure successful response assertEquals(200, response.getStatus()); // get the response - final ProcessGroupEntity responseEntity = response.getEntity(ProcessGroupEntity.class); + final ProcessGroupEntity responseEntity = response.readEntity(ProcessGroupEntity.class); // verify assertEquals(WRITE_CLIENT_ID, responseEntity.getRevision().getClientId()); @@ -269,7 +269,7 @@ public class ITProcessGroupAccessControl { requestEntity.setComponent(requestDto); // perform the request - final ClientResponse response = updateProcessGroup(helper.getNoneUser(), requestEntity); + final Response response = updateProcessGroup(helper.getNoneUser(), requestEntity); // ensure forbidden response assertEquals(403, response.getStatus()); @@ -319,13 +319,13 @@ public class ITProcessGroupAccessControl { final String url = helper.getBaseUrl() + "/flow/process-groups/root"; // get the process groups - final ClientResponse response = user.testGet(url); + final Response response = user.testGet(url); // ensure the response was successful assertEquals(200, response.getStatus()); // unmarshal - final ProcessGroupFlowEntity flowEntity = response.getEntity(ProcessGroupFlowEntity.class); + final ProcessGroupFlowEntity flowEntity = response.readEntity(ProcessGroupFlowEntity.class); final FlowDTO flowDto = flowEntity.getProcessGroupFlow().getFlow(); final Set<ProcessGroupEntity> processGroups = flowDto.getProcessGroups(); @@ -338,7 +338,7 @@ public class ITProcessGroupAccessControl { return processGroupIter.next(); } - private ClientResponse updateProcessGroup(final NiFiTestUser user, final ProcessGroupEntity entity) throws Exception { + private Response updateProcessGroup(final NiFiTestUser user, final ProcessGroupEntity entity) throws Exception { final String url = helper.getBaseUrl() + "/process-groups/" + entity.getId(); // perform the request @@ -365,13 +365,13 @@ public class ITProcessGroupAccessControl { entity.setComponent(processor); // perform the request - ClientResponse response = helper.getReadWriteUser().testPost(url, entity); + Response response = helper.getReadWriteUser().testPost(url, entity); // ensure the request is successful assertEquals(201, response.getStatus()); // get the entity body - entity = response.getEntity(ProcessGroupEntity.class); + entity = response.readEntity(ProcessGroupEntity.class); // verify creation processor = entity.getComponent(); @@ -390,7 +390,7 @@ public class ITProcessGroupAccessControl { queryParams.put("clientId", clientId); // perform the request - ClientResponse response = user.testDelete(entity.getUri(), queryParams); + Response response = user.testDelete(entity.getUri(), queryParams); // ensure the request is failed with a forbidden status code assertEquals(responseCode, response.getStatus()); http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessorAccessControl.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessorAccessControl.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessorAccessControl.java index cf7226c..2b70930 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessorAccessControl.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessorAccessControl.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.integration.accesscontrol; -import com.sun.jersey.api.client.ClientResponse; import org.apache.nifi.integration.util.NiFiTestAuthorizer; import org.apache.nifi.integration.util.NiFiTestUser; import org.apache.nifi.integration.util.RestrictedProcessor; @@ -39,6 +38,7 @@ import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; +import javax.ws.rs.core.Response; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -135,7 +135,7 @@ public class ITProcessorAccessControl { entity.getComponent().setName("Updated Name"); // perform the request - final ClientResponse response = updateProcessor(helper.getReadUser(), entity); + final Response response = updateProcessor(helper.getReadUser(), entity); // ensure forbidden response assertEquals(403, response.getStatus()); @@ -161,13 +161,13 @@ public class ITProcessorAccessControl { entity.getComponent().setName(updatedName); // perform the request - final ClientResponse response = updateProcessor(helper.getReadWriteUser(), entity); + final Response response = updateProcessor(helper.getReadWriteUser(), entity); // ensure successful response assertEquals(200, response.getStatus()); // get the response - final ProcessorEntity responseEntity = response.getEntity(ProcessorEntity.class); + final ProcessorEntity responseEntity = response.readEntity(ProcessorEntity.class); // verify assertEquals(READ_WRITE_CLIENT_ID, responseEntity.getRevision().getClientId()); @@ -192,13 +192,13 @@ public class ITProcessorAccessControl { entity.getComponent().setName(updatedName); // perform the request - final ClientResponse response = updateProcessor(helper.getReadWriteUser(), entity); + final Response response = updateProcessor(helper.getReadWriteUser(), entity); // ensure successful response assertEquals(200, response.getStatus()); // get the response - final ProcessorEntity responseEntity = response.getEntity(ProcessorEntity.class); + final ProcessorEntity responseEntity = response.readEntity(ProcessorEntity.class); // verify assertEquals(AccessControlHelper.READ_WRITE_CLIENT_ID, responseEntity.getRevision().getClientId()); @@ -236,13 +236,13 @@ public class ITProcessorAccessControl { requestEntity.setComponent(requestDto); // perform the request - final ClientResponse response = updateProcessor(helper.getWriteUser(), requestEntity); + final Response response = updateProcessor(helper.getWriteUser(), requestEntity); // ensure successful response assertEquals(200, response.getStatus()); // get the response - final ProcessorEntity responseEntity = response.getEntity(ProcessorEntity.class); + final ProcessorEntity responseEntity = response.readEntity(ProcessorEntity.class); // verify assertEquals(WRITE_CLIENT_ID, responseEntity.getRevision().getClientId()); @@ -279,7 +279,7 @@ public class ITProcessorAccessControl { requestEntity.setComponent(requestDto); // perform the request - final ClientResponse response = updateProcessor(helper.getNoneUser(), requestEntity); + final Response response = updateProcessor(helper.getNoneUser(), requestEntity); // ensure forbidden response assertEquals(403, response.getStatus()); @@ -300,7 +300,7 @@ public class ITProcessorAccessControl { final String url = helper.getBaseUrl() + "/processors/" + entity.getId() + "/state/clear-requests"; // perform the request - final ClientResponse response = helper.getReadUser().testPost(url); + final Response response = helper.getReadUser().testPost(url); // ensure forbidden response assertEquals(403, response.getStatus()); @@ -321,7 +321,7 @@ public class ITProcessorAccessControl { final String url = helper.getBaseUrl() + "/processors/" + entity.getId() + "/state/clear-requests"; // perform the request - final ClientResponse response = helper.getNoneUser().testPost(url); + final Response response = helper.getNoneUser().testPost(url); // ensure forbidden response assertEquals(403, response.getStatus()); @@ -342,7 +342,7 @@ public class ITProcessorAccessControl { final String url = helper.getBaseUrl() + "/processors/" + entity.getId() + "/state/clear-requests"; // perform the request - final ClientResponse response = helper.getReadWriteUser().testPost(url); + final Response response = helper.getReadWriteUser().testPost(url); // ensure ok response assertEquals(200, response.getStatus()); @@ -363,7 +363,7 @@ public class ITProcessorAccessControl { final String url = helper.getBaseUrl() + "/processors/" + entity.getId() + "/state/clear-requests"; // perform the request - final ClientResponse response = helper.getWriteUser().testPost(url); + final Response response = helper.getWriteUser().testPost(url); // ensure ok response assertEquals(200, response.getStatus()); @@ -434,7 +434,7 @@ public class ITProcessorAccessControl { entity.setComponent(processor); // perform the request as a user with read/write but no restricted access - ClientResponse response = helper.getReadWriteUser().testPost(url, entity); + Response response = helper.getReadWriteUser().testPost(url, entity); // ensure the request is successful assertEquals(403, response.getStatus()); @@ -445,7 +445,7 @@ public class ITProcessorAccessControl { // ensure the request is successful assertEquals(201, response.getStatus()); - final ProcessorEntity responseEntity = response.getEntity(ProcessorEntity.class); + final ProcessorEntity responseEntity = response.readEntity(ProcessorEntity.class); // remove the restricted component deleteRestrictedComponent(responseEntity); @@ -469,7 +469,7 @@ public class ITProcessorAccessControl { copyRequest.setOriginY(0.0); // create the snippet - ClientResponse response = helper.getReadWriteUser().testPost(copyUrl, copyRequest); + Response response = helper.getReadWriteUser().testPost(copyUrl, copyRequest); // ensure the request failed... need privileged users since snippet comprised of the restricted components assertEquals(403, response.getStatus()); @@ -480,7 +480,7 @@ public class ITProcessorAccessControl { // ensure the request is successful assertEquals(201, response.getStatus()); - final FlowEntity flowEntity = response.getEntity(FlowEntity.class); + final FlowEntity flowEntity = response.readEntity(FlowEntity.class); // remove the restricted processors deleteRestrictedComponent(tuple.getKey()); @@ -505,7 +505,7 @@ public class ITProcessorAccessControl { createTemplateRequest.setName("test"); // create the snippet - ClientResponse response = helper.getWriteUser().testPost(createTemplateUrl, createTemplateRequest); + Response response = helper.getWriteUser().testPost(createTemplateUrl, createTemplateRequest); // ensure the request failed... need read perms to the components in the snippet assertEquals(403, response.getStatus()); @@ -515,7 +515,7 @@ public class ITProcessorAccessControl { // ensure the request is successfull assertEquals(201, response.getStatus()); - final TemplateEntity templateEntity = response.getEntity(TemplateEntity.class); + final TemplateEntity templateEntity = response.readEntity(TemplateEntity.class); // build the template request final InstantiateTemplateRequestEntity instantiateTemplateRequest = new InstantiateTemplateRequestEntity(); @@ -535,7 +535,7 @@ public class ITProcessorAccessControl { // ensure the request is successful assertEquals(201, response.getStatus()); - final FlowEntity flowEntity = response.getEntity(FlowEntity.class); + final FlowEntity flowEntity = response.readEntity(FlowEntity.class); // clean up the resources created during this test deleteTemplate(templateEntity); @@ -563,13 +563,13 @@ public class ITProcessorAccessControl { entity.setComponent(processor); // perform the request as a user with read/write and restricted access - ClientResponse response = helper.getPrivilegedUser().testPost(processorUrl, entity); + Response response = helper.getPrivilegedUser().testPost(processorUrl, entity); // ensure the request is successful assertEquals(201, response.getStatus()); // get the response - final ProcessorEntity responseProcessorEntity = response.getEntity(ProcessorEntity.class); + final ProcessorEntity responseProcessorEntity = response.readEntity(ProcessorEntity.class); // build the snippet for the copy/paste final SnippetDTO snippet = new SnippetDTO(); @@ -593,12 +593,12 @@ public class ITProcessorAccessControl { assertEquals(201, response.getStatus()); // get the response - return new Tuple<>(responseProcessorEntity, response.getEntity(SnippetEntity.class)); + return new Tuple<>(responseProcessorEntity, response.readEntity(SnippetEntity.class)); } private void deleteTemplate(final TemplateEntity entity) throws Exception { // perform the request - ClientResponse response = helper.getReadWriteUser().testDelete(entity.getTemplate().getUri()); + Response response = helper.getReadWriteUser().testDelete(entity.getTemplate().getUri()); // ensure the request is successful assertEquals(200, response.getStatus()); @@ -616,7 +616,7 @@ public class ITProcessorAccessControl { queryParams.put("clientId", READ_WRITE_CLIENT_ID); // perform the request - ClientResponse response = helper.getReadWriteUser().testDelete(entity.getUri(), queryParams); + Response response = helper.getReadWriteUser().testDelete(entity.getUri(), queryParams); // ensure the request fails... needs access to restricted components assertEquals(403, response.getStatus()); @@ -631,13 +631,13 @@ public class ITProcessorAccessControl { final String url = helper.getBaseUrl() + "/flow/process-groups/root"; // get the processors - final ClientResponse response = user.testGet(url); + final Response response = user.testGet(url); // ensure the response was successful assertEquals(200, response.getStatus()); // unmarshal - final ProcessGroupFlowEntity flowEntity = response.getEntity(ProcessGroupFlowEntity.class); + final ProcessGroupFlowEntity flowEntity = response.readEntity(ProcessGroupFlowEntity.class); final FlowDTO flowDto = flowEntity.getProcessGroupFlow().getFlow(); final Set<ProcessorEntity> processors = flowDto.getProcessors(); @@ -650,7 +650,7 @@ public class ITProcessorAccessControl { return processorIter.next(); } - private ClientResponse updateProcessor(final NiFiTestUser user, final ProcessorEntity entity) throws Exception { + private Response updateProcessor(final NiFiTestUser user, final ProcessorEntity entity) throws Exception { final String url = helper.getBaseUrl() + "/processors/" + entity.getId(); // perform the request @@ -676,13 +676,13 @@ public class ITProcessorAccessControl { entity.setComponent(processor); // perform the request - ClientResponse response = ach.getReadWriteUser().testPost(url, entity); + Response response = ach.getReadWriteUser().testPost(url, entity); // ensure the request is successful assertEquals(201, response.getStatus()); // get the entity body - entity = response.getEntity(ProcessorEntity.class); + entity = response.readEntity(ProcessorEntity.class); // verify creation processor = entity.getComponent(); @@ -702,7 +702,7 @@ public class ITProcessorAccessControl { queryParams.put("clientId", clientId); // perform the request - ClientResponse response = user.testDelete(entity.getUri(), queryParams); + Response response = user.testDelete(entity.getUri(), queryParams); // ensure the request is failed with a forbidden status code assertEquals(responseCode, response.getStatus()); http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java index 677e6ab..832c7df 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.integration.util; -import com.sun.jersey.api.client.Client; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.framework.security.util.SslContextFactory; import org.apache.nifi.services.FlowService; @@ -36,6 +35,7 @@ import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; import javax.servlet.ServletContext; +import javax.ws.rs.client.Client; import java.io.File; import java.util.Collections; http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestUser.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestUser.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestUser.java index 77f8910..72d59ba 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestUser.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestUser.java @@ -16,13 +16,15 @@ */ package org.apache.nifi.integration.util; -import com.sun.jersey.api.client.Client; -import com.sun.jersey.api.client.ClientResponse; -import com.sun.jersey.api.client.WebResource; -import com.sun.jersey.core.util.MultivaluedMapImpl; import org.apache.nifi.web.security.ProxiedEntitiesUtils; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.Response; import java.util.Map; /** @@ -48,7 +50,7 @@ public class NiFiTestUser { * @param builder the resource builder * @return the resource builder */ - private WebResource.Builder addProxiedEntities(final WebResource.Builder builder) { + private Invocation.Builder addProxiedEntities(final Invocation.Builder builder) { if (proxyDn == null) { return builder; } else { @@ -63,7 +65,7 @@ public class NiFiTestUser { * @return response * @throws Exception ex */ - public ClientResponse testGet(String url) throws Exception { + public Response testGet(String url) throws Exception { return testGet(url, null); } @@ -74,7 +76,7 @@ public class NiFiTestUser { * @param queryParams params * @return response */ - public ClientResponse testGet(String url, Map<String, String> queryParams) { + public Response testGet(String url, Map<String, String> queryParams) { return testGetWithHeaders(url, queryParams, null); } @@ -86,9 +88,9 @@ public class NiFiTestUser { * @param headers http headers * @return response */ - public ClientResponse testGetWithHeaders(String url, Map<String, String> queryParams, Map<String, String> headers) { + public Response testGetWithHeaders(String url, Map<String, String> queryParams, Map<String, String> headers) { // get the resource - WebResource resource = client.resource(url); + WebTarget resource = client.target(url); // append any query parameters if (queryParams != null && !queryParams.isEmpty()) { @@ -98,7 +100,7 @@ public class NiFiTestUser { } // get the builder - WebResource.Builder builder = addProxiedEntities(resource.getRequestBuilder()); + Invocation.Builder builder = addProxiedEntities(resource.request()); // append any headers if (headers != null && !headers.isEmpty()) { @@ -108,7 +110,7 @@ public class NiFiTestUser { } // perform the query - return builder.get(ClientResponse.class); + return builder.get(); } /** @@ -118,7 +120,7 @@ public class NiFiTestUser { * @return response * @throws Exception ex */ - public ClientResponse testPost(String url) throws Exception { + public Response testPost(String url) throws Exception { return testPost(url, (Object) null); } @@ -130,7 +132,7 @@ public class NiFiTestUser { * @return response * @throws Exception ex */ - public ClientResponse testPost(String url, Object entity) throws Exception { + public Response testPost(String url, Object entity) throws Exception { return testPostWithHeaders(url, entity, null); } @@ -143,14 +145,9 @@ public class NiFiTestUser { * @return response * @throws Exception ex */ - public ClientResponse testPostWithHeaders(String url, Object entity, Map<String, String> headers) throws Exception { + public Response testPostWithHeaders(String url, Object entity, Map<String, String> headers) throws Exception { // get the resource - WebResource.Builder resourceBuilder = addProxiedEntities(client.resource(url).type(MediaType.APPLICATION_JSON)); - - // include the request entity - if (entity != null) { - resourceBuilder = resourceBuilder.entity(entity); - } + Invocation.Builder resourceBuilder = addProxiedEntities(client.target(url).request()); // append any headers if (headers != null && !headers.isEmpty()) { @@ -160,7 +157,7 @@ public class NiFiTestUser { } // perform the request - return resourceBuilder.post(ClientResponse.class); + return resourceBuilder.post(Entity.json(entity)); } /** @@ -171,7 +168,7 @@ public class NiFiTestUser { * @return response * @throws Exception ex */ - public ClientResponse testPostMultiPart(String url, Object entity) throws Exception { + public Response testPostMultiPart(String url, Object entity) throws Exception { return testPostMultiPartWithHeaders(url, entity, null); } @@ -184,14 +181,9 @@ public class NiFiTestUser { * @return response * @throws Exception ex */ - public ClientResponse testPostMultiPartWithHeaders(String url, Object entity, Map<String, String> headers) throws Exception { + public Response testPostMultiPartWithHeaders(String url, Object entity, Map<String, String> headers) throws Exception { // get the resource - WebResource.Builder resourceBuilder = addProxiedEntities(client.resource(url).accept(MediaType.APPLICATION_XML).type(MediaType.MULTIPART_FORM_DATA)); - - // include the request entity - if (entity != null) { - resourceBuilder = resourceBuilder.entity(entity); - } + Invocation.Builder resourceBuilder = addProxiedEntities(client.target(url).request()); // append any headers if (headers != null && !headers.isEmpty()) { @@ -201,7 +193,7 @@ public class NiFiTestUser { } // perform the request - return resourceBuilder.post(ClientResponse.class); + return resourceBuilder.post(Entity.entity(entity, MediaType.MULTIPART_FORM_DATA)); } /** @@ -212,7 +204,7 @@ public class NiFiTestUser { * @return response * @throws java.lang.Exception ex */ - public ClientResponse testPost(String url, Map<String, String> formData) throws Exception { + public Response testPost(String url, Map<String, String> formData) throws Exception { return testPostWithHeaders(url, formData, null); } @@ -225,20 +217,15 @@ public class NiFiTestUser { * @return response * @throws java.lang.Exception ex */ - public ClientResponse testPostWithHeaders(String url, Map<String, String> formData, Map<String, String> headers) throws Exception { + public Response testPostWithHeaders(String url, Map<String, String> formData, Map<String, String> headers) throws Exception { // convert the form data - MultivaluedMapImpl entity = new MultivaluedMapImpl(); + MultivaluedHashMap<String, String> entity = new MultivaluedHashMap(); for (String key : formData.keySet()) { entity.add(key, formData.get(key)); } // get the resource - WebResource.Builder resourceBuilder = addProxiedEntities(client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED)); - - // add the form data if necessary - if (!entity.isEmpty()) { - resourceBuilder = resourceBuilder.entity(entity); - } + Invocation.Builder resourceBuilder = addProxiedEntities(client.target(url).request()); // append any headers if (headers != null && !headers.isEmpty()) { @@ -248,7 +235,7 @@ public class NiFiTestUser { } // perform the request - return resourceBuilder.post(ClientResponse.class); + return resourceBuilder.post(Entity.form(entity)); } /** @@ -259,7 +246,7 @@ public class NiFiTestUser { * @return response * @throws java.lang.Exception ex */ - public ClientResponse testPut(String url, Object entity) throws Exception { + public Response testPut(String url, Object entity) throws Exception { return testPutWithHeaders(url, entity, null); } @@ -272,14 +259,9 @@ public class NiFiTestUser { * @return response * @throws java.lang.Exception ex */ - public ClientResponse testPutWithHeaders(String url, Object entity, Map<String, String> headers) throws Exception { + public Response testPutWithHeaders(String url, Object entity, Map<String, String> headers) throws Exception { // get the resource - WebResource.Builder resourceBuilder = addProxiedEntities(client.resource(url).type(MediaType.APPLICATION_JSON)); - - // include the request entity - if (entity != null) { - resourceBuilder = resourceBuilder.entity(entity); - } + Invocation.Builder resourceBuilder = addProxiedEntities(client.target(url).request()); // append any headers if (headers != null && !headers.isEmpty()) { @@ -289,7 +271,7 @@ public class NiFiTestUser { } // perform the request - return resourceBuilder.put(ClientResponse.class); + return resourceBuilder.put(Entity.json(entity)); } /** @@ -300,7 +282,7 @@ public class NiFiTestUser { * @return response * @throws java.lang.Exception ex */ - public ClientResponse testPut(String url, Map<String, String> formData) throws Exception { + public Response testPut(String url, Map<String, String> formData) throws Exception { return testPutWithHeaders(url, formData, null); } @@ -313,30 +295,25 @@ public class NiFiTestUser { * @return response * @throws java.lang.Exception ex */ - public ClientResponse testPutWithHeaders(String url, Map<String, String> formData, Map<String, String> headers) throws Exception { + public Response testPutWithHeaders(String url, Map<String, String> formData, Map<String, String> headers) throws Exception { // convert the form data - MultivaluedMapImpl entity = new MultivaluedMapImpl(); + MultivaluedHashMap<String, String> entity = new MultivaluedHashMap(); for (String key : formData.keySet()) { entity.add(key, formData.get(key)); } // get the resource - WebResource.Builder resourceBuilder = addProxiedEntities(client.resource(url).type(MediaType.APPLICATION_FORM_URLENCODED)); - - // add the form data if necessary - if (!entity.isEmpty()) { - resourceBuilder = resourceBuilder.entity(entity); - } + Invocation.Builder builder = addProxiedEntities(client.target(url).request()); // append any headers if (headers != null && !headers.isEmpty()) { for (String key : headers.keySet()) { - resourceBuilder = resourceBuilder.header(key, headers.get(key)); + builder = builder.header(key, headers.get(key)); } } // perform the request - return resourceBuilder.put(ClientResponse.class); + return builder.put(Entity.form(entity)); } /** @@ -346,7 +323,7 @@ public class NiFiTestUser { * @return response * @throws java.lang.Exception ex */ - public ClientResponse testDelete(String url) throws Exception { + public Response testDelete(String url) throws Exception { return testDelete(url, null); } @@ -358,19 +335,19 @@ public class NiFiTestUser { * @return response * @throws java.lang.Exception ex */ - public ClientResponse testDeleteWithHeaders(String url, Map<String, String> headers) throws Exception { + public Response testDeleteWithHeaders(String url, Map<String, String> headers) throws Exception { // get the resource - WebResource.Builder resourceBuilder = addProxiedEntities(client.resource(url).getRequestBuilder()); + Invocation.Builder builder = addProxiedEntities(client.target(url).request()); // append any headers if (headers != null && !headers.isEmpty()) { for (String key : headers.keySet()) { - resourceBuilder = resourceBuilder.header(key, headers.get(key)); + builder = builder.header(key, headers.get(key)); } } // perform the query - return resourceBuilder.delete(ClientResponse.class); + return builder.delete(); } /** @@ -381,19 +358,19 @@ public class NiFiTestUser { * @return response * @throws java.lang.Exception ex */ - public ClientResponse testDelete(String url, Map<String, String> queryParams) throws Exception { + public Response testDelete(String url, Map<String, String> queryParams) throws Exception { // get the resource - WebResource resource = client.resource(url); + WebTarget target = client.target(url); // append any query parameters if (queryParams != null && !queryParams.isEmpty()) { for (String key : queryParams.keySet()) { - resource = resource.queryParam(key, queryParams.get(key)); + target = target.queryParam(key, queryParams.get(key)); } } // perform the request - return addProxiedEntities(resource.type(MediaType.APPLICATION_FORM_URLENCODED)).delete(ClientResponse.class); + return addProxiedEntities(target.request()).delete(); } /** @@ -405,17 +382,17 @@ public class NiFiTestUser { * @return response * @throws Exception ex */ - public ClientResponse testCreateToken(String url, String username, String password) throws Exception { + public Response testCreateToken(String url, String username, String password) throws Exception { // convert the form data - MultivaluedMapImpl entity = new MultivaluedMapImpl(); + MultivaluedHashMap<String, String> entity = new MultivaluedHashMap(); entity.add("username", username); entity.add("password", password); // get the resource - WebResource.Builder resourceBuilder = addProxiedEntities(client.resource(url).accept(MediaType.TEXT_PLAIN).type(MediaType.APPLICATION_FORM_URLENCODED)).entity(entity); + Invocation.Builder resourceBuilder = addProxiedEntities(client.target(url).request().accept(MediaType.TEXT_PLAIN)); // perform the request - return resourceBuilder.post(ClientResponse.class); + return resourceBuilder.post(Entity.form(entity)); } } http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/filter/TestRedirectResourceFilter.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/filter/TestRedirectResourceFilter.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/filter/TestRedirectResourceFilter.java index 17b50e0..f38ab68 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/filter/TestRedirectResourceFilter.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/filter/TestRedirectResourceFilter.java @@ -16,13 +16,14 @@ */ package org.apache.nifi.web.api.filter; -import com.sun.jersey.spi.container.ContainerRequest; import org.junit.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.core.UriInfo; import java.net.URI; import static org.junit.Assert.assertEquals; @@ -38,13 +39,16 @@ public class TestRedirectResourceFilter { @Test public void testUnmatched() throws Exception { - - ContainerRequest request = mock(ContainerRequest.class); String path = "unmatched"; String baseUri = "http://example.com:8080/nifi-api/"; - when(request.getPath()).thenReturn(path); - when(request.getBaseUri()).thenReturn(new URI(baseUri)); - when(request.getRequestUri()).thenReturn(new URI(baseUri + path)); + + UriInfo uriInfo = mock(UriInfo.class); + when(uriInfo.getPath()).thenReturn(path); + when(uriInfo.getBaseUri()).thenReturn(new URI(baseUri)); + when(uriInfo.getRequestUri()).thenReturn(new URI(baseUri + path)); + + ContainerRequestContext request = mock(ContainerRequestContext.class); + when(request.getUriInfo()).thenReturn(uriInfo); doAnswer(new Answer() { @Override @@ -52,22 +56,24 @@ public class TestRedirectResourceFilter { fail("setUris shouldn't be called"); return null; } - }).when(request).setUris(any(URI.class), any(URI.class)); + }).when(request).setRequestUri(any(URI.class), any(URI.class)); RedirectResourceFilter filter = new RedirectResourceFilter(); filter.filter(request); - } @Test public void testController() throws Exception { - - ContainerRequest request = mock(ContainerRequest.class); String path = "controller"; String baseUri = "http://example.com:8080/nifi-api/"; - when(request.getPath()).thenReturn(path); - when(request.getBaseUri()).thenReturn(new URI(baseUri)); - when(request.getRequestUri()).thenReturn(new URI(baseUri + path)); + + UriInfo uriInfo = mock(UriInfo.class); + when(uriInfo.getPath()).thenReturn(path); + when(uriInfo.getBaseUri()).thenReturn(new URI(baseUri)); + when(uriInfo.getRequestUri()).thenReturn(new URI(baseUri + path)); + + ContainerRequestContext request = mock(ContainerRequestContext.class); + when(request.getUriInfo()).thenReturn(uriInfo); doAnswer(new Answer() { @Override @@ -76,7 +82,7 @@ public class TestRedirectResourceFilter { assertEquals("request uri should be redirected", new URI(baseUri + "site-to-site"), invocation.getArguments()[1]); return null; } - }).when(request).setUris(any(URI.class), any(URI.class)); + }).when(request).setRequestUri(any(URI.class), any(URI.class)); RedirectResourceFilter filter = new RedirectResourceFilter(); filter.filter(request); @@ -85,14 +91,17 @@ public class TestRedirectResourceFilter { @Test public void testControllerWithParams() throws Exception { - - ContainerRequest request = mock(ContainerRequest.class); String path = "controller"; String baseUri = "http://example.com:8080/nifi-api/"; String query = "?a=1&b=23&cde=456"; - when(request.getPath()).thenReturn(path); - when(request.getBaseUri()).thenReturn(new URI(baseUri)); - when(request.getRequestUri()).thenReturn(new URI(baseUri + path + query)); + + UriInfo uriInfo = mock(UriInfo.class); + when(uriInfo.getPath()).thenReturn(path); + when(uriInfo.getBaseUri()).thenReturn(new URI(baseUri)); + when(uriInfo.getRequestUri()).thenReturn(new URI(baseUri + path + query)); + + ContainerRequestContext request = mock(ContainerRequestContext.class); + when(request.getUriInfo()).thenReturn(uriInfo); doAnswer(new Answer() { @Override @@ -102,7 +111,7 @@ public class TestRedirectResourceFilter { new URI(baseUri + "site-to-site" + query), invocation.getArguments()[1]); return null; } - }).when(request).setUris(any(URI.class), any(URI.class)); + }).when(request).setRequestUri(any(URI.class), any(URI.class)); RedirectResourceFilter filter = new RedirectResourceFilter(); filter.filter(request); http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/pom.xml index 1da0b1b..8b76774 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/pom.xml @@ -85,8 +85,8 @@ <artifactId>javax.servlet-api</artifactId> </dependency> <dependency> - <groupId>com.sun.jersey</groupId> - <artifactId>jersey-server</artifactId> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> <scope>provided</scope> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/pom.xml index 8c7a795..670047e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/pom.xml @@ -92,6 +92,12 @@ <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> <version>0.6.0</version> + <exclusions> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.bouncycastle</groupId> @@ -139,5 +145,25 @@ <groupId>com.nimbusds</groupId> <artifactId>oauth2-oidc-sdk</artifactId> </dependency> + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-client</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-json-jackson</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>org.codehaus.jettison</groupId> + <artifactId>jettison</artifactId> + <version>1.3.7</version> + <scope>test</scope> + </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/ocsp/OcspCertificateValidator.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/ocsp/OcspCertificateValidator.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/ocsp/OcspCertificateValidator.java index 01be921..10aeedd 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/ocsp/OcspCertificateValidator.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/ocsp/OcspCertificateValidator.java @@ -20,13 +20,6 @@ import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.util.concurrent.UncheckedExecutionException; -import com.sun.jersey.api.client.Client; -import com.sun.jersey.api.client.ClientHandlerException; -import com.sun.jersey.api.client.ClientResponse; -import com.sun.jersey.api.client.UniformInterfaceException; -import com.sun.jersey.api.client.WebResource; -import com.sun.jersey.api.client.config.ClientConfig; -import com.sun.jersey.api.client.config.DefaultClientConfig; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.framework.security.util.SslContextFactory; import org.apache.nifi.security.util.KeyStoreUtils; @@ -55,6 +48,8 @@ import org.bouncycastle.operator.DigestCalculatorProvider; import org.bouncycastle.operator.OperatorCreationException; import org.bouncycastle.operator.jcajce.JcaContentVerifierProviderBuilder; import org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder; +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,8 +57,14 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; import javax.security.auth.x500.X500Principal; +import javax.ws.rs.ProcessingException; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Response; import java.io.FileInputStream; import java.io.IOException; +import java.io.InputStream; import java.math.BigInteger; import java.net.URI; import java.security.KeyStore; @@ -79,7 +80,6 @@ public class OcspCertificateValidator { private static final Logger logger = LoggerFactory.getLogger(OcspCertificateValidator.class); private static final String HTTPS = "https"; - private static final String CONTENT_TYPE_HEADER = "Content-Type"; private static final String OCSP_REQUEST_CONTENT_TYPE = "application/ocsp-request"; private static final int CONNECT_TIMEOUT = 10000; @@ -101,16 +101,15 @@ public class OcspCertificateValidator { // attempt to parse the specified va url validationAuthorityURI = URI.create(rawValidationAuthorityUrl); - // connection details - final ClientConfig config = new DefaultClientConfig(); - config.getProperties().put(ClientConfig.PROPERTY_READ_TIMEOUT, READ_TIMEOUT); - config.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, CONNECT_TIMEOUT); + final ClientConfig clientConfig = new ClientConfig(); + clientConfig.property(ClientProperties.READ_TIMEOUT, READ_TIMEOUT); + clientConfig.property(ClientProperties.CONNECT_TIMEOUT, CONNECT_TIMEOUT); // initialize the client if (HTTPS.equalsIgnoreCase(validationAuthorityURI.getScheme())) { - client = WebUtils.createClient(config, SslContextFactory.createSslContext(properties)); + client = WebUtils.createClient(clientConfig, SslContextFactory.createSslContext(properties)); } else { - client = WebUtils.createClient(config); + client = WebUtils.createClient(clientConfig); } // get the trusted CAs @@ -311,16 +310,16 @@ public class OcspCertificateValidator { final OCSPReq ocspRequest = requestGenerator.build(); // perform the request - final ClientResponse response = getClientResponse(ocspRequest); + final Response response = getClientResponse(ocspRequest); // ensure the request was completed successfully - if (ClientResponse.Status.OK.getStatusCode() != response.getStatusInfo().getStatusCode()) { + if (Response.Status.OK.getStatusCode() != response.getStatusInfo().getStatusCode()) { logger.warn(String.format("OCSP request was unsuccessful (%s).", response.getStatus())); return ocspStatus; } // interpret the response - OCSPResp ocspResponse = new OCSPResp(response.getEntityInputStream()); + OCSPResp ocspResponse = new OCSPResp(response.readEntity(InputStream.class)); // verify the response status switch (ocspResponse.getStatus()) { @@ -402,7 +401,7 @@ public class OcspCertificateValidator { } } } - } catch (final OCSPException | IOException | UniformInterfaceException | ClientHandlerException | OperatorCreationException e) { + } catch (final OCSPException | IOException | ProcessingException | OperatorCreationException e) { logger.error(e.getMessage(), e); } catch (CertificateException e) { e.printStackTrace(); @@ -411,9 +410,9 @@ public class OcspCertificateValidator { return ocspStatus; } - private ClientResponse getClientResponse(OCSPReq ocspRequest) throws IOException { - final WebResource resource = client.resource(validationAuthorityURI); - return resource.header(CONTENT_TYPE_HEADER, OCSP_REQUEST_CONTENT_TYPE).post(ClientResponse.class, ocspRequest.getEncoded()); + private Response getClientResponse(OCSPReq ocspRequest) throws IOException { + final WebTarget webTarget = client.target(validationAuthorityURI); + return webTarget.request().post(Entity.entity(ocspRequest.getEncoded(), OCSP_REQUEST_CONTENT_TYPE)); } /** http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/groovy/org/apache/nifi/web/security/x509/ocsp/OcspCertificateValidatorGroovyTest.groovy ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/groovy/org/apache/nifi/web/security/x509/ocsp/OcspCertificateValidatorGroovyTest.groovy b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/groovy/org/apache/nifi/web/security/x509/ocsp/OcspCertificateValidatorGroovyTest.groovy index e3ff000..1a36fe9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/groovy/org/apache/nifi/web/security/x509/ocsp/OcspCertificateValidatorGroovyTest.groovy +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/groovy/org/apache/nifi/web/security/x509/ocsp/OcspCertificateValidatorGroovyTest.groovy @@ -15,13 +15,17 @@ * limitations under the License. */ package org.apache.nifi.web.security.x509.ocsp + import com.google.common.cache.CacheBuilder import com.google.common.cache.CacheLoader import com.google.common.cache.LoadingCache -import com.sun.jersey.api.client.Client import org.apache.nifi.util.NiFiProperties import org.bouncycastle.asn1.x500.X500Name -import org.bouncycastle.asn1.x509.* +import org.bouncycastle.asn1.x509.ExtendedKeyUsage +import org.bouncycastle.asn1.x509.KeyPurposeId +import org.bouncycastle.asn1.x509.KeyUsage +import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo +import org.bouncycastle.asn1.x509.X509Extension import org.bouncycastle.cert.X509CertificateHolder import org.bouncycastle.cert.X509v3CertificateBuilder import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter @@ -29,11 +33,24 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider import org.bouncycastle.operator.ContentSigner import org.bouncycastle.operator.OperatorCreationException import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder -import org.junit.* +import org.junit.After +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Ignore +import org.junit.Test import org.slf4j.Logger import org.slf4j.LoggerFactory -import java.security.* +import javax.ws.rs.client.ClientBuilder +import java.security.InvalidKeyException +import java.security.KeyPair +import java.security.KeyPairGenerator +import java.security.NoSuchAlgorithmException +import java.security.NoSuchProviderException +import java.security.PrivateKey +import java.security.PublicKey +import java.security.Security +import java.security.SignatureException import java.security.cert.CertificateException import java.security.cert.X509Certificate @@ -295,7 +312,7 @@ public class OcspCertificateValidatorGroovyTest { certificateValidator = new OcspCertificateValidator(mockProperties) // Must populate the client even though it is not used in this check - certificateValidator.client = new Client() + certificateValidator.client = ClientBuilder.newBuilder().build() // Form a map of the request to a good status and load it into the cache OcspRequest revokedRequest = new OcspRequest(certificateChain.first(), certificateChain.last()) @@ -328,7 +345,7 @@ public class OcspCertificateValidatorGroovyTest { certificateValidator = new OcspCertificateValidator(mockProperties) // Must populate the client even though it is not used in this check - certificateValidator.client = new Client() + certificateValidator.client = ClientBuilder.newBuilder().build() // Form a map of the request to a revoked status and load it into the cache OcspRequest revokedRequest = new OcspRequest(certificateChain.first(), certificateChain.last()) http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/pom.xml index 55d8cce..979f20d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/pom.xml @@ -128,6 +128,55 @@ <artifactId>nifi-authorizer</artifactId> <version>1.5.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> + <version>2.1</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-client</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-json-jackson</artifactId> + <version>${jersey.version}</version> + <exclusions> + <exclusion> + <groupId>com.fasterxml.jackson.module</groupId> + <artifactId>jackson-module-jaxb-annotations</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-multipart</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.ext</groupId> + <artifactId>jersey-spring4</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-common</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.inject</groupId> + <artifactId>jersey-hk2</artifactId> + <version>${jersey.version}</version> + </dependency> </dependencies> </dependencyManagement> </project> http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-hadoop-libraries-bundle/nifi-hadoop-libraries-nar/src/main/resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-hadoop-libraries-bundle/nifi-hadoop-libraries-nar/src/main/resources/META-INF/NOTICE b/nifi-nar-bundles/nifi-hadoop-libraries-bundle/nifi-hadoop-libraries-nar/src/main/resources/META-INF/NOTICE index d95bc8f..516fcc8 100644 --- a/nifi-nar-bundles/nifi-hadoop-libraries-bundle/nifi-hadoop-libraries-nar/src/main/resources/META-INF/NOTICE +++ b/nifi-nar-bundles/nifi-hadoop-libraries-bundle/nifi-hadoop-libraries-nar/src/main/resources/META-INF/NOTICE @@ -280,14 +280,37 @@ The following binary components are provided under the Apache Software License v The following NOTICE information applies: Copyright 2008 Google Inc. + (ASLv2) Jackson JSON processor + The following NOTICE information applies: + # Jackson JSON processor + + Jackson is a high-performance, Free/Open Source JSON processing library. + It was originally written by Tatu Saloranta ([email protected]), and has + been in development since 2007. + It is currently developed by a community of developers, as well as supported + commercially by FasterXML.com. + + ## Licensing + + Jackson core and extension components may licensed under different licenses. + To find the details that apply to this artifact see the accompanying LICENSE file. + For more information, including possible other licensing options, contact + FasterXML.com (http://fasterxml.com). + + ## Credits + + A list of contributors may be found from CREDITS file, which is included + in some artifacts (usually source distributions); but is always available + from the source code management (SCM) system project uses. + ************************ Common Development and Distribution License 1.1 ************************ The following binary components are provided under the Common Development and Distribution License 1.1. See project link for details. - (CDDL 1.1) (GPL2 w/ CPE) jersey-client (com.sun.jersey:jersey-client:jar:1.19 - https://jersey.java.net/jersey-client/) - (CDDL 1.1) (GPL2 w/ CPE) jersey-core (com.sun.jersey:jersey-core:jar:1.19 - https://jersey.java.net/jersey-core/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-client (com.sun.jersey:jersey-client:jar:1.9 - https://jersey.java.net/jersey-client/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-core (com.sun.jersey:jersey-core:jar:1.9 - https://jersey.java.net/jersey-core/) (CDDL 1.1) (GPL2 w/ CPE) Java Architecture For XML Binding (javax.xml.bind:jaxb-api:jar:2.2.2 - https://jaxb.dev.java.net/) ************************ @@ -299,7 +322,6 @@ The following binary components are provided under the Common Development and Di (CDDL 1.0) JavaServlet(TM) Specification (javax.servlet:servlet-api:jar:2.5 - no url available) (CDDL 1.0) (GPL3) Streaming API For XML (javax.xml.stream:stax-api:jar:1.0-2 - no url provided) (CDDL 1.0) JavaBeans Activation Framework (JAF) (javax.activation:activation:jar:1.1 - http://java.sun.com/products/javabeans/jaf/index.jsp) - (CDDL 1.0) JSR311 API (javax.ws.rs:jsr311-api:jar:1.1.1 - https://jsr311.dev.java.net) ***************** Public Domain http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-nar/src/main/resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-nar/src/main/resources/META-INF/NOTICE b/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-nar/src/main/resources/META-INF/NOTICE index 49ba9bb..ac4b278 100644 --- a/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-nar/src/main/resources/META-INF/NOTICE +++ b/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-nar/src/main/resources/META-INF/NOTICE @@ -17,3 +17,26 @@ The following binary components are provided under the Apache Software License v This product includes software from the Spring Framework, under the Apache License 2.0 (see: StringUtils.containsWhitespace()) + + (ASLv2) Jackson JSON processor + The following NOTICE information applies: + # Jackson JSON processor + + Jackson is a high-performance, Free/Open Source JSON processing library. + It was originally written by Tatu Saloranta ([email protected]), and has + been in development since 2007. + It is currently developed by a community of developers, as well as supported + commercially by FasterXML.com. + + ## Licensing + + Jackson core and extension components may licensed under different licenses. + To find the details that apply to this artifact see the accompanying LICENSE file. + For more information, including possible other licensing options, contact + FasterXML.com (http://fasterxml.com). + + ## Credits + + A list of contributors may be found from CREDITS file, which is included + in some artifacts (usually source distributions); but is always available + from the source code management (SCM) system project uses. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-processors/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-processors/pom.xml b/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-processors/pom.xml index b87ebdb..65477f2 100644 --- a/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-processors/pom.xml +++ b/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-processors/pom.xml @@ -58,9 +58,14 @@ <version>3.4</version> </dependency> <dependency> - <groupId>org.codehaus.jackson</groupId> - <artifactId>jackson-mapper-asl</artifactId> - <version>${jackson.old.version}</version> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>${jackson.version}</version> </dependency> <dependency> <groupId>org.apache.nifi</groupId> @@ -73,12 +78,6 @@ <version>1.10.19</version> <scope>test</scope> </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - <version>${jackson.version}</version> - <scope>test</scope> - </dependency> <dependency> <groupId>org.apache.hbase</groupId> http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseJSON.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseJSON.java b/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseJSON.java index 2cb5a13..dc1766a 100644 --- a/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseJSON.java +++ b/nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseJSON.java @@ -17,18 +17,8 @@ package org.apache.nifi.hbase; -import java.io.BufferedInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.concurrent.atomic.AtomicReference; - +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.annotation.behavior.EventDriven; import org.apache.nifi.annotation.behavior.InputRequirement; @@ -48,8 +38,18 @@ import org.apache.nifi.processor.Relationship; import org.apache.nifi.processor.exception.ProcessException; import org.apache.nifi.processor.io.InputStreamCallback; import org.apache.nifi.processor.util.StandardValidators; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.map.ObjectMapper; + +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.concurrent.atomic.AtomicReference; @EventDriven @SupportsBatching @@ -208,7 +208,7 @@ public class PutHBaseJSON extends AbstractPutHBase { final AtomicReference<String> rowIdHolder = new AtomicReference<>(null); // convert each field/value to a column for the put, skip over nulls and arrays - final Iterator<String> fieldNames = rootNode.getFieldNames(); + final Iterator<String> fieldNames = rootNode.fieldNames(); while (fieldNames.hasNext()) { final String fieldName = fieldNames.next(); final AtomicReference<byte[]> fieldValueHolder = new AtomicReference<>(null); @@ -263,7 +263,7 @@ public class PutHBaseJSON extends AbstractPutHBase { // if we are expecting a field name to use for the row id and the incoming document doesn't have it // log an error message so the user can see what the field names were and return null so it gets routed to failure if (extractRowId && rowIdHolder.get() == null) { - final String fieldNameStr = StringUtils.join(rootNode.getFieldNames(), ","); + final String fieldNameStr = StringUtils.join(rootNode.fieldNames(), ","); getLogger().error("Row ID field named '{}' not found in field names '{}'; routing to failure", new Object[] {rowFieldName, fieldNameStr}); return null; } http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-nar/src/main/resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-nar/src/main/resources/META-INF/NOTICE b/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-nar/src/main/resources/META-INF/NOTICE index 83b97e7..cbb02a6 100644 --- a/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-nar/src/main/resources/META-INF/NOTICE +++ b/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-nar/src/main/resources/META-INF/NOTICE @@ -314,10 +314,11 @@ The following binary components are provided under the Apache Software License v The following binary components are provided under the Common Development and Distribution License 1.1. See project link for details. - (CDDL 1.1) (GPL2 w/ CPE) jersey-client (com.sun.jersey:jersey-client:jar:1.19 - https://jersey.java.net) - (CDDL 1.1) (GPL2 w/ CPE) jersey-core (com.sun.jersey:jersey-core:jar:1.19 - https://jersey.java.net/) - (CDDL 1.1) (GPL2 w/ CPE) jersey-json (com.sun.jersey:jersey-json:jar:1.19 - https://jersey.java.net/) - (CDDL 1.1) (GPL2 w/ CPE) jersey-server (com.sun.jersey:jersey-server:jar:1.19 - https://jersey.java.net/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-client (com.sun.jersey:jersey-client:jar:1.9 - https://jersey.java.net) + (CDDL 1.1) (GPL2 w/ CPE) jersey-core (com.sun.jersey:jersey-core:jar:1.9 - https://jersey.java.net/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-json (com.sun.jersey:jersey-json:jar:1.9 - https://jersey.java.net/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-server (com.sun.jersey:jersey-server:jar:1.9 - https://jersey.java.net/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-guice (com.sun.jersey.contribs:jersey-guice:jar:1.9 - https://jersey.java.net/) (CDDL 1.1) (GPL2 w/ CPE) Java Architecture For XML Binding (javax.xml.bind:jaxb-api:jar:2.2.2 - https://jaxb.dev.java.net/) (CDDL 1.1) (GPL2 w/ CPE) JavaMail API (compat) (javax.mail:mail:jar:1.4.7 - http://kenai.com/projects/javamail/mail) @@ -332,7 +333,6 @@ The following binary components are provided under the Apache Software License v (CDDL 1.0) (GPL3) Streaming API For XML (javax.xml.stream:stax-api:jar:1.0-2 - no url provided) (CDDL 1.0) JavaBeans Activation Framework (JAF) (javax.activation:activation:jar:1.1 - http://java.sun.com/products/javabeans/jaf/index.jsp) (CDDL 1.0) JavaServer Pages(TM) API (javax.servlet.jsp:jsp-api:jar:2.1 - http://jsp.java.net) - (CDDL 1.0) JSR311 API (javax.ws.rs:jsr311-api:jar:1.1.1 - https://jsr311.dev.java.net) ***************** Public Domain http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service-nar/src/main/resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service-nar/src/main/resources/META-INF/NOTICE b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service-nar/src/main/resources/META-INF/NOTICE index 42e6610..9c13792 100644 --- a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service-nar/src/main/resources/META-INF/NOTICE +++ b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service-nar/src/main/resources/META-INF/NOTICE @@ -15,4 +15,25 @@ The following binary components are provided under the Apache Software License v Apache Commons Lang Copyright 2001-2016 The Apache Software Foundation - + (ASLv2) Jackson JSON processor + The following NOTICE information applies: + # Jackson JSON processor + + Jackson is a high-performance, Free/Open Source JSON processing library. + It was originally written by Tatu Saloranta ([email protected]), and has + been in development since 2007. + It is currently developed by a community of developers, as well as supported + commercially by FasterXML.com. + + ## Licensing + + Jackson core and extension components may licensed under different licenses. + To find the details that apply to this artifact see the accompanying LICENSE file. + For more information, including possible other licensing options, contact + FasterXML.com (http://fasterxml.com). + + ## Credits + + A list of contributors may be found from CREDITS file, which is included + in some artifacts (usually source distributions); but is always available + from the source code management (SCM) system project uses.
