Examples of optString()


Examples of org.apache.sling.commons.json.JSONObject.optString()

        queryPackagerServlet.doPost(request, response);
        String tmp = response.getOutput().toString();
        final JSONObject actual = new JSONObject(tmp);

        assertEquals("preview", actual.optString("status", "error"));
    }

    @Test
    public void testDoPost_error() throws Exception {
        final String resourcePath = "/etc/acs-commons/packages/query-packager-test/jcr:content";
View Full Code Here

Examples of org.apache.sling.commons.json.JSONObject.optString()

        request.setResource(contentResource);

        queryPackagerServlet.doPost(request, response);

        final JSONObject actual = new JSONObject(response.getOutput().toString());
        assertEquals("error", actual.optString("status", "success"));
    }


    private class SuccessMockResourceResolver extends MockResourceResolver {
        final List<Resource> results;
View Full Code Here

Examples of org.apache.sling.commons.json.JSONObject.optString()

        request.setResource(contentResource);

        aclPackagerServlet.doPost(request, response);

        final JSONObject actual = new JSONObject(response.getOutput().toString());
        assertEquals("success", actual.optString("status", "error"));
    }


    @Test
    public void testDoPost_preview() throws Exception {
View Full Code Here

Examples of org.apache.sling.commons.json.JSONObject.optString()

        aclPackagerServlet.doPost(request, response);
        String tmp = response.getOutput().toString();
        System.out.println(tmp);
        final JSONObject actual = new JSONObject(tmp);

        assertEquals("preview", actual.optString("status", "error"));
    }

    @Test
    public void testDoPost_error() throws Exception {
        final String resourcePath = "/etc/acs-commons/packages/acl-packager-test/jcr:content";
View Full Code Here

Examples of org.apache.sling.commons.json.JSONObject.optString()

        request.setResource(contentResource);

        aclPackagerServlet.doPost(request, response);

        final JSONObject actual = new JSONObject(response.getOutput().toString());
        assertEquals("error", actual.optString("status", "success"));
    }


    private class SuccessMockResourceResolver extends MockResourceResolver {
        final List<Resource> results;
View Full Code Here

Examples of org.apache.wink.json4j.JSONArray.optString()

            String[] strArray = new String[] {"hello", "world", null, "after null"};

            JSONArray jArray = new JSONArray(strArray);
            assertTrue(jArray.length() == 4);
            assertTrue(jArray.getString(0).equals("hello"));
            assertTrue(jArray.optString(2) == null);
            assertTrue(jArray.getString(3).equals("after null"));
        } catch (Exception ex1) {
            ex = ex1;
            ex.printStackTrace();
        }
View Full Code Here

Examples of org.apache.wink.json4j.JSONObject.optString()

                    resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
                    resp.flushBuffer();
                    return;
                }
                MyFlights.getInstance().addMyFlight(flight.getString(FLIGHT_ID), userId,
                        flight.getString(APPROVER_ID), flight.optString(REASON));
                resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
                resp.flushBuffer();
                return;
            } catch (JSONException e) {
                resp.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage());
View Full Code Here

Examples of org.codehaus.jettison.json.JSONArray.optString()

        assertNotNull("Result Query is missing the 'selected' property",jSelected);
        assertTrue("Result Query is expected to have at least a single selected field",
            jSelected.length() > 0);
        boolean found = false;
        for(int i=0;i<jSelected.length() && !found;i++){
            String selectedField = jSelected.optString(i,null);
            assertNotNull("Selected array contains a NULL element \n"+jSelected.toString(4),
                selectedField);
            selectedSet.remove(selectedField);
        }
        assertTrue("Fields "+selectedSet+" are not selected by\n"+jSelected.toString(4),
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optString()

        //General NOTE:
        //  use opt**(..) methods to avoid JSON Exception. We want to parse
        //  everything and than do asserts!
        for(int i=0;i<results.length();i++){
            JSONObject result = results.getJSONObject(i);
            String id = result.optString("id", null);
            log.info("({}) {}",i,id);
            assertNotNull("ID missing for an Result", id);
            if(expectedIds != null){
                expectedIds.remove(id); //not all results must be in the list
            }
View Full Code Here

Examples of org.hornetq.utils.json.JSONObject.optString()

      String jsonString = serverControl.getConnectorsAsJSON();
      Assert.assertNotNull(jsonString);
      JSONArray array = new JSONArray(jsonString);
      Assert.assertEquals(1, array.length());
      JSONObject data = array.getJSONObject(0);
      Assert.assertEquals(connectorConfig.getName(), data.optString("name"));
      Assert.assertEquals(connectorConfig.getFactoryClassName(), data.optString("factoryClassName"));
      Assert.assertEquals(connectorConfig.getParams().size(), data.getJSONObject("params").length());
   }

   public void testCreateAndDestroyQueue() throws Exception
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.