-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15467 from mkouba/arc-devui-compare-fix
Dev UI - fix comparator for CDI observers
- Loading branch information
Showing
4 changed files
with
148 additions
and
64 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
49 changes: 49 additions & 0 deletions
49
...ions/arc/deployment/src/test/java/io/quarkus/arc/test/devconsole/DevObserverInfoTest.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,49 @@ | ||
package io.quarkus.arc.test.devconsole; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import javax.enterprise.event.Reception; | ||
import javax.enterprise.event.TransactionPhase; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.arc.deployment.devconsole.DevObserverInfo; | ||
import io.quarkus.arc.deployment.devconsole.Name; | ||
|
||
public class DevObserverInfoTest { | ||
|
||
@Test | ||
public void testCompare() { | ||
List<DevObserverInfo> observers = new ArrayList<>(); | ||
// Synthetic non-app - should be last | ||
observers.add(new DevObserverInfo(false, null, null, new Name("Delta"), | ||
Collections.emptyList(), 0, false, Reception.ALWAYS, TransactionPhase.IN_PROGRESS)); | ||
// App observers | ||
observers.add(new DevObserverInfo(true, new Name("Alpha"), "fooish", new Name("java.lang.String"), | ||
Collections.emptyList(), 0, false, Reception.ALWAYS, TransactionPhase.IN_PROGRESS)); | ||
observers.add(new DevObserverInfo(true, new Name("Alpha"), "blabla", new Name("java.lang.String"), | ||
Collections.emptyList(), 1, false, Reception.ALWAYS, TransactionPhase.IN_PROGRESS)); | ||
observers.add(new DevObserverInfo(true, null, null, new Name("Charlie"), | ||
Collections.emptyList(), 0, false, Reception.ALWAYS, TransactionPhase.IN_PROGRESS)); | ||
observers.add(new DevObserverInfo(true, new Name("Bravo"), "hop", new Name("java.lang.String"), | ||
Collections.emptyList(), 0, false, Reception.IF_EXISTS, TransactionPhase.IN_PROGRESS)); | ||
|
||
Collections.sort(observers); | ||
assertEquals("blabla", observers.get(0).getMethodName()); | ||
assertEquals("Alpha", observers.get(0).getDeclaringClass().toString()); | ||
assertEquals("fooish", observers.get(1).getMethodName()); | ||
assertEquals("Alpha", observers.get(1).getDeclaringClass().toString()); | ||
assertEquals("hop", observers.get(2).getMethodName()); | ||
assertEquals("Bravo", observers.get(2).getDeclaringClass().toString()); | ||
assertNull(observers.get(3).getMethodName()); | ||
assertEquals("Charlie", observers.get(3).getObservedType().toString()); | ||
assertEquals("Delta", observers.get(observers.size() - 1).getObservedType().toString()); | ||
assertNull(observers.get(observers.size() - 1).getDeclaringClass()); | ||
} | ||
|
||
} |