Skip to content

Commit ecb8f1e

Browse files
committed
Formatting for google style
1 parent 9b64a66 commit ecb8f1e

File tree

2 files changed

+35
-29
lines changed

2 files changed

+35
-29
lines changed

zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ public Response getNotebook(@PathParam("notebookId") String notebookId) throws I
150150

151151
/**
152152
* export note REST API
153+
*
153154
* @param
154155
* @return note JSON with status.OK
155156
* @throws IOException
@@ -167,6 +168,7 @@ public Response exportNoteBook(@PathParam("id") String noteId) {
167168

168169
/**
169170
* import new note REST API
171+
*
170172
* @param req - notebook Json
171173
* @return JSON with new note ID
172174
* @throws IOException
@@ -195,7 +197,7 @@ public Response importNotebook(String req) {
195197
}
196198
notebookServer.broadcastNote(newNote);
197199
notebookServer.broadcastNoteList();
198-
return new JsonResponse<>(Status.CREATED, "", newNote.getId() ).build();
200+
return new JsonResponse<>(Status.CREATED, "", newNote.getId()).build();
199201
}
200202

201203
/**

zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)