Package com.ibm.commons.util.io.json

Examples of com.ibm.commons.util.io.json.JsonJavaObject


        addSnippetParam("ForumService.replyUuid", "Foo");
        addSnippetParam("ForumService.replyTitle", "Foo");
        addSnippetParam("ForumService.replyContent", "Foo");
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertEquals(404, json.getInt("code"));
        Assert.assertEquals("CLFRV0008E: Error, unable to find object with uuid: forum for post Foo not found", json.getString("message"));
    }
View Full Code Here


      String title = createForumTopicName();
      ForumTopic forumTopic = createForumTopic(forum, title, title);
        addSnippetParam("ForumService.topicUuid", forumTopic.getTopicUuid());
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        assertForumTopicValid(forumTopic, (JsonJavaObject)json);
    }
View Full Code Here

    @Test
    public void testGetForumTopicError() {
        addSnippetParam("ForumService.topicUuid", "Foo");
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertEquals(404, json.getInt("code"));
        Assert.assertEquals("No existing forum found. Please contact your system administrator.", json.getString("message"));
    }
View Full Code Here

    @Test
    public void testGetForumTopicInvalidArg() {
        addSnippetParam("ForumService.topicUuid", "");
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertEquals(400, json.getInt("code"));
        Assert.assertEquals("Invalid argument, expected topicUuid.", json.getString("message"));
    }
View Full Code Here

       
        Forum aforum = getForum(forum.getForumUuid());
        Assert.assertNotNull(aforum);
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        assertForumValid(forum, (JsonJavaObject)json);
    }
View Full Code Here

    @Test
    public void testGetForumError() {
        addSnippetParam("ForumService.forumUuid", "Foo");
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertEquals(404, json.getInt("code"));
        Assert.assertEquals("CLFRV0008E: Error, unable to find object with uuid: Foo", json.getString("message"));
    }
View Full Code Here

    @Test
    public void testGetForumInvalidArg() {
        addSnippetParam("ForumService.forumUuid", "");
       
        JavaScriptPreviewPage previewPage = executeSnippet(SNIPPET_ID);
        JsonJavaObject json = previewPage.getJson();
        Assert.assertEquals(400, json.getInt("code"));
        Assert.assertEquals("Invalid argument, expected forumUuid.", json.getString("message"));
    }
View Full Code Here

  public Attachment(){
   
  }
 
  public Attachment(DataHandler<?> dataHandler){
    JsonJavaObject attachmentObject = (JsonJavaObject) (dataHandler.getEntries(ASJsonPath.Attachments.getPath())).get(0);
    setSummary(attachmentObject.getString(ASJsonPath.AttachmentSummary.getPath()));
    setId(attachmentObject.getString(ASJsonPath.AttachmentId.getPath()));
    setDisplayName(attachmentObject.getString(ASJsonPath.AttachmentDisplayName.getPath()));
    setPublished(attachmentObject.getString(ASJsonPath.AttachmentPublished.getPath()));
    setUrl(attachmentObject.getString(ASJsonPath.AttachmentUrl.getPath()));
//    setAuthor(new Actor(dataHandler));
    JsonJavaObject imageObject = attachmentObject.getJsonObject(ASJsonPath.AttachmentImage.getPath());
    if(StringUtil.isNotEmpty(imageObject.getString(ASJsonPath.AttachmentImageUrl.getPath()))){
      setIsImage(true);
      setImage(new Image(dataHandler));
    }
   
    JsonJavaObject authorObject = attachmentObject.getJsonObject(ASJsonPath.AttachmentActor.getPath());
    setAuthorId(authorObject.getString(ASJsonPath.AttachmentActorId.getPath()));
    setAuthorName(authorObject.getString(ASJsonPath.AttachmentActorName.getPath()));
    setAuthorType(authorObject.getString(ASJsonPath.ReplyAuthorObjectType.getPath()));
    setAuthorUrl(authorObject.getString(ASJsonPath.AttachmentActorUrl.getPath()));
  }
View Full Code Here

    // Look for a spec.json
    String spec = loadFile(parent,"spec.json");
    if(StringUtil.isNotEmpty(spec)) {
      GadgetSnippet s = (GadgetSnippet)new GadgetSnippet();
      try {
        JsonJavaObject o=(JsonJavaObject)JsonParser.fromJson(JsonJavaFactory.instanceEx, spec);
        String t = o.getString("title");
        s.setTitle(t);
        //boolean isDefault = o.getBoolean("isDefault");
        String ag = getFirstString(o,"gadget");
        if(ag!=null) {
          s.setGadgetXml(loadFile(parent, ag));
View Full Code Here

          int pos = unid.lastIndexOf('/');
          if(pos>0) {
            unid = unid.substring(pos+1);
          }
          try {
            JsonJavaObject o = (JsonJavaObject)JsonParser.fromJson(JsonJavaFactory.instanceEx2, new InputStreamReader(zipIs,"UTF-8"));
            return new Entry(unid,o);
          } catch (JsonException ex) {
            throw new IOException(ex);
          }
        }
View Full Code Here

TOP

Related Classes of com.ibm.commons.util.io.json.JsonJavaObject

Copyright © 2018 www.massapicom. 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.