Source:
public void testModuleInfo() throws Exception { ModuleIdentifier identifier = ModuleIdentifier.fromString(TARGET_MODULE_NAME + ":main"); Module module = loadModule(identifier); ModelNode op = Util.createEmptyOperation("module-info", RESOURCE); op.get(NAME).set(TARGET_MODULE_NAME); ModelNode response = getModelControllerClient().execute(op); ModelNode result = validateResponse(response); Assert.assertEquals("Unexpected name", TARGET_MODULE_NAME + ":main", result.get(NAME).asString()); List<ModelNode> dependencies = result.get("dependencies").asList(); DependencySpec[] xmlDependencies = module.getDependencies(); Map<String, ModuleDependencySpec> moduleDependencies = new HashMap<>(); for (DependencySpec d : xmlDependencies) { if (d instanceof ModuleDependencySpec) { ModuleDependencySpec mds = (ModuleDependencySpec) d; moduleDependencies.put(mds.getIdentifier().getName() + ":" + mds.getIdentifier().getSlot(), mds); } } int foundDependencies = 0; for (ModelNode d : dependencies) { String dependencyName = d.get("module-name").asString(); Assert.assertNotNull("Expected dependency", moduleDependencies.get(dependencyName)); foundDependencies++; } Assert.assertEquals("# of dependencies in module.xml != # of dependencies in module-info output", moduleDependencies.size(), foundDependencies); List<ModelNode> resourceLoaders = result.get("resource-loaders").asList(); List<String> paths = new ArrayList<>(); for (ModelNode n : resourceLoaders) { if (n.get("type").asString().equals("org.jboss.modules.JarFileResourceLoader")) { for (ModelNode node : n.get("paths").asList()) { paths.add(node.asString()); } break; } } String xmlLocalPaths = module.getClassLoader().getLocalPaths().toString(); Assert.assertEquals(xmlLocalPaths, paths.toString()); }

Target:
public void testModuleInfo() throws Exception { ModuleIdentifier identifier = ModuleIdentifier.fromString(TARGET_MODULE_NAME + ":main"); Module module = loadModule(identifier); ModelNode op = Util.createEmptyOperation("module-info", RESOURCE); op.get(NAME).set(TARGET_MODULE_NAME); ModelNode response = getModelControllerClient().execute(op); ModelNode result = validateResponse(response); Assert.assertEquals("Unexpected name", TARGET_MODULE_NAME + ":main", result.get(NAME).asString()); List<ModelNode> dependencies = result.get("dependencies").asList(); DependencySpec[] xmlDependencies = module.getDependencies(); Map<String, ModuleDependencySpec> moduleDependencies = new HashMap<>(); for (DependencySpec d : xmlDependencies) { if (d instanceof ModuleDependencySpec) { ModuleDependencySpec mds = (ModuleDependencySpec) d; moduleDependencies.put(mds.getIdentifier().getName() + ":" + mds.getIdentifier().getSlot(), mds); } } int foundDependencies = 0; for (ModelNode d : dependencies) { String dependencyName = d.get("module-name").asString(); Assert.assertTrue("Expected dependency", moduleDependencies.containsKey(dependencyName)); foundDependencies++; } Assert.assertEquals("# of dependencies in module.xml != # of dependencies in module-info output", moduleDependencies.size(), foundDependencies); List<ModelNode> resourceLoaders = result.get("resource-loaders").asList(); List<String> paths = new ArrayList<>(); for (ModelNode n : resourceLoaders) { if (n.get("type").asString().equals("org.jboss.modules.JarFileResourceLoader")) { for (ModelNode node : n.get("paths").asList()) { paths.add(node.asString()); } break; } } Assert.assertTrue(module.getClassLoader().getLocalPaths().containsAll(paths)); }