Compare commits

...

2 Commits

Author SHA1 Message Date
841514935c [FIX] missing model test class 2024-12-31 10:41:14 +01:00
5f682da13e [FIX] variable access 2024-12-31 10:40:50 +01:00
2 changed files with 28 additions and 7 deletions

View File

@ -0,0 +1,17 @@
package test.kar.archidata.apiExtern.model;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.Date;
public class DataTimes {
public Date time;
public Timestamp date;
public LocalDateTime dateTime;
@Override
public String toString() {
return "DataForJSR310 [time=" + this.time + ", date=" + this.date + ", dateTime=" + this.dateTime + "]";
}
}

View File

@ -35,7 +35,7 @@ public class TestResource {
@GET
@PermitAll
public List<SimpleArchiveTable> gets() throws Exception {
return this.data;
return TestResource.data;
}
@GET
@ -43,7 +43,7 @@ public class TestResource {
@PermitAll
public SimpleArchiveTable get(@PathParam("id") final Long id) throws Exception {
LOGGER.info("get({})", id);
for (final SimpleArchiveTable elem : this.data) {
for (final SimpleArchiveTable elem : TestResource.data) {
if (elem.id.equals(id)) {
return elem;
}
@ -56,8 +56,9 @@ public class TestResource {
@PermitAll
public SimpleArchiveTable archive(@PathParam("id") final Long id) throws Exception {
LOGGER.info("archive({})", id);
for (final SimpleArchiveTable elem : this.data) {
for (final SimpleArchiveTable elem : TestResource.data) {
if (elem.id.equals(id)) {
elem.updatedAt = new Date();
elem.archive = new Date();
return elem;
}
@ -70,8 +71,9 @@ public class TestResource {
@PermitAll
public SimpleArchiveTable restore(@PathParam("id") final Long id) throws Exception {
LOGGER.info("restore({})", id);
for (final SimpleArchiveTable elem : this.data) {
for (final SimpleArchiveTable elem : TestResource.data) {
if (elem.id.equals(id)) {
elem.updatedAt = new Date();
elem.archive = null;
return elem;
}
@ -84,8 +86,10 @@ public class TestResource {
@Consumes(MediaType.APPLICATION_JSON)
public SimpleArchiveTable post(final SimpleArchiveTable data) throws Exception {
LOGGER.info("post(...)");
data.id = this.uniqueId;
this.uniqueId += 5;
data.id = TestResource.uniqueId;
TestResource.uniqueId += 5;
data.updatedAt = new Date();
data.createdAt = new Date();
this.data.add(data);
return data;
}
@ -115,7 +119,7 @@ public class TestResource {
@PermitAll
public void remove(@PathParam("id") final Long id) throws Exception {
LOGGER.info("remove({})", id);
this.data.removeIf(e -> e.id.equals(id));
TestResource.data.removeIf(e -> e.id.equals(id));
}
}