@Override public LegacyKernelServiceInitializerImpl addParentFirstClassPattern(String pattern) { classLoaderBuilder.addParentFirstClassPattern(pattern); return this; }
@Override public LegacyKernelServicesInitializer addMavenResourceURL(String artifactGav) throws IOException, ClassNotFoundException { classLoaderBuilder.addMavenResourceURL(artifactGav); return this; }
@Override public LegacyKernelServiceInitializerImpl addChildFirstClassPattern(String pattern) { classLoaderBuilder.addChildFirstClassPattern(pattern); return this; }
private LegacyControllerKernelServicesProxy install(KernelServices mainServices, List<ModelNode> bootOperations) throws Exception { if (!skipReverseCheck) { bootCurrentVersionWithLegacyBootOperations(bootOperations, mainServices); } classLoaderBuilder.addParentFirstClassPattern("org.jboss.as.subsystem.bridge.shared.*"); classLoaderBuilder.addMavenResourceURL("org.wildfly.core:wildfly-subsystem-test-framework:" + ModelTestControllerVersion.CurrentVersion.VERSION); classLoaderBuilder.addMavenResourceURL("org.wildfly.core:wildfly-model-test:" + ModelTestControllerVersion.CurrentVersion.VERSION); classLoaderBuilder.addMavenResourceURL("org.wildfly.legacy.test:wildfly-legacy-spi:" + Version.LEGACY_TEST_CONTROLLER_VERSION); if (testControllerVersion != ModelTestControllerVersion.MASTER && testControllerVersion.getTestControllerVersion() != null) { String groupId = testControllerVersion.getCoreMavenGroupId(); String serverArtifactId = testControllerVersion.getServerMavenArtifactId(); classLoaderBuilder.addRecursiveMavenResourceURL(groupId + ":" + serverArtifactId + ":" + testControllerVersion.getCoreVersion()); //TODO Even with this there are some workarounds needed in JGroupsSubsystemTransformerTestCase, InfinispanSubsystemTransformersTestCase and LoggingSubsystemTestCase //Don't load modules from the scoped classloader to avoid some funky stuff going on when initializing the JAXP redirect //The mentioned funky stuff works fine when running in Eclipse but fails when running the tests on the command-line classLoaderBuilder.addParentFirstClassPattern("__redirected.*"); classLoaderBuilder.addParentFirstClassPattern("org.jboss.modules.*"); classLoaderBuilder.addMavenResourceURL("org.wildfly.legacy.test:wildfly-legacy-subsystem-" + testControllerVersion.getTestControllerVersion() + ":" + Version.LEGACY_TEST_CONTROLLER_VERSION); } URLClassLoader legacyCl = classLoaderBuilder.build(); ScopedKernelServicesBootstrap scopedBootstrap = new ScopedKernelServicesBootstrap(legacyCl); return scopedBootstrap.createKernelServices(mainSubsystemName, extensionClassName != null ? extensionClassName : mainExtension.getClass().getName(), additionalInit, getOperationValidationFilter(), bootOperations, modelVersion, persistXml); }
protected static ModelControllerClient createClient(final String artifact, final String version, final String host, final int port) throws Exception { final ChildFirstClassLoaderBuilder classLoaderBuilder = new ChildFirstClassLoaderBuilder(false); classLoaderBuilder.addRecursiveMavenResourceURL(artifact + ":" + version, excludes); classLoaderBuilder.addParentFirstClassPattern("org.jboss.as.controller.client.ModelControllerClient"); classLoaderBuilder.addParentFirstClassPattern("org.jboss.as.controller.client.OperationMessageHandler"); classLoaderBuilder.addParentFirstClassPattern("org.jboss.as.controller.client.Operation"); classLoaderBuilder.addParentFirstClassPattern("org.jboss.as.controller.client.OperationResponse*"); classLoaderBuilder.addParentFirstClassPattern("org.jboss.as.protocol.logging.ProtocolLogger*"); final ClassLoader classLoader = classLoaderBuilder.build(); final Class<?> factoryClass = classLoader.loadClass("org.jboss.as.controller.client.ModelControllerClient$Factory"); final Method factory = factoryClass.getMethod("create", String.class, int.class); try { final Object client = factory.invoke(null, host, port); final InvocationHandler invocationHandler = new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return method.invoke(client, args); } }; final Class<?>[] interfaces = new Class<?>[]{ModelControllerClient.class}; return (ModelControllerClient) Proxy.newProxyInstance(classLoader, interfaces, invocationHandler); } catch (InvocationTargetException e) { Throwable t = e.getCause(); if (t == null) { throw e; } throw t instanceof Exception ? (Exception) t : new RuntimeException(t); } }
LegacyKernelServicesInitializerImpl(ModelVersion modelVersion, ModelTestControllerVersion version) { this.classLoaderBuilder = new ChildFirstClassLoaderBuilder(version.isEap()); this.modelVersion = modelVersion; this.testControllerVersion = version; }
@Override public LegacyKernelServicesInitializer addSimpleResourceURL(String resource) throws MalformedURLException { classLoaderBuilder.addSimpleResourceURL(resource); return this; }
@Override public LegacyKernelServicesInitializer addSingleChildFirstClass(Class<?>...classes) { classLoaderBuilder.addSingleChildFirstClass(classes); return this; }
@Override public LegacyKernelServicesInitializer addURL(URL url) { classLoaderBuilder.addURL(url); return this; }
@Override public LegacyKernelServicesInitializer excludeFromParent(ClassFilter exclusionFilter) { classLoaderBuilder.excludeFromParent(exclusionFilter); return this; }
private LegacyControllerKernelServicesProxy install(KernelServices mainServices, List<ModelNode> bootOperations) throws Exception { if (!skipReverseCheck) { bootCurrentVersionWithLegacyBootOperations(bootOperations, mainServices); } classLoaderBuilder.addParentFirstClassPattern("org.jboss.as.subsystem.bridge.shared.*"); classLoaderBuilder.addMavenResourceURL("org.wildfly.core:wildfly-subsystem-test-framework:" + ModelTestControllerVersion.CurrentVersion.VERSION); classLoaderBuilder.addMavenResourceURL("org.wildfly.core:wildfly-model-test:" + ModelTestControllerVersion.CurrentVersion.VERSION); classLoaderBuilder.addMavenResourceURL("org.wildfly.legacy.test:wildfly-legacy-spi:" + Version.LEGACY_TEST_CONTROLLER_VERSION); if (testControllerVersion != ModelTestControllerVersion.MASTER && testControllerVersion.getTestControllerVersion() != null) { String groupId = testControllerVersion.getCoreMavenGroupId(); String serverArtifactId = testControllerVersion.getServerMavenArtifactId(); classLoaderBuilder.addRecursiveMavenResourceURL(groupId + ":" + serverArtifactId + ":" + testControllerVersion.getCoreVersion()); //TODO Even with this there are some workarounds needed in JGroupsSubsystemTransformerTestCase, InfinispanSubsystemTransformersTestCase and LoggingSubsystemTestCase //Don't load modules from the scoped classloader to avoid some funky stuff going on when initializing the JAXP redirect //The mentioned funky stuff works fine when running in Eclipse but fails when running the tests on the command-line classLoaderBuilder.addParentFirstClassPattern("__redirected.*"); classLoaderBuilder.addParentFirstClassPattern("org.jboss.modules.*"); classLoaderBuilder.addMavenResourceURL("org.wildfly.legacy.test:wildfly-legacy-subsystem-" + testControllerVersion.getTestControllerVersion() + ":" + Version.LEGACY_TEST_CONTROLLER_VERSION); } URLClassLoader legacyCl = classLoaderBuilder.build(); ScopedKernelServicesBootstrap scopedBootstrap = new ScopedKernelServicesBootstrap(legacyCl); return scopedBootstrap.createKernelServices(mainSubsystemName, extensionClassName != null ? extensionClassName : mainExtension.getClass().getName(), additionalInit, getOperationValidationFilter(), bootOperations, modelVersion, persistXml); }
public LegacyKernelServiceInitializerImpl(AdditionalInitialization additionalInit, ModelTestControllerVersion version, ModelVersion modelVersion) { this.classLoaderBuilder = new ChildFirstClassLoaderBuilder(version.isEap()); this.additionalInit = additionalInit == null ? AdditionalInitialization.MANAGEMENT : additionalInit; this.testControllerVersion = version; this.modelVersion = modelVersion; }
@Override public LegacyKernelServicesInitializer addSimpleResourceURL(String resource) throws MalformedURLException { classLoaderBuilder.addSimpleResourceURL(resource); return this; }
@Override public LegacyKernelServicesInitializer addSingleChildFirstClass(final Class<?>... classes) { classLoaderBuilder.addSingleChildFirstClass(classes); return this; }
@Override public LegacyKernelServicesInitializer addURL(URL url) { classLoaderBuilder.addURL(url); return this; }
@Override public LegacyKernelServicesInitializer excludeFromParent(ClassFilter exclusionFilter) { classLoaderBuilder.excludeFromParent(exclusionFilter); return this; }
private LegacyControllerKernelServicesProxy install(KernelServices mainServices, List<ModelNode> bootOperations) throws Exception { if (!skipReverseCheck) { bootCurrentVersionWithLegacyBootOperations(bootOperations, mainServices); } classLoaderBuilder.addParentFirstClassPattern("org.jboss.as.subsystem.bridge.shared.*"); classLoaderBuilder.addMavenResourceURL("org.jboss.as:jboss-as-subsystem-test-framework:" + ModelTestControllerVersion.CurrentVersion.VERSION); classLoaderBuilder.addMavenResourceURL("org.jboss.as:jboss-as-model-test:" + ModelTestControllerVersion.CurrentVersion.VERSION); if (testControllerVersion != ModelTestControllerVersion.MASTER && testControllerVersion.getTestControllerVersion() != null) { String groupId = testControllerVersion.getMavenGavVersion().startsWith("7.") ? "org.jboss.as" : "org.wildfly"; String serverArtifactId = testControllerVersion.getMavenGavVersion().startsWith("7.") ? "jboss-as-server" : "wildfly-server"; classLoaderBuilder.addRecursiveMavenResourceURL(groupId + ":" + serverArtifactId + ":" + testControllerVersion.getMavenGavVersion()); //TODO Even with this there are some workarounds needed in JGroupsSubsystemTransformerTestCase, InfinispanSubsystemTransformersTestCase and LoggingSubsystemTestCase //Don't load modules from the scoped classloader to avoid some funky stuff going on when initializing the JAXP redirect //The mentioned funky stuff works fine when running in Eclipse but fails when running the tests on the command-line classLoaderBuilder.addParentFirstClassPattern("__redirected.*"); classLoaderBuilder.addParentFirstClassPattern("org.jboss.modules.*"); classLoaderBuilder.addMavenResourceURL("org.jboss.as:jboss-as-subsystem-test-controller-" + testControllerVersion.getTestControllerVersion() + ":" + ModelTestControllerVersion.CurrentVersion.VERSION); } ClassLoader legacyCl = classLoaderBuilder.build(); ScopedKernelServicesBootstrap scopedBootstrap = new ScopedKernelServicesBootstrap(legacyCl); return scopedBootstrap.createKernelServices(mainSubsystemName, extensionClassName != null ? extensionClassName : mainExtension.getClass().getName(), additionalInit, getOperationValidationFilter(), bootOperations, modelVersion, persistXml); }
LegacyKernelServicesInitializerImpl(ModelVersion modelVersion, ModelTestControllerVersion version) { this.classLoaderBuilder = new ChildFirstClassLoaderBuilder(version.isEap()); this.modelVersion = modelVersion; this.testControllerVersion = version; }
@Override public LegacyKernelServiceInitializerImpl addParentFirstClassPattern(String pattern) { classLoaderBuilder.addParentFirstClassPattern(pattern); return this; }
@Override public LegacyKernelServicesInitializer addMavenResourceURL(String...artifactGavs) throws IOException, ClassNotFoundException { for (String artifactGav : artifactGavs) { classLoaderBuilder.addMavenResourceURL(artifactGav); } return this; }