Package net.sf.json

Examples of net.sf.json.JSON


        assertEquals( catalog.getNamespaces().size() ,
            dom.getElementsByTagName( "namespace").getLength() );
    }
   
    public void testGetAllAsJSON() throws Exception {
        JSON json = getAsJSON( "/rest/namespaces.json");
        assertTrue( json instanceof JSONObject );
       
        JSONArray namespaces = ((JSONObject)json).getJSONObject("namespaces").getJSONArray("namespace");
        assertNotNull( namespaces );
       
View Full Code Here


        NamespaceInfo ws = getCatalog().getNamespaceByPrefix( "foo" );
        assertNotNull(ws);
    }
   
    public void testGetAsJSON() throws Exception {
        JSON json = getAsJSON( "/rest/namespaces/sf.json");
        JSONObject namespace = ((JSONObject) json).getJSONObject( "namespace") ;
        assertEquals( "sf", namespace.get( "prefix" ) );
        assertEquals( MockData.SF_URI, namespace.get( "uri" ) );
    }
View Full Code Here

        assertEquals( catalog.getStoresByWorkspace( "wcs", CoverageStoreInfo.class ).size(),
            dom.getElementsByTagName( "coverageStore").getLength() );
    }
   
    public void testGetAllAsJSON() throws Exception {
        JSON json = getAsJSON( "/rest/workspaces/wcs/coveragestores.json");
        assertTrue( json instanceof JSONObject );
       
        Object coveragestores = ((JSONObject)json).getJSONObject("coverageStores").get("coverageStore");
        assertNotNull( coveragestores );
       
View Full Code Here

       
        assertNotNull(newCoverageStore.getFormat());
    }
   
    public void testGetAsJSON() throws Exception {
        JSON json = getAsJSON( "/rest/workspaces/wcs/coveragestores/BlueMarble.json" );
       
        JSONObject coverageStore = ((JSONObject)json).getJSONObject("coverageStore");
        assertNotNull(coverageStore);
       
        assertEquals( "BlueMarble", coverageStore.get( "name") );
View Full Code Here

        assertEquals( catalog.getNamespaces().size() ,
            dom.getElementsByTagName( "workspace").getLength() );
    }
   
    public void testGetAllAsJSON() throws Exception {
        JSON json = getAsJSON( "/rest/workspaces.json");
        assertTrue( json instanceof JSONObject );
       
        JSONArray workspaces = ((JSONObject)json).getJSONObject("workspaces").getJSONArray("workspace");
        assertNotNull( workspaces );
       
View Full Code Here

        WorkspaceInfo ws = getCatalog().getWorkspaceByName( "foo" );
        assertNotNull(ws);
    }
   
    public void testGetAsJSON() throws Exception {
        JSON json = getAsJSON( "/rest/workspaces/sf.json");
        JSONObject workspace = ((JSONObject) json).getJSONObject( "workspace") ;
        assertEquals( "sf", workspace.get( "name" ) );
    }
View Full Code Here

        assertXpathEvaluatesTo( "1", "count(//supportedFormats)", dom);
    }
   
 
  public void testGetAsJSON() throws Exception {
      JSON json = getAsJSON( "/rest/workspaces/wcs/coveragestores/BlueMarble/coverages/BlueMarble.json");
      JSONObject coverage = ((JSONObject)json).getJSONObject("coverage");
      assertNotNull(coverage);
     
      assertEquals( "BlueMarble", coverage.get("name") );
     
View Full Code Here

      if( JsonMediaTypeHandler.couldBeJsonContent( me.getResponseHeaders().get( "Content-Type", "" ) ) )
      {
        try
        {
          JSON json = JSONSerializer.toJSON( me.getResponseContent() );
          if( json.isEmpty() )
            content = "<Empty JSON content>";
          else
            content = json.toString( 3 );
        }
        catch( Throwable e )
        {
          if( !"Invalid JSON String".equals( e.getMessage() ) )
            e.printStackTrace();
View Full Code Here

      if( JsonMediaTypeHandler.couldBeJsonContent( httpResponse.getContentType() ) )
      {
        try
        {
          JSON json = JSONSerializer.toJSON( httpResponse.getContentAsString() );
          if( json.isEmpty() )
            content = "<Empty JSON content>";
          else
            content = json.toString( 3 );
        }
        catch( Throwable e )
        {
          if( !"Invalid JSON String".equals( e.getMessage() ) )
            e.printStackTrace();
View Full Code Here

    {
      String content = response.getContentAsString().trim();
      if( !StringUtils.hasContent( content ) )
        return null;

      JSON json = JSONSerializer.toJSON( content );
      XMLSerializer serializer = new XMLSerializer();
      serializer.setTypeHintsEnabled( false );
      serializer.setRootName( HttpUtils.isErrorStatus( response.getStatusCode() ) ? "Fault" : "Response" );
      URL url = response.getURL();
      serializer.setNamespace( "", url.getProtocol() + "://" + url.getHost() + url.getPath() );
View Full Code Here

TOP

Related Classes of net.sf.json.JSON

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.