-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ondrej Benkovsky
committed
Feb 11, 2016
1 parent
1547e16
commit f831092
Showing
8 changed files
with
277 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (C) 2007-2015, GoodData(R) Corporation. All rights reserved. | ||
*/ | ||
package com.gooddata.dataset; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
import com.gooddata.util.GDDateTimeDeserializer; | ||
import com.gooddata.util.GDDateTimeSerializer; | ||
|
||
import org.joda.time.DateTime; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Batch fail status of dataset load. | ||
*/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class BatchFailStatus { | ||
|
||
private final List<FailStatus> failStatuses; | ||
private final List<String> messages; | ||
private final String status; | ||
private final DateTime date; | ||
|
||
@JsonCreator | ||
private BatchFailStatus(@JsonProperty("uploads") List<FailStatus> failStatuses, @JsonProperty("messages") List<String> messages, | ||
@JsonProperty("status") String status, @JsonProperty("date") @JsonDeserialize(using = GDDateTimeDeserializer.class) DateTime date) { | ||
this.failStatuses = failStatuses; | ||
this.messages = messages; | ||
this.status = status; | ||
this.date = date; | ||
} | ||
|
||
public List<FailStatus> getFailStatuses() { | ||
return failStatuses; | ||
} | ||
|
||
public List<String> getMessages() { | ||
return messages; | ||
} | ||
|
||
public String getStatus() { | ||
return status; | ||
} | ||
|
||
@JsonSerialize(using = GDDateTimeSerializer.class) | ||
public DateTime getDate() { | ||
return date; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/test/java/com/gooddata/dataset/BatchFailStatusTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2007-2015, GoodData(R) Corporation. All rights reserved. | ||
*/ | ||
package com.gooddata.dataset; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.containsInAnyOrder; | ||
import static org.hamcrest.Matchers.hasSize; | ||
import static org.hamcrest.Matchers.is; | ||
import static org.hamcrest.Matchers.notNullValue; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.hamcrest.Matchers; | ||
import org.joda.time.DateTime; | ||
import org.joda.time.DateTimeZone; | ||
import org.testng.annotations.Test; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
public class BatchFailStatusTest { | ||
@Test | ||
public void testParser() throws Exception { | ||
final InputStream stream = getClass().getResourceAsStream("/dataset/batchFailStatus1.json"); | ||
final BatchFailStatus value = new ObjectMapper().readValue(stream, BatchFailStatus.class); | ||
assertThat(value, is(notNullValue())); | ||
assertThat(value.getStatus(),is("ERROR")); | ||
assertThat(value.getMessages(),is(Matchers.<String>empty())); | ||
assertThat(value.getDate(),is(new DateTime(2016,2,1,10,12,9, DateTimeZone.UTC))); | ||
assertThat(value.getFailStatuses(),hasSize(2)); | ||
} | ||
|
||
@Test | ||
public void testParser2() throws IOException { | ||
final InputStream stream = getClass().getResourceAsStream("/dataset/batchFailStatus2.json"); | ||
final BatchFailStatus value = new ObjectMapper().readValue(stream, BatchFailStatus.class); | ||
assertThat(value,is(notNullValue())); | ||
assertThat(value.getStatus(),is("ERROR")); | ||
assertThat(value.getMessages(),containsInAnyOrder("test1","test2")); | ||
assertThat(value.getDate(),is(new DateTime(2016,1,1,10,11,15, DateTimeZone.UTC))); | ||
assertThat(value.getFailStatuses(),is(Matchers.<FailStatus>empty())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
f_person.f_shoesize,f_person.nm_name,d_person_role.nm_role,f_person.f_age,d_person_department.nm_department | ||
37,Jane,manager,35,HR | ||
42,developer,25,DevOps | ||
35,Sandy,recruiter,27 | ||
40,Jonathan,developer,50,DevOps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"uploads" : [ | ||
{ | ||
"date" : "2016-02-01 10:12:09", | ||
"status" : "ERROR", | ||
"error" : { | ||
"parameters" : [ | ||
"dataset.stats.csv", | ||
"f_competitors.nm_name" | ||
], | ||
"component" : "GDC::SliToDli", | ||
"errorClass" : "GDC::Exception::User", | ||
"message" : "Manifest consist of columns that are not in single CSV file %s: %s." | ||
} | ||
}, | ||
{ | ||
"date" : "2016-02-01 10:12:09", | ||
"status" : "ERROR", | ||
"error" : { | ||
"parameters" : [ | ||
"dataset.stats.csv", | ||
"f_competitors.nm_name" | ||
], | ||
"component" : "GDC::SliToDli", | ||
"errorClass" : "GDC::Exception::User", | ||
"message" : "Manifest consist of columns that are not in single CSV file %s: %s." | ||
} | ||
} | ||
], | ||
"messages" : [], | ||
"status" : "ERROR", | ||
"date" : "2016-02-01 10:12:09" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"uploads": [], | ||
"messages": [ | ||
"test1", | ||
"test2" | ||
], | ||
"status": "ERROR", | ||
"date": "2016-01-01 10:11:15" | ||
} |