Search in sources :

Example 1 with MessageBundle

use of org.ovirt.engine.api.restapi.logging.MessageBundle in project ovirt-engine by oVirt.

the class AbstractBackendBaseTest method setUp.

@Before
public void setUp() {
    interactions.clear();
    DbUser currentUser = new DbUser();
    currentUser.setFirstName(USER);
    currentUser.setLastName(USER);
    currentUser.setDomain(DOMAIN);
    currentUser.setNamespace(NAMESPACE);
    currentUser.setId(GUIDS[0]);
    Current current = new Current();
    current.setUser(currentUser);
    current.setSessionId(SESSION_ID);
    current.setRoot(URI_ROOT);
    current.setPrefix(BASE_PATH);
    current.setPath("");
    current.setVersion("4");
    current.setVersionSource(VersionSource.DEFAULT);
    current.setBackend(backend);
    CurrentManager.put(current);
    locales = new ArrayList<>();
    when(httpHeaders.getAcceptableLanguages()).thenReturn(locales);
    accepts = new ArrayList<>();
    when(httpHeaders.getRequestHeader("Accept")).thenReturn(accepts);
    List<String> filterValue = new ArrayList<>();
    filterValue.add("false");
    when(httpHeaders.getRequestHeader(USER_FILTER_HEADER)).thenReturn(filterValue);
    mapperLocator = new MappingLocator();
    mapperLocator.populate();
    locale = Locale.getDefault();
    Locale.setDefault(Locale.GERMANY);
    messageBundle = new MessageBundle();
    messageBundle.setPath(BUNDLE_PATH);
    messageBundle.populate();
    init();
}
Also used : MessageBundle(org.ovirt.engine.api.restapi.logging.MessageBundle) ArrayList(java.util.ArrayList) Current(org.ovirt.engine.api.restapi.invocation.Current) MappingLocator(org.ovirt.engine.api.restapi.types.MappingLocator) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) Before(org.junit.Before)

Example 2 with MessageBundle

use of org.ovirt.engine.api.restapi.logging.MessageBundle in project ovirt-engine by oVirt.

the class BackendApiResourceTest method setUp.

@Before
public void setUp() {
    backend = mock(BackendLocal.class);
    currentUser = new DbUser();
    currentUser.setLoginName(USER);
    currentUser.setDomain(DOMAIN);
    current = new Current();
    current.setUser(currentUser);
    current.setSessionId(SESSION_ID);
    current.setRoot(URI_ROOT);
    current.setPrefix(BASE_PATH);
    current.setPath("");
    current.setVersion("4");
    current.setVersionSource(VersionSource.DEFAULT);
    current.setBackend(backend);
    CurrentManager.put(current);
    MessageBundle messageBundle = new MessageBundle();
    messageBundle.setPath(BUNDLE_PATH);
    messageBundle.populate();
    resource.setMessageBundle(messageBundle);
    httpHeaders = mock(HttpHeaders.class);
    List<Locale> locales = new ArrayList<>();
    when(httpHeaders.getAcceptableLanguages()).thenReturn(locales);
    List<String> filterValue = new ArrayList<>();
    filterValue.add("false");
    when(httpHeaders.getRequestHeader(USER_FILTER_HEADER)).thenReturn(filterValue);
    resource.setHttpHeaders(httpHeaders);
}
Also used : MessageBundle(org.ovirt.engine.api.restapi.logging.MessageBundle) Locale(java.util.Locale) HttpHeaders(javax.ws.rs.core.HttpHeaders) BackendLocal(org.ovirt.engine.core.common.interfaces.BackendLocal) ArrayList(java.util.ArrayList) Current(org.ovirt.engine.api.restapi.invocation.Current) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) Before(org.junit.Before)

Example 3 with MessageBundle

use of org.ovirt.engine.api.restapi.logging.MessageBundle in project ovirt-engine by oVirt.

the class BackendApiResource method init.

private void init() {
    // Create and populate the message bundle:
    messageBundle = new MessageBundle();
    messageBundle.setPath(Messages.class.getName());
    messageBundle.populate();
    // Create and populate the mapping locator:
    mappingLocator = new MappingLocator();
    mappingLocator.populate();
}
Also used : MessageBundle(org.ovirt.engine.api.restapi.logging.MessageBundle) Messages(org.ovirt.engine.api.restapi.logging.Messages) MappingLocator(org.ovirt.engine.api.restapi.types.MappingLocator)

Aggregations

MessageBundle (org.ovirt.engine.api.restapi.logging.MessageBundle)3 ArrayList (java.util.ArrayList)2 Before (org.junit.Before)2 Current (org.ovirt.engine.api.restapi.invocation.Current)2 MappingLocator (org.ovirt.engine.api.restapi.types.MappingLocator)2 DbUser (org.ovirt.engine.core.common.businessentities.aaa.DbUser)2 Locale (java.util.Locale)1 HttpHeaders (javax.ws.rs.core.HttpHeaders)1 Messages (org.ovirt.engine.api.restapi.logging.Messages)1 BackendLocal (org.ovirt.engine.core.common.interfaces.BackendLocal)1