You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2015/07/01 15:13:40 UTC
[2/3] directory-kerby git commit: o made junit and assert4j libs
automatically inheritable by all child modules o made the kerb-identity-test
and kerb-kdc-test modules produce test jars
o made junit and assert4j libs automatically inheritable by all child modules
o made the kerb-identity-test and kerb-kdc-test modules produce test jars
Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/81f69a04
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/81f69a04
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/81f69a04
Branch: refs/heads/master
Commit: 81f69a0491abc7c5c0a69097a14f69c9da73b211
Parents: 52717bd
Author: Kiran Ayyagari <ka...@apache.org>
Authored: Wed Jul 1 20:53:43 2015 +0800
Committer: Kiran Ayyagari <ka...@apache.org>
Committed: Wed Jul 1 20:53:43 2015 +0800
----------------------------------------------------------------------
kerby-asn1/pom.xml | 10 +-
kerby-backend/json-backend/pom.xml | 1 +
kerby-backend/ldap-backend/pom.xml | 1 +
kerby-backend/zookeeper-backend/pom.xml | 1 +
kerby-kdc-test/pom.xml | 2 +
kerby-kdc/pom.xml | 4 -
kerby-kerb/kerb-identity-test/pom.xml | 21 ++-
.../kerb/identity/backend/BackendTest.java | 175 -------------------
.../kerb/identity/backend/BackendTest.java | 175 +++++++++++++++++++
kerby-kerb/kerb-kdc-test/pom.xml | 28 +--
.../kerby/kerberos/kerb/server/KdcTestBase.java | 143 ---------------
.../kerberos/kerb/server/TestKdcServer.java | 54 ------
.../kerby/kerberos/kerb/server/KdcTestBase.java | 143 +++++++++++++++
.../kerberos/kerb/server/TestKdcServer.java | 54 ++++++
kerby-kerb/pom.xml | 11 --
kerby-provider/token-provider/pom.xml | 12 +-
lib/pom.xml | 8 -
pom.xml | 30 ++--
18 files changed, 428 insertions(+), 445 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-asn1/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-asn1/pom.xml b/kerby-asn1/pom.xml
index 427fe7e..ada8d61 100644
--- a/kerby-asn1/pom.xml
+++ b/kerby-asn1/pom.xml
@@ -29,14 +29,6 @@
<description>Kerby ASN1 Project</description>
<dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- </dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-backend/json-backend/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-backend/json-backend/pom.xml b/kerby-backend/json-backend/pom.xml
index da2b369..0a5bd33 100644
--- a/kerby-backend/json-backend/pom.xml
+++ b/kerby-backend/json-backend/pom.xml
@@ -45,6 +45,7 @@
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-identity-test</artifactId>
<version>${project.version}</version>
+ <type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-backend/ldap-backend/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-backend/ldap-backend/pom.xml b/kerby-backend/ldap-backend/pom.xml
index 752770f..65353ab 100644
--- a/kerby-backend/ldap-backend/pom.xml
+++ b/kerby-backend/ldap-backend/pom.xml
@@ -90,6 +90,7 @@
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-identity-test</artifactId>
<version>${project.version}</version>
+ <type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-backend/zookeeper-backend/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-backend/zookeeper-backend/pom.xml b/kerby-backend/zookeeper-backend/pom.xml
index bfa490b..649948b 100644
--- a/kerby-backend/zookeeper-backend/pom.xml
+++ b/kerby-backend/zookeeper-backend/pom.xml
@@ -49,6 +49,7 @@
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-identity-test</artifactId>
<version>${project.version}</version>
+ <type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-kdc-test/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-kdc-test/pom.xml b/kerby-kdc-test/pom.xml
index d675237..68d8c52 100644
--- a/kerby-kdc-test/pom.xml
+++ b/kerby-kdc-test/pom.xml
@@ -56,6 +56,8 @@
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-kdc-test</artifactId>
<version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.kerby</groupId>
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-kdc/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-kdc/pom.xml b/kerby-kdc/pom.xml
index 7cf5b77..3f35ee7 100644
--- a/kerby-kdc/pom.xml
+++ b/kerby-kdc/pom.xml
@@ -47,10 +47,6 @@
<version>4.0.0.Final</version>
<scope>compile</scope>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
</dependencies>
<profiles>
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-kerb/kerb-identity-test/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-identity-test/pom.xml b/kerby-kerb/kerb-identity-test/pom.xml
index 18437f7..a86d027 100644
--- a/kerby-kerb/kerb-identity-test/pom.xml
+++ b/kerby-kerb/kerb-identity-test/pom.xml
@@ -52,10 +52,21 @@
<artifactId>kerb-identity</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>compile</scope>
- </dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-kerb/kerb-identity-test/src/main/java/org/apache/kerby/kerberos/kerb/identity/backend/BackendTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-identity-test/src/main/java/org/apache/kerby/kerberos/kerb/identity/backend/BackendTest.java b/kerby-kerb/kerb-identity-test/src/main/java/org/apache/kerby/kerberos/kerb/identity/backend/BackendTest.java
deleted file mode 100644
index b87e071..0000000
--- a/kerby-kerb/kerb-identity-test/src/main/java/org/apache/kerby/kerberos/kerb/identity/backend/BackendTest.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerby.kerberos.kerb.identity.backend;
-
-import org.apache.kerby.kerberos.kerb.KrbException;
-import org.apache.kerby.kerberos.kerb.common.EncryptionUtil;
-import org.apache.kerby.kerberos.kerb.identity.KrbIdentity;
-import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
-import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
-import org.apache.kerby.kerberos.kerb.spec.base.EncryptionType;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * A common backend test utility
- */
-public abstract class BackendTest {
-
- static final String TEST_PRINCIPAL = "test@EXAMPLE.COM";
-
- static final EncryptionType[] encTypes = new EncryptionType[]{
- EncryptionType.AES128_CTS,
- EncryptionType.DES3_CBC_SHA1_KD
- };
-
- protected void testGet(IdentityBackend backend) {
- KrbIdentity kid = createOneIdentity(TEST_PRINCIPAL);
- backend.addIdentity(kid);
- // clear the identity cache.
- backend.release();
-
- KrbIdentity identity = backend.getIdentity(TEST_PRINCIPAL);
- assertThat(identity).isNotNull();
- assertThat(identity.getExpireTime()).isEqualTo(kid.getExpireTime());
- assertThat(identity.isDisabled()).isEqualTo(kid.isDisabled());
- assertThat(identity.getKeyVersion()).isEqualTo(kid.getKeyVersion());
- for (EncryptionKey expectedKey : kid.getKeys().values()) {
- EncryptionType actualType = EncryptionType.fromValue(expectedKey.getKeyType().getValue());
- EncryptionKey actualKey = identity.getKey(actualType);
- assertThat(actualKey.getKeyType().getValue()).isEqualTo(expectedKey.getKeyType().getValue());
- assertThat(actualKey.getKeyData()).isEqualTo(expectedKey.getKeyData());
- assertThat(actualKey.getKvno()).isEqualTo(expectedKey.getKvno());
- }
-
- //tearDown
- backend.deleteIdentity(TEST_PRINCIPAL);
- }
-
- protected void testStore(IdentityBackend backend) {
- KrbIdentity kid = createOneIdentity(TEST_PRINCIPAL);
- backend.addIdentity(kid);
- // clear the identity cache.
- backend.release();
- KrbIdentity kid2 = backend.getIdentity(TEST_PRINCIPAL);
-
- assertThat(kid).isEqualTo(kid2);
-
- //tearDown
- backend.deleteIdentity(TEST_PRINCIPAL);
- }
-
- protected void testUpdate(IdentityBackend backend) {
- KrbIdentity kid = createOneIdentity(TEST_PRINCIPAL);
- backend.addIdentity(kid);
-
- kid.setDisabled(true);
- backend.updateIdentity(kid);
-
- // clear the identity cache.
- backend.release();
- assertThat(backend.getIdentity(TEST_PRINCIPAL)).isEqualTo(kid);
-
- //tearDown
- backend.deleteIdentity(TEST_PRINCIPAL);
- }
-
- protected void testDelete(IdentityBackend backend) {
- KrbIdentity kid = createOneIdentity(TEST_PRINCIPAL);
- backend.addIdentity(kid);
- // clear the identity cache.
- backend.release();
-
- assertThat(backend.getIdentity(TEST_PRINCIPAL)).isNotNull();
-
- backend.deleteIdentity(TEST_PRINCIPAL);
- assertThat(backend.getIdentity(TEST_PRINCIPAL)).isNull();
- }
-
- protected void testGetIdentities(IdentityBackend backend) {
- KrbIdentity[] identities = createManyIdentities();
-
- for (KrbIdentity identity : identities) {
- backend.addIdentity(identity);
- }
-
- // clear the identity cache.
- backend.release();
-
- List<String> principals = backend.getIdentities(2, 5);
- assertThat(principals).hasSize(3)
- .contains(identities[2].getPrincipalName())
- .contains(identities[3].getPrincipalName())
- .contains(identities[4].getPrincipalName());
-
- //tearDown
- for (KrbIdentity identity : identities) {
- backend.deleteIdentity(identity.getPrincipalName());
- }
- }
-
- protected KrbIdentity[] createManyIdentities() {
- return new KrbIdentity[] {
- createOneIdentity("test1@EXAMPLE.COM"),
- createOneIdentity("test2@EXAMPLE.COM"),
- createOneIdentity("test3@EXAMPLE.COM"),
- createOneIdentity("test4@EXAMPLE.COM"),
- createOneIdentity("test5@EXAMPLE.COM"),
- createOneIdentity("test6@EXAMPLE.COM"),
- };
- }
- protected KrbIdentity createOneIdentity(String principal) {
- KrbIdentity kid = new KrbIdentity(principal);
- kid.setCreatedTime(KerberosTime.now());
- kid.setExpireTime(new KerberosTime(253402300799900L));
- kid.setDisabled(false);
- kid.setKeyVersion(1);
- kid.setLocked(false);
- kid.addKeys(generateKeys(kid.getPrincipalName()));
-
- return kid;
- }
-
- protected List<EncryptionKey> generateKeys(String principal) {
- String passwd = UUID.randomUUID().toString();
- try {
- return EncryptionUtil.generateKeys(principal, passwd, getEncryptionTypes());
- } catch (KrbException e) {
- throw new RuntimeException("Failed to create keys", e);
- }
- }
-
- protected List<EncryptionType> getEncryptionTypes() {
- return Arrays.asList(encTypes);
- }
-
- protected void cleanIdentities(IdentityBackend backend) {
- List<String> identities = backend.getIdentities();
- if (identities != null) {
- for (String identity : identities) {
- backend.deleteIdentity(identity);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-kerb/kerb-identity-test/src/test/java/org/apache/kerby/kerberos/kerb/identity/backend/BackendTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-identity-test/src/test/java/org/apache/kerby/kerberos/kerb/identity/backend/BackendTest.java b/kerby-kerb/kerb-identity-test/src/test/java/org/apache/kerby/kerberos/kerb/identity/backend/BackendTest.java
new file mode 100644
index 0000000..b87e071
--- /dev/null
+++ b/kerby-kerb/kerb-identity-test/src/test/java/org/apache/kerby/kerberos/kerb/identity/backend/BackendTest.java
@@ -0,0 +1,175 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.identity.backend;
+
+import org.apache.kerby.kerberos.kerb.KrbException;
+import org.apache.kerby.kerberos.kerb.common.EncryptionUtil;
+import org.apache.kerby.kerberos.kerb.identity.KrbIdentity;
+import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
+import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
+import org.apache.kerby.kerberos.kerb.spec.base.EncryptionType;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * A common backend test utility
+ */
+public abstract class BackendTest {
+
+ static final String TEST_PRINCIPAL = "test@EXAMPLE.COM";
+
+ static final EncryptionType[] encTypes = new EncryptionType[]{
+ EncryptionType.AES128_CTS,
+ EncryptionType.DES3_CBC_SHA1_KD
+ };
+
+ protected void testGet(IdentityBackend backend) {
+ KrbIdentity kid = createOneIdentity(TEST_PRINCIPAL);
+ backend.addIdentity(kid);
+ // clear the identity cache.
+ backend.release();
+
+ KrbIdentity identity = backend.getIdentity(TEST_PRINCIPAL);
+ assertThat(identity).isNotNull();
+ assertThat(identity.getExpireTime()).isEqualTo(kid.getExpireTime());
+ assertThat(identity.isDisabled()).isEqualTo(kid.isDisabled());
+ assertThat(identity.getKeyVersion()).isEqualTo(kid.getKeyVersion());
+ for (EncryptionKey expectedKey : kid.getKeys().values()) {
+ EncryptionType actualType = EncryptionType.fromValue(expectedKey.getKeyType().getValue());
+ EncryptionKey actualKey = identity.getKey(actualType);
+ assertThat(actualKey.getKeyType().getValue()).isEqualTo(expectedKey.getKeyType().getValue());
+ assertThat(actualKey.getKeyData()).isEqualTo(expectedKey.getKeyData());
+ assertThat(actualKey.getKvno()).isEqualTo(expectedKey.getKvno());
+ }
+
+ //tearDown
+ backend.deleteIdentity(TEST_PRINCIPAL);
+ }
+
+ protected void testStore(IdentityBackend backend) {
+ KrbIdentity kid = createOneIdentity(TEST_PRINCIPAL);
+ backend.addIdentity(kid);
+ // clear the identity cache.
+ backend.release();
+ KrbIdentity kid2 = backend.getIdentity(TEST_PRINCIPAL);
+
+ assertThat(kid).isEqualTo(kid2);
+
+ //tearDown
+ backend.deleteIdentity(TEST_PRINCIPAL);
+ }
+
+ protected void testUpdate(IdentityBackend backend) {
+ KrbIdentity kid = createOneIdentity(TEST_PRINCIPAL);
+ backend.addIdentity(kid);
+
+ kid.setDisabled(true);
+ backend.updateIdentity(kid);
+
+ // clear the identity cache.
+ backend.release();
+ assertThat(backend.getIdentity(TEST_PRINCIPAL)).isEqualTo(kid);
+
+ //tearDown
+ backend.deleteIdentity(TEST_PRINCIPAL);
+ }
+
+ protected void testDelete(IdentityBackend backend) {
+ KrbIdentity kid = createOneIdentity(TEST_PRINCIPAL);
+ backend.addIdentity(kid);
+ // clear the identity cache.
+ backend.release();
+
+ assertThat(backend.getIdentity(TEST_PRINCIPAL)).isNotNull();
+
+ backend.deleteIdentity(TEST_PRINCIPAL);
+ assertThat(backend.getIdentity(TEST_PRINCIPAL)).isNull();
+ }
+
+ protected void testGetIdentities(IdentityBackend backend) {
+ KrbIdentity[] identities = createManyIdentities();
+
+ for (KrbIdentity identity : identities) {
+ backend.addIdentity(identity);
+ }
+
+ // clear the identity cache.
+ backend.release();
+
+ List<String> principals = backend.getIdentities(2, 5);
+ assertThat(principals).hasSize(3)
+ .contains(identities[2].getPrincipalName())
+ .contains(identities[3].getPrincipalName())
+ .contains(identities[4].getPrincipalName());
+
+ //tearDown
+ for (KrbIdentity identity : identities) {
+ backend.deleteIdentity(identity.getPrincipalName());
+ }
+ }
+
+ protected KrbIdentity[] createManyIdentities() {
+ return new KrbIdentity[] {
+ createOneIdentity("test1@EXAMPLE.COM"),
+ createOneIdentity("test2@EXAMPLE.COM"),
+ createOneIdentity("test3@EXAMPLE.COM"),
+ createOneIdentity("test4@EXAMPLE.COM"),
+ createOneIdentity("test5@EXAMPLE.COM"),
+ createOneIdentity("test6@EXAMPLE.COM"),
+ };
+ }
+ protected KrbIdentity createOneIdentity(String principal) {
+ KrbIdentity kid = new KrbIdentity(principal);
+ kid.setCreatedTime(KerberosTime.now());
+ kid.setExpireTime(new KerberosTime(253402300799900L));
+ kid.setDisabled(false);
+ kid.setKeyVersion(1);
+ kid.setLocked(false);
+ kid.addKeys(generateKeys(kid.getPrincipalName()));
+
+ return kid;
+ }
+
+ protected List<EncryptionKey> generateKeys(String principal) {
+ String passwd = UUID.randomUUID().toString();
+ try {
+ return EncryptionUtil.generateKeys(principal, passwd, getEncryptionTypes());
+ } catch (KrbException e) {
+ throw new RuntimeException("Failed to create keys", e);
+ }
+ }
+
+ protected List<EncryptionType> getEncryptionTypes() {
+ return Arrays.asList(encTypes);
+ }
+
+ protected void cleanIdentities(IdentityBackend backend) {
+ List<String> identities = backend.getIdentities();
+ if (identities != null) {
+ for (String identity : identities) {
+ backend.deleteIdentity(identity);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-kerb/kerb-kdc-test/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-kdc-test/pom.xml b/kerby-kerb/kerb-kdc-test/pom.xml
index 1167df8..d8b15a3 100644
--- a/kerby-kerb/kerb-kdc-test/pom.xml
+++ b/kerby-kerb/kerb-kdc-test/pom.xml
@@ -57,15 +57,21 @@
<artifactId>kerb-client</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>compile</scope>
- </dependency>
</dependencies>
-</project>
\ No newline at end of file
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-kerb/kerb-kdc-test/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcTestBase.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-kdc-test/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcTestBase.java b/kerby-kerb/kerb-kdc-test/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcTestBase.java
deleted file mode 100644
index 59b163e..0000000
--- a/kerby-kerb/kerb-kdc-test/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcTestBase.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerby.kerberos.kerb.server;
-
-import org.apache.kerby.kerberos.kerb.KrbException;
-import org.apache.kerby.kerberos.kerb.client.KrbClient;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-import java.io.File;
-import java.io.IOException;
-
-public abstract class KdcTestBase {
- private static File testDir;
-
- private final String clientPassword = "123456";
- private final String hostname = "localhost";
- private final String clientPrincipalName = "drankye";
- private final String clientPrincipal =
- clientPrincipalName + "@" + TestKdcServer.kdcRealm;
- private final String serverPrincipalName = "test-service";
- private final String serverPrincipal =
- serverPrincipalName + "/" + hostname + "@" + TestKdcServer.kdcRealm;
-
- private SimpleKdcServer kdcServer;
-
- @BeforeClass
- public static void createTestDir() throws IOException {
- String basedir = System.getProperty("basedir");
- if (basedir == null) {
- basedir = new File(".").getCanonicalPath();
- }
- File targetdir= new File(basedir, "target");
- testDir = new File(targetdir, "tmp");
- testDir.mkdirs();
- }
-
- @AfterClass
- public static void deleteTestDir() throws IOException {
- testDir.delete();
- }
-
- protected File getTestDir() {
- return testDir;
- }
-
- protected SimpleKdcServer getKdcServer() {
- return kdcServer;
- }
-
- protected KrbClient getKrbClient() {
- return kdcServer.getKrbClient();
- }
-
- protected String getClientPrincipalName() {
- return clientPrincipalName;
- }
-
- protected String getClientPrincipal() {
- return clientPrincipal;
- }
-
- protected String getServerPrincipalName() {
- return serverPrincipalName;
- }
-
- protected String getClientPassword() {
- return clientPassword;
- }
-
- protected String getServerPrincipal() {
- return serverPrincipal;
- }
-
- protected boolean allowUdp() {
- return true;
- }
-
- protected boolean allowTcp() {
- return true;
- }
-
- @Before
- public void setUp() throws Exception {
- setUpKdcServer();
-
- createPrincipals();
-
- setUpClient();
- }
-
- protected void prepareKdc() throws KrbException {
- kdcServer.init();
- }
-
- protected void setUpKdcServer() throws Exception {
- kdcServer = new TestKdcServer(allowTcp(), allowUdp());
- kdcServer.setWorkDir(testDir);
-
- prepareKdc();
-
- kdcServer.start();
- }
-
- protected void setUpClient() throws Exception {
- }
-
- protected void createPrincipals() throws KrbException {
- kdcServer.createPrincipals(serverPrincipal);
- kdcServer.createPrincipal(clientPrincipal, clientPassword);
- }
-
- protected void deletePrincipals() throws KrbException {
- kdcServer.getKadmin().deleteBuiltinPrincipals();
- kdcServer.deletePrincipals(serverPrincipal);
- kdcServer.deletePrincipal(clientPrincipal);
- }
-
- @After
- public void tearDown() throws Exception {
- deletePrincipals();
- kdcServer.stop();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-kerb/kerb-kdc-test/src/main/java/org/apache/kerby/kerberos/kerb/server/TestKdcServer.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-kdc-test/src/main/java/org/apache/kerby/kerberos/kerb/server/TestKdcServer.java b/kerby-kerb/kerb-kdc-test/src/main/java/org/apache/kerby/kerberos/kerb/server/TestKdcServer.java
deleted file mode 100644
index 4395f4b..0000000
--- a/kerby-kerb/kerb-kdc-test/src/main/java/org/apache/kerby/kerberos/kerb/server/TestKdcServer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.kerby.kerberos.kerb.server;
-
-import org.apache.kerby.kerberos.kerb.KrbException;
-import org.apache.kerby.kerberos.kerb.client.KrbClient;
-import org.apache.kerby.kerberos.kerb.client.KrbConfig;
-import org.apache.kerby.kerberos.kerb.client.KrbConfigKey;
-import org.apache.kerby.util.NetworkUtil;
-
-public class TestKdcServer extends SimpleKdcServer {
- public final static String kdcRealm = "TEST.COM";
- public final static String hostname = "localhost";
-
- public TestKdcServer(boolean allowTcp, boolean allowUdp) throws KrbException {
- super();
-
- setKdcRealm(kdcRealm);
- setKdcHost(hostname);
- setAllowTcp(allowTcp);
- setAllowUdp(allowUdp);
-
- if (allowTcp) {
- setKdcTcpPort(NetworkUtil.getServerPort());
- }
- if (allowUdp) {
- setKdcUdpPort(NetworkUtil.getServerPort());
- }
-
- KrbClient krbClnt = getKrbClient();
- KrbConfig krbConfig = krbClnt.getKrbConfig();
- krbConfig.setString(KrbConfigKey.PERMITTED_ENCTYPES,
- "aes128-cts-hmac-sha1-96 des-cbc-crc des-cbc-md5 des3-cbc-sha1");
-
- krbClnt.setTimeout(10 * 1000);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/KdcTestBase.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/KdcTestBase.java b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/KdcTestBase.java
new file mode 100644
index 0000000..59b163e
--- /dev/null
+++ b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/KdcTestBase.java
@@ -0,0 +1,143 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.server;
+
+import org.apache.kerby.kerberos.kerb.KrbException;
+import org.apache.kerby.kerberos.kerb.client.KrbClient;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+import java.io.File;
+import java.io.IOException;
+
+public abstract class KdcTestBase {
+ private static File testDir;
+
+ private final String clientPassword = "123456";
+ private final String hostname = "localhost";
+ private final String clientPrincipalName = "drankye";
+ private final String clientPrincipal =
+ clientPrincipalName + "@" + TestKdcServer.kdcRealm;
+ private final String serverPrincipalName = "test-service";
+ private final String serverPrincipal =
+ serverPrincipalName + "/" + hostname + "@" + TestKdcServer.kdcRealm;
+
+ private SimpleKdcServer kdcServer;
+
+ @BeforeClass
+ public static void createTestDir() throws IOException {
+ String basedir = System.getProperty("basedir");
+ if (basedir == null) {
+ basedir = new File(".").getCanonicalPath();
+ }
+ File targetdir= new File(basedir, "target");
+ testDir = new File(targetdir, "tmp");
+ testDir.mkdirs();
+ }
+
+ @AfterClass
+ public static void deleteTestDir() throws IOException {
+ testDir.delete();
+ }
+
+ protected File getTestDir() {
+ return testDir;
+ }
+
+ protected SimpleKdcServer getKdcServer() {
+ return kdcServer;
+ }
+
+ protected KrbClient getKrbClient() {
+ return kdcServer.getKrbClient();
+ }
+
+ protected String getClientPrincipalName() {
+ return clientPrincipalName;
+ }
+
+ protected String getClientPrincipal() {
+ return clientPrincipal;
+ }
+
+ protected String getServerPrincipalName() {
+ return serverPrincipalName;
+ }
+
+ protected String getClientPassword() {
+ return clientPassword;
+ }
+
+ protected String getServerPrincipal() {
+ return serverPrincipal;
+ }
+
+ protected boolean allowUdp() {
+ return true;
+ }
+
+ protected boolean allowTcp() {
+ return true;
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ setUpKdcServer();
+
+ createPrincipals();
+
+ setUpClient();
+ }
+
+ protected void prepareKdc() throws KrbException {
+ kdcServer.init();
+ }
+
+ protected void setUpKdcServer() throws Exception {
+ kdcServer = new TestKdcServer(allowTcp(), allowUdp());
+ kdcServer.setWorkDir(testDir);
+
+ prepareKdc();
+
+ kdcServer.start();
+ }
+
+ protected void setUpClient() throws Exception {
+ }
+
+ protected void createPrincipals() throws KrbException {
+ kdcServer.createPrincipals(serverPrincipal);
+ kdcServer.createPrincipal(clientPrincipal, clientPassword);
+ }
+
+ protected void deletePrincipals() throws KrbException {
+ kdcServer.getKadmin().deleteBuiltinPrincipals();
+ kdcServer.deletePrincipals(serverPrincipal);
+ kdcServer.deletePrincipal(clientPrincipal);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ deletePrincipals();
+ kdcServer.stop();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/TestKdcServer.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/TestKdcServer.java b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/TestKdcServer.java
new file mode 100644
index 0000000..4395f4b
--- /dev/null
+++ b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/TestKdcServer.java
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.server;
+
+import org.apache.kerby.kerberos.kerb.KrbException;
+import org.apache.kerby.kerberos.kerb.client.KrbClient;
+import org.apache.kerby.kerberos.kerb.client.KrbConfig;
+import org.apache.kerby.kerberos.kerb.client.KrbConfigKey;
+import org.apache.kerby.util.NetworkUtil;
+
+public class TestKdcServer extends SimpleKdcServer {
+ public final static String kdcRealm = "TEST.COM";
+ public final static String hostname = "localhost";
+
+ public TestKdcServer(boolean allowTcp, boolean allowUdp) throws KrbException {
+ super();
+
+ setKdcRealm(kdcRealm);
+ setKdcHost(hostname);
+ setAllowTcp(allowTcp);
+ setAllowUdp(allowUdp);
+
+ if (allowTcp) {
+ setKdcTcpPort(NetworkUtil.getServerPort());
+ }
+ if (allowUdp) {
+ setKdcUdpPort(NetworkUtil.getServerPort());
+ }
+
+ KrbClient krbClnt = getKrbClient();
+ KrbConfig krbConfig = krbClnt.getKrbConfig();
+ krbConfig.setString(KrbConfigKey.PERMITTED_ENCTYPES,
+ "aes128-cts-hmac-sha1-96 des-cbc-crc des-cbc-md5 des3-cbc-sha1");
+
+ krbClnt.setTimeout(10 * 1000);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-kerb/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-kerb/pom.xml b/kerby-kerb/pom.xml
index 0e8c3bf..6936a7b 100644
--- a/kerby-kerb/pom.xml
+++ b/kerby-kerb/pom.xml
@@ -42,15 +42,4 @@
<module>kerb-client-api-all</module>
<module>kerb-server-api-all</module>
</modules>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- </dependency>
- </dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/kerby-provider/token-provider/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-provider/token-provider/pom.xml b/kerby-provider/token-provider/pom.xml
index b9ca4ea..652331d 100644
--- a/kerby-provider/token-provider/pom.xml
+++ b/kerby-provider/token-provider/pom.xml
@@ -25,16 +25,6 @@
<version>3.9</version>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<profiles>
@@ -66,4 +56,4 @@
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/lib/pom.xml
----------------------------------------------------------------------
diff --git a/lib/pom.xml b/lib/pom.xml
index 1b9af80..f4b3bef 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -32,14 +32,6 @@
</modules>
<dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/81f69a04/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2b28322..edd47e0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,22 +48,24 @@
<module>kerby-provider</module>
</modules>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <scope>test</scope>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>${assertj.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <dependencyManagement>
+ <dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>