Skip to content

Commit

Permalink
Minor fixes and cleanups (#1395)
Browse files Browse the repository at this point in the history
  • Loading branch information
chanseokoh committed Jan 7, 2019
1 parent f6ee164 commit b648ad4
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 67 deletions.
2 changes: 1 addition & 1 deletion examples/dropwizard/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 3 additions & 1 deletion examples/helloworld/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>example</groupId>
Expand Down
4 changes: 3 additions & 1 deletion examples/java-agent/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>example</groupId>
Expand Down
5 changes: 3 additions & 2 deletions examples/multi-module/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<!-- Defines artifact information for this parent POM. -->
Expand Down Expand Up @@ -52,4 +53,4 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>
</project>
2 changes: 1 addition & 1 deletion examples/spring-boot-kubernetes/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>example</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.time.Instant;
import java.util.ArrayDeque;
import java.util.Deque;
import javax.annotation.Nullable;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -92,47 +91,6 @@ public void testLogging() {
Assert.assertTrue(timerEventQueue.isEmpty());
}

/**
* Verifies the next {@link TimerEvent} on the {@link #timerEventQueue}.
*
* @param expectedParentTimer the expected parent {@link TimerEvent.Timer}, or {@code null} if
* none expected
* @param expectedState the expected {@link TimerEvent.State}
* @param expectedDescription the expected description
* @param hasLapped {@code true} if the timer has already lapped; {@code false} if it has not
* @return the verified {@link TimerEvent}
*/
private TimerEvent.Timer verifyNextTimerEvent(
@Nullable TimerEvent.Timer expectedParentTimer,
State expectedState,
String expectedDescription,
boolean hasLapped) {
TimerEvent timerEvent = timerEventQueue.poll();
Assert.assertNotNull(timerEvent);

if (expectedParentTimer == null) {
Assert.assertFalse(timerEvent.getTimer().getParent().isPresent());
} else {
Assert.assertTrue(timerEvent.getTimer().getParent().isPresent());
Assert.assertSame(expectedParentTimer, timerEvent.getTimer().getParent().get());
}
Assert.assertEquals(expectedState, timerEvent.getState());
if (expectedState == State.START) {
Assert.assertEquals(Duration.ZERO, timerEvent.getDuration());
Assert.assertEquals(Duration.ZERO, timerEvent.getElapsed());
} else {
Assert.assertTrue(timerEvent.getDuration().compareTo(Duration.ZERO) > 0);
if (hasLapped) {
Assert.assertTrue(timerEvent.getElapsed().compareTo(timerEvent.getDuration()) > 0);
} else {
Assert.assertEquals(0, timerEvent.getElapsed().compareTo(timerEvent.getDuration()));
}
}
Assert.assertEquals(expectedDescription, timerEvent.getDescription());

return timerEvent.getTimer();
}

/**
* Verifies that the {@code timerEvent}'s timer has no parent.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.junit.Assert;
import org.junit.Test;

Expand Down Expand Up @@ -101,7 +100,7 @@ public void testGetUnfinishedAllocations_singleThread() {

@Test
public void testGetUnfinishedAllocations_multipleThreads()
throws InterruptedException, ExecutionException, IOException, TimeoutException {
throws InterruptedException, ExecutionException, IOException {
try (MultithreadedExecutor multithreadedExecutor = new MultithreadedExecutor()) {
AllocationCompletionTracker allocationCompletionTracker = new AllocationCompletionTracker();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.DoubleAccumulator;
import org.junit.Assert;
import org.junit.Test;
Expand Down Expand Up @@ -56,8 +55,7 @@ private AllocationTree() {}
private static final double DOUBLE_ERROR_MARGIN = 1e-10;

@Test
public void testAccept()
throws ExecutionException, InterruptedException, IOException, TimeoutException {
public void testAccept() throws ExecutionException, InterruptedException, IOException {
try (MultithreadedExecutor multithreadedExecutor = new MultithreadedExecutor()) {
DoubleAccumulator maxProgress = new DoubleAccumulator(Double::max, 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ public void apply(Project project) {
.getTasks()
.create(BUILD_TAR_TASK_NAME, BuildTarTask.class)
.setJibExtension(jibExtension);
Task filesTask =
project.getTasks().create(FILES_TASK_NAME, FilesTask.class).setJibExtension(jibExtension);
project.getTasks().create(FILES_TASK_NAME, FilesTask.class).setJibExtension(jibExtension);

project.afterEvaluate(
projectAfterEvaluation -> {
Expand Down
4 changes: 3 additions & 1 deletion jib-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.google.cloud.tools</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.test</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.test</groupId>
Expand Down
4 changes: 3 additions & 1 deletion jib-maven-plugin/src/test/resources/projects/empty/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.test</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.jib.test</groupId>
Expand Down
1 change: 1 addition & 0 deletions jib-maven-plugin/src/test/resources/projects/multi/pom.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.test</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.test</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.test</groupId>
Expand Down
4 changes: 3 additions & 1 deletion jib-maven-plugin/src/test/resources/projects/simple/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.test</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.test</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.test</groupId>
Expand Down

0 comments on commit b648ad4

Please sign in to comment.