Package org.codehaus.jettison.json

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


       
        assertEquals("The 'type' of the Constraint is not 'text' but "+constraint.opt("type"),
            "text",constraint.optString("type"));

        assertEquals("The 'patternType' of the Constraint is not 'wildcard' but "+constraint.opt("patternType"),
            "wildcard",constraint.optString("patternType"));
       
        assertEquals("The 'field' of the Constraint is not "+getDefaultFindQueryField()+" but "+constraint.opt("field"),
            getDefaultFindQueryField(),constraint.optString("field"));
    }
    /**
 
View Full Code Here


        assertEquals("The 'patternType' of the Constraint is not 'wildcard' but "+constraint.opt("patternType"),
            "wildcard",constraint.optString("patternType"));
       
        assertEquals("The 'field' of the Constraint is not "+getDefaultFindQueryField()+" but "+constraint.opt("field"),
            getDefaultFindQueryField(),constraint.optString("field"));
    }
    /**
     * Getter for the default field used for find queries of the 'field' parameter
     * is not defined.<p>
     * This default is different for the '/entityhub' and the other service
View Full Code Here

        //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);
            assertNotNull("ID missing for an Result", id);
            if(expectedIds != null){
                expectedIds.remove(id); //not all results must be in the list
            }
            if(test.getProhibitedResultIds() != null){
View Full Code Here

     */
    public static JSONObject assertEntity(String content,String id, String site) throws JSONException {
        assertNotNull("The content to parse the Entity from is NULL",content);
        JSONObject jEntity = new JSONObject(content);
        if(id != null){
            assertEquals("Entity has the wrong ID", id,jEntity.optString("id", null));
        } else {
            id = jEntity.optString("id", null);
            assertNotNull("ID of the Entity MUST NOT be NULL",id);
        }
        if(site != null){
View Full Code Here

        assertNotNull("The content to parse the Entity from is NULL",content);
        JSONObject jEntity = new JSONObject(content);
        if(id != null){
            assertEquals("Entity has the wrong ID", id,jEntity.optString("id", null));
        } else {
            id = jEntity.optString("id", null);
            assertNotNull("ID of the Entity MUST NOT be NULL",id);
        }
        if(site != null){
            assertEquals("Entity has the wrong Site", site, jEntity.optString("site",null));
        }
View Full Code Here

        } else {
            id = jEntity.optString("id", null);
            assertNotNull("ID of the Entity MUST NOT be NULL",id);
        }
        if(site != null){
            assertEquals("Entity has the wrong Site", site, jEntity.optString("site",null));
        }
       
        assertTrue("Representation is missing",jEntity.has("representation"));
        JSONObject jRepresentation = jEntity.getJSONObject("representation");
        assertNotNull("Representation is not an JSON Object",jRepresentation);
View Full Code Here

                    JSONObject fieldValue = jValues.optJSONObject(i);
                    assertNotNull("Values for field "+key+" does contain an value " +
                        "that is not an JSONObject "+jValues.optString(i),
                        fieldValue);
                    String[] value = new String[2];
                    value[0] = fieldValue.optString("value");
                    value[1] = null;
                    assertNotNull("All Field-values MUST have the 'value' property",value[0]);
                    assertFalse("All Field-values MUST not be empty",value[0].isEmpty());
                    if(fieldValue.has("xsd:datatype")){
                        value[1] = fieldValue.getString("xsd:datatype");
View Full Code Here

            JSONObject obj = new JSONObject(str);
            obj = obj.getJSONObject("command");
            CachedCommandModel cm = new CachedCommandModel(obj.getString("@name"), etag);
            cm.dashOk = obj.optBoolean("@unknown-options-are-operands", false);
            cm.managedJob = obj.optBoolean("@managed-job", false);
            cm.setUsage(obj.optString("usage", null));
            Object optns = obj.opt("option");
            if (!JSONObject.NULL.equals(optns)) {
                JSONArray jsonOptions;
                if (optns instanceof JSONArray) {
                    jsonOptions = (JSONArray) optns;
View Full Code Here

                    String type = jsOpt.getString("@type");
                    ParamModelData opt = new ParamModelData(
                            jsOpt.getString("@name"),
                            typeOf(type),
                            jsOpt.optBoolean("@optional", false),
                            jsOpt.optString("@default"),
                            jsOpt.optString("@short"),
                            jsOpt.optBoolean("@obsolete", false),
                            jsOpt.optString("@alias"));
                    opt.param._acceptableValues = jsOpt.optString("@acceptable-values");
                    if ("PASSWORD".equals(type)) {
View Full Code Here

                    ParamModelData opt = new ParamModelData(
                            jsOpt.getString("@name"),
                            typeOf(type),
                            jsOpt.optBoolean("@optional", false),
                            jsOpt.optString("@default"),
                            jsOpt.optString("@short"),
                            jsOpt.optBoolean("@obsolete", false),
                            jsOpt.optString("@alias"));
                    opt.param._acceptableValues = jsOpt.optString("@acceptable-values");
                    if ("PASSWORD".equals(type)) {
                        opt.param._password = true;
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.