Search in sources :

Example 1 with PentahoSystem

use of org.pentaho.platform.engine.core.system.PentahoSystem in project pentaho-platform by pentaho.

the class RuntimeContextTest method before.

@Before
public void before() {
    mockedRuntimeRepository = mock(IRuntimeRepository.class);
    mockedSolutionEngine = mock(ISolutionEngine.class);
    mockedPentahoSystem = new MockUp<PentahoSystem>() {

        @Mock
        public <T> T get(Class<T> type, IPentahoSession session) {
            if (type == IRuntimeRepository.class) {
                return (T) mockedRuntimeRepository;
            } else if (type == ISolutionEngine.class) {
                return (T) mockedSolutionEngine;
            }
            throw new IllegalStateException("Unsupported type: " + type.getSimpleName());
        }

        @Mock
        public void setApplicationContext(final IApplicationContext applicationContext) {
        }

        @Mock
        public IApplicationContext getApplicationContext() {
            final String solutionPath = ".";
            final String applicationPath = "";
            return new StandaloneApplicationContext(solutionPath, applicationPath);
        }
    };
    runtimeCtx = new RuntimeContext("id", mockedSolutionEngine, "solutionName", makeRuntimeData(session), session, null, "processId", urlFactory, makeParameterProviders(session), new ArrayList<String>(), null);
}
Also used : ISolutionEngine(org.pentaho.platform.api.engine.ISolutionEngine) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) ArrayList(java.util.ArrayList) IApplicationContext(org.pentaho.platform.api.engine.IApplicationContext) Matchers.anyString(org.mockito.Matchers.anyString) StandaloneApplicationContext(org.pentaho.platform.engine.core.system.StandaloneApplicationContext) PentahoSystem(org.pentaho.platform.engine.core.system.PentahoSystem) InvocationOnMock(org.mockito.invocation.InvocationOnMock) Mock(mockit.Mock) IRuntimeRepository(org.pentaho.platform.api.repository.IRuntimeRepository) IRuntimeContext(org.pentaho.platform.api.engine.IRuntimeContext) Before(org.junit.Before)

Example 2 with PentahoSystem

use of org.pentaho.platform.engine.core.system.PentahoSystem in project pentaho-platform by pentaho.

the class MessageFormatterTest method before.

@Before
public void before() {
    mockedRuntimeRepository = mock(IRuntimeRepository.class);
    mockedSolutionEngine = mock(ISolutionEngine.class);
    mockedPentahoSystem = new MockUp<PentahoSystem>() {

        @Mock
        public IApplicationContext getApplicationContext() {
            final String solutionPath = ".";
            final String applicationPath = "";
            return new StandaloneApplicationContext(solutionPath, applicationPath);
        }
    };
    runtimeCtx = spy(new RuntimeContext("id", mockedSolutionEngine, "solutionName", makeRuntimeData(session), session, null, "processId", urlFactory, makeParameterProviders(session), new ArrayList<String>(), null));
}
Also used : IRuntimeRepository(org.pentaho.platform.api.repository.IRuntimeRepository) ISolutionEngine(org.pentaho.platform.api.engine.ISolutionEngine) IApplicationContext(org.pentaho.platform.api.engine.IApplicationContext) StandaloneApplicationContext(org.pentaho.platform.engine.core.system.StandaloneApplicationContext) IRuntimeContext(org.pentaho.platform.api.engine.IRuntimeContext) RuntimeContext(org.pentaho.platform.engine.services.runtime.RuntimeContext) PentahoSystem(org.pentaho.platform.engine.core.system.PentahoSystem) Mock(mockit.Mock) Before(org.junit.Before)

Aggregations

Mock (mockit.Mock)2 Before (org.junit.Before)2 IApplicationContext (org.pentaho.platform.api.engine.IApplicationContext)2 IRuntimeContext (org.pentaho.platform.api.engine.IRuntimeContext)2 ISolutionEngine (org.pentaho.platform.api.engine.ISolutionEngine)2 IRuntimeRepository (org.pentaho.platform.api.repository.IRuntimeRepository)2 PentahoSystem (org.pentaho.platform.engine.core.system.PentahoSystem)2 StandaloneApplicationContext (org.pentaho.platform.engine.core.system.StandaloneApplicationContext)2 ArrayList (java.util.ArrayList)1 Matchers.anyString (org.mockito.Matchers.anyString)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)1 RuntimeContext (org.pentaho.platform.engine.services.runtime.RuntimeContext)1