m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/pl/edu/mimuw/cloudatlas
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2020-01-05 19:33:37 +0100
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2020-01-05 19:33:37 +0100
commit89a5d7b00f71a5be805ecc7e7907e5b0c88c5f03 (patch)
tree3472730ddd357f51b92f13d1838bca497704ab06 /src/test/java/pl/edu/mimuw/cloudatlas
parent9325737ff613f7f14e44338b68ab657e0ed52d37 (diff)
Fix tests
Diffstat (limited to 'src/test/java/pl/edu/mimuw/cloudatlas')
-rw-r--r--src/test/java/pl/edu/mimuw/cloudatlas/agent/AgentIntegrationTest.java3
-rw-r--r--src/test/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementationTests.java3
-rw-r--r--src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java2
3 files changed, 5 insertions, 3 deletions
diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/AgentIntegrationTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/AgentIntegrationTest.java
index 28b47a9..e4684cd 100644
--- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/AgentIntegrationTest.java
+++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/AgentIntegrationTest.java
@@ -95,7 +95,8 @@ public class AgentIntegrationTest {
assertEquals(new ValueInt(2l), attributes.get("level"));
assertEquals(new ValueString("whatever01"), attributes.get("name"));
assertEquals(new ValueString("/pjwstk/whatever01"), attributes.get("owner"));
- assertEquals(new ValueTime("2012/11/09 21:12:00.000"), attributes.get("timestamp"));
+ long timestamp = ((ValueTime) attributes.get("timestamp")).getValue();
+ assertTrue(timestamp <= System.currentTimeMillis());
assertEquals(new ValueInt(1l), attributes.get("cardinality"));
assertEquals(new ValueTime("2012/10/18 07:03:00.000"), attributes.get("creation"));
assertEquals(new ValueDouble(0.1), attributes.get("cpu_usage"));
diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementationTests.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementationTests.java
index 0a7a8df..002c43c 100644
--- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementationTests.java
+++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementationTests.java
@@ -63,7 +63,8 @@ public class ApiImplementationTests {
assertEquals(new ValueInt(2l), attributes.get("level"));
assertEquals(new ValueString("whatever01"), attributes.get("name"));
assertEquals(new ValueString("/pjwstk/whatever01"), attributes.get("owner"));
- assertEquals(new ValueTime("2012/11/09 21:12:00.000"), attributes.get("timestamp"));
+ long timestamp = ((ValueTime) attributes.get("timestamp")).getValue();
+ assertTrue(timestamp <= System.currentTimeMillis());
assertEquals(new ValueInt(1l), attributes.get("cardinality"));
assertEquals(new ValueTime("2012/10/18 07:03:00.000"), attributes.get("creation"));
assertEquals(new ValueDouble(0.1), attributes.get("cpu_usage"));
diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java
index ab13642..1ca8608 100644
--- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java
+++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java
@@ -157,7 +157,7 @@ public class StanikTest {
public void dontApplyWithStaleTimestamp() throws Exception {
AttributesMap attributes = new AttributesMap();
attributes.add("foo", new ValueInt(1337l));
- attributes.add("timestamp", new ValueTime("2012/12/21 04:20:00.000"));
+ attributes.add("timestamp", (ValueTime) testTime.subtract(new ValueDuration(61 * 1000l)));
attributes.add("name", new ValueString("new"));
UpdateAttributesMessage message = new UpdateAttributesMessage("test_msg", 0, "/new", attributes);
stanik.handleTyped(message);