use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class EmailServiceIT method setUp.
@Override
public void setUp() throws Exception {
mp = new MicroPlatform();
mp.defineInstance(IAuthorizationPolicy.class, new TestAuthorizationPolicy());
mp.start();
// Setup the temp directory
tempDir = File.createTempFile("EmailServiceTest", "");
assertTrue("Error setting up testing scenario", tempDir.delete());
assertTrue("Error setting up testing scenario", tempDir.mkdir());
tempDir.deleteOnExit();
final File systemDir = new File(tempDir, "system");
assertTrue("Error setting up testing scenario", systemDir.mkdir());
final File configDir = new File(systemDir, "smtp-email");
assertTrue("Error setting up testing scenario", configDir.mkdir());
defaultConfigFile = new File(configDir, "email_config.xml");
assertTrue("Error setting up testing scenario", defaultConfigFile.createNewFile());
PentahoSystem.setApplicationContext(new MockApplicationContext(tempDir.getAbsolutePath()));
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class MetadataImportHandlerIT method setUp.
@Before
public void setUp() throws Exception {
// mock logger to prevent npe
importLogger = new Log4JRepositoryImportLogger();
context = new Mockery();
metadataImporter = context.mock(IPentahoMetadataDomainRepositoryImporter.class);
MicroPlatform microPlatform = new MicroPlatform();
NameBaseMimeResolver nameResolver = new NameBaseMimeResolver();
microPlatform.defineInstance(IPlatformMimeResolver.class, nameResolver);
List<IMimeType> mimeList = new ArrayList<IMimeType>();
mimeList.add(new MimeType("text/xmi+xml", "xmi"));
metadataHandler = new MetadataImportHandler(mimeList, metadataImporter);
handlers.add(metadataHandler);
importer = new PentahoPlatformImporter(handlers, new DefaultRepositoryContentConverterHandler(new HashMap<String, Converter>()));
importer.setRepositoryImportLogger(importLogger);
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class SolutionImportHandlerIT method init.
@Before
public void init() throws PlatformInitializationException, SchedulerException {
MicroPlatform mp = new MicroPlatform();
mp.define("IScheduler", TestQuartzScheduler.class);
mp.define(IUserRoleListService.class, StubUserRoleListService.class);
IAuthorizationPolicy policy = mock(IAuthorizationPolicy.class);
when(policy.isAllowed(anyString())).thenReturn(true);
mp.defineInstance(IAuthorizationPolicy.class, policy);
mp.start();
scheduler = PentahoSystem.get(IScheduler.class);
scheduler.start();
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class MimeTypeListFactoryIT method testGetMimeTypeList.
@Test
public void testGetMimeTypeList() throws Exception {
MicroPlatform microPlatform = new MicroPlatform();
StandaloneSpringPentahoObjectFactory objectFactory = new StandaloneSpringPentahoObjectFactory();
objectFactory.init(TestResourceLocation.TEST_RESOURCES + "/MimeTypeFactoryTest/MimeTypeFactoryTest.spring.xml", null);
PentahoSystem.registerObjectFactory(objectFactory);
MimeTypeListFactory factory = new MimeTypeListFactory(TestResourceLocation.TEST_RESOURCES + "/MimeTypeFactoryTest/ImportHandlerMimeTypeDefinitions.xml");
List<IMimeType> list1 = factory.createMimeTypeList("org.pentaho.platform.plugin.services.importer.RepositoryFileImportFileHandler");
assertNotNull(list1);
list1 = factory.createMimeTypeList("this.one.is.not.present");
assertNotNull(list1);
assertEquals(0, list1.size());
list1 = factory.createMimeTypeList("org.pentaho.platform.plugin.services.importer.SolutionImportHandler");
assertNotNull(list1);
assertTrue(list1.size() > 0);
list1 = factory.createMimeTypeList("com.pentaho.repository.importexport.PDIImportFileHandler");
assertNotNull(list1);
assert (list1.contains(new MimeType("application/vnd.pentaho.job", "ktr")));
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class MondrianCatalogRepositoryHelperIT method setUpClass.
@BeforeClass
public static void setUpClass() throws Exception {
MicroPlatform platform = new MicroPlatform(TestResourceLocation.TEST_RESOURCES + "/solution");
platform.defineInstance("inlineModeling", new MondrianSchemaAnnotator() {
@Override
public InputStream getInputStream(final InputStream schemaInputStream, final InputStream annotationsInputStream) {
return new java.io.SequenceInputStream(schemaInputStream, annotationsInputStream);
}
});
platform.start();
}
Aggregations