Modified tests to accomodate refactoring changes.
This commit is contained in:
parent
d15f25e509
commit
c252513bb7
src
main/resources/META-INF
test/java/se/su/dsv/scipro
60
src/main/resources/META-INF/base-repository.xml
Normal file
60
src/main/resources/META-INF/base-repository.xml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<!DOCTYPE Repository
|
||||||
|
PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.5//EN"
|
||||||
|
"http://jackrabbit.apache.org/dtd/repository-1.5.dtd">
|
||||||
|
<Repository>
|
||||||
|
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
|
||||||
|
<param name="path" value="/jackrabbit" />
|
||||||
|
</FileSystem>
|
||||||
|
<Security appName="Jackrabbit">
|
||||||
|
<AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager" />
|
||||||
|
<LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule">
|
||||||
|
<param name="anonymousId" value="anonymous" />
|
||||||
|
</LoginModule>
|
||||||
|
</Security>
|
||||||
|
<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" />
|
||||||
|
|
||||||
|
<DataStore class="org.apache.jackrabbit.core.data.FileDataStore">
|
||||||
|
<param name="path" value="${rep.home}/repository/datastore"/>
|
||||||
|
<param name="minRecordLength" value="100"/>
|
||||||
|
</DataStore>
|
||||||
|
|
||||||
|
<Workspace name="${wsp.name}">
|
||||||
|
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
|
||||||
|
<param name="path" value="${wsp.home}" />
|
||||||
|
</FileSystem>
|
||||||
|
|
||||||
|
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager">
|
||||||
|
<param name="blobFSBlockSize" value="0"/>
|
||||||
|
<param name="minBlobSize" value="4096"/>
|
||||||
|
<param name="errorHandling" value=""/>
|
||||||
|
</PersistenceManager>
|
||||||
|
|
||||||
|
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
|
||||||
|
<param name="path" value="${wsp.home}/index" />
|
||||||
|
<param name="indexingConfiguration" value="${wsp.home}/index-config.xml"/>
|
||||||
|
<param name="textFilterClasses" value="
|
||||||
|
org.apache.jackrabbit.extractor.MsWordTextExtractor,
|
||||||
|
org.apache.jackrabbit.extractor.MsExcelTextExtractor,
|
||||||
|
org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,
|
||||||
|
org.apache.jackrabbit.extractor.PdfTextExtractor,
|
||||||
|
org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,
|
||||||
|
org.apache.jackrabbit.extractor.RTFTextExtractor,
|
||||||
|
org.apache.jackrabbit.extractor.XMLTextExtractor,
|
||||||
|
org.apache.jackrabbit.extractor.PngTextExtractor,
|
||||||
|
org.apache.jackrabbit.extractor.HTMLTextExtractor"/>
|
||||||
|
<param name="extractorPoolSize " value="2"/>
|
||||||
|
<param name="supportHighlighting" value="true"/>
|
||||||
|
</SearchIndex>
|
||||||
|
</Workspace>
|
||||||
|
<Versioning rootPath="${rep.home}/versions">
|
||||||
|
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
|
||||||
|
<param name="path" value="${rep.home}/versions" />
|
||||||
|
</FileSystem>
|
||||||
|
<!-- <PersistenceManager class="org.apache.jackrabbit.core.persistence.xml.XMLPersistenceManager" />-->
|
||||||
|
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager">
|
||||||
|
<param name="blobFSBlockSize" value="0"/>
|
||||||
|
<param name="minBlobSize" value="4096"/>
|
||||||
|
<param name="errorHandling" value=""/>
|
||||||
|
</PersistenceManager>
|
||||||
|
</Versioning>
|
||||||
|
</Repository>
|
@ -111,7 +111,7 @@ public class TestAuthRoutines {
|
|||||||
ac.putBean("roleDao",mockedRoleDao);
|
ac.putBean("roleDao",mockedRoleDao);
|
||||||
ac.putBean("projectDao",Mockito.mock(ProjectDao.class));
|
ac.putBean("projectDao",Mockito.mock(ProjectDao.class));
|
||||||
ac.putBean("userSettingsDao",Mockito.mock(UserSettingsDao.class));
|
ac.putBean("userSettingsDao",Mockito.mock(UserSettingsDao.class));
|
||||||
ac.putBean("userLookupFromUsername",fixedLookupFromIdentifier);
|
ac.putBean("userLookupFromUsername",fixedLookupFromUsername);
|
||||||
ac.putBean("userLookupFromIdentifier",fixedLookupFromIdentifier);
|
ac.putBean("userLookupFromIdentifier",fixedLookupFromIdentifier);
|
||||||
//Create tester
|
//Create tester
|
||||||
wt = new WicketTester(new SciProApplication(){
|
wt = new WicketTester(new SciProApplication(){
|
||||||
@ -161,7 +161,7 @@ public class TestAuthRoutines {
|
|||||||
//At this point, an exception should be thrown
|
//At this point, an exception should be thrown
|
||||||
new ExternalAuthenticationRequestHelper(null);
|
new ExternalAuthenticationRequestHelper(null);
|
||||||
}
|
}
|
||||||
@Test(expected=NullPointerException.class)
|
@Test
|
||||||
public void testSessionSignInAndSu(){
|
public void testSessionSignInAndSu(){
|
||||||
ExternalAuthenticationRequestHelper helper = new ExternalAuthenticationRequestHelper(new HttpServletRequestWrapper(wt.getServletRequest()){
|
ExternalAuthenticationRequestHelper helper = new ExternalAuthenticationRequestHelper(new HttpServletRequestWrapper(wt.getServletRequest()){
|
||||||
@Override
|
@Override
|
||||||
@ -183,10 +183,9 @@ public class TestAuthRoutines {
|
|||||||
user.setRoles(roles);
|
user.setRoles(roles);
|
||||||
Assert.assertTrue(session.switchAuthenticatedUser("kalle-kula", "dsv.su.se"));
|
Assert.assertTrue(session.switchAuthenticatedUser("kalle-kula", "dsv.su.se"));
|
||||||
Assert.assertTrue(session.getUser().getIdentifier().equals(user.getIdentifier()));
|
Assert.assertTrue(session.getUser().getIdentifier().equals(user.getIdentifier()));
|
||||||
//This should fail with an exception, there is no such user
|
Assert.assertFalse(session.switchAuthenticatedUser("somebody","somewhere.se"));
|
||||||
session.switchAuthenticatedUser("somebody","somewhere.se");
|
|
||||||
}
|
}
|
||||||
@Test(expected=NullPointerException.class)
|
@Test
|
||||||
public void testFailedAuthenticatedSignIn(){
|
public void testFailedAuthenticatedSignIn(){
|
||||||
ExternalAuthenticationRequestHelper helper = new ExternalAuthenticationRequestHelper(new HttpServletRequestWrapper(wt.getServletRequest()){
|
ExternalAuthenticationRequestHelper helper = new ExternalAuthenticationRequestHelper(new HttpServletRequestWrapper(wt.getServletRequest()){
|
||||||
@Override
|
@Override
|
||||||
@ -194,8 +193,7 @@ public class TestAuthRoutines {
|
|||||||
return "some-dude@ki.se";
|
return "some-dude@ki.se";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//This should throw exceptions, not sure about this interface (throwing exceptions when authentication passes but no user can be located).
|
Assert.assertFalse(helper.signIn(session));
|
||||||
helper.signIn(session);
|
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
public void testFailedSwitchAuthentitedUser(){
|
public void testFailedSwitchAuthentitedUser(){
|
||||||
|
@ -8,7 +8,6 @@ import org.apache.wicket.Session;
|
|||||||
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
|
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
|
||||||
import org.apache.wicket.spring.test.ApplicationContextMock;
|
import org.apache.wicket.spring.test.ApplicationContextMock;
|
||||||
import org.apache.wicket.util.tester.WicketTester;
|
import org.apache.wicket.util.tester.WicketTester;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
@ -50,6 +49,7 @@ import se.su.dsv.scipro.data.dao.interfaces.WorkerDataDao;
|
|||||||
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
|
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
import se.su.dsv.scipro.data.dataobjects.User;
|
import se.su.dsv.scipro.data.dataobjects.User;
|
||||||
|
import se.su.dsv.scipro.json.DefaultUserLookupFromUsername;
|
||||||
import se.su.dsv.scipro.peer.data.dao.controllers.PeerPortalController;
|
import se.su.dsv.scipro.peer.data.dao.controllers.PeerPortalController;
|
||||||
import se.su.dsv.scipro.peer.data.dao.interfaces.PeerRequestDao;
|
import se.su.dsv.scipro.peer.data.dao.interfaces.PeerRequestDao;
|
||||||
import se.su.dsv.scipro.peer.data.dao.interfaces.PeerReviewDao;
|
import se.su.dsv.scipro.peer.data.dao.interfaces.PeerReviewDao;
|
||||||
@ -104,6 +104,7 @@ public abstract class BaseWicketTest {
|
|||||||
@Mock ProjectPartnerDao projectPartnerDao;
|
@Mock ProjectPartnerDao projectPartnerDao;
|
||||||
@Mock WebNotificationDao webNotificationDao;
|
@Mock WebNotificationDao webNotificationDao;
|
||||||
@Mock NotificationController notificationController;
|
@Mock NotificationController notificationController;
|
||||||
|
@Mock DefaultUserLookupFromUsername userLookupFromUsername;
|
||||||
|
|
||||||
@Mock ApplicationSettings applicationSettings;
|
@Mock ApplicationSettings applicationSettings;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user