-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Option Name is optinal for Vertx instance.
- Loading branch information
Showing
8 changed files
with
86 additions
and
8 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
56 changes: 56 additions & 0 deletions
56
...on/basic/src/test/java/org/wildfly/extension/vertx/test/basic/VertxInjectionTestCase.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,56 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.wildfly.extension.vertx.test.basic; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.container.test.api.RunAsClient; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.arquillian.test.api.ArquillianResource; | ||
import org.jboss.as.arquillian.api.ContainerResource; | ||
import org.jboss.as.arquillian.container.ManagementClient; | ||
import org.jboss.as.test.integration.common.HttpRequest; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.junit.Assert; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.wildfly.extension.vertx.test.shared.ejb.EchoService; | ||
import org.wildfly.extension.vertx.test.shared.rest.RestApp; | ||
import org.wildfly.extension.vertx.test.shared.rest.ServiceEndpoint; | ||
|
||
import java.net.URL; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
/** | ||
* Test injection in servlet, ejb, REST resource endpoints. | ||
* | ||
* @author <a href="mailto:[email protected]">Lin Gao</a> | ||
*/ | ||
@RunWith(Arquillian.class) | ||
@RunAsClient | ||
@Ignore("io.netty.netty-transport needs to be added as dependency to module: io.smallrye.reactive.mutiny.vertx-core") | ||
public class VertxInjectionTestCase { | ||
@ArquillianResource | ||
private URL url; | ||
|
||
@ContainerResource | ||
private ManagementClient managementClient; | ||
|
||
@Deployment | ||
public static WebArchive createDeployment() { | ||
final WebArchive war = ShrinkWrap.create(WebArchive.class, "test-injection.war"); | ||
war.addClasses(EchoService.class, RestApp.class, ServiceEndpoint.class); | ||
war.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); | ||
return war; | ||
} | ||
|
||
@Test | ||
public void testInjection() throws Exception { | ||
String res = HttpRequest.get(url.toExternalForm() + "rest/echo/Hello", 4, TimeUnit.SECONDS); | ||
Assert.assertEquals("Hello", res); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
import static org.wildfly.extension.vertx.test.shared.ManagementClientUtils.vertxOptionOperation; | ||
|
||
/** | ||
* Test vertx eventbus message in async ejb on basic set up. | ||
* Test vertx subsystem management operations. | ||
* | ||
* @author <a href="mailto:[email protected]">Lin Gao</a> | ||
*/ | ||
|
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 |
---|---|---|
|
@@ -6,21 +6,27 @@ | |
|
||
import java.io.IOException; | ||
|
||
import io.smallrye.common.annotation.Identifier; | ||
import io.vertx.core.Vertx; | ||
import jakarta.enterprise.inject.Any; | ||
import jakarta.inject.Inject; | ||
import jakarta.servlet.AsyncContext; | ||
import jakarta.servlet.ServletException; | ||
import jakarta.servlet.http.HttpServlet; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
|
||
import static org.wildfly.extension.vertx.VertxConstants.CDI_QUALIFIER; | ||
|
||
/** | ||
* An abstract servlet class which communicates with a Vert.x eventbus address. | ||
* | ||
* @author <a href="mailto:[email protected]">Lin Gao</a> | ||
*/ | ||
public abstract class AbstractVertxServlet<S, R> extends HttpServlet { | ||
|
||
@Any | ||
@Identifier(CDI_QUALIFIER) | ||
@Inject | ||
private Vertx vertx; | ||
|
||
|
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