Skip to content

Commit

Permalink
refactor: move to net.laprun.sustainability package / group id
Browse files Browse the repository at this point in the history
  • Loading branch information
metacosm committed Apr 2, 2024
1 parent 0db1323 commit 708085d
Show file tree
Hide file tree
Showing 27 changed files with 51 additions and 54 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To use the extension:
your application:
```xml
<dependency>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability.power.quarkus</groupId>
<artifactId>quarkus-power</artifactId>
<version>${project.version}</version>
</dependency>
Expand Down
4 changes: 2 additions & 2 deletions deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability</groupId>
<artifactId>quarkus-power-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
Expand All @@ -23,7 +23,7 @@
<artifactId>quarkus-rest-jackson-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability</groupId>
<artifactId>quarkus-power</artifactId>
<version>${project.version}</version>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.quarkiverse.power.deployment;
package net.laprun.sustainability.power.quarkus.deployment;

import io.quarkiverse.power.deployment.devui.commands.PowerCommands;
import io.quarkiverse.power.runtime.PowerMeasurer;
import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.ConsoleCommandBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import net.laprun.sustainability.power.quarkus.deployment.devui.commands.PowerCommands;
import net.laprun.sustainability.power.quarkus.runtime.PowerMeasurer;

class PowerProcessor {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.quarkiverse.power.deployment.devui.commands;
package net.laprun.sustainability.power.quarkus.deployment.devui.commands;

import io.quarkiverse.power.runtime.PowerMeasurer;
import net.laprun.sustainability.power.quarkus.runtime.PowerMeasurer;
import org.aesh.command.Command;
import org.aesh.command.CommandResult;
import org.aesh.command.GroupCommand;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.quarkiverse.power.deployment.devui.commands;
package net.laprun.sustainability.power.quarkus.deployment.devui.commands;

import io.quarkiverse.power.runtime.PowerMeasure;
import io.quarkiverse.power.runtime.PowerMeasurer;
import io.quarkus.deployment.console.QuarkusCommand;
import net.laprun.sustainability.power.quarkus.runtime.PowerMeasure;
import net.laprun.sustainability.power.quarkus.runtime.PowerMeasurer;
import org.aesh.command.CommandDefinition;
import org.aesh.command.CommandResult;
import org.aesh.command.invocation.CommandInvocation;
Expand Down Expand Up @@ -39,9 +39,7 @@ public CommandResult doExecute(CommandInvocation commandInvocation) {
commandInvocation.println("Establishing baseline for 30s, please do not use your application until done.");
commandInvocation.println("Power measurement will start as configured after this initial measure is done.");
sensor.start(30, 1000);
sensor.onError(e -> {
commandInvocation.println("An error occurred: " + e.getMessage());
});
sensor.onError(e -> commandInvocation.println("An error occurred: " + e.getMessage()));
sensor.onCompleted((m) -> {
baseline = m;
outputConsumptionSinceStarted(baseline, commandInvocation, true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.quarkiverse.power.deployment.devui.commands;
package net.laprun.sustainability.power.quarkus.deployment.devui.commands;

import io.quarkiverse.power.runtime.PowerMeasurer;
import io.quarkus.deployment.console.QuarkusCommand;
import net.laprun.sustainability.power.quarkus.runtime.PowerMeasurer;
import org.aesh.command.CommandDefinition;
import org.aesh.command.CommandResult;
import org.aesh.command.invocation.CommandInvocation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.quarkiverse.power.deployment;
package net.laprun.sustainability.power.quarkus.deployment;

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;
import net.laprun.sustainability.power.quarkus.runtime.PowerMeasurer;
import net.laprun.sustainability.power.quarkus.runtime.ServerSampler;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

Expand All @@ -21,7 +21,7 @@ public class PowerMeasurerTest {
.withApplicationRoot((jar) -> jar.addClasses(PowerResource.class, TestPowerMeasurer.class, TestPowerSensor.class));

@Test
void startShouldAccumulateOverSpecifiedDurationAndStop() throws Exception {
void startShouldAccumulateOverSpecifiedDurationAndStop() {
final var measurer = new PowerMeasurer(new ServerSampler(uri));

measurer.start(1, 100);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.deployment;
package net.laprun.sustainability.power.quarkus.deployment;

import io.quarkus.test.Mock;
import net.laprun.sustainability.power.PowerMeasurer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.deployment;
package net.laprun.sustainability.power.quarkus.deployment;

import io.quarkus.test.Mock;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package io.quarkiverse.power.test;
package net.laprun.sustainability.power.quarkus.test;

import io.quarkus.test.QuarkusDevModeTest;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusDevModeTest;

@Disabled
public class PowerDevModeTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package io.quarkiverse.power.test;
package net.laprun.sustainability.power.quarkus.test;

import io.quarkus.test.QuarkusUnitTest;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusUnitTest;

public class PowerTest {

// Start unit test with your extension loaded
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ TIP: Describe what the extension does here.

== Installation

If you want to use this extension, you need to add the `io.quarkiverse.power:quarkus-power` extension first to your build file.
If you want to use this extension, you need to add the `net.laprun.sustainability:quarkus-power` extension first to your build file.

For instance, with Maven, add the following dependency to your POM file:

[source,xml,subs=attributes+]
----
<dependency>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability</groupId>
<artifactId>quarkus-power</artifactId>
<version>{project-version}</version>
</dependency>
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability</groupId>
<artifactId>quarkus-power-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
Expand All @@ -18,9 +18,9 @@
<artifactId>quarkus-rest</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability</groupId>
<artifactId>quarkus-power</artifactId>
<version>${project.version}</version>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.quarkiverse.power.it;
package net.laprun.sustainability.power.quarkus.it;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.ws.rs.GET;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.it;
package net.laprun.sustainability.power.quarkus.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package io.quarkiverse.power.it;

import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.is;
package net.laprun.sustainability.power.quarkus.it;

import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;

import io.quarkus.test.junit.QuarkusTest;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.is;

@QuarkusTest
public class PowerResourceTest {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<artifactId>quarkiverse-parent</artifactId>
<version>16</version>
</parent>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability</groupId>
<artifactId>quarkus-power-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability</groupId>
<artifactId>quarkus-power-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.runtime;
package net.laprun.sustainability.power.quarkus.runtime;

import net.laprun.sustainability.power.SensorMetadata;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.runtime;
package net.laprun.sustainability.power.quarkus.runtime;

import net.laprun.sustainability.power.SensorMetadata;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.runtime;
package net.laprun.sustainability.power.quarkus.runtime;

import net.laprun.sustainability.power.SensorMetadata;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.runtime;
package net.laprun.sustainability.power.quarkus.runtime;

import com.sun.management.OperatingSystemMXBean;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package io.quarkiverse.power.runtime;

import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
package net.laprun.sustainability.power.quarkus.runtime;

import io.smallrye.mutiny.Multi;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import net.laprun.sustainability.power.SensorMetadata;

@Path("/power")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.runtime;
package net.laprun.sustainability.power.quarkus.runtime;

import java.util.function.Consumer;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.runtime;
package net.laprun.sustainability.power.quarkus.runtime;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.rest.client.reactive.jackson.runtime.serialisers.ClientJacksonMessageBodyReader;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.runtime;
package net.laprun.sustainability.power.quarkus.runtime;

public class StoppedPowerMeasure extends AbstractPowerMeasure {
private final long duration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.runtime;
package net.laprun.sustainability.power.quarkus.runtime;

import net.laprun.sustainability.power.SensorMetadata;
import org.junit.jupiter.api.Test;
Expand Down

0 comments on commit 708085d

Please sign in to comment.