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;
}
};
}
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);
}
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;
}
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);
}
Aggregations