-
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.
first commit for looping the call to Nudge api #6
- Loading branch information
Showing
6 changed files
with
141 additions
and
11 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.nudge.elasticstack.executor; | ||
|
||
/** | ||
* @author Frédéric Massart | ||
*/ | ||
public enum Metric { | ||
|
||
JAVA, CASSANDRA | ||
} |
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,45 @@ | ||
package json; | ||
|
||
import org.junit.Test; | ||
|
||
import java.time.Duration; | ||
import java.time.Instant; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* @author Frédéric Massart | ||
*/ | ||
public class NudgeApiPOCTest { | ||
|
||
NudgeApiPOC nudgeApiPOC = new NudgeApiPOC(); | ||
|
||
@Test | ||
public void buildFromInstantTest() { | ||
// given | ||
Duration duration = Duration.ofDays(2); | ||
|
||
Instant now = Instant.parse("2014-03-18T00:00:00.000Z"); | ||
Instant expectedInstant = Instant.parse("2014-03-16T00:00:00.000Z"); | ||
|
||
// when | ||
Instant fromInstant = nudgeApiPOC.buildFromInstant(duration, now); | ||
|
||
// then | ||
assertEquals(expectedInstant, fromInstant); | ||
} | ||
|
||
|
||
@Test | ||
public void formatInstantToNudgeDateTestWithLocale() { | ||
// given | ||
String date = "2014-03-16T12:00:00.000Z"; | ||
|
||
// when | ||
String nudgeDate = nudgeApiPOC.formatInstantToNudgeDate(Instant.parse("2014-03-16T12:00:00.000Z")); | ||
|
||
// then | ||
assertEquals(date, nudgeDate); | ||
|
||
} | ||
} |
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 org.nudge.elasticstack; | ||
|
||
import org.junit.Test; | ||
|
||
import java.time.Duration; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* @author Frédéric Massart | ||
*/ | ||
public class DaemonTest { | ||
|
||
@Test | ||
public void testRetrieveDuration() throws Exception { | ||
// given | ||
long period = 10; | ||
TimeUnit timeUnit = TimeUnit.DAYS; | ||
Duration expectedDuration = Duration.ofDays(10); | ||
|
||
// when | ||
Duration durationResponse = Daemon.retrieveDuration(period, timeUnit); | ||
|
||
// then | ||
assertEquals(expectedDuration, durationResponse); | ||
} | ||
} |