forked from altran/Valuereporter
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
4 changed files
with
145 additions
and
27 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/main/java/org/valuereporter/activity/CountedActivity.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,17 @@ | ||
package org.valuereporter.activity; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Created by baardl on 01.08.17. | ||
*/ | ||
public class CountedActivity extends ObservedActivity{ | ||
private long count = 1; | ||
public CountedActivity(String name, long startTime, Map<String, Object> data) { | ||
super(name, startTime, data); | ||
} | ||
|
||
public long getCount() { | ||
return count; | ||
} | ||
} |
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
59 changes: 59 additions & 0 deletions
59
src/test/java/org/valuereporter/activity/timeseries/CommandSendActivitiesTest.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,59 @@ | ||
package org.valuereporter.activity.timeseries; | ||
|
||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
import org.valuereporter.activity.CountedActivity; | ||
import org.valuereporter.activity.ObservedActivity; | ||
|
||
import java.net.URI; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
|
||
/** | ||
* Created by baardl on 01.08.17. | ||
*/ | ||
public class CommandSendActivitiesTest { | ||
List<ObservedActivity> observedActivities = null; | ||
ObservedActivity activity = null; | ||
CommandSendActivities commandSendActivities = null; | ||
@BeforeMethod | ||
public void setUp() throws Exception { | ||
String name = "client-access"; | ||
long startTime = System.nanoTime(); | ||
Map<String, Object> data = new HashMap<>(); | ||
data.put("host", "whydahdev.cantara.no"); | ||
data.put("service", "sts"); | ||
data.put("function", "login"); | ||
data.put("ip", "127.0.0.1"); | ||
activity = new CountedActivity(name,startTime,data); | ||
observedActivities = new ArrayList<>(); | ||
observedActivities.add(activity); | ||
|
||
URI uri = URI.create("http://localhost"); | ||
String databaseName = "testdb"; | ||
commandSendActivities = new CommandSendActivities(uri, databaseName, observedActivities); | ||
} | ||
|
||
@Test | ||
public void testBuildBody() throws Exception { | ||
} | ||
|
||
@Test | ||
public void testBuildMeasurement() throws Exception { | ||
|
||
} | ||
|
||
@Test | ||
public void testBuildTags() throws Exception { | ||
String expected = "service=sts,function=login,ip=127.0.0.1,host=whydahdev.cantara.no"; | ||
assertEquals(commandSendActivities.buildTags(activity), expected); | ||
assertEquals(commandSendActivities.buildTags(null), ""); | ||
|
||
|
||
} | ||
|
||
} |
16 changes: 15 additions & 1 deletion
16
src/test/java/org/valuereporter/activity/timeseries/ManualSendActivitiesTest.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