Java Code Examples for org.jboss.shrinkwrap.api.spec.JavaArchive#deleteClass()

The following examples show how to use org.jboss.shrinkwrap.api.spec.JavaArchive#deleteClass() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigApplicationArchiveProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public void process(Archive<?> applicationArchive, TestClass testClass) {
    if (applicationArchive instanceof WebArchive) {
        WebArchive war = applicationArchive.as(WebArchive.class);
        Node libNode = war.get(PATH_LIBRARY);
        if (libNode != null) {
            for (Node child : libNode.getChildren()) {
                Asset childAsset = child.getAsset();
                if (childAsset instanceof ArchiveAsset) {
                    ArchiveAsset archiveAsset = (ArchiveAsset) childAsset;
                    if (archiveAsset.getArchive() instanceof JavaArchive) {
                        JavaArchive libArchive = (JavaArchive) archiveAsset.getArchive();
                        libArchive.deleteClass(testClass.getName());
                    }
                }
            }
        }
    }
}
 
Example 2
Source File: BuildPushTest.java    From pnc with Apache License 2.0 5 votes vote down vote up
@Deployment
public static EnterpriseArchive deploy() {
    EnterpriseArchive enterpriseArchive = Deployments.testEar();

    JavaArchive processManager = enterpriseArchive.getAsType(JavaArchive.class, Deployments.CAUSEWAY_CLIENT_JAR);
    processManager.deleteClass(DefaultCausewayClient.class);
    processManager.addClass(CausewayClientMock.class);

    processManager.addAsManifestResource("beans-use-mock-remote-clients.xml", "beans.xml");

    addBuildExecutorMock(enterpriseArchive);

    return enterpriseArchive;
}
 
Example 3
Source File: Deployments.java    From pnc with Apache License 2.0 4 votes vote down vote up
public static void addBuildExecutorMock(EnterpriseArchive enterpriseArchive) {
    JavaArchive jar = enterpriseArchive.getAsType(JavaArchive.class, EXECUTOR_JAR);

    jar.deleteClass(DefaultBuildExecutor.class);

    jar.addPackage(BuildExecutorMock.class.getPackage());
    jar.addClass(BuildDriverResultMock.class);
    jar.addClass(RepositoryManagerResultMock.class);
    jar.addClass(ArtifactBuilder.class);

    jar.addAsManifestResource("beans-use-mock-remote-clients.xml", "beans.xml");

    logger.info(jar.toString(true));

    enterpriseArchive.addAsModule(jar);

}
 
Example 4
Source File: Deployments.java    From pnc with Apache License 2.0 3 votes vote down vote up
private static void addKeycloakServiceClientMock(EnterpriseArchive enterpriseArchive) {
    JavaArchive jar = enterpriseArchive.getAsType(JavaArchive.class, AUTH_JAR);

    jar.deleteClass(DefaultKeycloakServiceClient.class);
    jar.addClass(KeycloakServiceClientMock.class);

    jar.addAsManifestResource("beans-use-mock-remote-clients.xml", "beans.xml");

    logger.info(jar.toString(true));

    enterpriseArchive.addAsModule(jar);
}