Commit 906e1b14 authored by bmajor's avatar bmajor Committed by GitHub
Browse files

Merge pull request #8 from brianmajor/s1970

s1970 - added application targets to GMS client and AC Admin client. …
parents 20041524 a0d24742
......@@ -3,40 +3,39 @@ plugins {
id 'maven'
id 'maven-publish'
id 'com.jfrog.bintray' version '1.7.1'
id 'application'
}
repositories {
jcenter()
mavenLocal()
// Only here until cadcUtil is in jcenter.
maven {
url 'http://dl.bintray.com/opencadc/software'
}
}
sourceCompatibility = 1.7
group = 'org.opencadc'
version = '1.0'
version = '1.0.1'
mainClassName = 'ca.nrc.cadc.ac.admin.Main'
dependencies {
compile 'log4j:log4j:1.2.+'
compile 'org.jdom:jdom2:2.+'
compile 'javax.servlet:javax.servlet-api:3.+'
compile 'xerces:xercesImpl:2.+'
compile 'com.unboundid:unboundid-ldapsdk:2.3.+'
compile 'commons-fileupload:commons-fileupload:1.3.+'
compile 'com.sun.mail:javax.mail:1.+'
compile 'org.opencadc:cadc-util:1.+'
compile 'org.opencadc:cadc-log:1.+'
compile 'org.opencadc:cadc-registry:1.+'
compile 'org.opencadc:cadc-access-control:1.+'
compile 'org.opencadc:cadc-access-control-server:1.+'
testCompile 'junit:junit:4.+'
testCompile 'org.easymock:easymock:3.+'
testCompile 'xerces:xercesImpl:2.+'
testCompile 'org.skyscreamer:jsonassert:1.+'
}
configurations {
runtime.exclude group: 'org.springframework'
runtime.exclude group: 'org.restlet.jse'
runtime.exclude group: 'org.restlet.jee'
}
#!/bin/bash
java -Xmx128m -jar ${CADC_ROOT}/lib/cadcAccessControl-Admin.jar $*
......@@ -8,11 +8,6 @@ plugins {
repositories {
jcenter()
mavenLocal()
// Only here until cadcUtil is in jcenter.
maven {
url 'http://dl.bintray.com/opencadc/software'
}
}
sourceCompatibility = 1.7
......@@ -24,7 +19,6 @@ dependencies {
compile 'log4j:log4j:1.2.+'
compile 'org.opencadc:cadc-util:1.+'
compile 'org.opencadc:cadc-log:1.+'
compile 'org.opencadc:cadc-registry:1.+'
compile 'org.opencadc:cadc-vosi:1.+'
compile 'org.opencadc:cadc-access-control:1.+'
......
......@@ -8,23 +8,17 @@ plugins {
repositories {
jcenter()
mavenLocal()
// Only here until cadcUtil is in jcenter.
maven {
url 'http://dl.bintray.com/opencadc/software'
}
}
sourceCompatibility = 1.7
group = 'org.opencadc'
version = '1.0'
version = '1.0.1'
dependencies {
compile 'log4j:log4j:1.2.+'
compile 'org.jdom:jdom2:2.+'
compile 'org.json:json:20160212'
compile 'javax.servlet:javax.servlet-api:3.+'
compile 'xerces:xercesImpl:2.+'
compile 'com.unboundid:unboundid-ldapsdk:2.3.+'
......@@ -39,5 +33,4 @@ dependencies {
testCompile 'org.easymock:easymock:3.+'
testCompile 'xerces:xercesImpl:2.+'
testCompile 'org.skyscreamer:jsonassert:1.+'
testCompile 'commons-logging:commons-logging:1.+'
}
......@@ -67,23 +67,24 @@
package ca.nrc.cadc.ac.server.ldap;
import java.lang.reflect.Field;
import java.util.NoSuchElementException;
import javax.security.auth.Subject;
import javax.security.auth.x500.X500Principal;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.BeforeClass;
import ca.nrc.cadc.ac.PersonalDetails;
import ca.nrc.cadc.ac.User;
import ca.nrc.cadc.ac.UserNotFoundException;
import ca.nrc.cadc.ac.UserRequest;
import ca.nrc.cadc.auth.DNPrincipal;
import ca.nrc.cadc.auth.HttpPrincipal;
import ca.nrc.cadc.auth.NumericPrincipal;
import ca.nrc.cadc.util.Log4jInit;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.BeforeClass;
import javax.security.auth.Subject;
import javax.security.auth.x500.X500Principal;
import java.lang.reflect.Field;
import java.util.UUID;
import java.util.NoSuchElementException;
import ca.nrc.cadc.util.PropertiesReader;
/**
* Created by jburke on 2014-11-03.
......@@ -132,6 +133,8 @@ public class AbstractLdapDAOTest
{
Log4jInit.setLevel("ca.nrc.cadc.ac", Level.DEBUG);
System.setProperty(PropertiesReader.class.getName() + ".dir", "src/test/resources");
// get the configuration of the development server from and config files...
try
{
......
......@@ -68,34 +68,42 @@
package ca.nrc.cadc.ac.server.ldap;
import ca.nrc.cadc.auth.DNPrincipal;
import ca.nrc.cadc.auth.HttpPrincipal;
import ca.nrc.cadc.auth.NumericPrincipal;
import ca.nrc.cadc.util.Log4jInit;
import com.unboundid.ldap.sdk.DN;
import com.unboundid.ldap.sdk.LDAPConnection;
import com.unboundid.ldap.sdk.LDAPException;
import com.unboundid.ldap.sdk.LDAPInterface;
import static org.junit.Assert.assertTrue;
import java.security.PrivilegedAction;
import org.apache.log4j.Level;
import org.junit.BeforeClass;
import org.junit.Test;
import java.security.PrivilegedExceptionAction;
import java.util.UUID;
import javax.security.auth.Subject;
import javax.security.auth.x500.X500Principal;
import java.security.PrivilegedExceptionAction;
import java.util.UUID;
import org.junit.Assert;
import org.apache.log4j.Level;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import com.unboundid.ldap.sdk.LDAPConnection;
import ca.nrc.cadc.auth.HttpPrincipal;
import ca.nrc.cadc.auth.NumericPrincipal;
import ca.nrc.cadc.util.Log4jInit;
import ca.nrc.cadc.util.PropertiesReader;
public class LdapDAOTest extends AbstractLdapDAOTest
{
@BeforeClass
public static void setUpClass()
{
Log4jInit.setLevel("ca.nrc.cadc.ac", Level.INFO);
System.setProperty(PropertiesReader.class.getName() + ".dir", "src/test/resources");
}
@AfterClass
public static void teardownClass()
{
System.clearProperty(PropertiesReader.class.getName() + ".dir");
}
@Test
public void testLdapBindConnection() throws Exception
{
......
......@@ -77,19 +77,37 @@ import java.util.Collection;
import javax.security.auth.Subject;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import ca.nrc.cadc.ac.Group;
import ca.nrc.cadc.ac.GroupNotFoundException;
import ca.nrc.cadc.ac.GroupProperty;
import ca.nrc.cadc.ac.User;
import ca.nrc.cadc.util.Log4jInit;
import ca.nrc.cadc.util.PropertiesReader;
public class LdapGroupDAOTest extends AbstractLdapDAOTest
{
private static final Logger log = Logger.getLogger(LdapGroupDAOTest.class);
@BeforeClass
public static void setUpClass()
{
Log4jInit.setLevel("ca.nrc.cadc.ac", Level.INFO);
System.setProperty(PropertiesReader.class.getName() + ".dir", "src/test/resources");
}
@AfterClass
public static void teardownClass()
{
System.clearProperty(PropertiesReader.class.getName() + ".dir");
}
LdapGroupDAO getGroupDAO() throws Exception
{
LdapConnections connections = new LdapConnections(config);
......
......@@ -84,7 +84,10 @@ import java.util.Collection;
import javax.security.auth.Subject;
import javax.security.auth.x500.X500Principal;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import ca.nrc.cadc.ac.PersonalDetails;
......@@ -96,9 +99,25 @@ import ca.nrc.cadc.auth.DNPrincipal;
import ca.nrc.cadc.auth.HttpPrincipal;
import ca.nrc.cadc.auth.NumericPrincipal;
import ca.nrc.cadc.auth.SSLUtil;
import ca.nrc.cadc.util.Log4jInit;
import ca.nrc.cadc.util.PropertiesReader;
public class LdapUserDAOTest extends AbstractLdapDAOTest
{
@BeforeClass
public static void setUpClass()
{
Log4jInit.setLevel("ca.nrc.cadc.ac", Level.INFO);
System.setProperty(PropertiesReader.class.getName() + ".dir", "src/test/resources");
}
@AfterClass
public static void teardownClass()
{
System.clearProperty(PropertiesReader.class.getName() + ".dir");
}
private static final Logger log = Logger.getLogger(LdapUserDAOTest.class);
String createUsername()
......
......@@ -83,11 +83,14 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Level;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import ca.nrc.cadc.ac.server.UserPersistence;
import ca.nrc.cadc.auth.HttpPrincipal;
import ca.nrc.cadc.util.Log4jInit;
import ca.nrc.cadc.util.PropertiesReader;
import ca.nrc.cadc.util.StringUtil;
......@@ -99,6 +102,18 @@ public class ModifyPasswordServletTest
Log4jInit.setLevel("ca.nrc.cadc.ac", Level.INFO);
}
@BeforeClass
public static void setUpClass()
{
System.setProperty(PropertiesReader.class.getName() + ".dir", "src/test/resources");
}
@AfterClass
public static void teardownClass()
{
System.clearProperty(PropertiesReader.class.getName() + ".dir");
}
public void testSubjectAndPasswords(final Subject subject, final String oldPassword,
final String newPassword, int responseStatus) throws Exception
{
......
......@@ -83,6 +83,8 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import ca.nrc.cadc.ac.UserAlreadyExistsException;
......@@ -90,6 +92,7 @@ import ca.nrc.cadc.ac.UserNotFoundException;
import ca.nrc.cadc.ac.server.UserPersistence;
import ca.nrc.cadc.ac.server.ldap.LdapUserDAO;
import ca.nrc.cadc.auth.HttpPrincipal;
import ca.nrc.cadc.util.PropertiesReader;
import ca.nrc.cadc.util.StringUtil;
......@@ -97,6 +100,18 @@ public class ResetPasswordServletTest
{
private static final String EMAIL_ADDRESS = "email@canada.ca";
@BeforeClass
public static void setupClass()
{
System.setProperty(PropertiesReader.class.getName() + ".dir", "src/test/resources");
}
@AfterClass
public static void teardownClass()
{
System.clearProperty(PropertiesReader.class.getName() + ".dir");
}
public void testSubjectAndEmailAddress(final Subject subject, final String emailAddress,
int responseStatus) throws Exception
{
......
......@@ -13,17 +13,18 @@ import javax.security.auth.Subject;
import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServletRequest;
import junit.framework.Assert;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.easymock.EasyMock;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import ca.nrc.cadc.ac.server.PluginFactory;
import ca.nrc.cadc.db.StandaloneContextFactory;
import ca.nrc.cadc.util.Log4jInit;
import ca.nrc.cadc.util.PropertiesReader;
import junit.framework.Assert;
public class UserServletTest
......@@ -35,6 +36,18 @@ public class UserServletTest
Log4jInit.setLevel("ca.nrc.cadc.ac", Level.INFO);
}
@BeforeClass
public static void setupClass()
{
System.setProperty(PropertiesReader.class.getName() + ".dir", "src/test/resources");
}
@AfterClass
public static void teardownClass()
{
System.clearProperty(PropertiesReader.class.getName() + ".dir");
}
@Test
public void getAcceptedContentTypeJSON() throws Exception
{
......
......@@ -82,19 +82,19 @@ import javax.security.auth.Subject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import ca.nrc.cadc.ac.server.web.groups.AddUserMemberActionTest;
import ca.nrc.cadc.auth.AuthMethod;
import ca.nrc.cadc.reg.Standards;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import ca.nrc.cadc.auth.AuthMethod;
import ca.nrc.cadc.auth.HttpPrincipal;
import ca.nrc.cadc.reg.Standards;
import ca.nrc.cadc.reg.client.LocalAuthority;
import ca.nrc.cadc.reg.client.RegistryClient;
import ca.nrc.cadc.util.Log4jInit;
import ca.nrc.cadc.util.PropertiesReader;
public class WhoAmIServletTest
......@@ -105,6 +105,13 @@ public class WhoAmIServletTest
public static void setUpClass()
{
Log4jInit.setLevel("ca.nrc.cadc.ac", Level.INFO);
System.setProperty(PropertiesReader.class.getName() + ".dir", "src/test/resources");
}
@AfterClass
public static void teardownClass()
{
System.clearProperty(PropertiesReader.class.getName() + ".dir");
}
@Test
......
......@@ -80,6 +80,7 @@ import javax.security.auth.x500.X500Principal;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.easymock.EasyMock;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
......@@ -96,6 +97,7 @@ import ca.nrc.cadc.reg.Standards;
import ca.nrc.cadc.reg.client.LocalAuthority;
import ca.nrc.cadc.util.Log4jInit;
import ca.nrc.cadc.util.ObjectUtil;
import ca.nrc.cadc.util.PropertiesReader;
/**
*
......@@ -109,6 +111,13 @@ public class RemoveUserMemberActionTest
public static void setUpClass()
{
Log4jInit.setLevel("ca.nrc.cadc.ac", Level.INFO);
System.setProperty(PropertiesReader.class.getName() + ".dir", "src/test/resources");
}
@AfterClass
public static void teardownClass()
{
System.clearProperty(PropertiesReader.class.getName() + ".dir");
}
@Test
......
......@@ -78,7 +78,6 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.security.PrivilegedExceptionAction;
import java.util.Set;
import java.util.UUID;
import javax.security.auth.Subject;
......@@ -87,6 +86,8 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import ca.nrc.cadc.ac.PersonalDetails;
......@@ -99,6 +100,7 @@ import ca.nrc.cadc.ac.xml.UserWriter;
import ca.nrc.cadc.auth.HttpPrincipal;
import ca.nrc.cadc.auth.NumericPrincipal;
import ca.nrc.cadc.util.Log4jInit;
import ca.nrc.cadc.util.PropertiesReader;
public class GetUserActionTest
{
......@@ -109,6 +111,18 @@ public class GetUserActionTest
Log4jInit.setLevel("ca.nrc.cadc.ac.server", Level.INFO);
}
@BeforeClass
public static void setupClass()
{
System.setProperty(PropertiesReader.class.getName() + ".dir", "src/test/resources");
}
@AfterClass
public static void teardownClass()
{
System.clearProperty(PropertiesReader.class.getName() + ".dir");
}
@Test
public void writeUserXML() throws Exception
{
......
......@@ -83,6 +83,7 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Level;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
......@@ -95,6 +96,7 @@ import ca.nrc.cadc.ac.server.web.SyncOutput;
import ca.nrc.cadc.ac.xml.UserListWriter;
import ca.nrc.cadc.auth.HttpPrincipal;
import ca.nrc.cadc.util.Log4jInit;
import ca.nrc.cadc.util.PropertiesReader;
/**
*
......@@ -106,6 +108,13 @@ public class GetUserListActionTest
public static void setUpClass()
{
Log4jInit.setLevel("ca.nrc.cadc.ac", Level.INFO);
System.setProperty(PropertiesReader.class.getName() + ".dir", "src/test/resources");
}
@AfterClass
public static void teardownClass()
{
System.clearProperty(PropertiesReader.class.getName() + ".dir");
}
@Test
......
......@@ -80,7 +80,10 @@ import java.security.Principal;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Level;
import org.easymock.EasyMock;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import ca.nrc.cadc.ac.PersonalDetails;
......@@ -89,9 +92,25 @@ import ca.nrc.cadc.ac.json.JsonUserWriter;
import ca.nrc.cadc.ac.server.UserPersistence;
import ca.nrc.cadc.ac.server.web.SyncOutput;
import ca.nrc.cadc.auth.HttpPrincipal;
import ca.nrc.cadc.util.Log4jInit;
import ca.nrc.cadc.util.PropertiesReader;
public class ModifyUserActionTest
{
@BeforeClass
public static void setUpClass()
{
Log4jInit.setLevel("ca.nrc.cadc.ac", Level.INFO);
System.setProperty(PropertiesReader.class.getName() + ".dir", "src/test/resources");
}
@AfterClass
public static void teardownClass()
{
System.clearProperty(PropertiesReader.class.getName() + ".dir");
}
@Test
public void testModifyUser() throws Exception
{
......
......@@ -72,10 +72,13 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.easymock.EasyMock;