@Test public void testProvider() { Provider p = Provider.provider(); String pName = p.getClass().getName(); assertEquals( "JBossWS is not being used: " + pName, "org.jboss.wsf.stack.cxf.client.ProviderImpl", pName); }
/** * AS7 check on client TCCL * * @param cl */ private void checkImplementationClassesAreNotVisible(ClassLoader cl) { // retrieve the stack specific Provider impl class name through the JAXWS API // classloading mechanism (JBEE-75), which is able to "see" implementation classes String providerImplClassName = Provider.provider().getClass().getName(); if (!providerImplClassName.contains("jboss")) { throw new RuntimeException( "Expected a JBoss(WS) specific implementation for javax.xml.ws.spi.Provider: " + providerImplClassName); } // then try loading the same class using the provided classloader try { cl.loadClass(providerImplClassName); throw new RuntimeException( "ClassLoader " + cl + " should not be able to load " + providerImplClassName); } catch (ClassNotFoundException e) { // this is expected, just check the class that can't be found is our impl if (!(e.getMessage().contains(providerImplClassName))) { throw new RuntimeException( "Unexpected Provider implementation being looked up: " + e.getMessage()); } } }