-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #306 from szprutamich/master
Version 2.16
- Loading branch information
Showing
37 changed files
with
949 additions
and
417 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
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 |
---|---|---|
|
@@ -8,18 +8,16 @@ | |
* @author Łukasz Kajda <[email protected]> | ||
*/ | ||
@XmlRootElement | ||
public class APIExceptionMessage { | ||
|
||
private String message; | ||
public class APIExceptionMessage extends APIMessage { | ||
|
||
private Integer statusCode; | ||
|
||
public APIExceptionMessage() { | ||
} | ||
|
||
public APIExceptionMessage(Integer statusCode, String message) { | ||
super(message); | ||
this.statusCode = statusCode; | ||
this.message = message; | ||
} | ||
|
||
public Integer getStatusCode() { | ||
|
@@ -30,12 +28,4 @@ public void setStatusCode(Integer statusCode) { | |
this.statusCode = statusCode; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,98 @@ | ||
package com.testdroid.api; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Michał Szpruta <[email protected]> | ||
*/ | ||
public class APIFilter { | ||
|
||
private List<APIFilterItem> filterItems; | ||
|
||
public APIFilter() { | ||
this.filterItems = Collections.emptyList(); | ||
} | ||
|
||
public APIFilter(List<APIFilterItem> filterItems) { | ||
this.filterItems = filterItems; | ||
} | ||
|
||
public static APIFilter create(List<APIFilterItem> filterItems) { | ||
return new APIFilter(filterItems); | ||
} | ||
|
||
public String serialize() { | ||
List<String> resultItems = new ArrayList<String>(); | ||
for (APIFilterItem item : filterItems) { | ||
resultItems.add(item.serialize()); | ||
} | ||
return StringUtils.join(resultItems, ";"); | ||
} | ||
|
||
public static class APIFilterItem { | ||
|
||
public static enum Operand { | ||
GT, | ||
AFTER, | ||
LT, | ||
BEFORE, | ||
ON, | ||
EQ, | ||
ISNULL, | ||
IN, | ||
NOTIN, | ||
INORNULL, | ||
BEFOREORNULL, | ||
BEFOREOREQUAL, | ||
AFTERORNULL | ||
} | ||
|
||
public static enum Type { | ||
N, | ||
D, | ||
S, | ||
B, | ||
LN, | ||
LD, | ||
LS, | ||
LB | ||
} | ||
|
||
private String fieldName; | ||
|
||
private Operand operand; | ||
|
||
private Type type; | ||
|
||
private Object[] values; | ||
|
||
public APIFilterItem(Type type, String fieldName, Operand operand, Object... values) { | ||
this.type = type; | ||
this.fieldName = fieldName; | ||
this.operand = operand; | ||
this.values = values; | ||
} | ||
|
||
private String serialize() { | ||
StringBuilder stringBuilder = new StringBuilder(); | ||
stringBuilder.append(type.name().toLowerCase()); | ||
stringBuilder.append("_"); | ||
stringBuilder.append(fieldName); | ||
stringBuilder.append("_"); | ||
stringBuilder.append(operand.name().toLowerCase()); | ||
if (values.length > 0) { | ||
stringBuilder.append("_"); | ||
for (Object object : values) { | ||
stringBuilder.append(object); | ||
stringBuilder.append("|"); | ||
} | ||
stringBuilder.setLength(stringBuilder.length() - 1); | ||
} | ||
return stringBuilder.toString(); | ||
} | ||
} | ||
} |
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,28 @@ | ||
package com.testdroid.api; | ||
|
||
import javax.xml.bind.annotation.XmlRootElement; | ||
|
||
/** | ||
* @author Michał Szpruta <[email protected]> | ||
*/ | ||
@XmlRootElement | ||
public class APIMessage { | ||
|
||
private String message; | ||
|
||
public APIMessage() { | ||
} | ||
|
||
public APIMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
} |
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
Oops, something went wrong.