Commit a0d24742 authored by Brian Major's avatar Brian Major
Browse files

s1970 - more test config for travis

parent b096967b
......@@ -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;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import ca.nrc.cadc.util.Log4jInit;
import ca.nrc.cadc.util.PropertiesReader;
public class UserActionFactoryTest
......@@ -87,6 +90,18 @@ public class UserActionFactoryTest
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 testCreateUserAction()
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment