use of org.molgenis.core.ui.menu.Menu in project molgenis by molgenis.
the class MetadataManagerControllerTest method beforeMethod.
@BeforeMethod
public void beforeMethod() {
MockitoAnnotations.initMocks(this);
FreeMarkerViewResolver freeMarkerViewResolver = new FreeMarkerViewResolver();
freeMarkerViewResolver.setSuffix(".ftl");
Menu menu = mock(Menu.class);
when(menu.findMenuItemPath(MetadataManagerController.METADATA_MANAGER)).thenReturn("/test/path");
when(menuReaderService.getMenu()).thenReturn(menu);
when(appSettings.getLanguageCode()).thenReturn("nl");
User user = mock(User.class);
when(user.isSuperuser()).thenReturn(false);
when(userAccountService.getCurrentUser()).thenReturn(user);
MetadataManagerController metadataEditorController = new MetadataManagerController(menuReaderService, appSettings, metadataManagerService, userAccountService);
mockMvc = MockMvcBuilders.standaloneSetup(metadataEditorController).setLocaleResolver(localeResolver).setMessageConverters(new FormHttpMessageConverter(), gsonHttpMessageConverter).build();
}
use of org.molgenis.core.ui.menu.Menu in project molgenis by molgenis.
the class OneClickImporterControllerTest method before.
@BeforeMethod
public void before() {
OneClickImporterController oneClickImporterController = new OneClickImporterController(menuReaderService, appSettings, userAccountService, fileStore, oneClickImportJobExecutionFactory, jobExecutor);
Menu menu = mock(Menu.class);
when(menu.findMenuItemPath(OneClickImporterController.ONE_CLICK_IMPORTER)).thenReturn("/test-path");
when(menuReaderService.getMenu()).thenReturn(menu);
when(localeResolver.resolveLocale(any())).thenReturn(new Locale("nl"));
when(appSettings.getLanguageCode()).thenReturn("en");
User user = mock(User.class);
when(user.isSuperuser()).thenReturn(false);
when(userAccountService.getCurrentUser()).thenReturn(user);
OneClickImportJobExecution jobExecution = mock(OneClickImportJobExecution.class);
when(oneClickImportJobExecutionFactory.create()).thenReturn(jobExecution);
EntityType oneClickImportJobExecutionEntityType = mock(EntityType.class);
when(jobExecution.getEntityType()).thenReturn(oneClickImportJobExecutionEntityType);
when(jobExecution.getIdValue()).thenReturn("id_1");
when(oneClickImportJobExecutionEntityType.getId()).thenReturn("jobExecutionId");
StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
stringConverter.setWriteAcceptCharset(false);
mockMvc = MockMvcBuilders.standaloneSetup(oneClickImporterController).setLocaleResolver(localeResolver).setMessageConverters(gsonHttpMessageConverter, stringConverter).build();
}
use of org.molgenis.core.ui.menu.Menu in project molgenis by molgenis.
the class NavigatorControllerTest method before.
@BeforeMethod
public void before() {
initMocks(this);
Menu menu = mock(Menu.class);
when(menu.findMenuItemPath(NavigatorController.ID)).thenReturn("/test/path");
when(menuReaderService.getMenu()).thenReturn(menu);
when(appSettings.getLanguageCode()).thenReturn("de");
User user = mock(User.class);
when(userAccountService.getCurrentUser()).thenReturn(user);
when(user.isSuperuser()).thenReturn(false);
NavigatorController navigatorController = new NavigatorController(menuReaderService, appSettings, userAccountService);
mockMvc = MockMvcBuilders.standaloneSetup(navigatorController).setLocaleResolver(localeResolver).build();
}
use of org.molgenis.core.ui.menu.Menu in project molgenis by molgenis.
the class DataExplorerControllerTest method beforeTest.
@BeforeMethod
public void beforeTest() {
when(permissionService.hasPermission(new EntityTypeIdentity("yes"), EntityTypePermission.WRITEMETA)).thenReturn(true);
when(permissionService.hasPermission(new EntityTypeIdentity("no"), EntityTypePermission.WRITEMETA)).thenReturn(false);
when(idAttr.getDataType()).thenReturn(STRING);
when(entityType.getIdAttribute()).thenReturn(idAttr);
when(package_.getLabel()).thenReturn("pack");
when(package_.getId()).thenReturn("packId");
when(parentPackage.getLabel()).thenReturn("parent");
when(parentPackage.getId()).thenReturn("parentId");
when(package_.getParent()).thenReturn(parentPackage);
when(entityType.getPackage()).thenReturn(package_);
when(repository.findOneById(entityId)).thenReturn(entity);
when(dataService.getEntityType(entityTypeId)).thenReturn(entityType);
when(dataService.getRepository(entityTypeId)).thenReturn(repository);
when(dataExplorerSettings.getEntityReport(entityTypeId)).thenReturn("template");
when(dataExplorerSettings.getModStandaloneReports()).thenReturn(true);
when(freemarkerConfigurer.getConfiguration()).thenReturn(configuration);
Menu menu = mock(Menu.class);
when(menuReaderService.getMenu()).thenReturn(menu);
when(menu.findMenuItemPath(NAVIGATOR)).thenReturn(null);
when(localeResolver.resolveLocale(any())).thenReturn(Locale.ENGLISH);
mockMvc = MockMvcBuilders.standaloneSetup(controller).setMessageConverters(gsonHttpMessageConverter).build();
}
use of org.molgenis.core.ui.menu.Menu in project molgenis by molgenis.
the class QuestionnaireControllerTest method beforeMethod.
@BeforeMethod
private void beforeMethod() {
initMocks(this);
Menu menu = mock(Menu.class);
when(menu.findMenuItemPath(QuestionnaireController.ID)).thenReturn("/test/path");
User user = mock(User.class);
when(user.isSuperuser()).thenReturn(false);
when(menuReaderService.getMenu()).thenReturn(menu);
when(appSettings.getLanguageCode()).thenReturn("en");
when(userAccountService.getCurrentUser()).thenReturn(user);
QuestionnaireController questionnaireController = new QuestionnaireController(questionnaireService, menuReaderService, appSettings, userAccountService);
mockMvc = MockMvcBuilders.standaloneSetup(questionnaireController).setMessageConverters(new FormHttpMessageConverter(), gsonHttpMessageConverter).build();
}
Aggregations