Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PDI-15856] Store NamedCluster information with HadoopFileOutputStep
- Loading branch information
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
core/test-src/org/pentaho/di/metastore/MetaStoreConstTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.pentaho.di.metastore; | ||
|
||
import java.io.File; | ||
|
||
import org.apache.commons.io.FileUtils; | ||
import org.junit.Test; | ||
import org.pentaho.di.core.Const; | ||
import org.pentaho.metastore.stores.xml.XmlUtil; | ||
|
||
import com.google.common.io.Files; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertNull; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
public class MetaStoreConstTest { | ||
|
||
@Test | ||
public void testOpenLocalPentahoMetaStore() throws Exception { | ||
MetaStoreConst.disableMetaStore = false; | ||
File tempDir = Files.createTempDir(); | ||
String tempPath = tempDir.getAbsolutePath(); | ||
System.setProperty( Const.PENTAHO_METASTORE_FOLDER, tempPath ); | ||
String metaFolder = tempPath + File.separator + XmlUtil.META_FOLDER_NAME; | ||
|
||
// Create a metastore | ||
assertNotNull( MetaStoreConst.openLocalPentahoMetaStore() ); | ||
assertTrue( ( new File( metaFolder ) ).exists() ); | ||
|
||
// Check existing while disabling the metastore ( used for tests ) | ||
MetaStoreConst.disableMetaStore = true; | ||
assertNull( MetaStoreConst.openLocalPentahoMetaStore() ); | ||
|
||
// Check existing metastore | ||
MetaStoreConst.disableMetaStore = false; | ||
assertNotNull( MetaStoreConst.openLocalPentahoMetaStore( false ) ); | ||
|
||
// Try to read a metastore that does not exist with allowCreate = false | ||
FileUtils.deleteDirectory( new File( metaFolder ) ); | ||
assertNull( MetaStoreConst.openLocalPentahoMetaStore( false ) ); | ||
assertFalse( ( new File( metaFolder ) ).exists() ); | ||
} | ||
|
||
} |