Examples of MultivaluedMapImpl


Examples of com.dotcms.repackage.com.sun.jersey.core.util.MultivaluedMapImpl

    assertNotNull(response);
  }

  @Test(expected=UniformInterfaceException.class)
  public void testAuthenticateInvalidUserPost() {
    MultivaluedMap<String, String> formData = new MultivaluedMapImpl();
    formData.add("user", "wrong@user.com");
    formData.add("password", "123456");
    webResource = client.resource("http://"+serverName+":"+serverPort+"/api/dummy");
    webResource.path("/postauth").type("application/x-www-form-urlencoded").post(String.class, formData);
  }
View Full Code Here

Examples of com.sun.jersey.core.util.MultivaluedMapImpl

  public String redirect(ModelMap modelMap, HttpServletRequest request, HttpServletResponse response)
          throws JsonParseException, JsonMappingException, IOException {
    String code = request.getParameter("code");
    ClientSettings settings = createDefaultSettings(false);

    MultivaluedMap<String, String> formData = new MultivaluedMapImpl();
    formData.add("grant_type", "authorization_code");
    formData.add("code", code);
    formData.add("redirect_uri", env.getProperty("redirect_uri"));

    String auth = "Basic ".concat(new String(Base64.encodeBase64(settings.getOauthKey().concat(":")
            .concat(settings.getOauthSecret()).getBytes())));
    Builder builder = client.resource(settings.getAccessTokenEndPoint()).header(AUTHORIZATION, auth)
            .type(MediaType.APPLICATION_FORM_URLENCODED_TYPE);
    OutBoundHeaders headers = getHeadersCopy(builder);
    ClientResponse clientResponse = builder.post(ClientResponse.class, formData);
    String json = IOUtils.toString(clientResponse.getEntityInputStream());
    HashMap map = mapper.readValue(json, HashMap.class);
    settings.setStep("step3");
    settings.setAccessToken((String) map.get("access_token"));
    modelMap.put(SETTINGS, settings);
    modelMap.put(
            "requestInfo",
            "Method: POST".concat(BR).concat("URL: ").concat(settings.getAccessTokenEndPoint()).concat(BR)
                    .concat("Headers: ").concat(headers.toString()).concat(BR).concat("Body: ").concat(formData.toString()));
    addResponseInfo(modelMap, clientResponse);
    modelMap.put("rawResponseInfo", json);
    return "oauth-client";
  }
View Full Code Here

Examples of com.sun.jersey.core.util.MultivaluedMapImpl

    // According to
    // see https://blogs.oracle.com/enterprisetechtips/entry/consuming_restful_web_services_with
    // and http://stackoverflow.com/questions/8992857/using-the-jersey-client-to-do-a-post-operation-with-request-params-and-a-request
    // it seems that using a MultivaluedMap is mandatory for posting request as urlencoded form data

    MultivaluedMap<String,String> formData = new MultivaluedMapImpl();
    formData.add("client", this.SERVICE_KEY);
    formData.add("duration", "341");
