Search in sources :

Example 6 with ModuleRegistry

use of org.terasology.module.ModuleRegistry 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));
}
Also used : TableModuleRegistry(org.terasology.module.TableModuleRegistry) ModuleRegistry(org.terasology.module.ModuleRegistry) BaseModule(org.terasology.module.BaseModule) Module(org.terasology.module.Module) DependencyResolver(org.terasology.module.DependencyResolver) Test(org.junit.Test)

Example 7 with ModuleRegistry

use of org.terasology.module.ModuleRegistry in project Terasology by MovingBlocks.

the class ModuleDownloadListGeneratorTest method buildRegistry.

private ModuleRegistry buildRegistry(String engineVersion, Module... modules) {
    ModuleRegistry result = new TableModuleRegistry();
    result.add(buildEngineModule(engineVersion));
    result.addAll(Arrays.asList(modules));
    return result;
}
Also used : TableModuleRegistry(org.terasology.module.TableModuleRegistry) TableModuleRegistry(org.terasology.module.TableModuleRegistry) ModuleRegistry(org.terasology.module.ModuleRegistry)

Example 8 with ModuleRegistry

use of org.terasology.module.ModuleRegistry in project Terasology by MovingBlocks.

the class BindsSubsystemTest method setUpMockModuleEnvironment.

private void setUpMockModuleEnvironment() {
    ModuleManager moduleManager = mock(ModuleManager.class);
    ModuleRegistry moduleRegistry = new TableModuleRegistry();
    Module module = mock(Module.class);
    when(module.isCodeModule()).thenReturn(true);
    when(module.getId()).thenReturn(new Name(TEST_MODULE));
    when(module.getVersion()).thenReturn(new Version(0, 0, 1, true));
    when(module.getMetadata()).thenReturn(new ModuleMetadata());
    moduleRegistry.add(module);
    when(moduleManager.getRegistry()).thenReturn(moduleRegistry);
    ModuleEnvironment environment = mock(ModuleEnvironment.class);
    when(moduleManager.loadEnvironment(any(), anyBoolean())).thenReturn(environment);
    when(moduleManager.getEnvironment()).thenReturn(environment);
    registerBindButtonClasses = new ArrayList<>();
    when(environment.getTypesAnnotatedWith(eq(RegisterBindButton.class))).thenReturn(registerBindButtonClasses);
    when(environment.getTypesAnnotatedWith(eq(RegisterBindButton.class), any())).thenReturn(registerBindButtonClasses);
    registerRealBindAxisClasses = new ArrayList<>();
    when(environment.getTypesAnnotatedWith(eq(RegisterBindAxis.class))).thenReturn(registerRealBindAxisClasses);
    when(environment.getTypesAnnotatedWith(eq(RegisterBindAxis.class), any())).thenReturn(registerRealBindAxisClasses);
    when(environment.getModuleProviding(any())).thenReturn(new Name(TEST_MODULE));
    context.put(ModuleManager.class, moduleManager);
}
Also used : TableModuleRegistry(org.terasology.module.TableModuleRegistry) Version(org.terasology.naming.Version) ModuleEnvironment(org.terasology.module.ModuleEnvironment) RegisterBindButton(org.terasology.input.RegisterBindButton) RegisterBindAxis(org.terasology.input.RegisterBindAxis) ModuleRegistry(org.terasology.module.ModuleRegistry) TableModuleRegistry(org.terasology.module.TableModuleRegistry) ModuleMetadata(org.terasology.module.ModuleMetadata) ModuleManager(org.terasology.engine.module.ModuleManager) Module(org.terasology.module.Module) Name(org.terasology.naming.Name)

Aggregations

ModuleRegistry (org.terasology.module.ModuleRegistry)8 TableModuleRegistry (org.terasology.module.TableModuleRegistry)6 DependencyResolver (org.terasology.module.DependencyResolver)5 Test (org.junit.Test)4 Module (org.terasology.module.Module)3 ModuleManager (org.terasology.engine.module.ModuleManager)2 BaseModule (org.terasology.module.BaseModule)2 ModuleEnvironment (org.terasology.module.ModuleEnvironment)2 ArrayList (java.util.ArrayList)1 ExecutionException (java.util.concurrent.ExecutionException)1 RegisterBindAxis (org.terasology.input.RegisterBindAxis)1 RegisterBindButton (org.terasology.input.RegisterBindButton)1 ModuleMetadata (org.terasology.module.ModuleMetadata)1 ResolutionResult (org.terasology.module.ResolutionResult)1 Name (org.terasology.naming.Name)1 NameVersion (org.terasology.naming.NameVersion)1 Version (org.terasology.naming.Version)1 ServerInfoMessage (org.terasology.network.ServerInfoMessage)1 FontColor (org.terasology.rendering.FontColor)1 Color (org.terasology.rendering.nui.Color)1