use of org.terasology.gestalt.module.Module in project Terasology by MovingBlocks.
the class ModuleDownloadListGeneratorTest method buildSimpleModule.
private Module buildSimpleModule(String id, String version) {
ModuleMetadata metadata = new ModuleMetadata();
metadata.setId(new Name(id));
if (version != null) {
metadata.setVersion(new Version(version));
}
return new Module(metadata, new EmptyFileSource(), Collections.emptyList(), new Reflections(), (c) -> false);
}
use of org.terasology.gestalt.module.Module in project Terasology by MovingBlocks.
the class ModuleDownloadListGeneratorTest method testMultipleModulesPartialUpdate.
@Test
public void testMultipleModulesPartialUpdate() throws DependencyResolutionFailedException {
Module moduleAV1 = buildSimpleModule("myModuleA", "1.0.0");
Module moduleBV1 = buildSimpleModule("myModuleB", "1.0.0");
Module moduleBV2 = buildSimpleModule("myModuleB", "2.0.0");
ModuleRegistry localRegistry = buildRegistry("1.0.0", moduleAV1, moduleBV1);
DependencyResolver resolver = mockResolver(true, moduleBV1, moduleBV2, buildEngineModule("1.0.0"));
ModuleDownloadListGenerator listGenerator = new ModuleDownloadListGenerator(localRegistry, resolver);
assertEquals(Collections.singleton(moduleBV2), buildList(listGenerator));
}
use of org.terasology.gestalt.module.Module in project Terasology by MovingBlocks.
the class ModuleDownloadListGeneratorTest method testSingleModuleNeedsUpdate.
@Test
public void testSingleModuleNeedsUpdate() throws DependencyResolutionFailedException {
Module moduleV1 = buildSimpleModule("myModule", "1.0.0");
Module moduleV2 = buildSimpleModule("myModule", "2.0.0");
ModuleRegistry localRegistry = buildRegistry("1.0.0", moduleV1);
DependencyResolver resolver = mockResolver(true, moduleV2, buildEngineModule("1.0.0"));
ModuleDownloadListGenerator listGenerator = new ModuleDownloadListGenerator(localRegistry, resolver);
assertEquals(Collections.singleton(moduleV2), buildList(listGenerator));
}
use of org.terasology.gestalt.module.Module in project Terasology by MovingBlocks.
the class ClasspathCompromisingModuleFactoryTest method archiveModuleContainsClass.
@Test
@Disabled("TODO: need a jar module containing classes")
public void archiveModuleContainsClass() throws IOException {
Module module = factory.createArchiveModule(new File("FIXME.jar"));
Class<?> someClassInTheModule = module.getModuleManifest().getTypesAnnotatedWith(API.class).iterator().next();
assertTrue(module.getClassPredicate().test(someClassInTheModule));
assertFalse(module.getClassPredicate().test(someClassOutsideTheModule));
}
use of org.terasology.gestalt.module.Module in project Terasology by MovingBlocks.
the class ModuleManager method registerPackageModule.
/**
* Create and register a new module for this package.
*/
public Module registerPackageModule(String packageName) {
Module module = moduleFactory.createPackageModule(packageName);
registry.add(module);
ensureModulesDependOnEngine();
return module;
}
Aggregations