ClassLoader legacyCl = new ChildFirstClassLoader(parent, parentFirst, childFirst, classloaderURLs.toArray(new URL[classloaderURLs.size()]));
Class<?> clazz = legacyCl.loadClass(extensionClassName != null ? extensionClassName : mainExtension.getClass().getName());
Assert.assertEquals(legacyCl, clazz.getClassLoader());
Assert.assertTrue(Extension.class.isAssignableFrom(clazz));
Extension extension = (Extension) clazz.newInstance();
//Initialize the parsers for the legacy subsystem (copied from the @Before method)
XMLMapper xmlMapper = XMLMapper.Factory.create();
TestParser testParser = new TestParser(mainSubsystemName);
ExtensionRegistry extensionParsingRegistry = new ExtensionRegistry(additionalInit.getProcessType(), new RunningModeControl(additionalInit.getExtensionRegistryRunningMode()));
xmlMapper.registerRootElement(new QName(TEST_NAMESPACE, "test"), testParser);
extension.initializeParsers(extensionParsingRegistry.getExtensionParsingContext("Test", xmlMapper));
//TODO extra parsers from additionalInit
return KernelServices.create(mainSubsystemName, additionalInit, cloneExtensionRegistry(additionalInit), bootOperations, testParser, extension, modelVersion);
}