Skip to content

Commit d9a09a5

Browse files
committed
Don't document the ServerResourceProducer as there should be no real need for users to implement it. The same thing can be achieved with JUnit API's.
Signed-off-by: James R. Perkins <jperkins@ibm.com>
1 parent ea55538 commit d9a09a5

File tree

2 files changed

+0
-69
lines changed

2 files changed

+0
-69
lines changed

docs/src/main/asciidoc/extension/index.adoc

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -682,74 +682,6 @@ Set `jboss.home` to the provisioning directory:
682682

683683
This chapter covers advanced features and extensibility points in {project-name}.
684684

685-
== Extending Resource Injection
686-
687-
The framework supports custom resource injection via the `ServerResourceProducer` SPI.
688-
689-
=== Implementing a Resource Producer
690-
691-
Create a class that implements `org.wildfly.testing.junit.extension.api.ServerResourceProducer`:
692-
693-
[source,java]
694-
----
695-
package com.example;
696-
697-
import java.lang.annotation.Annotation;
698-
699-
import jakarta.ws.rs.client.Client;
700-
import jakarta.ws.rs.client.ClientBuilder;
701-
import org.junit.jupiter.api.extension.ExtensionContext;
702-
import org.kohsuke.MetaInfServices;
703-
import org.wildfly.testing.junit.extension.api.ServerResourceProducer;
704-
705-
@MetaInfServices
706-
public class RestClientProducer implements ServerResourceProducer {
707-
708-
private static final ExtensionContext.Namespace NAMESPACE =
709-
ExtensionContext.Namespace.create("Rest.Client");
710-
711-
@Override
712-
public boolean canInject(ExtensionContext context, Class<?> clazz,
713-
Annotation... annotations) {
714-
return Client.class.isAssignableFrom(clazz);
715-
}
716-
717-
@Override
718-
public Object produce(ExtensionContext context, Class<?> clazz,
719-
Annotation... annotations) {
720-
ExtensionContext.Store store = context.getRoot().getStore(NAMESPACE);
721-
return store.computeIfAbsent("rest-client",
722-
(c) -> ClientBuilder.newClient(), Client.class);
723-
}
724-
}
725-
----
726-
727-
=== Using the Custom Producer
728-
729-
Now you can inject the custom resource type:
730-
731-
[source,java]
732-
----
733-
@WildFlyTest
734-
public class RestApiTest {
735-
736-
@ServerResource
737-
private Client client;
738-
739-
@ServerResource
740-
private URI uri;
741-
742-
@Test
743-
public void testRestApi() {
744-
Response response = client.target(uri)
745-
.path("api/resource")
746-
.request()
747-
.get();
748-
Assertions.assertEquals(200, response.getStatus());
749-
}
750-
}
751-
----
752-
753685
== Custom Server Configurations
754686

755687
=== Standalone Configuration

docs/src/main/asciidoc/extension/troubleshooting.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ public class MyTest {
202202
**Solution:** Only specific types can be injected. Supported types:
203203
+
204204
* See the link:index.html#available-resources[Available Resources]
205-
* Custom types via `ServerResourceProducer` SPI
206205

207206
== Module and Conditional Test Issues
208207

0 commit comments

Comments
 (0)