@@ -337,23 +337,24 @@ public void testExportNotebook() throws IOException {
337337 LOG .info ("testNotebookExport \n " + get .getResponseBodyAsString ());
338338 assertThat ("test notebook export method:" , get , isAllowed ());
339339
340- Map <String , Object > resp = gson .fromJson (get .getResponseBodyAsString (), new TypeToken <Map <String , Object >>() {
341- }.getType ());
340+ Map <String , Object > resp =
341+ gson .fromJson (get .getResponseBodyAsString (),
342+ new TypeToken <Map <String , Object >>() {}.getType ());
342343
343- String exportJSON = (String ) resp .get ("body" );
344+ String exportJSON = (String ) resp .get ("body" );
344345 assertNotNull ("Can not find new notejson" , exportJSON );
345346 LOG .info ("export JSON:=" + exportJSON );
346347 ZeppelinServer .notebook .removeNote (sourceNoteID );
347348 get .releaseConnection ();
348349
349350 }
350-
351+
351352 @ Test
352353 public void testImportNotebook () throws IOException {
353- Map <String , Object > resp ;
354- String noteName = "source note for import" ;
354+ Map <String , Object > resp ;
355+ String noteName = "source note for import" ;
355356 LOG .info ("testImortNotebook" );
356- //create test notebook
357+ // create test notebook
357358 Note note = ZeppelinServer .notebook .createNote ();
358359 assertNotNull ("can't create new note" , note );
359360 note .setName (noteName );
@@ -366,36 +367,39 @@ public void testImportNotebook() throws IOException {
366367 String sourceNoteID = note .getId ();
367368 // get note content as JSON
368369 String oldJson = getNoteContent (sourceNoteID );
369- //call notebook put
370- PutMethod importPut = httpPut ("/notebook/import/" , oldJson );
370+ // call notebook put
371+ PutMethod importPut = httpPut ("/notebook/import/" , oldJson );
371372 assertThat (importPut , isCreated ());
372- resp = gson .fromJson (importPut .getResponseBodyAsString (), new TypeToken <Map <String , Object >>(){}.getType ());
373+ resp =
374+ gson .fromJson (importPut .getResponseBodyAsString (),
375+ new TypeToken <Map <String , Object >>() {}.getType ());
373376 String importId = (String ) resp .get ("body" );
374-
377+
375378 assertNotNull ("Did not get back a notebook id in body" , importId );
376- Note newNote = ZeppelinServer .notebook .getNote (importId );
379+ Note newNote = ZeppelinServer .notebook .getNote (importId );
377380 assertEquals ("Compare note names" , noteName , newNote .getName ());
378- assertEquals ("Compare paragraphs count" , note .getParagraphs ().size (), newNote .getParagraphs ().size ());
379- //cleanup
381+ assertEquals ("Compare paragraphs count" , note .getParagraphs ().size (), newNote .getParagraphs ()
382+ .size ());
383+ // cleanup
380384 ZeppelinServer .notebook .removeNote (note .getId ());
381385 ZeppelinServer .notebook .removeNote (newNote .getId ());
382386 importPut .releaseConnection ();
383387 }
384388
385- private String getNoteContent (String id ) throws IOException {
386- GetMethod get = httpGet ("/notebook/export/" + id );
387- assertThat (get , isAllowed ());
388- get .addRequestHeader ("Origin" , "http://localhost" );
389- Map <String , Object > resp = gson . fromJson ( get . getResponseBodyAsString (),
390- new TypeToken < Map < String , Object >>() {
391- }.getType ());
392- assertEquals (200 , get .getStatusCode ());
393- String body = resp .get ("body" ).toString ();
394- // System.out.println("Body is " + body);
395- get .releaseConnection ();
396- return body ;
397- }
398-
389+ private String getNoteContent (String id ) throws IOException {
390+ GetMethod get = httpGet ("/notebook/export/" + id );
391+ assertThat (get , isAllowed ());
392+ get .addRequestHeader ("Origin" , "http://localhost" );
393+ Map <String , Object > resp =
394+ gson . fromJson ( get . getResponseBodyAsString (),
395+ new TypeToken < Map < String , Object >>() { }.getType ());
396+ assertEquals (200 , get .getStatusCode ());
397+ String body = resp .get ("body" ).toString ();
398+ // System.out.println("Body is " + body);
399+ get .releaseConnection ();
400+ return body ;
401+ }
402+
399403 private void testDeleteNotebook (String notebookId ) throws IOException {
400404
401405 DeleteMethod delete = httpDelete (("/notebook/" + notebookId ));
0 commit comments