[DEV] correct delete API for test
This commit is contained in:
parent
fe63c6b954
commit
7b31c66ce5
@ -39,7 +39,7 @@ public class CheckJPA<T> implements CheckFunctionInterface {
|
||||
void check(final String baseName, final K data) throws Exception;
|
||||
}
|
||||
|
||||
private Map<String, List<CheckInterface<T>>> checking = null;
|
||||
protected Map<String, List<CheckInterface<T>>> checking = null;
|
||||
|
||||
protected void add(final String field, final CheckInterface<T> checkFunction) {
|
||||
List<CheckInterface<T>> actions = this.checking.get(field);
|
||||
@ -309,7 +309,9 @@ public class CheckJPA<T> implements CheckFunctionInterface {
|
||||
|
||||
@Override
|
||||
public void check(final String baseName, final Object data, final List<String> filterValue) throws Exception {
|
||||
initialize();
|
||||
if (this.checking == null) {
|
||||
initialize();
|
||||
}
|
||||
if (!(this.clazz.isAssignableFrom(data.getClass()))) {
|
||||
throw new DataAccessException("Incompatatyble type of Object" + data.getClass().getCanonicalName());
|
||||
}
|
||||
|
31
src/org/kar/archidata/tools/ListTools.java
Normal file
31
src/org/kar/archidata/tools/ListTools.java
Normal file
@ -0,0 +1,31 @@
|
||||
package org.kar.archidata.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ListTools {
|
||||
public static boolean checkListIdentical(final List<?> list1, final List<?> list2) {
|
||||
if (list1 == list2) {
|
||||
return true;
|
||||
}
|
||||
if (list1 == null) {
|
||||
return false;
|
||||
}
|
||||
if (list1.size() != list2.size()) {
|
||||
return false;
|
||||
}
|
||||
for (int iii = 0; iii < list1.size(); iii++) {
|
||||
final Object aaa = list1.get(iii);
|
||||
final Object bbb = list2.get(iii);
|
||||
if (aaa == bbb) {
|
||||
continue;
|
||||
}
|
||||
if (aaa == null) {
|
||||
return false;
|
||||
}
|
||||
if (!aaa.equals(bbb)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -167,7 +167,7 @@ public class RESTApi {
|
||||
return this.mapper.readValue(httpResponse.body(), clazz);
|
||||
}
|
||||
|
||||
public <T, U> T delete(final Class<T> clazz, final String urlOffset) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||
public <T, U> void delete(final Class<T> clazz, final String urlOffset) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||
final HttpClient client = HttpClient.newHttpClient();
|
||||
Builder requestBuilding = HttpRequest.newBuilder().version(Version.HTTP_1_1).uri(URI.create(this.baseUrl + urlOffset));
|
||||
if (this.token != null) {
|
||||
@ -183,9 +183,5 @@ public class RESTApi {
|
||||
throw new IOException("Fail to get the data [" + httpResponse.statusCode() + "] " + httpResponse.body());
|
||||
}
|
||||
}
|
||||
if (clazz.equals(String.class)) {
|
||||
return (T) httpResponse.body();
|
||||
}
|
||||
return this.mapper.readValue(httpResponse.body(), clazz);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user