//    formData.add("meta", "recordings releasegroups compress");
//    formData.add("meta", "recordings recordingids releases releaseids releasegroups releasegroupids tracks puids usermeta sources");
    formData.add("meta", "recordings releases releasegroups sources tracks usermeta compress");
    formData.add("fingerprint", "AQADtEokMsoUIv-hTxpCXbAOZ8fxBHh8ZJWyQG10IV8Jo2RyXMQf_B0udD08hFU0I7lyPCN6nDl-3IapIMc3pRCr7PCR4wnD48Plwyb64kdeVN2FT4d4HeHxiOiuVHB-_HCmwDvCF7pShFvho-SFC5fTodcMq_hx5sgsQbMf5GhJNMpH_Hj2Do-OUkeWMIfO0Mhz3ELzo4pzcK2OX8eVBz8lhNGoB-rR5kP4jCMaB9_64GkmEeeLKw2ao9YS5ExMIVl4SjgzEj5ROyiVwy_GLVkwRV0u_KmQh9CPXDnaHc6NJ1IIO9Th_uito0eWTLnwRDzUK0UY_UKv40sa4kq4o2GO6uiRp9B7ZIeffPiNypnwhKGKyaKw54fXw0h25MxJ_EKd6QmuJAXzoEQT5diVOcKppcJ1-A9-PJGGS8eT3XA2Bld2XCrCG5qeB00XPUIfDU-LhhG6LFmgZxTuZ2ge4vYhbolwUUrQJPPwrEV-5JeCB_0FLVMT_Eb04BOYS8K1RYe3GFVWNHGIWsh3JHuO4ymuB1b-oFZjfApqsYedVAipQ43GBqHEKNngXph-XJry4NGD-nBzCY-O5Bk75M7gSkfVXHikGObz4Y1E7AcT-UNJKceXyWiioz9KqqBqtMqS0LiKvHVENPHxR4O5bESt5KhzpDz6yMaR3ZBvRKSOJ8erBr_g487x9OjTR0iHKo2O-MtwSlliNOiPqwAacll09JmgSza8Rcc_SjgbCc6TC8nGIQyOLqTQ8D6eRhR-JOGRg4l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CEYApDZIEkRgBojABIAWCEYAQRJ4iAVjDBARTAImEIEwYBoACRBAmgBBUKIQGAMpw4AwgBUCgAACOACYaIUEgZBBGiRhHhCFACMgQIQJAIRREBACBgAACCCUCAAQ4RAoCwhABjhDBCCQWUAMQAJAwiRhsEhqMAEAAIAQgAhIxTgAIAAFXGGSsgQwQwYQQABAmilCJGAKARAUApBFkChguEIADAMSCgUIYopgRxAAhgEAOCGAAQAkQoAIQQABDBiAJCIEIIEEIqACQRgiAGiCKEIAOgAIQECIgAQBhDmQLGKWEgIQAxAJxQAhBmlAMCAUIoQEQAKACQAhkEhTGGCCUgMIQAQYACRBjhnJCMECIEAg4JpaCiAgDgAQEACYKEUcoIgBiBBighAQCECEoAAsAqRYwDRhhDCAHIKMKUA1IAKoKChCAkgEEICCMEEc4IYgAARiDjBACACAEEBoAgZBQARAggIBFCAMJIZEJQIYRgyABGDHAUAAs0IMYQQ4QRAEMABERCOCAOgwwJgwAxwgjEBFDEKSKQoggJYIAUmAhjGACEEGGYEIQBgpCEQhjEgBDQACUQYAw4YgwFiCiBjAEIECAwQAAIBZAgQBoFgIEGC4SRIEABYAlzgBiCEKGAGUKFQBQB5Ag0gBgCGGIICGAclcoKQJyiABAIlAJAACKYsBA");
    JSONObject response = webResource.type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(JSONObject.class, formData);
    System.out.println("answer: "+response.toString());
        ObjectMapper mapper = new ObjectMapper();
        List<AcoustIdWsResult> results = null;
        try {
View Full Code Here

Examples of com.sun.jersey.core.util.MultivaluedMapImpl

import com.sun.jersey.api.client.Client;
import com.sun.jersey.core.util.MultivaluedMapImpl;

public class TestViewResource extends SetupTestEnv{
  public void testViewClone() {
    MultivaluedMap form = new MultivaluedMapImpl();
    form.add("owner", "system");
    form.add("view_name","test");
    form.add("view_vid","default");
    client = Client.create();
    resource = client.resource("http://localhost:"+restPort);
    ReturnCodeBean result = resource.path("/hicc/v1/view").
    header("Authorization", authorization).
    post(ReturnCodeBean.class,form);
View Full Code Here

Examples of com.sun.jersey.core.util.MultivaluedMapImpl

    rm.killApp(killedApp.getApplicationId());

    amNodeManager.nodeHeartbeat(true);

    WebResource r = resource();
    MultivaluedMapImpl params = new MultivaluedMapImpl();
    params.add("states", YarnApplicationState.ACCEPTED.toString());
    ClientResponse response = r.path("ws").path("v1").path("cluster")
        .path("apps").queryParams(params)
        .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    JSONObject json = response.getEntity(JSONObject.class);
    assertEquals("incorrect number of elements", 1, json.length());
    JSONObject apps = json.getJSONObject("apps");
    assertEquals("incorrect number of elements", 1, apps.length());
    JSONArray array = apps.getJSONArray("app");
    assertEquals("incorrect number of elements", 1, array.length());
    assertEquals("state not equal to ACCEPTED", "ACCEPTED", array
        .getJSONObject(0).getString("state"));

    r = resource();
    params = new MultivaluedMapImpl();
    params.add("states", YarnApplicationState.ACCEPTED.toString());
    params.add("states", YarnApplicationState.KILLED.toString());
    response = r.path("ws").path("v1").path("cluster")
        .path("apps").queryParams(params)
        .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    json = response.getEntity(JSONObject.class);
View Full Code Here

Examples of com.sun.jersey.core.util.MultivaluedMapImpl

    rm.killApp(killedApp.getApplicationId());

    amNodeManager.nodeHeartbeat(true);

    WebResource r = resource();
    MultivaluedMapImpl params = new MultivaluedMapImpl();
    params.add("states", YarnApplicationState.ACCEPTED.toString());
    ClientResponse response = r.path("ws").path("v1").path("cluster")
        .path("apps").queryParams(params)
        .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    JSONObject json = response.getEntity(JSONObject.class);
    assertEquals("incorrect number of elements", 1, json.length());
    JSONObject apps = json.getJSONObject("apps");
    assertEquals("incorrect number of elements", 1, apps.length());
    JSONArray array = apps.getJSONArray("app");
    assertEquals("incorrect number of elements", 1, array.length());
    assertEquals("state not equal to ACCEPTED", "ACCEPTED", array
        .getJSONObject(0).getString("state"));

    r = resource();
    params = new MultivaluedMapImpl();
    params.add("states", YarnApplicationState.ACCEPTED.toString() + ","
        + YarnApplicationState.KILLED.toString());
    response = r.path("ws").path("v1").path("cluster")
        .path("apps").queryParams(params)
        .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
View Full Code Here

Examples of com.sun.jersey.core.util.MultivaluedMapImpl

    }

    public Date getWorkflowNodeStartTime(WorkflowInstanceNode workflowNode) {
        webResource = getProvenanceRegistryBaseResource().path(
                ResourcePathConstants.ProvenanceResourcePathConstants.GET_WORKFLOWNODE_STARTTIME);
        MultivaluedMap queryParams = new MultivaluedMapImpl();
        queryParams.add("workflowInstanceId", workflowNode.getWorkflowInstance().getWorkflowExecutionId());
        queryParams.add("nodeId", workflowNode.getNodeId());
        builder = BasicAuthHeaderUtil.getBuilder(
                webResource, queryParams, userName, null, cookie, gateway);

        ClientResponse response = builder.accept(
                MediaType.TEXT_PLAIN).get(ClientResponse.class);
View Full Code Here

Examples of com.sun.jersey.core.util.MultivaluedMapImpl

    }

    public Date getWorkflowStartTime(WorkflowExecution workflowInstance) {
        webResource = getProvenanceRegistryBaseResource().path(
                ResourcePathConstants.ProvenanceResourcePathConstants.GET_WORKFLOW_STARTTIME);
        MultivaluedMap queryParams = new MultivaluedMapImpl();
        queryParams.add("workflowInstanceId", workflowInstance.getWorkflowExecutionId());
        builder = BasicAuthHeaderUtil.getBuilder(
                webResource, queryParams, userName, null, cookie, gateway);

        ClientResponse response = builder.accept(
                MediaType.TEXT_PLAIN).get(ClientResponse.class);
View Full Code Here

Examples of com.sun.jersey.core.util.MultivaluedMapImpl

    }

    public WorkflowExecutionData getWorkflowInstanceData(String workflowInstanceId) {
        webResource = getProvenanceRegistryBaseResource().path(
                ResourcePathConstants.ProvenanceResourcePathConstants.GET_WORKFLOWINSTANCEDATA);
        MultivaluedMap queryParams = new MultivaluedMapImpl();
        queryParams.add("workflowInstanceId", workflowInstanceId);
        builder = BasicAuthHeaderUtil.getBuilder(
                webResource, queryParams, userName, null, cookie, gateway);

        ClientResponse response = builder.accept(
                MediaType.APPLICATION_JSON).get(ClientResponse.class);
View Full Code Here

Examples of com.sun.jersey.core.util.MultivaluedMapImpl

    }

    public boolean isWorkflowInstanceNodePresent(String workflowInstanceId, String nodeId) {
        webResource = getProvenanceRegistryBaseResource().path(
                ResourcePathConstants.ProvenanceResourcePathConstants.WORKFLOWINSTANCE_NODE_EXIST);
        MultivaluedMap queryParams = new MultivaluedMapImpl();
        queryParams.add("workflowInstanceId", workflowInstanceId);
        queryParams.add("nodeId", nodeId);
        builder = BasicAuthHeaderUtil.getBuilder(
                webResource, queryParams, userName, null, cookie, gateway);

        ClientResponse response = builder.accept(
                MediaType.TEXT_PLAIN).get(ClientResponse.class);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.