cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/3] cxf git commit: Only write the kdc port out once
Date Thu, 04 Dec 2014 11:39:21 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 09d2d260c -> d6b11c3e6


Only write the kdc port out once


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5131e2d4
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5131e2d4
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5131e2d4

Branch: refs/heads/3.0.x-fixes
Commit: 5131e2d40592250829deb423815e2b385a082316
Parents: 09d2d26
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Wed Dec 3 16:33:51 2014 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Dec 4 11:19:49 2014 +0000

----------------------------------------------------------------------
 .../wssec/kerberos/KerberosTokenTest.java       | 45 +++++++++++--------
 .../kerberos/wssec/spnego/SpnegoTokenTest.java  | 47 +++++++++++---------
 2 files changed, 53 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5131e2d4/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/kerberos/KerberosTokenTest.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/kerberos/KerberosTokenTest.java
b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/kerberos/KerberosTokenTest.java
index ccac694..b613270 100644
--- a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/kerberos/KerberosTokenTest.java
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/kerberos/KerberosTokenTest.java
@@ -49,6 +49,7 @@ import org.apache.directory.server.core.kerberos.KeyDerivationInterceptor;
 import org.apache.wss4j.dom.WSSConfig;
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 
@@ -113,27 +114,33 @@ public class KerberosTokenTest extends AbstractLdapTestUnit {
         SecurityTestUtil.checkUnrestrictedPoliciesInstalled();
     
     private static boolean runTests;
+    private static boolean portUpdated;
     
-    public KerberosTokenTest() throws Exception {
-        String basedir = System.getProperty("basedir");
-        if (basedir == null) {
-            basedir = new File(".").getCanonicalPath();
+    @Before
+    public void updatePort() throws Exception {
+        if (!portUpdated) {
+            String basedir = System.getProperty("basedir");
+            if (basedir == null) {
+                basedir = new File(".").getCanonicalPath();
+            }
+            
+            // Read in krb5.conf and substitute in the correct port
+            File f = new File(basedir + "/src/test/resources/krb5.conf");
+            
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            content = content.replaceAll("port", "" + super.getKdcServer().getTransports()[0].getPort());
+            
+            File f2 = new File(basedir + "/target/test-classes/krb5.conf");
+            FileOutputStream outputStream = new FileOutputStream(f2);
+            IOUtils.write(content, outputStream, "UTF-8");
+            outputStream.close();
+            
+            System.setProperty("java.security.krb5.conf", f2.getPath());
+            
+            portUpdated = true;
         }
-        
-        // Read in krb5.conf and substitute in the correct port
-        File f = new File(basedir + "/src/test/resources/krb5.conf");
-        
-        FileInputStream inputStream = new FileInputStream(f);
-        String content = IOUtils.toString(inputStream, "UTF-8");
-        inputStream.close();
-        content = content.replaceAll("port", "" + super.getKdcServer().getTransports()[0].getPort());
-        
-        File f2 = new File(basedir + "/target/test-classes/krb5.conf");
-        FileOutputStream outputStream = new FileOutputStream(f2);
-        IOUtils.write(content, outputStream, "UTF-8");
-        outputStream.close();
-        
-        System.setProperty("java.security.krb5.conf", f2.getPath());
     }
     
     @BeforeClass

http://git-wip-us.apache.org/repos/asf/cxf/blob/5131e2d4/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/spnego/SpnegoTokenTest.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/spnego/SpnegoTokenTest.java
b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/spnego/SpnegoTokenTest.java
index 6003d40..df18e8f 100644
--- a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/spnego/SpnegoTokenTest.java
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/spnego/SpnegoTokenTest.java
@@ -46,6 +46,7 @@ import org.apache.directory.server.core.kerberos.KeyDerivationInterceptor;
 import org.apache.wss4j.dom.WSSConfig;
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 
@@ -106,27 +107,33 @@ public class SpnegoTokenTest extends AbstractLdapTestUnit {
             SecurityTestUtil.checkUnrestrictedPoliciesInstalled();
     
     private static boolean runTests;
-    
-    public SpnegoTokenTest() throws Exception {
-        String basedir = System.getProperty("basedir");
-        if (basedir == null) {
-            basedir = new File(".").getCanonicalPath();
+    private static boolean portUpdated;
+
+    @Before
+    public void updatePort() throws Exception {
+        if (!portUpdated) {
+            String basedir = System.getProperty("basedir");
+            if (basedir == null) {
+                basedir = new File(".").getCanonicalPath();
+            }
+            
+            // Read in krb5.conf and substitute in the correct port
+            File f = new File(basedir + "/src/test/resources/krb5.conf");
+            
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            content = content.replaceAll("port", "" + super.getKdcServer().getTransports()[0].getPort());
+            
+            File f2 = new File(basedir + "/target/test-classes/krb5.conf");
+            FileOutputStream outputStream = new FileOutputStream(f2);
+            IOUtils.write(content, outputStream, "UTF-8");
+            outputStream.close();
+            
+            System.setProperty("java.security.krb5.conf", f2.getPath());
+            
+            portUpdated = true;
         }
-        
-        // Read in krb5.conf and substitute in the correct port
-        File f = new File(basedir + "/src/test/resources/krb5.conf");
-        
-        FileInputStream inputStream = new FileInputStream(f);
-        String content = IOUtils.toString(inputStream, "UTF-8");
-        inputStream.close();
-        content = content.replaceAll("port", "" + super.getKdcServer().getTransports()[0].getPort());
-        
-        File f2 = new File(basedir + "/target/test-classes/krb5.conf");
-        FileOutputStream outputStream = new FileOutputStream(f2);
-        IOUtils.write(content, outputStream, "UTF-8");
-        outputStream.close();
-        
-        System.setProperty("java.security.krb5.conf", f2.getPath());
     }
     
     @BeforeClass


Mime
View raw message