You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by km...@apache.org on 2013/09/18 06:13:04 UTC
git commit: Even more temporary debugging to resolve build env issue.
Updated Branches:
refs/heads/master 5ab0569ed -> 86c136a9e
Even more temporary debugging to resolve build env issue.
Project: http://git-wip-us.apache.org/repos/asf/incubator-knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-knox/commit/86c136a9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-knox/tree/86c136a9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-knox/diff/86c136a9
Branch: refs/heads/master
Commit: 86c136a9eb6b3c3ba051ed0cf04504ecb7d2ff75
Parents: 5ab0569
Author: Kevin Minder <ke...@hortonworks.com>
Authored: Wed Sep 18 00:12:54 2013 -0400
Committer: Kevin Minder <ke...@hortonworks.com>
Committed: Wed Sep 18 00:12:54 2013 -0400
----------------------------------------------------------------------
.../security/impl/BaseKeystoreService.java | 23 +++++++++++++++++++-
.../hadoop/gateway/GatewayBasicFuncTest.java | 2 +-
2 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/86c136a9/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/impl/BaseKeystoreService.java
----------------------------------------------------------------------
diff --git a/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/impl/BaseKeystoreService.java b/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/impl/BaseKeystoreService.java
index 0147fb1..63f4951 100644
--- a/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/impl/BaseKeystoreService.java
+++ b/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/impl/BaseKeystoreService.java
@@ -109,9 +109,30 @@ public class BaseKeystoreService {
return cert;
}
+ protected FileOutputStream createKeyStoreFile( String fileName ) throws IOException { //DEBUG
+ File file = new File( fileName );
+ if( file.exists() ) {
+ if( file.isDirectory() ) {
+ throw new IOException( "EXISTING FILE IS DIRECTORY " + file.getAbsolutePath() );
+ } else if( !file.canWrite() ) {
+ throw new IOException( "EXISTING FILE IS UNWRITEABLE " + file.getAbsolutePath() );
+ }
+ } else {
+ File dir = file.getParentFile();
+ if( !dir.exists() ) {
+ if( !dir.mkdirs() ) {
+ throw new IOException( "FAILED TO CREATE PARENT DIRECTORIES " + file.getAbsolutePath() );
+ }
+ }
+ }
+ FileOutputStream stream = new FileOutputStream( file );
+ return stream;
+ }
+
protected void createKeystore(String filename, String keystoreType) {
+System.out.println( "CREATING KEYSTORE " + filename + ", TYPE=" + keystoreType ); //DEBUG
try {
- FileOutputStream out = new FileOutputStream( filename );
+ FileOutputStream out = createKeyStoreFile( filename );
KeyStore ks = KeyStore.getInstance(keystoreType);
ks.load( null, null );
ks.store( out, masterService.getMasterSecret() );
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/86c136a9/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java
index 6c5eb03..a43ff2e 100644
--- a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java
@@ -90,7 +90,7 @@ public class GatewayBasicFuncTest {
// Specifies if the GATEWAY_HOME created for the test should be deleted when the test suite is complete.
// This is frequently used during debugging to keep the GATEWAY_HOME around for inspection.
- private static final boolean CLEANUP_TEST = true;
+ private static final boolean CLEANUP_TEST = false;
// private static final boolean USE_GATEWAY = false;
// private static final boolean USE_MOCK_SERVICES = false;