Search in sources :

Example 1 with Version

use of org.terasology.naming.Version 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 BaseModule(Collections.emptyList(), metadata) {

        @Override
        public ImmutableList<URL> getClasspaths() {
            return null;
        }

        @Override
        public boolean isOnClasspath() {
            return false;
        }

        @Override
        public boolean isCodeModule() {
            return false;
        }
    };
}
Also used : Version(org.terasology.naming.Version) BaseModule(org.terasology.module.BaseModule) ModuleMetadata(org.terasology.module.ModuleMetadata) URL(java.net.URL) Name(org.terasology.naming.Name)

Example 2 with Version

use of org.terasology.naming.Version in project Terasology by MovingBlocks.

the class ModuleDownloadListGenerator method getAllModulesToDownloadFor.

Set<Module> getAllModulesToDownloadFor(Name... modulesToInstall) throws DependencyResolutionFailedException {
    Version currentEngineVersion = localRegistry.getLatestModuleVersion(TerasologyConstants.ENGINE_MODULE).getVersion();
    ResolutionResult resolutionResult = remoteDependencyResolver.builder().requireVersion(TerasologyConstants.ENGINE_MODULE, currentEngineVersion).requireAll(modulesToInstall).build();
    return processResolutionResult(resolutionResult);
}
Also used : Version(org.terasology.naming.Version) ResolutionResult(org.terasology.module.ResolutionResult)

Example 3 with Version

use of org.terasology.naming.Version in project Terasology by MovingBlocks.

the class ServerInfoMessageImpl method getModuleList.

@Override
public List<NameVersion> getModuleList() {
    List<NameVersion> result = Lists.newArrayList();
    for (NetData.ModuleInfo moduleInfo : info.getModuleList()) {
        if (!moduleInfo.hasModuleId() || !moduleInfo.hasModuleVersion()) {
            logger.error("Received incomplete module info");
        } else {
            Name id = new Name(moduleInfo.getModuleId());
            Version version = new Version(moduleInfo.getModuleVersion());
            result.add(new NameVersion(id, version));
        }
    }
    return result;
}
Also used : NameVersion(org.terasology.naming.NameVersion) NetData(org.terasology.protobuf.NetData) NameVersion(org.terasology.naming.NameVersion) Version(org.terasology.naming.Version) Name(org.terasology.naming.Name)

Example 4 with Version

use of org.terasology.naming.Version 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

Version (org.terasology.naming.Version)4 Name (org.terasology.naming.Name)3 ModuleMetadata (org.terasology.module.ModuleMetadata)2 URL (java.net.URL)1 ModuleManager (org.terasology.engine.module.ModuleManager)1 RegisterBindAxis (org.terasology.input.RegisterBindAxis)1 RegisterBindButton (org.terasology.input.RegisterBindButton)1 BaseModule (org.terasology.module.BaseModule)1 Module (org.terasology.module.Module)1 ModuleEnvironment (org.terasology.module.ModuleEnvironment)1 ModuleRegistry (org.terasology.module.ModuleRegistry)1 ResolutionResult (org.terasology.module.ResolutionResult)1 TableModuleRegistry (org.terasology.module.TableModuleRegistry)1 NameVersion (org.terasology.naming.NameVersion)1 NetData (org.terasology.protobuf.NetData)1