-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: attempt to test power-server client
- Loading branch information
Showing
9 changed files
with
105 additions
and
33 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
33 changes: 33 additions & 0 deletions
33
deployment/src/test/java/io/quarkiverse/power/deployment/PowerMeasurerTest.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,33 @@ | ||
package io.quarkiverse.power.deployment; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.net.URI; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkiverse.power.runtime.PowerMeasurer; | ||
import io.quarkiverse.power.runtime.ServerSampler; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.quarkus.test.common.http.TestHTTPResource; | ||
import net.laprun.sustainability.power.PowerResource; | ||
|
||
public class PowerMeasurerTest { | ||
@TestHTTPResource | ||
URI uri; | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar.addClasses(PowerResource.class, TestPowerMeasurer.class, TestPowerSensor.class)); | ||
|
||
@Test | ||
void startShouldAccumulateOverSpecifiedDurationAndStop() throws Exception { | ||
final var measurer = new PowerMeasurer<>(new ServerSampler(uri)); | ||
|
||
measurer.start(1, 100); | ||
measurer.onCompleted(measure -> { | ||
assertEquals(10, measure.numberOfSamples()); | ||
}); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
deployment/src/test/java/io/quarkiverse/power/deployment/TestPowerMeasurer.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,8 @@ | ||
package io.quarkiverse.power.deployment; | ||
|
||
import io.quarkus.test.Mock; | ||
import net.laprun.sustainability.power.PowerMeasurer; | ||
|
||
@Mock | ||
public class TestPowerMeasurer extends PowerMeasurer { | ||
} |
7 changes: 7 additions & 0 deletions
7
deployment/src/test/java/io/quarkiverse/power/deployment/TestPowerSensor.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,7 @@ | ||
package io.quarkiverse.power.deployment; | ||
|
||
import io.quarkus.test.Mock; | ||
|
||
@Mock | ||
public class TestPowerSensor extends net.laprun.sustainability.power.sensors.test.TestPowerSensor { | ||
} |
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
23 changes: 0 additions & 23 deletions
23
runtime/src/test/java/io/quarkiverse/power/runtime/PowerMeasurerTest.java
This file was deleted.
Oops, something went wrong.