use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class JcrStringHelperTest method testFilePathSpecEncodeDecodeUsingMultiByteEncoding.
@Test
public void testFilePathSpecEncodeDecodeUsingMultiByteEncoding() throws PlatformInitializationException {
MicroPlatform mp = new MicroPlatform(getSolutionPath());
mp.defineInstance("useMultiByteEncoding", new Boolean(true));
// Start the micro-platform
mp.start();
JcrStringHelper.setMultiByteEncodingEnabled(true);
String path = "/asdf/3err";
String encodedPath = JcrStringHelper.pathEncode(path);
assertFalse(path.equals(encodedPath));
String decodedPath = JcrStringHelper.fileNameDecode(encodedPath);
assertEquals(path, decodedPath);
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class JcrStringHelperTest method testFilePath_1Encode.
@Test
public void testFilePath_1Encode() throws PlatformInitializationException {
MicroPlatform mp = new MicroPlatform(getSolutionPath());
mp.defineInstance("useMultiByteEncoding", new Boolean(false));
// Start the micro-platform
mp.start();
JcrStringHelper.setMultiByteEncodingEnabled(false);
String path = "/asdf/3err";
String encodedPath = JcrStringHelper.pathEncode(path);
assertEquals(path, encodedPath);
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class JcrStringHelperTest method testFilePathSpecEncodeDecode.
@Test
public void testFilePathSpecEncodeDecode() throws PlatformInitializationException {
MicroPlatform mp = new MicroPlatform(getSolutionPath());
mp.defineInstance("useMultiByteEncoding", new Boolean(false));
// Start the micro-platform
mp.start();
JcrStringHelper.setMultiByteEncodingEnabled(false);
String path = "/asdf/3err";
String encodedPath = JcrStringHelper.pathEncode(path);
assertEquals(path, encodedPath);
String decodedPath = JcrStringHelper.fileNameDecode(encodedPath);
assertEquals(path, decodedPath);
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class EmbeddedVersionCheckSystemListenerIT method init.
@Before
public void init() throws SchedulerException, PlatformInitializationException {
MicroPlatform mp = new MicroPlatform();
mp.define(IPluginManager.class, TstPluginManager.class);
mp.define("IScheduler2", TestQuartzScheduler.class);
mp.define(IUserRoleListService.class, StubUserRoleListService.class);
mp.define(UserDetailsService.class, StubUserDetailsService.class);
mp.start();
scheduler = PentahoSystem.get(IScheduler.class, "IScheduler2", null);
scheduler.start();
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class SolutionImportHandlerNamingIT method init.
@Before
public void init() throws IOException, PlatformInitializationException, PlatformImportException, DomainIdNullException, DomainAlreadyExistsException, DomainStorageException {
// repository
File repoDir = new File(tempDir.getAbsolutePath() + REPO_PATH);
FileUtils.forceMkdir(repoDir);
FileUtils.cleanDirectory(repoDir);
repoRoot = repoDir;
repo = new FileSystemBackedUnifiedRepository();
repo = Mockito.spy(repo);
repo.setRootDir(repoRoot);
// mimeResolver
final Converter defaultConverter = new StreamConverter();
final List<IMimeType> solutionMimeList = java.util.Collections.singletonList(MIME_SOLUTION);
final List<IMimeType> contentMimeList = java.util.Arrays.asList(new IMimeType[] { MIME_PRPT, MIME_XML });
final List<IMimeType> allMimeTypes = new ArrayList<IMimeType>(solutionMimeList.size() + contentMimeList.size());
{
allMimeTypes.addAll(solutionMimeList);
allMimeTypes.addAll(contentMimeList);
for (IMimeType mimeType : allMimeTypes) {
mimeType.setConverter(defaultConverter);
}
}
final IPlatformMimeResolver mimeResolver = new NameBaseMimeResolver();
for (IMimeType mimeType : allMimeTypes) {
mimeResolver.addMimeType(mimeType);
}
// platform, import handlers
PentahoSystem.clearObjectFactory();
microPlatform = new MicroPlatform(getSolutionPath());
microPlatform.defineInstance(IUnifiedRepository.class, repo);
microPlatform.defineInstance(IPlatformMimeResolver.class, mimeResolver);
microPlatform.defineInstance(ISolutionEngine.class, Mockito.mock(SolutionEngine.class));
microPlatform.defineInstance(IDatasourceMgmtService.class, Mockito.mock(IDatasourceMgmtService.class));
IRepositoryContentConverterHandler converterHandler = new DefaultRepositoryContentConverterHandler(new HashMap<String, Converter>());
RepositoryFileImportFileHandler contentImportFileHandler = new RepositoryFileImportFileHandler(contentMimeList);
contentImportFileHandler.setRepository(repo);
solutionImportHandler = new SolutionImportHandler(solutionMimeList);
List<IPlatformImportHandler> handlers = new ArrayList<IPlatformImportHandler>();
handlers.add(contentImportFileHandler);
handlers.add(solutionImportHandler);
PentahoPlatformImporter importer = new PentahoPlatformImporter(handlers, converterHandler);
importer.setDefaultHandler(contentImportFileHandler);
importer.setRepositoryImportLogger(new Log4JRepositoryImportLogger());
microPlatform.defineInstance(IPlatformImporter.class, importer);
microPlatform.start();
}
Aggregations