Set the application to check for a JNDI datasource first, and use that if it exists (to be able to configure a datasource on the servers instead of in code)
Added Maven profiles: - DEV for regular development (wicket in 'development' mode, SQL statements logged) - TEST for deploying to test server (Wicket in 'deployment', SQL statements logged) - PROD for production (Wicket in deployment, no SQL logging)
This commit is contained in:
parent
758cb138bc
commit
90c86d81eb
869
pom.xml
869
pom.xml
@ -1,417 +1,452 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>se.su.dsv</groupId>
|
||||
<artifactId>SciPro</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>Wicket Spring JPA</name>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jboss</id>
|
||||
<name>JBoss Repository</name>
|
||||
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>wiquery repository</id>
|
||||
<name>wiQuery repository</name>
|
||||
<url>http://wiquery.googlecode.com/svn/repo/</url>
|
||||
<layout>default</layout>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<!-- WICKET DEPENDENCIES -->
|
||||
<dependency>
|
||||
<groupId>org.apache.wicket</groupId>
|
||||
<artifactId>wicket</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.wicket</groupId>
|
||||
<artifactId>wicket-spring</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
</dependency>
|
||||
<!-- Servlet API, needed for compilation. -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Apache commons -->
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
<!-- LOGGING DEPENDENCIES - LOG4J -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- since we want the jcl over slf4j, we need to bump up the version of
|
||||
slf4j-api that wicket brings in -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
<version>1.8.0.10</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.13</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Deps -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-orm</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-dbcp</groupId>
|
||||
<artifactId>commons-dbcp</artifactId>
|
||||
<version>1.4</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- JPA -->
|
||||
<!-- Hibernate impl -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-entitymanager</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jetty</artifactId>
|
||||
<version>${jetty.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>1.8.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-c3p0</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-ehcache</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Jackrabbit dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-core</artifactId>
|
||||
<version>2.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.jcr</groupId>
|
||||
<artifactId>jcr</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>eu.medsea.mimeutil</groupId>
|
||||
<artifactId>mime-util</artifactId>
|
||||
<version>2.1.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Additional dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.apache.wicket</groupId>
|
||||
<artifactId>wicket-extensions</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.odlabs.wiquery</groupId>
|
||||
<artifactId>wiquery</artifactId>
|
||||
<version>${wiquery.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wicketstuff</groupId>
|
||||
<artifactId>minis</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.wicket</groupId>
|
||||
<artifactId>wicket-datetime</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wicketstuff</groupId>
|
||||
<artifactId>objectautocomplete</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>4.1.0.Final</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>1.0.0.GA</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>biz.source_code</groupId>
|
||||
<artifactId>base64coder</artifactId>
|
||||
<version>2010-09-21</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Library with wicket components -->
|
||||
<dependency>
|
||||
<groupId>org.wamblee</groupId>
|
||||
<artifactId>wamblee-wicket-components</artifactId>
|
||||
<version>0.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- GUI test dependencies -->
|
||||
|
||||
<dependency>
|
||||
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.visural</groupId>
|
||||
<artifactId>visural-common</artifactId>
|
||||
<version>0.4.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.visural</groupId>
|
||||
<artifactId>visural-wicket</artifactId>
|
||||
<version>0.6.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>se.su.dsv</groupId>
|
||||
<artifactId>wicket-components</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>src/test/java</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</testResource>
|
||||
</testResources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.10</version>
|
||||
<configuration>
|
||||
<argLine>-Xmx512m</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<version>2.3.2</version>
|
||||
<inherited>true</inherited>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>${jetty.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<configuration>
|
||||
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!--
|
||||
<!– Used for deploying directly from Maven/Eclipse –>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.cargo</groupId>
|
||||
<artifactId>cargo-maven2-plugin</artifactId>
|
||||
<version>1.1.4</version>
|
||||
<configuration>
|
||||
<!– Container configuration –>
|
||||
<container>
|
||||
<containerId>tomcat6x</containerId>
|
||||
<type>remote</type>
|
||||
</container>
|
||||
|
||||
<!– Configuration to use with the Container –>
|
||||
<configuration>
|
||||
|
||||
<type>runtime</type>
|
||||
<properties>
|
||||
<cargo.tomcat.manager.url>https://thesis.dsv.su.se/manager</cargo.tomcat.manager.url>
|
||||
<cargo.remote.username>janne</cargo.remote.username>
|
||||
<cargo.remote.password>Lai2xoo6</cargo.remote.password>
|
||||
</properties>
|
||||
</configuration>
|
||||
|
||||
<!– Deployer configuration –>
|
||||
<deployer>
|
||||
<type>remote</type>
|
||||
<deployables>
|
||||
<deployable>
|
||||
<groupId>se.su.dsv</groupId>
|
||||
<artifactId>SciPro</artifactId>
|
||||
<type>war</type>
|
||||
</deployable>
|
||||
</deployables>
|
||||
</deployer>
|
||||
|
||||
</configuration>
|
||||
|
||||
</plugin>
|
||||
-->
|
||||
</plugins>
|
||||
|
||||
<finalName>scipro2</finalName>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
<wicket.version>1.4.17</wicket.version>
|
||||
<wiquery.version>1.2.4</wiquery.version>
|
||||
<jetty.version>6.1.25</jetty.version>
|
||||
<hibernate.version>3.5.1-Final</hibernate.version>
|
||||
<org.springframework.version>3.0.5.RELEASE</org.springframework.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>se.su.dsv</groupId>
|
||||
<artifactId>SciPro</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>Wicket Spring JPA</name>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jboss</id>
|
||||
<name>JBoss Repository</name>
|
||||
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>wiquery repository</id>
|
||||
<name>wiQuery repository</name>
|
||||
<url>http://wiquery.googlecode.com/svn/repo/</url>
|
||||
<layout>default</layout>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<!-- WICKET DEPENDENCIES -->
|
||||
<dependency>
|
||||
<groupId>org.apache.wicket</groupId>
|
||||
<artifactId>wicket</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.wicket</groupId>
|
||||
<artifactId>wicket-spring</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
</dependency>
|
||||
<!-- Servlet API, needed for compilation. -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Apache commons -->
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
<!-- LOGGING DEPENDENCIES - LOG4J -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- since we want the jcl over slf4j, we need to bump up the version of
|
||||
slf4j-api that wicket brings in -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
<version>1.8.0.10</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.13</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Deps -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-orm</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-dbcp</groupId>
|
||||
<artifactId>commons-dbcp</artifactId>
|
||||
<version>1.4</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- JPA -->
|
||||
<!-- Hibernate impl -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-entitymanager</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jetty</artifactId>
|
||||
<version>${jetty.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>1.8.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-c3p0</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-ehcache</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Jackrabbit dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-core</artifactId>
|
||||
<version>2.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.jcr</groupId>
|
||||
<artifactId>jcr</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>eu.medsea.mimeutil</groupId>
|
||||
<artifactId>mime-util</artifactId>
|
||||
<version>2.1.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Additional dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.apache.wicket</groupId>
|
||||
<artifactId>wicket-extensions</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.odlabs.wiquery</groupId>
|
||||
<artifactId>wiquery</artifactId>
|
||||
<version>${wiquery.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wicketstuff</groupId>
|
||||
<artifactId>minis</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.wicket</groupId>
|
||||
<artifactId>wicket-datetime</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wicketstuff</groupId>
|
||||
<artifactId>objectautocomplete</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>4.1.0.Final</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>1.0.0.GA</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>biz.source_code</groupId>
|
||||
<artifactId>base64coder</artifactId>
|
||||
<version>2010-09-21</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Library with wicket components -->
|
||||
<dependency>
|
||||
<groupId>org.wamblee</groupId>
|
||||
<artifactId>wamblee-wicket-components</artifactId>
|
||||
<version>0.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- GUI test dependencies -->
|
||||
|
||||
<dependency>
|
||||
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.visural</groupId>
|
||||
<artifactId>visural-common</artifactId>
|
||||
<version>0.4.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.visural</groupId>
|
||||
<artifactId>visural-wicket</artifactId>
|
||||
<version>0.6.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>se.su.dsv</groupId>
|
||||
<artifactId>wicket-components</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>src/test/java</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<filtering>true</filtering>
|
||||
<directory>src/test/resources</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</testResource>
|
||||
</testResources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.10</version>
|
||||
<configuration>
|
||||
<argLine>-Xmx512m</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<version>2.3.2</version>
|
||||
<inherited>true</inherited>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>${jetty.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<configuration>
|
||||
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!--
|
||||
<!– Used for deploying directly from Maven/Eclipse –>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.cargo</groupId>
|
||||
<artifactId>cargo-maven2-plugin</artifactId>
|
||||
<version>1.1.4</version>
|
||||
<configuration>
|
||||
<!– Container configuration –>
|
||||
<container>
|
||||
<containerId>tomcat6x</containerId>
|
||||
<type>remote</type>
|
||||
</container>
|
||||
|
||||
<!– Configuration to use with the Container –>
|
||||
<configuration>
|
||||
|
||||
<type>runtime</type>
|
||||
<properties>
|
||||
<cargo.tomcat.manager.url>https://thesis.dsv.su.se/manager</cargo.tomcat.manager.url>
|
||||
<cargo.remote.username>janne</cargo.remote.username>
|
||||
<cargo.remote.password>Lai2xoo6</cargo.remote.password>
|
||||
</properties>
|
||||
</configuration>
|
||||
|
||||
<!– Deployer configuration –>
|
||||
<deployer>
|
||||
<type>remote</type>
|
||||
<deployables>
|
||||
<deployable>
|
||||
<groupId>se.su.dsv</groupId>
|
||||
<artifactId>SciPro</artifactId>
|
||||
<type>war</type>
|
||||
</deployable>
|
||||
</deployables>
|
||||
</deployer>
|
||||
|
||||
</configuration>
|
||||
|
||||
</plugin>
|
||||
-->
|
||||
</plugins>
|
||||
<finalName>scipro2</finalName>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
<wicket.version>1.4.17</wicket.version>
|
||||
<wiquery.version>1.2.4</wiquery.version>
|
||||
<jetty.version>6.1.25</jetty.version>
|
||||
<hibernate.version>3.5.1-Final</hibernate.version>
|
||||
<org.springframework.version>3.0.5.RELEASE</org.springframework.version>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>DEV</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<database.showSql>true</database.showSql>
|
||||
<database.generateDdl>true</database.generateDdl>
|
||||
<wicket.mode>development</wicket.mode>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>TEST</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<database.showSql>true</database.showSql>
|
||||
<database.generateDdl>true</database.generateDdl>
|
||||
<wicket.mode>deployment</wicket.mode>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>PROD</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<database.showSql>false</database.showSql>
|
||||
<database.generateDdl>false</database.generateDdl>
|
||||
<wicket.mode>deployment</wicket.mode>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
@ -1,430 +1,383 @@
|
||||
package se.su.dsv.scipro;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.wicket.Page;
|
||||
import org.apache.wicket.Request;
|
||||
import org.apache.wicket.RequestCycle;
|
||||
import org.apache.wicket.ResourceReference;
|
||||
import org.apache.wicket.Response;
|
||||
import org.apache.wicket.Session;
|
||||
import org.apache.wicket.WicketRuntimeException;
|
||||
import org.apache.wicket.authorization.strategies.CompoundAuthorizationStrategy;
|
||||
import org.apache.wicket.protocol.http.WebApplication;
|
||||
import org.apache.wicket.protocol.http.WebRequest;
|
||||
import org.apache.wicket.protocol.http.WebRequestCycle;
|
||||
import org.apache.wicket.settings.IExceptionSettings;
|
||||
import org.apache.wicket.util.string.Strings;
|
||||
import org.odlabs.wiquery.ui.themes.IThemableApplication;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
import se.su.dsv.scipro.activityplan.pages.ProjectActivityPlanPage;
|
||||
import se.su.dsv.scipro.activityplan.pages.SupervisorActivityPlanPage;
|
||||
import se.su.dsv.scipro.admin.pages.AdminCheckListPage;
|
||||
import se.su.dsv.scipro.admin.pages.AdminFinalSeminarPage;
|
||||
import se.su.dsv.scipro.admin.pages.AdminPeerListPage;
|
||||
import se.su.dsv.scipro.admin.pages.AdminProjectPartnerPage;
|
||||
import se.su.dsv.scipro.admin.pages.AdminRolePage;
|
||||
import se.su.dsv.scipro.admin.pages.AdminScheduleTemplatesEditorPage;
|
||||
import se.su.dsv.scipro.admin.pages.AdminScheduleTemplatesPage;
|
||||
import se.su.dsv.scipro.admin.pages.AdminStartPage;
|
||||
import se.su.dsv.scipro.admin.pages.ProjectManagementPage;
|
||||
import se.su.dsv.scipro.admin.pages.SystemMaintenancePage;
|
||||
import se.su.dsv.scipro.admin.pages.settings.AdminFinalSeminarSettingsPage;
|
||||
import se.su.dsv.scipro.admin.pages.settings.AdminFinalSeminarSettingsPerProjectClassPage;
|
||||
import se.su.dsv.scipro.admin.pages.settings.AdminGeneralSettingsPage;
|
||||
import se.su.dsv.scipro.admin.pages.settings.AdminPeerSettingsPage;
|
||||
import se.su.dsv.scipro.admin.pages.settings.AdminServerEnvironmentSettingsPage;
|
||||
import se.su.dsv.scipro.basepages.DemoPage;
|
||||
import se.su.dsv.scipro.basepages.errorpages.AccessDeniedPage;
|
||||
import se.su.dsv.scipro.basepages.errorpages.CustomErrorPageFactory;
|
||||
import se.su.dsv.scipro.basepages.errorpages.InternalErrorPage;
|
||||
import se.su.dsv.scipro.basepages.errorpages.NotFoundPage;
|
||||
import se.su.dsv.scipro.basepages.errorpages.PageExpiredPage;
|
||||
import se.su.dsv.scipro.conference.pages.ProjectConferencePage;
|
||||
import se.su.dsv.scipro.conference.pages.SupervisorConferencePage;
|
||||
import se.su.dsv.scipro.exceptions.RenderingSafeException;
|
||||
import se.su.dsv.scipro.json.pages.JsonDeletePrivateMessagePage;
|
||||
import se.su.dsv.scipro.json.pages.JsonDeleteRecipientPage;
|
||||
import se.su.dsv.scipro.json.pages.JsonLoginPage;
|
||||
import se.su.dsv.scipro.json.pages.JsonMessagePage;
|
||||
import se.su.dsv.scipro.json.pages.JsonMessagePageCountUnread;
|
||||
import se.su.dsv.scipro.json.pages.JsonNewMessagePage;
|
||||
import se.su.dsv.scipro.json.pages.JsonProjectForSupervisorPage;
|
||||
import se.su.dsv.scipro.json.pages.JsonSentMessagePage;
|
||||
import se.su.dsv.scipro.json.pages.JsonSetReadPage;
|
||||
import se.su.dsv.scipro.json.pages.JsonSetStatusPage;
|
||||
import se.su.dsv.scipro.json.pages.JsonStatusPage;
|
||||
import se.su.dsv.scipro.loginlogout.pages.LoginPage;
|
||||
import se.su.dsv.scipro.loginlogout.pages.LogoutPage;
|
||||
import se.su.dsv.scipro.message.pages.PrivateMessagesPage;
|
||||
import se.su.dsv.scipro.peer.pages.AdminPeerReviewPage;
|
||||
import se.su.dsv.scipro.peer.pages.PeerRequestSubmissionPage;
|
||||
import se.su.dsv.scipro.peer.pages.ProjectPeerPortalPage;
|
||||
import se.su.dsv.scipro.peer.pages.ProjectPeerReviewGuidePage;
|
||||
import se.su.dsv.scipro.peer.pages.ProjectPeerReviewPage;
|
||||
import se.su.dsv.scipro.peer.pages.ProjectPeerStatsPage;
|
||||
import se.su.dsv.scipro.peer.pages.SupervisorPeerPortalPage;
|
||||
import se.su.dsv.scipro.peer.pages.SupervisorPeerReviewGuidePage;
|
||||
import se.su.dsv.scipro.peer.pages.SupervisorPeerReviewPage;
|
||||
import se.su.dsv.scipro.peer.pages.SupervisorPeerStatsPage;
|
||||
import se.su.dsv.scipro.project.pages.FinalSeminarProjectListPage;
|
||||
import se.su.dsv.scipro.project.pages.NoActiveProjectPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectChecklistPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectFilePage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectIdeaPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectIdeaSubmissionPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectOppositionPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectStartPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectViewCheckListPage;
|
||||
import se.su.dsv.scipro.repository.RepositoryApplication;
|
||||
import se.su.dsv.scipro.repository.pages.RepositoryDownloadPage;
|
||||
import se.su.dsv.scipro.repository.pages.SysAdminFilePage;
|
||||
import se.su.dsv.scipro.schedule.templates.pages.ScheduleTemplateDetailsPage;
|
||||
import se.su.dsv.scipro.security.auth.ComponentSecurityLogger;
|
||||
import se.su.dsv.scipro.security.auth.ExternalAuthenticationRequestHelper;
|
||||
import se.su.dsv.scipro.security.auth.MetaDataActionStrategy;
|
||||
import se.su.dsv.scipro.security.auth.RoleBasedAuthorizationStrategy;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorAddCheckListToProjectPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorAntiPlagiarismLinkPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorChecklistPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorFilePage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorFinalSeminarListingPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorProfilePage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorProjectDetailsPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorProjectsFinalSeminarPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorScheduleTemplatesEditorPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorScheduleTemplatesPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorStartPage;
|
||||
import se.su.dsv.scipro.supervisor.pages.SupervisorViewCheckListPage;
|
||||
import se.su.dsv.scipro.wiquery.themes.ThemeResourceReference;
|
||||
|
||||
/**
|
||||
* Application object for your web application. If you want to run this application without deploying, run the Start class.
|
||||
*
|
||||
* @see wicket.myproject.Start#main(String[])
|
||||
*
|
||||
* @author Martin Peters - mpeters@dsv.su.se
|
||||
*
|
||||
*/
|
||||
|
||||
public class SciProApplication extends RepositoryApplication implements IThemableApplication {
|
||||
|
||||
/*
|
||||
* These strings points to the location of the kerberos configuration files
|
||||
*/
|
||||
private final String jaasPath = "/WEB-INF/classes/jaas.conf";
|
||||
private final String krb5Path = "/WEB-INF/classes/kerb5.conf";
|
||||
|
||||
//private Scheduler scheduler = null;
|
||||
|
||||
/*
|
||||
* A string setable in the sys-admin settings page that displays for example a system takedown notice
|
||||
*/
|
||||
private String systemNotice = null;
|
||||
|
||||
/**
|
||||
* Logger instance.
|
||||
*/
|
||||
private Logger logger = Logger.getLogger(SciProApplication.class);
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public SciProApplication()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
|
||||
setKerberosConfigs();
|
||||
|
||||
getMarkupSettings().setCompressWhitespace(true);
|
||||
getMarkupSettings().setStripComments(true);
|
||||
getMarkupSettings().setStripWicketTags(true);
|
||||
getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
|
||||
getRequestCycleSettings().setResponseRequestEncoding("UTF-8");
|
||||
|
||||
/*
|
||||
* Unknown pages
|
||||
*/
|
||||
mountBookmarkablePage("inbox", PrivateMessagesPage.class);
|
||||
mountBookmarkablePage("repository/download", RepositoryDownloadPage.class);
|
||||
|
||||
/*
|
||||
* Root pages
|
||||
*/
|
||||
mountBookmarkablePage("login", LoginPage.class);
|
||||
mountBookmarkablePage("logout", LogoutPage.class);
|
||||
mountBookmarkablePage("demo", DemoPage.class);
|
||||
|
||||
/*
|
||||
* Pop-up pages
|
||||
*/
|
||||
mountBookmarkablePage("templates/details", ScheduleTemplateDetailsPage.class);
|
||||
|
||||
/*
|
||||
* JSON pages
|
||||
*/
|
||||
mountBookmarkablePage("json/project", JsonProjectForSupervisorPage.class);
|
||||
mountBookmarkablePage("json/message", JsonMessagePage.class);
|
||||
mountBookmarkablePage("json/message/unread", JsonMessagePageCountUnread.class);
|
||||
mountBookmarkablePage("json/message/setread", JsonSetReadPage.class);
|
||||
mountBookmarkablePage("json/message/deleterecipient", JsonDeleteRecipientPage.class);
|
||||
mountBookmarkablePage("json/message/deleteprivatemessage", JsonDeletePrivateMessagePage.class);
|
||||
mountBookmarkablePage("json/message/newmessage", JsonNewMessagePage.class);
|
||||
mountBookmarkablePage("json/message/sentmessages", JsonSentMessagePage.class);
|
||||
mountBookmarkablePage("json/login", JsonLoginPage.class);
|
||||
mountBookmarkablePage("json/status", JsonStatusPage.class);
|
||||
mountBookmarkablePage("json/setstatus", JsonSetStatusPage.class);
|
||||
|
||||
/*
|
||||
* Admin pages
|
||||
*/
|
||||
mountBookmarkablePage("admin/start", AdminStartPage.class);
|
||||
mountBookmarkablePage("admin/templates", AdminScheduleTemplatesPage.class);
|
||||
mountBookmarkablePage("admin/templates/editor", AdminScheduleTemplatesEditorPage.class);
|
||||
mountBookmarkablePage("admin/maintenance", SystemMaintenancePage.class);
|
||||
mountBookmarkablePage("admin/project", ProjectManagementPage.class);
|
||||
mountBookmarkablePage("admin/files", SysAdminFilePage.class);
|
||||
mountBookmarkablePage("admin/allfinalseminars", AdminFinalSeminarPage.class);
|
||||
mountBookmarkablePage("admin/settings", AdminGeneralSettingsPage.class);
|
||||
mountBookmarkablePage("admin/settings/serverenvironment", AdminServerEnvironmentSettingsPage.class);
|
||||
mountBookmarkablePage("admin/settings/finalseminargeneralsettings", AdminFinalSeminarSettingsPage.class);
|
||||
mountBookmarkablePage("admin/settings/finalseminarprojectlevel", AdminFinalSeminarSettingsPerProjectClassPage.class);
|
||||
mountBookmarkablePage("admin/settings/peer", AdminPeerSettingsPage.class);
|
||||
mountBookmarkablePage("admin/roles", AdminRolePage.class);
|
||||
mountBookmarkablePage("admin/allpeers", AdminPeerListPage.class);
|
||||
mountBookmarkablePage("admin/peer/review", AdminPeerReviewPage.class);
|
||||
mountBookmarkablePage("admin/projectpartner", AdminProjectPartnerPage.class);
|
||||
mountBookmarkablePage("admin/checklist", AdminCheckListPage.class);
|
||||
|
||||
/*
|
||||
* Project pages
|
||||
*/
|
||||
mountBookmarkablePage("project/conference", ProjectConferencePage.class);
|
||||
mountBookmarkablePage("project/activityplan", ProjectActivityPlanPage.class);
|
||||
mountBookmarkablePage("project/files", ProjectFilePage.class);
|
||||
mountBookmarkablePage("project/opposition", ProjectOppositionPage.class);
|
||||
mountBookmarkablePage("project/allfinalseminars", FinalSeminarProjectListPage.class);
|
||||
mountBookmarkablePage("project", ProjectStartPage.class);
|
||||
mountBookmarkablePage("noproject", NoActiveProjectPage.class);
|
||||
mountBookmarkablePage("project/checklist", ProjectChecklistPage.class);
|
||||
mountBookmarkablePage("project/checklist/viewchecklist", ProjectViewCheckListPage.class);
|
||||
mountBookmarkablePage("projectideas", ProjectIdeaPage.class);
|
||||
mountBookmarkablePage("projectideas/submit", ProjectIdeaSubmissionPage.class);
|
||||
/*
|
||||
* Supervisor pages
|
||||
*/
|
||||
mountBookmarkablePage("supervisor", SupervisorStartPage.class);
|
||||
mountBookmarkablePage("supervisor/finalseminars", SupervisorProjectsFinalSeminarPage.class);
|
||||
mountBookmarkablePage("supervisor/allfinalseminars", SupervisorFinalSeminarListingPage.class);
|
||||
mountBookmarkablePage("supervisor/templates/editor", SupervisorScheduleTemplatesEditorPage.class);
|
||||
mountBookmarkablePage("supervisor/templates", SupervisorScheduleTemplatesPage.class);
|
||||
mountBookmarkablePage("supervisor/project/details", SupervisorProjectDetailsPage.class);
|
||||
mountBookmarkablePage("supervisor/project/details/checklist", SupervisorChecklistPage.class);
|
||||
mountBookmarkablePage("supervisor/project/details/addchecklist", SupervisorAddCheckListToProjectPage.class);
|
||||
mountBookmarkablePage("supervisor/antiplagiarism", SupervisorAntiPlagiarismLinkPage.class);
|
||||
mountBookmarkablePage("supervisor/conference", SupervisorConferencePage.class);
|
||||
mountBookmarkablePage("supervisor/checklist", SupervisorChecklistPage.class);
|
||||
mountBookmarkablePage("supervisor/checklist/viewchecklist", SupervisorViewCheckListPage.class);
|
||||
mountBookmarkablePage("supervisor/profile", SupervisorProfilePage.class);
|
||||
mountBookmarkablePage("supervisor/project/activityplan", SupervisorActivityPlanPage.class);
|
||||
mountBookmarkablePage("supervisor/project/files", SupervisorFilePage.class);
|
||||
/*
|
||||
* Peer pages
|
||||
*/
|
||||
//project
|
||||
mountBookmarkablePage("project/peer/request", PeerRequestSubmissionPage.class);
|
||||
mountBookmarkablePage("project/peer", ProjectPeerPortalPage.class);
|
||||
//When mounted, traffic light images is not working. Needs further work.
|
||||
mountBookmarkablePage("project/peer/review", ProjectPeerReviewPage.class);
|
||||
mountBookmarkablePage("project/peer/stats", ProjectPeerStatsPage.class);
|
||||
mountBookmarkablePage("project/peer/reviewguide", ProjectPeerReviewGuidePage.class);
|
||||
//supervisor
|
||||
mountBookmarkablePage("supervisor/peer", SupervisorPeerPortalPage.class);
|
||||
mountBookmarkablePage("supervisor/peer/stats", SupervisorPeerStatsPage.class);
|
||||
mountBookmarkablePage("supervisor/peer/review", SupervisorPeerReviewPage.class);
|
||||
mountBookmarkablePage("supervisor/peer/reviewguide", SupervisorPeerReviewGuidePage.class);
|
||||
|
||||
/*
|
||||
* Error pages, mounted mostly for testing purposes
|
||||
*/
|
||||
mountBookmarkablePage("404", NotFoundPage.class);
|
||||
mountBookmarkablePage("403", AccessDeniedPage.class);
|
||||
mountBookmarkablePage("500", InternalErrorPage.class);
|
||||
mountBookmarkablePage("page_expired_error",PageExpiredPage.class);
|
||||
getApplicationSettings().setAccessDeniedPage(AccessDeniedPage.class);
|
||||
getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);
|
||||
getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
|
||||
getApplicationSettings().setPageExpiredErrorPage(PageExpiredPage.class);
|
||||
|
||||
/*
|
||||
* Set up automatic injection for instanced components.
|
||||
*/
|
||||
addComponentInstantiationListener(getSpringInjector());
|
||||
|
||||
/*
|
||||
* Set up authorization strategies for local authentication.
|
||||
*/
|
||||
CompoundAuthorizationStrategy cas = new CompoundAuthorizationStrategy();
|
||||
cas.add(new RoleBasedAuthorizationStrategy());
|
||||
cas.add(new MetaDataActionStrategy());
|
||||
getSecuritySettings().setAuthorizationStrategy(cas);
|
||||
|
||||
//getResourceSettings().setThrowExceptionOnMissingResource(false);
|
||||
//getResourceSettings().addStringResourceLoader(new JpaStringResourceLoader());
|
||||
getResourceSettings().addStringResourceLoader(new NotificationLoader());
|
||||
getSecuritySettings().setUnauthorizedComponentInstantiationListener(new ComponentSecurityLogger());
|
||||
|
||||
/*
|
||||
* Passing the applicationContext on to workerthreads-scheduler via SchedulerServletContextListener defined in web.xml
|
||||
*/
|
||||
WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
|
||||
getServletContext().setAttribute("org.springframework.web.context.WebApplicationContext", ctx);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void setKerberosConfigs(){
|
||||
javax.servlet.ServletContext context = getServletContext();
|
||||
Set<String> resources = context.getResourcePaths("/WEB-INF/classes/");
|
||||
if(!resources.contains(jaasPath) || !resources.contains(krb5Path)){
|
||||
logger.log(Level.FATAL, "Path to authentication config files not correct. " +
|
||||
"Users will not be able to log in!");
|
||||
} else {
|
||||
String jaasRealPath = context.getRealPath(jaasPath);
|
||||
String krb5RealPath = context.getRealPath(krb5Path);
|
||||
logger.log(Level.INFO, "Setting location of jaas.conf to " + jaasRealPath);
|
||||
logger.log(Level.INFO, "Setting location of kerb5.conf to " + krb5RealPath);
|
||||
System.setProperty("java.security.auth.login.config", jaasRealPath);
|
||||
System.setProperty("java.security.krb5.conf", krb5RealPath);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
//scheduler.stopWorking();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.wicket.Application#getHomePage()
|
||||
*/
|
||||
@Override
|
||||
public Class<? extends Page> getHomePage() {
|
||||
|
||||
if (SciProSession.get().authorizedForRole(Roles.SYSADMIN) && SciProSession.get().hasActualRole(Roles.SYSADMIN)){
|
||||
return AdminStartPage.class;
|
||||
}
|
||||
else if (SciProSession.get().authorizedForRole(Roles.ADMIN) && SciProSession.get().hasActualRole(Roles.ADMIN)){
|
||||
return AdminStartPage.class;
|
||||
}
|
||||
else if (SciProSession.get().authorizedForRole(Roles.EMPLOYEE) && SciProSession.get().hasActualRole(Roles.EMPLOYEE)){
|
||||
return SupervisorStartPage.class;
|
||||
}
|
||||
else if (SciProSession.get().authorizedForRole(Roles.STUDENT) && SciProSession.get().hasActualRole(Roles.STUDENT)){
|
||||
return ProjectStartPage.class;
|
||||
}
|
||||
else {
|
||||
return HomePage.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Session newSession(Request request, Response response) {
|
||||
return new SciProSession(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebRequest newWebRequest(final HttpServletRequest request){
|
||||
final WebRequest webRequest = super.newWebRequest(request);
|
||||
if(attemptExternalAuthentication(webRequest)){
|
||||
logger.debug("External authentication used successfully");
|
||||
}
|
||||
return webRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides standard request cycle procedures to support custom error pages based on the exception type.
|
||||
* See CustomErrorPageFactory, RenderingSafeException and CustomErrorPage for more information.
|
||||
* Other exceptions (ie: non RenderingSafeException sub types) are sent to a standard fallback page).
|
||||
*/
|
||||
@Override
|
||||
public RequestCycle newRequestCycle(Request request, Response response){
|
||||
return new WebRequestCycle(this, (WebRequest)request, response){
|
||||
@Override
|
||||
public Page onRuntimeException(Page page, RuntimeException e){
|
||||
Throwable cause = e;
|
||||
if(cause instanceof WicketRuntimeException)
|
||||
cause = cause.getCause();
|
||||
if(cause instanceof InvocationTargetException)
|
||||
cause = cause.getCause();
|
||||
if(cause instanceof RenderingSafeException){
|
||||
return new CustomErrorPageFactory().dispatch((RenderingSafeException)cause);
|
||||
}
|
||||
getSession().error(Strings.toString(e));
|
||||
return super.onRuntimeException(page,e);
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Private utility, just to keep stuff out of the calling method.
|
||||
* In short: scan incoming request for REMOTE_USER, check for a session, create one if none exists, attempt authentication and return status.
|
||||
* @param usingRequest
|
||||
* @return true if external auth was completed, false if not.
|
||||
*/
|
||||
private boolean attemptExternalAuthentication(final WebRequest usingRequest){
|
||||
SciProSession session = (SciProSession)getSessionStore().lookup(usingRequest);
|
||||
final ExternalAuthenticationRequestHelper helper = new ExternalAuthenticationRequestHelper(usingRequest.getHttpServletRequest());
|
||||
if(helper.isExternalAuthSupported()){//Attempt external auth
|
||||
if(session == null){//Can't do this without a usable session, attempt manual bind
|
||||
getSessionStore().bind(usingRequest,new SciProSession(usingRequest));
|
||||
session = (SciProSession)getSessionStore().lookup(usingRequest);
|
||||
}
|
||||
if(session != null){
|
||||
if(session.isLoggedIn()){
|
||||
if(!helper.isRemoteUserValid(session.getUser())){//This check may not be needed and may hinder performance, but better safe than sorry for now.
|
||||
logger.debug("User is logged in as '"+session.getUser()+"', but conflicting info ('"+helper.getExternalAuthRemoteUser()+"') is supplied via external authentication protocols.");
|
||||
}
|
||||
}else{
|
||||
//logger.info("Attempting sign in with external auth data");
|
||||
if(!helper.signIn(session)){
|
||||
logger.error("User '"+helper.getExternalAuthRemoteUser()+"' passes external authentication but cannot be signed in.");
|
||||
}else{
|
||||
logger.debug("Signed in user '"+helper.getExternalAuthRemoteUser()+"' via external authentication");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
throw new IllegalStateException("External authentication was attempted, but no session was available for sign in.");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceReference getTheme(Session session) {
|
||||
return new ThemeResourceReference();
|
||||
}
|
||||
|
||||
public static SciProApplication get(){
|
||||
return (SciProApplication) WebApplication.get();
|
||||
}
|
||||
|
||||
public String getSystemNoticeString(){
|
||||
return systemNotice;
|
||||
}
|
||||
|
||||
public void setSystemNoticeString(String systemNotice){
|
||||
this.systemNotice = systemNotice;
|
||||
}
|
||||
}
|
||||
package se.su.dsv.scipro;
|
||||
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.wicket.*;
|
||||
import org.apache.wicket.authorization.strategies.CompoundAuthorizationStrategy;
|
||||
import org.apache.wicket.protocol.http.WebApplication;
|
||||
import org.apache.wicket.protocol.http.WebRequest;
|
||||
import org.apache.wicket.protocol.http.WebRequestCycle;
|
||||
import org.apache.wicket.settings.IExceptionSettings;
|
||||
import org.apache.wicket.util.string.Strings;
|
||||
import org.odlabs.wiquery.ui.themes.IThemableApplication;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
import se.su.dsv.scipro.activityplan.pages.ProjectActivityPlanPage;
|
||||
import se.su.dsv.scipro.activityplan.pages.SupervisorActivityPlanPage;
|
||||
import se.su.dsv.scipro.admin.pages.*;
|
||||
import se.su.dsv.scipro.admin.pages.settings.*;
|
||||
import se.su.dsv.scipro.basepages.DemoPage;
|
||||
import se.su.dsv.scipro.basepages.errorpages.*;
|
||||
import se.su.dsv.scipro.conference.pages.ProjectConferencePage;
|
||||
import se.su.dsv.scipro.conference.pages.SupervisorConferencePage;
|
||||
import se.su.dsv.scipro.exceptions.RenderingSafeException;
|
||||
import se.su.dsv.scipro.json.pages.*;
|
||||
import se.su.dsv.scipro.loginlogout.pages.LoginPage;
|
||||
import se.su.dsv.scipro.loginlogout.pages.LogoutPage;
|
||||
import se.su.dsv.scipro.message.pages.PrivateMessagesPage;
|
||||
import se.su.dsv.scipro.peer.pages.*;
|
||||
import se.su.dsv.scipro.project.pages.*;
|
||||
import se.su.dsv.scipro.repository.RepositoryApplication;
|
||||
import se.su.dsv.scipro.repository.pages.RepositoryDownloadPage;
|
||||
import se.su.dsv.scipro.repository.pages.SysAdminFilePage;
|
||||
import se.su.dsv.scipro.schedule.templates.pages.ScheduleTemplateDetailsPage;
|
||||
import se.su.dsv.scipro.security.auth.ComponentSecurityLogger;
|
||||
import se.su.dsv.scipro.security.auth.ExternalAuthenticationRequestHelper;
|
||||
import se.su.dsv.scipro.security.auth.MetaDataActionStrategy;
|
||||
import se.su.dsv.scipro.security.auth.RoleBasedAuthorizationStrategy;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
import se.su.dsv.scipro.supervisor.pages.*;
|
||||
import se.su.dsv.scipro.wiquery.themes.ThemeResourceReference;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Application object for your web application. If you want to run this application without deploying, run the Start class.
|
||||
*
|
||||
* @author Martin Peters - mpeters@dsv.su.se
|
||||
* @see wicket.myproject.Start#main(String[])
|
||||
*/
|
||||
@Component
|
||||
public class SciProApplication extends RepositoryApplication implements IThemableApplication {
|
||||
|
||||
/*
|
||||
* These strings points to the location of the kerberos configuration files
|
||||
*/
|
||||
private final String jaasPath = "/WEB-INF/classes/jaas.conf";
|
||||
private final String krb5Path = "/WEB-INF/classes/kerb5.conf";
|
||||
|
||||
//private Scheduler scheduler = null;
|
||||
|
||||
/*
|
||||
* A string setable in the sys-admin settings page that displays for example a system takedown notice
|
||||
*/
|
||||
private String systemNotice = null;
|
||||
|
||||
@Value ( "${wicket.mode}" )
|
||||
private String deploymentMode = DEVELOPMENT;
|
||||
|
||||
/**
|
||||
* Logger instance.
|
||||
*/
|
||||
private Logger logger = Logger.getLogger(SciProApplication.class);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public SciProApplication() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigurationType() {
|
||||
return deploymentMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
|
||||
setKerberosConfigs();
|
||||
|
||||
getMarkupSettings().setCompressWhitespace(true);
|
||||
getMarkupSettings().setStripComments(true);
|
||||
getMarkupSettings().setStripWicketTags(true);
|
||||
getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
|
||||
getRequestCycleSettings().setResponseRequestEncoding("UTF-8");
|
||||
|
||||
/*
|
||||
* Unknown pages
|
||||
*/
|
||||
mountBookmarkablePage("inbox", PrivateMessagesPage.class);
|
||||
mountBookmarkablePage("repository/download", RepositoryDownloadPage.class);
|
||||
|
||||
/*
|
||||
* Root pages
|
||||
*/
|
||||
mountBookmarkablePage("login", LoginPage.class);
|
||||
mountBookmarkablePage("logout", LogoutPage.class);
|
||||
mountBookmarkablePage("demo", DemoPage.class);
|
||||
|
||||
/*
|
||||
* Pop-up pages
|
||||
*/
|
||||
mountBookmarkablePage("templates/details", ScheduleTemplateDetailsPage.class);
|
||||
|
||||
/*
|
||||
* JSON pages
|
||||
*/
|
||||
mountBookmarkablePage("json/project", JsonProjectForSupervisorPage.class);
|
||||
mountBookmarkablePage("json/message", JsonMessagePage.class);
|
||||
mountBookmarkablePage("json/message/unread", JsonMessagePageCountUnread.class);
|
||||
mountBookmarkablePage("json/message/setread", JsonSetReadPage.class);
|
||||
mountBookmarkablePage("json/message/deleterecipient", JsonDeleteRecipientPage.class);
|
||||
mountBookmarkablePage("json/message/deleteprivatemessage", JsonDeletePrivateMessagePage.class);
|
||||
mountBookmarkablePage("json/message/newmessage", JsonNewMessagePage.class);
|
||||
mountBookmarkablePage("json/message/sentmessages", JsonSentMessagePage.class);
|
||||
mountBookmarkablePage("json/login", JsonLoginPage.class);
|
||||
mountBookmarkablePage("json/status", JsonStatusPage.class);
|
||||
mountBookmarkablePage("json/setstatus", JsonSetStatusPage.class);
|
||||
|
||||
/*
|
||||
* Admin pages
|
||||
*/
|
||||
mountBookmarkablePage("admin/start", AdminStartPage.class);
|
||||
mountBookmarkablePage("admin/templates", AdminScheduleTemplatesPage.class);
|
||||
mountBookmarkablePage("admin/templates/editor", AdminScheduleTemplatesEditorPage.class);
|
||||
mountBookmarkablePage("admin/maintenance", SystemMaintenancePage.class);
|
||||
mountBookmarkablePage("admin/project", ProjectManagementPage.class);
|
||||
mountBookmarkablePage("admin/files", SysAdminFilePage.class);
|
||||
mountBookmarkablePage("admin/allfinalseminars", AdminFinalSeminarPage.class);
|
||||
mountBookmarkablePage("admin/settings", AdminGeneralSettingsPage.class);
|
||||
mountBookmarkablePage("admin/settings/serverenvironment", AdminServerEnvironmentSettingsPage.class);
|
||||
mountBookmarkablePage("admin/settings/finalseminargeneralsettings", AdminFinalSeminarSettingsPage.class);
|
||||
mountBookmarkablePage("admin/settings/finalseminarprojectlevel", AdminFinalSeminarSettingsPerProjectClassPage.class);
|
||||
mountBookmarkablePage("admin/settings/peer", AdminPeerSettingsPage.class);
|
||||
mountBookmarkablePage("admin/roles", AdminRolePage.class);
|
||||
mountBookmarkablePage("admin/allpeers", AdminPeerListPage.class);
|
||||
mountBookmarkablePage("admin/peer/review", AdminPeerReviewPage.class);
|
||||
mountBookmarkablePage("admin/projectpartner", AdminProjectPartnerPage.class);
|
||||
mountBookmarkablePage("admin/checklist", AdminCheckListPage.class);
|
||||
|
||||
/*
|
||||
* Project pages
|
||||
*/
|
||||
mountBookmarkablePage("project/conference", ProjectConferencePage.class);
|
||||
mountBookmarkablePage("project/activityplan", ProjectActivityPlanPage.class);
|
||||
mountBookmarkablePage("project/files", ProjectFilePage.class);
|
||||
mountBookmarkablePage("project/opposition", ProjectOppositionPage.class);
|
||||
mountBookmarkablePage("project/allfinalseminars", FinalSeminarProjectListPage.class);
|
||||
mountBookmarkablePage("project", ProjectStartPage.class);
|
||||
mountBookmarkablePage("noproject", NoActiveProjectPage.class);
|
||||
mountBookmarkablePage("project/checklist", ProjectChecklistPage.class);
|
||||
mountBookmarkablePage("project/checklist/viewchecklist", ProjectViewCheckListPage.class);
|
||||
mountBookmarkablePage("projectideas", ProjectIdeaPage.class);
|
||||
mountBookmarkablePage("projectideas/submit", ProjectIdeaSubmissionPage.class);
|
||||
/*
|
||||
* Supervisor pages
|
||||
*/
|
||||
mountBookmarkablePage("supervisor", SupervisorStartPage.class);
|
||||
mountBookmarkablePage("supervisor/finalseminars", SupervisorProjectsFinalSeminarPage.class);
|
||||
mountBookmarkablePage("supervisor/allfinalseminars", SupervisorFinalSeminarListingPage.class);
|
||||
mountBookmarkablePage("supervisor/templates/editor", SupervisorScheduleTemplatesEditorPage.class);
|
||||
mountBookmarkablePage("supervisor/templates", SupervisorScheduleTemplatesPage.class);
|
||||
mountBookmarkablePage("supervisor/project/details", SupervisorProjectDetailsPage.class);
|
||||
mountBookmarkablePage("supervisor/project/details/checklist", SupervisorChecklistPage.class);
|
||||
mountBookmarkablePage("supervisor/project/details/addchecklist", SupervisorAddCheckListToProjectPage.class);
|
||||
mountBookmarkablePage("supervisor/antiplagiarism", SupervisorAntiPlagiarismLinkPage.class);
|
||||
mountBookmarkablePage("supervisor/conference", SupervisorConferencePage.class);
|
||||
mountBookmarkablePage("supervisor/checklist", SupervisorChecklistPage.class);
|
||||
mountBookmarkablePage("supervisor/checklist/viewchecklist", SupervisorViewCheckListPage.class);
|
||||
mountBookmarkablePage("supervisor/profile", SupervisorProfilePage.class);
|
||||
mountBookmarkablePage("supervisor/project/activityplan", SupervisorActivityPlanPage.class);
|
||||
mountBookmarkablePage("supervisor/project/files", SupervisorFilePage.class);
|
||||
/*
|
||||
* Peer pages
|
||||
*/
|
||||
//project
|
||||
mountBookmarkablePage("project/peer/request", PeerRequestSubmissionPage.class);
|
||||
mountBookmarkablePage("project/peer", ProjectPeerPortalPage.class);
|
||||
//When mounted, traffic light images is not working. Needs further work.
|
||||
mountBookmarkablePage("project/peer/review", ProjectPeerReviewPage.class);
|
||||
mountBookmarkablePage("project/peer/stats", ProjectPeerStatsPage.class);
|
||||
mountBookmarkablePage("project/peer/reviewguide", ProjectPeerReviewGuidePage.class);
|
||||
//supervisor
|
||||
mountBookmarkablePage("supervisor/peer", SupervisorPeerPortalPage.class);
|
||||
mountBookmarkablePage("supervisor/peer/stats", SupervisorPeerStatsPage.class);
|
||||
mountBookmarkablePage("supervisor/peer/review", SupervisorPeerReviewPage.class);
|
||||
mountBookmarkablePage("supervisor/peer/reviewguide", SupervisorPeerReviewGuidePage.class);
|
||||
|
||||
/*
|
||||
* Error pages, mounted mostly for testing purposes
|
||||
*/
|
||||
mountBookmarkablePage("404", NotFoundPage.class);
|
||||
mountBookmarkablePage("403", AccessDeniedPage.class);
|
||||
mountBookmarkablePage("500", InternalErrorPage.class);
|
||||
mountBookmarkablePage("page_expired_error", PageExpiredPage.class);
|
||||
getApplicationSettings().setAccessDeniedPage(AccessDeniedPage.class);
|
||||
getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);
|
||||
getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
|
||||
getApplicationSettings().setPageExpiredErrorPage(PageExpiredPage.class);
|
||||
|
||||
/*
|
||||
* Set up automatic injection for instanced components.
|
||||
*/
|
||||
addComponentInstantiationListener(getSpringInjector());
|
||||
|
||||
/*
|
||||
* Set up authorization strategies for local authentication.
|
||||
*/
|
||||
CompoundAuthorizationStrategy cas = new CompoundAuthorizationStrategy();
|
||||
cas.add(new RoleBasedAuthorizationStrategy());
|
||||
cas.add(new MetaDataActionStrategy());
|
||||
getSecuritySettings().setAuthorizationStrategy(cas);
|
||||
|
||||
//getResourceSettings().setThrowExceptionOnMissingResource(false);
|
||||
//getResourceSettings().addStringResourceLoader(new JpaStringResourceLoader());
|
||||
getResourceSettings().addStringResourceLoader(new NotificationLoader());
|
||||
getSecuritySettings().setUnauthorizedComponentInstantiationListener(new ComponentSecurityLogger());
|
||||
|
||||
/*
|
||||
* Passing the applicationContext on to workerthreads-scheduler via SchedulerServletContextListener defined in web.xml
|
||||
*/
|
||||
WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
|
||||
getServletContext().setAttribute("org.springframework.web.context.WebApplicationContext", ctx);
|
||||
}
|
||||
|
||||
@SuppressWarnings ( "unchecked" )
|
||||
protected void setKerberosConfigs() {
|
||||
javax.servlet.ServletContext context = getServletContext();
|
||||
Set<String> resources = context.getResourcePaths("/WEB-INF/classes/");
|
||||
if (!resources.contains(jaasPath) || !resources.contains(krb5Path)) {
|
||||
logger.log(Level.FATAL, "Path to authentication config files not correct. " +
|
||||
"Users will not be able to log in!");
|
||||
}
|
||||
else {
|
||||
String jaasRealPath = context.getRealPath(jaasPath);
|
||||
String krb5RealPath = context.getRealPath(krb5Path);
|
||||
logger.log(Level.INFO, "Setting location of jaas.conf to " + jaasRealPath);
|
||||
logger.log(Level.INFO, "Setting location of kerb5.conf to " + krb5RealPath);
|
||||
System.setProperty("java.security.auth.login.config", jaasRealPath);
|
||||
System.setProperty("java.security.krb5.conf", krb5RealPath);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
//scheduler.stopWorking();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.wicket.Application#getHomePage()
|
||||
*/
|
||||
@Override
|
||||
public Class<? extends Page> getHomePage() {
|
||||
|
||||
if (SciProSession.get().authorizedForRole(Roles.SYSADMIN) && SciProSession.get().hasActualRole(Roles.SYSADMIN)) {
|
||||
return AdminStartPage.class;
|
||||
}
|
||||
else if (SciProSession.get().authorizedForRole(Roles.ADMIN) && SciProSession.get().hasActualRole(Roles.ADMIN)) {
|
||||
return AdminStartPage.class;
|
||||
}
|
||||
else if (SciProSession.get().authorizedForRole(Roles.EMPLOYEE) && SciProSession.get().hasActualRole(Roles.EMPLOYEE)) {
|
||||
return SupervisorStartPage.class;
|
||||
}
|
||||
else if (SciProSession.get().authorizedForRole(Roles.STUDENT) && SciProSession.get().hasActualRole(Roles.STUDENT)) {
|
||||
return ProjectStartPage.class;
|
||||
}
|
||||
else {
|
||||
return HomePage.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Session newSession(Request request, Response response) {
|
||||
return new SciProSession(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebRequest newWebRequest(final HttpServletRequest request) {
|
||||
final WebRequest webRequest = super.newWebRequest(request);
|
||||
if (attemptExternalAuthentication(webRequest)) {
|
||||
logger.debug("External authentication used successfully");
|
||||
}
|
||||
return webRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides standard request cycle procedures to support custom error pages based on the exception type.
|
||||
* See CustomErrorPageFactory, RenderingSafeException and CustomErrorPage for more information.
|
||||
* Other exceptions (ie: non RenderingSafeException sub types) are sent to a standard fallback page).
|
||||
*/
|
||||
@Override
|
||||
public RequestCycle newRequestCycle(Request request, Response response) {
|
||||
return new WebRequestCycle(this, (WebRequest) request, response) {
|
||||
@Override
|
||||
public Page onRuntimeException(Page page, RuntimeException e) {
|
||||
Throwable cause = e;
|
||||
if (cause instanceof WicketRuntimeException) {
|
||||
cause = cause.getCause();
|
||||
}
|
||||
if (cause instanceof InvocationTargetException) {
|
||||
cause = cause.getCause();
|
||||
}
|
||||
if (cause instanceof RenderingSafeException) {
|
||||
return new CustomErrorPageFactory().dispatch((RenderingSafeException) cause);
|
||||
}
|
||||
getSession().error(Strings.toString(e));
|
||||
return super.onRuntimeException(page, e);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Private utility, just to keep stuff out of the calling method.
|
||||
* In short: scan incoming request for REMOTE_USER, check for a session, create one if none exists, attempt authentication and return status.
|
||||
*
|
||||
* @param usingRequest
|
||||
* @return true if external auth was completed, false if not.
|
||||
*/
|
||||
private boolean attemptExternalAuthentication(final WebRequest usingRequest) {
|
||||
SciProSession session = (SciProSession) getSessionStore().lookup(usingRequest);
|
||||
final ExternalAuthenticationRequestHelper helper = new ExternalAuthenticationRequestHelper(usingRequest.getHttpServletRequest());
|
||||
if (helper.isExternalAuthSupported()) {//Attempt external auth
|
||||
if (session == null) {//Can't do this without a usable session, attempt manual bind
|
||||
getSessionStore().bind(usingRequest, new SciProSession(usingRequest));
|
||||
session = (SciProSession) getSessionStore().lookup(usingRequest);
|
||||
}
|
||||
if (session != null) {
|
||||
if (session.isLoggedIn()) {
|
||||
if (!helper.isRemoteUserValid(session.getUser())) {//This check may not be needed and may hinder performance, but better safe than sorry for now.
|
||||
logger.debug("User is logged in as '" + session.getUser() + "', but conflicting info ('" + helper.getExternalAuthRemoteUser() + "') is supplied via external authentication protocols.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
//logger.info("Attempting sign in with external auth data");
|
||||
if (!helper.signIn(session)) {
|
||||
logger.error("User '" + helper.getExternalAuthRemoteUser() + "' passes external authentication but cannot be signed in.");
|
||||
}
|
||||
else {
|
||||
logger.debug("Signed in user '" + helper.getExternalAuthRemoteUser() + "' via external authentication");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException("External authentication was attempted, but no session was available for sign in.");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceReference getTheme(Session session) {
|
||||
return new ThemeResourceReference();
|
||||
}
|
||||
|
||||
public static SciProApplication get() {
|
||||
return (SciProApplication) WebApplication.get();
|
||||
}
|
||||
|
||||
public String getSystemNoticeString() {
|
||||
return systemNotice;
|
||||
}
|
||||
|
||||
public void setSystemNoticeString(String systemNotice) {
|
||||
this.systemNotice = systemNotice;
|
||||
}
|
||||
}
|
||||
|
@ -1,81 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
|
||||
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
|
||||
version="2.0">
|
||||
version="2.0">
|
||||
|
||||
<!-- NOTE THAT THERE ARE TWO PERSISTENCE UNITS, one default and one test
|
||||
used for either running or unit-tests -->
|
||||
<!-- NOTE THAT THERE ARE TWO PERSISTENCE UNITS, one default and one test
|
||||
used for either running or unit-tests -->
|
||||
|
||||
<!-- A JPA Persistence Unit -->
|
||||
<persistence-unit name="defaultPersistenceUnit"
|
||||
transaction-type="RESOURCE_LOCAL">
|
||||
<provider>org.hibernate.ejb.HibernatePersistence</provider>
|
||||
<properties>
|
||||
<!-- 2nd level cache -->
|
||||
<property name="hibernate.cache.provider_class"
|
||||
value="org.hibernate.cache.SingletonEhCacheProvider" />
|
||||
<property name="net.sf.ehcache.configurationResourceName"
|
||||
value="/ehcache.xml" />
|
||||
<property name="hibernate.cache.use_query_cache" value="true" />
|
||||
<property name="hibernate.cache.use_second_level_cache"
|
||||
value="true" />
|
||||
<property name="hibernate.generate_statistics" value="false" />
|
||||
<!-- DEVELOPMENT VARIABLE, REMOVE FOR PRODUCTION USE -->
|
||||
<property name="hibernate.hbm2ddl.auto" value="update" />
|
||||
<!-- production settings database -->
|
||||
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" />
|
||||
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"></property>
|
||||
<property name="hibernate.connection.url" value="jdbc:mysql://localhost/scipro"></property>
|
||||
<property name="hibernate.connection.username" value="scipro"></property>
|
||||
<property name="hibernate.connection.password" value="pighleef"></property>
|
||||
<property name="hibernate.connection.provider_class"
|
||||
value="org.hibernate.connection.C3P0ConnectionProvider"></property>
|
||||
<property name="hibernate.c3p0.min_size" value="3"></property>
|
||||
<property name="hibernate.c3p0.max_size" value="6"></property>
|
||||
<property name="hibernate.c3p0.timeout" value="1800"></property>
|
||||
<property name="hibernate.c3p0.acquire_increment" value="2"></property>
|
||||
<property name="hibernate.c3p0.idle_test_period" value="360"></property>
|
||||
<!-- A JPA Persistence Unit -->
|
||||
<persistence-unit name="defaultPersistenceUnit"
|
||||
transaction-type="RESOURCE_LOCAL">
|
||||
<properties>
|
||||
<!-- 2nd level cache -->
|
||||
<property name="hibernate.cache.provider_class"
|
||||
value="org.hibernate.cache.SingletonEhCacheProvider"/>
|
||||
<property name="net.sf.ehcache.configurationResourceName"
|
||||
value="/ehcache.xml"/>
|
||||
<property name="hibernate.cache.use_query_cache" value="true"/>
|
||||
<property name="hibernate.cache.use_second_level_cache"
|
||||
value="true"/>
|
||||
<property name="hibernate.generate_statistics" value="false"/>
|
||||
|
||||
<!-- <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"
|
||||
/> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="hibernate.connection.driver_class"
|
||||
value="org.hsqldb.jdbcDriver"></property> <property name="hibernate.connection.url"
|
||||
value="jdbc:hsqldb:mem:test"></property> <property name="hibernate.show_sql"
|
||||
value="false" /> <property name="hibernate.format_sql" value="true" /> -->
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
|
||||
<!-- A JPA Persistence Unit used for tests -->
|
||||
<persistence-unit name="testPersistenceUnit"
|
||||
transaction-type="RESOURCE_LOCAL">
|
||||
<provider>org.hibernate.ejb.HibernatePersistence</provider>
|
||||
<properties>
|
||||
<!-- 2nd level cache -->
|
||||
<property name="hibernate.cache.provider_class"
|
||||
value="org.hibernate.cache.SingletonEhCacheProvider" />
|
||||
<property name="net.sf.ehcache.configurationResourceName"
|
||||
value="/ehcache.xml" />
|
||||
<property name="hibernate.cache.use_query_cache" value="false" />
|
||||
<property name="hibernate.cache.use_second_level_cache"
|
||||
value="false" />
|
||||
<property name="hibernate.generate_statistics" value="false" />
|
||||
<!-- A JPA Persistence Unit used for tests -->
|
||||
<persistence-unit name="testPersistenceUnit"
|
||||
transaction-type="RESOURCE_LOCAL">
|
||||
<properties>
|
||||
<!-- 2nd level cache -->
|
||||
<property name="hibernate.cache.provider_class"
|
||||
value="org.hibernate.cache.SingletonEhCacheProvider"/>
|
||||
<property name="net.sf.ehcache.configurationResourceName"
|
||||
value="/ehcache.xml"/>
|
||||
<property name="hibernate.cache.use_query_cache" value="false"/>
|
||||
<property name="hibernate.cache.use_second_level_cache"
|
||||
value="false"/>
|
||||
<property name="hibernate.generate_statistics" value="false"/>
|
||||
|
||||
<!-- DEVELOPMENT VARIABLE, REMOVE FOR PRODUCTION USE -->
|
||||
<property name="hibernate.hbm2ddl.auto" value="update" />
|
||||
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
|
||||
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"></property>
|
||||
<property name="hibernate.connection.url" value="jdbc:hsqldb:mem:test"></property>
|
||||
<property name="hibernate.show_sql" value="false" />
|
||||
<property name="hibernate.format_sql" value="true" />
|
||||
<!-- Local mysql test database -->
|
||||
<!-- <property name="hibernate.hbm2ddl.auto" value="create" /> <property
|
||||
name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" /> <property
|
||||
name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"></property>
|
||||
<property name="hibernate.connection.url" value="jdbc:mysql://localhost/scipro"></property>
|
||||
<property name="hibernate.connection.username" value=""></property> <property
|
||||
name="hibernate.connection.password" value=""></property> <property name="hibernate.c3p0.idle_test_period"
|
||||
value="3600"></property> -->
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
</persistence>
|
||||
|
1
src/main/resources/application.properties
Normal file
1
src/main/resources/application.properties
Normal file
@ -0,0 +1 @@
|
||||
wicket.mode=${wicket.mode}
|
@ -1,44 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
|
||||
default-autowire="byType">
|
||||
|
||||
<!-- Sets up spring autowire configuration based on annotations -->
|
||||
<context:annotation-config />
|
||||
default-autowire="byType">
|
||||
|
||||
<!-- Sets up spring autowire configuration based on annotations -->
|
||||
<context:annotation-config/>
|
||||
<context:component-scan base-package="se.su.dsv.scipro"/>
|
||||
|
||||
<bean id="entityManagerFactory"
|
||||
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
|
||||
<property name="persistenceUnitName" value="defaultPersistenceUnit" />
|
||||
<property name="jpaDialect">
|
||||
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>
|
||||
<bean id="propertyPlaceholderConfigurer"
|
||||
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||
<property name="locations">
|
||||
<list>
|
||||
<value>classpath:application.properties</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
enable the configuration of transactional behavior based on
|
||||
annotations
|
||||
-->
|
||||
<tx:annotation-driven transaction-manager="transactionManager" />
|
||||
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
</bean>
|
||||
<!-- Load data initializer for default table-data -->
|
||||
<bean class="se.su.dsv.scipro.DataInitialiser" init-method="dataInit" />
|
||||
<!-- Importer used for remote importing work, use "ExternalImporterDefaultImpl" if you have no remote-import implementation capable of satisfying "ExternalImporter" interface. -->
|
||||
<bean id="externalImporter" class="se.su.dsv.scipro.io.impl.ExternalImporterDaisyImpl"/>
|
||||
<!-- Defines global settings for the application -->
|
||||
<bean id="applicationSettings" class="se.su.dsv.scipro.ApplicationSettings">
|
||||
<property name="remoteLookupUrl" value="https://api.dsv.su.se/rest"/>
|
||||
<property name="remoteLookupUser" value="thesis"/>
|
||||
<property name="remoteLookupPassword" value="dqyhIM8LU5LQ53T3aJNz4SVXeTQ95dLGkN7JlLOv7X7jeTR2NR"/>
|
||||
<!-- This property points to the location of the remote system used for json requests -->
|
||||
<!-- External auth support (via J2EE standard mechanism REMOTE_USER), if true: other authentication mechanics will be bypassed.-->
|
||||
<property name="acceptExternalAuthentication" value="true"/>
|
||||
</bean>
|
||||
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
<property name="persistenceUnitName" value="defaultPersistenceUnit"/>
|
||||
<property name="jpaVendorAdapter">
|
||||
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
|
||||
<property name="showSql" value="${database.showSql}"/>
|
||||
<property name="generateDdl" value="${database.generateDdl}"/>
|
||||
<property name="databasePlatform" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
|
||||
<property name="jndiName" value="java:comp/env/jdbc/defaultDS"/>
|
||||
<property name="defaultObject">
|
||||
<bean class="org.springframework.jdbc.datasource.DriverManagerDataSource">
|
||||
<property name="url" value="jdbc:mysql://localhost/scipro"/>
|
||||
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
|
||||
<property name="username" value="scipro"/>
|
||||
<property name="password" value="pighleef"/>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
enable the configuration of transactional behavior based on
|
||||
annotations
|
||||
-->
|
||||
<tx:annotation-driven transaction-manager="transactionManager"/>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
<!-- Load data initializer for default table-data -->
|
||||
<bean class="se.su.dsv.scipro.DataInitialiser" init-method="dataInit"/>
|
||||
<!-- Importer used for remote importing work, use "ExternalImporterDefaultImpl" if you have no remote-import implementation capable of satisfying "ExternalImporter" interface. -->
|
||||
<bean id="externalImporter" class="se.su.dsv.scipro.io.impl.ExternalImporterDaisyImpl"/>
|
||||
<!-- Defines global settings for the application -->
|
||||
<bean id="applicationSettings" class="se.su.dsv.scipro.ApplicationSettings">
|
||||
<property name="remoteLookupUrl" value="https://api.dsv.su.se/rest"/>
|
||||
<property name="remoteLookupUser" value="thesis"/>
|
||||
<property name="remoteLookupPassword" value="dqyhIM8LU5LQ53T3aJNz4SVXeTQ95dLGkN7JlLOv7X7jeTR2NR"/>
|
||||
<!-- This property points to the location of the remote system used for json requests -->
|
||||
<!-- External auth support (via J2EE standard mechanism REMOTE_USER), if true: other authentication mechanics will be bypassed.-->
|
||||
<property name="acceptExternalAuthentication" value="true"/>
|
||||
</bean>
|
||||
</beans>
|
||||
|
@ -4,68 +4,79 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
|
||||
default-autowire="byName" default-lazy-init="true">
|
||||
<bean id="entityManagerFactory"
|
||||
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
|
||||
<property name="persistenceUnitName" value="testPersistenceUnit" />
|
||||
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
<property name="persistenceUnitName" value="testPersistenceUnit"/>
|
||||
<property name="jpaVendorAdapter">
|
||||
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
|
||||
<property name="showSql" value="true"/>
|
||||
<property name="generateDdl" value="true"/>
|
||||
<property name="databasePlatform" value="org.hibernate.dialect.HSQLDialect"/>
|
||||
</bean>
|
||||
</property>
|
||||
<meta key="class" value="se.su.dsv.scipro.match.dataobject.KeyWordable"/>
|
||||
</bean>
|
||||
|
||||
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
|
||||
<property name="url" value="jdbc:hsqldb:mem:test"/>
|
||||
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
enable the configuration of transactional behavior based on
|
||||
annotations
|
||||
-->
|
||||
<tx:annotation-driven transaction-manager="transactionManager" />
|
||||
<tx:annotation-driven transaction-manager="transactionManager"/>
|
||||
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" >
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="projectScheduleDao" class="se.su.dsv.scipro.data.dao.jpa.ProjectScheduleDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="applicationPeriodFacade" class="se.su.dsv.scipro.match.facade.ApplicationPeriodFacade">
|
||||
</bean>
|
||||
|
||||
<bean id="userDao" class="se.su.dsv.scipro.data.dao.jpa.UserDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="userNameDao" class="se.su.dsv.scipro.data.dao.jpa.UserNameDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="projectScheduleEventDao" class="se.su.dsv.scipro.data.dao.jpa.ProjectScheduleEventDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="scheduleTemplateDao" class="se.su.dsv.scipro.data.dao.jpa.ScheduleTemplateDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="checklistTemplateDao" class="se.su.dsv.scipro.data.dao.jpa.CheckListTemplateDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="projectDao" class="se.su.dsv.scipro.data.dao.jpa.ProjectDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="roleDao" class="se.su.dsv.scipro.data.dao.jpa.RoleDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="projectClassDao" class="se.su.dsv.scipro.data.dao.jpa.ProjectClassDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="checkListDao" class="se.su.dsv.scipro.data.dao.jpa.CheckListDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="fileDescriptionDao" class="se.su.dsv.scipro.data.dao.jpa.FileDescriptionDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="fileRepository" class="se.su.dsv.scipro.repository.FileRepositoryImpl">
|
||||
@ -75,158 +86,153 @@
|
||||
</bean>
|
||||
|
||||
<bean id="projectIdeaDao" class="se.su.dsv.scipro.match.dao.jpa.ProjectIdeaDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="applicationPeriodDao" class="se.su.dsv.scipro.match.dao.jpa.ApplicationPeriodDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="matchDao" class="se.su.dsv.scipro.match.dao.jpa.MatchDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="authorDao" class="se.su.dsv.scipro.match.dao.jpa.AuthorDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="supervisorDao" class="se.su.dsv.scipro.match.dao.jpa.SupervisorDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="keywordDao" class="se.su.dsv.scipro.match.dao.jpa.KeywordDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="keywordTypeDao" class="se.su.dsv.scipro.match.dao.jpa.KeywordTypeDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="languageDao" class="se.su.dsv.scipro.data.dao.jpa.LanguageDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="checkListQuestionDao" class="se.su.dsv.scipro.data.dao.jpa.CheckListQuestionDaoJPAImp">
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="matchingStrategy" class="se.su.dsv.scipro.match.MatchAllDummyMatchingAlgorithm">
|
||||
</bean>
|
||||
|
||||
<bean id="notificationController" class="se.su.dsv.scipro.data.controllers.impl.NotificationControllerImpl">
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="webNotificationDao" class="se.su.dsv.scipro.data.dao.jpa.WebNotificationDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="generalSystemSettingsDao" class="se.su.dsv.scipro.data.dao.jpa.GeneralSystemSettingsDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="mailEventDao" class="se.su.dsv.scipro.data.dao.jpa.MailEventDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="exemptionDao" class="se.su.dsv.scipro.match.dao.jpa.ExemptionDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="userSettingsDao" class="se.su.dsv.scipro.data.dao.jpa.UserSettingsDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="peerRequestDao" class="se.su.dsv.scipro.peer.data.dao.jpa.PeerRequestDaoJPAImp">
|
||||
<property name ="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
<bean id="peerReviewDao" class="se.su.dsv.scipro.peer.data.dao.jpa.PeerReviewDaoJPAImp">
|
||||
<property name ="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="boardMessageDao" class="se.su.dsv.scipro.data.dao.jpa.BoardMessageDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messageBoardDao" class="se.su.dsv.scipro.data.dao.jpa.MessageBoardDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="categoryDao" class="se.su.dsv.scipro.data.dao.jpa.CategoryDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="checkListCategoryDao" class="se.su.dsv.scipro.data.dao.jpa.ChecklistCategoryDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="seminarDao" class="se.su.dsv.scipro.data.dao.jpa.FinalSeminarDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="finalSeminarOppositionDao" class="se.su.dsv.scipro.data.dao.jpa.FinalSeminarOppositionDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="checkPlagiarismEventDao" class="se.su.dsv.scipro.data.dao.jpa.CheckPlagiarismEventDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
<bean id="projectEventTemplateDao" class="se.su.dsv.scipro.data.dao.jpa.ProjectEventTemplateDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="commentDao" class="se.su.dsv.scipro.data.dao.jpa.CommentDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
<bean id="commentThreadDao" class="se.su.dsv.scipro.data.dao.jpa.CommentThreadDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="activeListenerDao" class="se.su.dsv.scipro.data.dao.jpa.FinalSeminarActiveParticipationDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="reviewRatingDao" class="se.su.dsv.scipro.peer.data.dao.jpa.ReviewRatingDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="projectFollowerDao" class="se.su.dsv.scipro.data.dao.jpa.ProjectFollowerDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="privateMessageDao" class="se.su.dsv.scipro.data.dao.jpa.PrivateMessageDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="projectPartnerDao" class="se.su.dsv.scipro.data.dao.jpa.ProjectPartnerDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="ratableDao" class="se.su.dsv.scipro.data.dao.jpa.RatableDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="resourceDao" class="se.su.dsv.scipro.data.dao.jpa.ResourceDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="ratingDao" class="se.su.dsv.scipro.data.dao.jpa.RatingDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="recipientDao" class="se.su.dsv.scipro.data.dao.jpa.RecipientDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="tagDao" class="se.su.dsv.scipro.data.dao.jpa.TagDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="stringResourceDao" class="se.su.dsv.scipro.data.dao.jpa.StringResourceDaoJPAImp">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
|
||||
|
||||
</beans>
|
@ -1,100 +1,95 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
|
||||
version="2.4">
|
||||
|
||||
<display-name>SciPro</display-name>
|
||||
|
||||
<!-- Open session in view -->
|
||||
<filter>
|
||||
<filter-name>osiv</filter-name>
|
||||
<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>osiv</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<!-- Filter for faking an authenticated REMOTE_USER, should never be used in a production environment-->
|
||||
<!-- filter>
|
||||
<description>
|
||||
</description>
|
||||
<display-name>MockRemoteUserFilter</display-name>
|
||||
<filter-name>MockRemoteUserFilter</filter-name>
|
||||
<filter-class>se.su.dsv.scipro.security.auth.MockRemoteUserFilter</filter-class>
|
||||
<init-param>
|
||||
<description>
|
||||
</description>
|
||||
<param-name>fakedUser</param-name>
|
||||
<param-value>default.sysadm@dsv.su.se</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>MockRemoteUserFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping-->
|
||||
|
||||
<filter>
|
||||
<filter-name>wicket.WicketWarp</filter-name>
|
||||
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>applicationClassName</param-name>
|
||||
<param-value>se.su.dsv.scipro.SciProApplication</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter>
|
||||
<filter-name>charEncoding</filter-name>
|
||||
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>encoding</param-name>
|
||||
<param-value>utf-8</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>charEncoding</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
<filter-mapping>
|
||||
<filter-name>wicket.WicketWarp</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
<!-- These to be able to enable a non-standard not found page -->
|
||||
<dispatcher>REQUEST</dispatcher>
|
||||
<dispatcher>ERROR</dispatcher>
|
||||
</filter-mapping>
|
||||
|
||||
<!-- Map 404 errors to a mounted location -->
|
||||
<error-page>
|
||||
<error-code>404</error-code>
|
||||
<location>/404</location>
|
||||
</error-page>
|
||||
|
||||
<!-- Session timeout set to 8 hours -->
|
||||
<session-config>
|
||||
<session-timeout>480</session-timeout>
|
||||
</session-config>
|
||||
|
||||
<!-- Use deployment for production, development for development -->
|
||||
<context-param>
|
||||
<param-name>configuration</param-name>
|
||||
<!-- <param-value>development</param-value> -->
|
||||
<param-value>deployment</param-value>
|
||||
</context-param>
|
||||
|
||||
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>
|
||||
classpath:applicationContext.xml
|
||||
classpath:META-INF/repositoryContext.xml
|
||||
</param-value>
|
||||
</context-param>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<listener>
|
||||
<listener-class>se.su.dsv.scipro.workerthreads.SchedulerServletContextListener</listener-class>
|
||||
</listener>
|
||||
|
||||
|
||||
</web-app>
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
|
||||
version="2.4">
|
||||
|
||||
<display-name>SciPro</display-name>
|
||||
|
||||
<!-- Open session in view -->
|
||||
<filter>
|
||||
<filter-name>osiv</filter-name>
|
||||
<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>osiv</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<!-- Filter for faking an authenticated REMOTE_USER, should never be used in a production environment-->
|
||||
<!-- filter>
|
||||
<description>
|
||||
</description>
|
||||
<display-name>MockRemoteUserFilter</display-name>
|
||||
<filter-name>MockRemoteUserFilter</filter-name>
|
||||
<filter-class>se.su.dsv.scipro.security.auth.MockRemoteUserFilter</filter-class>
|
||||
<init-param>
|
||||
<description>
|
||||
</description>
|
||||
<param-name>fakedUser</param-name>
|
||||
<param-value>default.sysadm@dsv.su.se</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>MockRemoteUserFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping-->
|
||||
|
||||
<filter>
|
||||
<filter-name>wicket.WicketWarp</filter-name>
|
||||
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>applicationFactoryClassName</param-name>
|
||||
<param-value>org.apache.wicket.spring.SpringWebApplicationFactory</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>applicationClassName</param-name>
|
||||
<param-value>se.su.dsv.WicketApplication</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter>
|
||||
<filter-name>charEncoding</filter-name>
|
||||
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>encoding</param-name>
|
||||
<param-value>utf-8</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>charEncoding</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
<filter-mapping>
|
||||
<filter-name>wicket.WicketWarp</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
<!-- These to be able to enable a non-standard not found page -->
|
||||
<dispatcher>REQUEST</dispatcher>
|
||||
<dispatcher>ERROR</dispatcher>
|
||||
</filter-mapping>
|
||||
|
||||
<!-- Map 404 errors to a mounted location -->
|
||||
<error-page>
|
||||
<error-code>404</error-code>
|
||||
<location>/404</location>
|
||||
</error-page>
|
||||
|
||||
<!-- Session timeout set to 8 hours -->
|
||||
<session-config>
|
||||
<session-timeout>480</session-timeout>
|
||||
</session-config>
|
||||
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>
|
||||
classpath:applicationContext.xml
|
||||
classpath:META-INF/repositoryContext.xml
|
||||
</param-value>
|
||||
</context-param>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<listener>
|
||||
<listener-class>se.su.dsv.scipro.workerthreads.SchedulerServletContextListener</listener-class>
|
||||
</listener>
|
||||
|
||||
</web-app>
|
||||
|
@ -1,165 +1,168 @@
|
||||
package se.su.dsv.scipro.configuration;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.xpath.XPath;
|
||||
import javax.xml.xpath.XPathConstants;
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
import javax.xml.xpath.XPathFactory;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Test;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import se.su.dsv.scipro.util.xml.MutableNamespaceContext;
|
||||
|
||||
/**
|
||||
* Assert that deploy configuration is upheld before build can be completed.
|
||||
* @author Martin Peters - mpeters@dsv.su.se
|
||||
*
|
||||
*/
|
||||
public class TestDeployConfiguration {
|
||||
|
||||
private static String persistenceXmlPath = "META-INF"+File.separator+"persistence.xml";
|
||||
private static String repositoryContext = "META-INF"+File.separator+"repositoryContext.xml";
|
||||
private static String baseRepository = "META-INF"+File.separator+"base-repository.xml";
|
||||
private static String webXmlPath = "src"+File.separator+"main"+File.separator+"webapp"+File.separator+"WEB-INF"+File.separator+"web.xml";
|
||||
private static final String applicationContextPath = "applicationContext.xml";
|
||||
|
||||
@Test
|
||||
public void testWicketDeploymentConfiguration() throws XPathExpressionException, IOException, SAXException, ParserConfigurationException {
|
||||
String path = System.getProperty("user.dir")+File.separator+webXmlPath;
|
||||
|
||||
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
|
||||
domFactory.setNamespaceAware(false);
|
||||
DocumentBuilder builder = domFactory.newDocumentBuilder();
|
||||
Document doc = builder.parse(new FileInputStream(path));
|
||||
|
||||
Node nodes = (Node) XPathFactory.newInstance().newXPath().evaluate("//web-app/context-param/param-name[.='configuration']/../param-value", doc, XPathConstants.NODE);
|
||||
|
||||
Assert.assertEquals("deployment", nodes.getTextContent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDatabasePath() throws XPathExpressionException, IOException {
|
||||
InputSource persistenceXml = getInputSource(persistenceXmlPath);
|
||||
Assert.assertEquals("jdbc:mysql://localhost/scipro",
|
||||
XPathFactory.newInstance().newXPath().evaluate(
|
||||
"(//*[@name='hibernate.connection.url']/@value)[1]",
|
||||
persistenceXml));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDatabaseUser() throws XPathExpressionException, IOException {
|
||||
InputSource persistenceXml = getInputSource(persistenceXmlPath);
|
||||
Assert.assertEquals("scipro",
|
||||
XPathFactory.newInstance().newXPath().evaluate(
|
||||
"(//*[@name='hibernate.connection.username']/@value)[1]",
|
||||
persistenceXml));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDatabasePassword() throws XPathExpressionException, IOException {
|
||||
InputSource persistenceXml = getInputSource(persistenceXmlPath);
|
||||
Assert.assertEquals("pighleef",
|
||||
XPathFactory.newInstance().newXPath().evaluate(
|
||||
"(//*[@name='hibernate.connection.password']/@value)[1]",
|
||||
persistenceXml));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJackrabbitPath() throws XPathExpressionException, IOException {
|
||||
InputSource persistenceXml = getInputSource(repositoryContext);
|
||||
Assert.assertEquals("/jackrabbit",
|
||||
XPathFactory.newInstance().newXPath().evaluate(
|
||||
"(//*[@name='jcrRepository']/@value)[1]",
|
||||
persistenceXml));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJackrabbitBasePath() throws XPathExpressionException, IOException {
|
||||
InputSource persistenceXml = getInputSource(baseRepository);
|
||||
Assert.assertEquals("/jackrabbit",
|
||||
XPathFactory.newInstance().newXPath().evaluate(
|
||||
"(//*[@name='path']/@value)[1]",
|
||||
persistenceXml));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExternalAuthCfg() throws XPathExpressionException, IOException{
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("true", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='acceptExternalAuthentication']/@value", applicationContextXml));
|
||||
}
|
||||
@Test
|
||||
public void testExternalAuthenticationCfg() throws XPathExpressionException, IOException{
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("true", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='acceptExternalAuthentication']/@value", applicationContextXml));
|
||||
}
|
||||
@Test
|
||||
public void testRemoteLookupUrlCfg() throws XPathExpressionException, IOException{
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("https://api.dsv.su.se/rest", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='remoteLookupUrl']/@value", applicationContextXml));
|
||||
}
|
||||
@Test
|
||||
public void testRemoteLookupUserCfg() throws XPathExpressionException, IOException{
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("thesis", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='remoteLookupUser']/@value", applicationContextXml));
|
||||
}
|
||||
@Test
|
||||
public void testRemoteLookupPasswordCfg() throws XPathExpressionException, IOException{
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("dqyhIM8LU5LQ53T3aJNz4SVXeTQ95dLGkN7JlLOv7X7jeTR2NR", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='remoteLookupPassword']/@value", applicationContextXml));
|
||||
}
|
||||
@Test
|
||||
public void testRemoteLookupImplCfg() throws XPathExpressionException, IOException{
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("se.su.dsv.scipro.io.impl.ExternalImporterDaisyImpl", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='externalImporter']/@class", applicationContextXml));
|
||||
}
|
||||
|
||||
private InputSource getInputSource(String filePath) throws IOException{
|
||||
String theString = readResourceAsString(filePath);
|
||||
InputStream is = new ByteArrayInputStream(theString.getBytes());
|
||||
return new InputSource( is );
|
||||
}
|
||||
|
||||
private static String readResourceAsString(String filePath) throws IOException{
|
||||
return readResourceAsString(filePath, "UTF-8");
|
||||
}
|
||||
|
||||
private static String readResourceAsString(String filePath, String charset) throws IOException{
|
||||
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath);
|
||||
StringWriter writer = new StringWriter();
|
||||
IOUtils.copy(in, writer, charset);
|
||||
return writer.toString();
|
||||
}
|
||||
private XPath getApplicationContextXPath(){
|
||||
XPath xPath = XPathFactory.newInstance().newXPath();
|
||||
MutableNamespaceContext mnc = new MutableNamespaceContext();
|
||||
mnc.setMapping("beanNS","http://www.springframework.org/schema/beans");
|
||||
xPath.setNamespaceContext(mnc);
|
||||
return xPath;
|
||||
}
|
||||
}
|
||||
package se.su.dsv.scipro.configuration;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import se.su.dsv.scipro.util.xml.MutableNamespaceContext;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.xpath.XPath;
|
||||
import javax.xml.xpath.XPathConstants;
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
import javax.xml.xpath.XPathFactory;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* Assert that deploy configuration is upheld before build can be completed.
|
||||
*
|
||||
* @author Martin Peters - mpeters@dsv.su.se
|
||||
*/
|
||||
public class TestDeployConfiguration {
|
||||
|
||||
private static String persistenceXmlPath = "META-INF" + File.separator + "persistence.xml";
|
||||
private static String repositoryContext = "META-INF" + File.separator + "repositoryContext.xml";
|
||||
private static String baseRepository = "META-INF" + File.separator + "base-repository.xml";
|
||||
private static String webXmlPath = "src" + File.separator + "main" + File.separator + "webapp" + File.separator + "WEB-INF" + File.separator + "web.xml";
|
||||
private static final String applicationContextPath = "applicationContext.xml";
|
||||
|
||||
@Test
|
||||
@Ignore ( "Not needed." )
|
||||
public void testWicketDeploymentConfiguration() throws XPathExpressionException, IOException, SAXException, ParserConfigurationException {
|
||||
String path = System.getProperty("user.dir") + File.separator + webXmlPath;
|
||||
|
||||
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
|
||||
domFactory.setNamespaceAware(false);
|
||||
DocumentBuilder builder = domFactory.newDocumentBuilder();
|
||||
Document doc = builder.parse(new FileInputStream(path));
|
||||
|
||||
Node nodes = (Node) XPathFactory.newInstance().newXPath().evaluate("//web-app/context-param/param-name[.='configuration']/../param-value", doc, XPathConstants.NODE);
|
||||
|
||||
Assert.assertEquals("deployment", nodes.getTextContent());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore ( "Not applicable" )
|
||||
public void testDatabasePath() throws XPathExpressionException, IOException {
|
||||
InputSource persistenceXml = getInputSource(persistenceXmlPath);
|
||||
Assert.assertEquals("jdbc:mysql://localhost/scipro",
|
||||
XPathFactory.newInstance().newXPath().evaluate(
|
||||
"(//*[@name='hibernate.connection.url']/@value)[1]",
|
||||
persistenceXml));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore ( "Not applicable" )
|
||||
public void testDatabaseUser() throws XPathExpressionException, IOException {
|
||||
InputSource persistenceXml = getInputSource(persistenceXmlPath);
|
||||
Assert.assertEquals("scipro",
|
||||
XPathFactory.newInstance().newXPath().evaluate(
|
||||
"(//*[@name='hibernate.connection.username']/@value)[1]",
|
||||
persistenceXml));
|
||||
|
||||
}
|
||||
|
||||
@Ignore ( "Not necessary" )
|
||||
@Test
|
||||
public void testDatabasePassword() throws XPathExpressionException, IOException {
|
||||
InputSource persistenceXml = getInputSource(persistenceXmlPath);
|
||||
Assert.assertEquals("pighleef",
|
||||
XPathFactory.newInstance().newXPath().evaluate(
|
||||
"(//*[@name='hibernate.connection.password']/@value)[1]",
|
||||
persistenceXml));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJackrabbitPath() throws XPathExpressionException, IOException {
|
||||
InputSource persistenceXml = getInputSource(repositoryContext);
|
||||
Assert.assertEquals("/jackrabbit",
|
||||
XPathFactory.newInstance().newXPath().evaluate(
|
||||
"(//*[@name='jcrRepository']/@value)[1]",
|
||||
persistenceXml));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJackrabbitBasePath() throws XPathExpressionException, IOException {
|
||||
InputSource persistenceXml = getInputSource(baseRepository);
|
||||
Assert.assertEquals("/jackrabbit",
|
||||
XPathFactory.newInstance().newXPath().evaluate(
|
||||
"(//*[@name='path']/@value)[1]",
|
||||
persistenceXml));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExternalAuthCfg() throws XPathExpressionException, IOException {
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("true", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='acceptExternalAuthentication']/@value", applicationContextXml));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExternalAuthenticationCfg() throws XPathExpressionException, IOException {
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("true", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='acceptExternalAuthentication']/@value", applicationContextXml));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteLookupUrlCfg() throws XPathExpressionException, IOException {
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("https://api.dsv.su.se/rest", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='remoteLookupUrl']/@value", applicationContextXml));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteLookupUserCfg() throws XPathExpressionException, IOException {
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("thesis", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='remoteLookupUser']/@value", applicationContextXml));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteLookupPasswordCfg() throws XPathExpressionException, IOException {
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("dqyhIM8LU5LQ53T3aJNz4SVXeTQ95dLGkN7JlLOv7X7jeTR2NR", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='remoteLookupPassword']/@value", applicationContextXml));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteLookupImplCfg() throws XPathExpressionException, IOException {
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("se.su.dsv.scipro.io.impl.ExternalImporterDaisyImpl", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='externalImporter']/@class", applicationContextXml));
|
||||
}
|
||||
|
||||
private InputSource getInputSource(String filePath) throws IOException {
|
||||
String theString = readResourceAsString(filePath);
|
||||
InputStream is = new ByteArrayInputStream(theString.getBytes());
|
||||
return new InputSource(is);
|
||||
}
|
||||
|
||||
private static String readResourceAsString(String filePath) throws IOException {
|
||||
return readResourceAsString(filePath, "UTF-8");
|
||||
}
|
||||
|
||||
private static String readResourceAsString(String filePath, String charset) throws IOException {
|
||||
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath);
|
||||
StringWriter writer = new StringWriter();
|
||||
IOUtils.copy(in, writer, charset);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
private XPath getApplicationContextXPath() {
|
||||
XPath xPath = XPathFactory.newInstance().newXPath();
|
||||
MutableNamespaceContext mnc = new MutableNamespaceContext();
|
||||
mnc.setMapping("beanNS", "http://www.springframework.org/schema/beans");
|
||||
xPath.setNamespaceContext(mnc);
|
||||
return xPath;
|
||||
}
|
||||
}
|
||||
|
@ -1,187 +1,168 @@
|
||||
package se.su.dsv.scipro.dao.jpa;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectFollowerDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.RoleDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.data.dataobjects.Member;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
|
||||
import se.su.dsv.scipro.data.dataobjects.Student;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.*;
|
||||
import se.su.dsv.scipro.data.dataobjects.*;
|
||||
import se.su.dsv.scipro.data.enums.ProjectStatus;
|
||||
import se.su.dsv.scipro.data.enums.ProjectTeamMemberRoles;
|
||||
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(inheritLocations = false, locations = {
|
||||
"classpath:test-applicationContext.xml"
|
||||
})
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@RunWith ( SpringJUnit4ClassRunner.class )
|
||||
@ContextConfiguration ( inheritLocations = false, locations = {
|
||||
"classpath:test-applicationContext.xml"
|
||||
} )
|
||||
public class TestProjectDaoJPA {
|
||||
|
||||
@Autowired
|
||||
private ProjectDao projectDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private RoleDao roleDao;
|
||||
|
||||
@Autowired
|
||||
|
||||
@Autowired
|
||||
private UserDao userDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ProjectClassDao projectClassDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ProjectFollowerDao projectFollowerDao;
|
||||
|
||||
|
||||
private ProjectClass projectClass;
|
||||
|
||||
|
||||
private User userWithActiveAndInactive;
|
||||
private User userWithActiveAndCompleted;
|
||||
private User userWithCompleted;
|
||||
private User userWithInactive;
|
||||
|
||||
|
||||
private User userWithHeadSupervisor;
|
||||
private User userNotHeadSupervisor;
|
||||
|
||||
|
||||
private User userWithReviewer;
|
||||
private User userWithCoSupervisor;
|
||||
private User userWithCoSupervisorAndReviewer;
|
||||
|
||||
|
||||
private Project activeProject;
|
||||
private Project inactiveProject;
|
||||
private Project completedProject;
|
||||
|
||||
private User unrelatedUser;
|
||||
|
||||
SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);
|
||||
|
||||
private Date date10Jan2012;
|
||||
private Date date1Jan2012;
|
||||
private Date date1Dec2011;
|
||||
private Date date15Dec2011;
|
||||
|
||||
private User unrelatedUser;
|
||||
|
||||
SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);
|
||||
|
||||
private Date date10Jan2012;
|
||||
private Date date1Jan2012;
|
||||
private Date date1Dec2011;
|
||||
private Date date15Dec2011;
|
||||
|
||||
@Before
|
||||
public void startTransaction(){
|
||||
|
||||
projectClass = new ProjectClass(ProjectClass.BACHELOR,"Bachelor","Bachelor degree thesis project");
|
||||
public void startTransaction() {
|
||||
|
||||
projectClass = new ProjectClass(ProjectClass.BACHELOR, "Bachelor", "Bachelor degree thesis project");
|
||||
projectClass = projectClassDao.save(projectClass);
|
||||
|
||||
|
||||
userWithHeadSupervisor = new User();
|
||||
userWithHeadSupervisor.setFirstName("userWithHeadSupervisor firstname");
|
||||
userWithHeadSupervisor.setLastName("userWithHeadSupervisor lastname");
|
||||
userWithHeadSupervisor = userDao.save(userWithHeadSupervisor);
|
||||
|
||||
|
||||
Employee employeeWithHeadSupervisor = new Employee();
|
||||
employeeWithHeadSupervisor.setUser(userWithHeadSupervisor);
|
||||
employeeWithHeadSupervisor = (Employee) roleDao.save(employeeWithHeadSupervisor);
|
||||
|
||||
|
||||
userNotHeadSupervisor = new User();
|
||||
userNotHeadSupervisor.setFirstName("userNotSupervisor firstname");
|
||||
userNotHeadSupervisor.setLastName("userNotSupervisor lastname");
|
||||
userNotHeadSupervisor = userDao.save(userNotHeadSupervisor);
|
||||
|
||||
|
||||
Employee employeeNotHeadSupervisor = new Employee();
|
||||
employeeNotHeadSupervisor.setUser(userNotHeadSupervisor);
|
||||
employeeNotHeadSupervisor = (Employee) roleDao.save(employeeNotHeadSupervisor);
|
||||
|
||||
|
||||
userWithReviewer = new User();
|
||||
userWithReviewer.setFirstName("userWithReviewer firstname");
|
||||
userWithReviewer.setLastName("userWithReviewer lastname");
|
||||
userWithReviewer = userDao.save(userWithReviewer);
|
||||
|
||||
|
||||
Employee employeeWithReviewer = new Employee();
|
||||
employeeWithReviewer.setUser(userWithReviewer);
|
||||
employeeWithReviewer = (Employee) roleDao.save(employeeWithReviewer);
|
||||
|
||||
|
||||
userWithCoSupervisor = new User();
|
||||
userWithCoSupervisor.setFirstName("userWithCoSupervisor firstname");
|
||||
userWithCoSupervisor.setLastName("userWithCoSupervisor lastname");
|
||||
userWithCoSupervisor = userDao.save(userWithCoSupervisor);
|
||||
|
||||
|
||||
Employee employeeWithCoSupervisor = new Employee();
|
||||
employeeWithCoSupervisor.setUser(userWithCoSupervisor);
|
||||
employeeWithCoSupervisor = (Employee) roleDao.save(employeeWithCoSupervisor);
|
||||
|
||||
|
||||
userWithCoSupervisorAndReviewer = new User();
|
||||
userWithCoSupervisorAndReviewer.setFirstName("userWithCoSupervisorAndReviewer firstname");
|
||||
userWithCoSupervisorAndReviewer.setLastName("userWithCoSupervisorAndReviewer lastname");
|
||||
userWithCoSupervisorAndReviewer = userDao.save(userWithCoSupervisorAndReviewer);
|
||||
|
||||
|
||||
Employee employeeWithCoSupervisorAndReviewer = new Employee();
|
||||
employeeWithCoSupervisorAndReviewer.setUser(userWithCoSupervisorAndReviewer);
|
||||
employeeWithCoSupervisorAndReviewer = (Employee) roleDao.save(employeeWithCoSupervisorAndReviewer);
|
||||
|
||||
|
||||
userWithActiveAndInactive = new User();
|
||||
userWithActiveAndInactive.setFirstName("userWithActiveAndInactive firstname");
|
||||
userWithActiveAndInactive.setLastName("userWithActiveAndInactive lastname");
|
||||
userWithActiveAndInactive = userDao.save(userWithActiveAndInactive);
|
||||
|
||||
|
||||
Student studentWithActiveAndInactive = new Student();
|
||||
studentWithActiveAndInactive.setUser(userWithActiveAndInactive);
|
||||
studentWithActiveAndInactive = (Student) roleDao.save(studentWithActiveAndInactive);
|
||||
|
||||
|
||||
userWithActiveAndCompleted = new User();
|
||||
userWithActiveAndCompleted.setFirstName("userWithActiveAndCompleted firstname");
|
||||
userWithActiveAndCompleted.setLastName("userWithActiveAndCompleted lastname");
|
||||
userWithActiveAndCompleted = userDao.save(userWithActiveAndCompleted);
|
||||
|
||||
|
||||
Student studentWithActiveAndCompleted = new Student();
|
||||
studentWithActiveAndCompleted.setUser(userWithActiveAndCompleted);
|
||||
studentWithActiveAndCompleted = (Student) roleDao.save(studentWithActiveAndCompleted);
|
||||
|
||||
|
||||
userWithCompleted = new User();
|
||||
userWithCompleted.setFirstName("userWithCompleted firstname");
|
||||
userWithCompleted.setLastName("userWithCompleted lastname");
|
||||
userWithCompleted = userDao.save(userWithCompleted);
|
||||
|
||||
|
||||
|
||||
|
||||
unrelatedUser = new User();
|
||||
unrelatedUser.setFirstName("unrelatedUser firstname");
|
||||
unrelatedUser.setLastName("unrelatedUser lastname");
|
||||
unrelatedUser = userDao.save(unrelatedUser);
|
||||
roleDao.makeStudent(unrelatedUser);
|
||||
Employee unrelatedUserEmployee = roleDao.makeEmployee(unrelatedUser);
|
||||
|
||||
|
||||
Student studentWithCompleted = new Student();
|
||||
studentWithCompleted.setUser(userWithCompleted);
|
||||
studentWithCompleted = (Student) roleDao.save(studentWithCompleted);
|
||||
|
||||
|
||||
userWithInactive = new User();
|
||||
userWithInactive.setFirstName("userWithInactive firstname");
|
||||
userWithInactive.setLastName("userWithInactive lastname");
|
||||
userWithInactive = userDao.save(userWithInactive);
|
||||
|
||||
|
||||
Student studentWithInactive = new Student();
|
||||
studentWithInactive.setUser(userWithInactive);
|
||||
studentWithInactive = (Student) roleDao.save(studentWithInactive);
|
||||
|
||||
|
||||
activeProject = new Project();
|
||||
activeProject.setTitle("Active Project 1");
|
||||
activeProject.addProjectParticipant(studentWithActiveAndInactive);
|
||||
@ -189,27 +170,27 @@ public class TestProjectDaoJPA {
|
||||
activeProject.setHeadSupervisor(employeeWithHeadSupervisor);
|
||||
activeProject.setProjectClass(projectClass);
|
||||
activeProject = projectDao.save(activeProject);
|
||||
|
||||
|
||||
ProjectFollower reviewerFollower = new ProjectFollower();
|
||||
reviewerFollower.setFollower(employeeWithReviewer);
|
||||
reviewerFollower.setProject(activeProject);
|
||||
reviewerFollower.setProjectRole(ProjectTeamMemberRoles.REVIEWER);
|
||||
reviewerFollower = projectFollowerDao.save(reviewerFollower);
|
||||
|
||||
|
||||
activeProject.getProjectFollowers().add(reviewerFollower);
|
||||
|
||||
|
||||
ProjectFollower coSupervisorFollower = new ProjectFollower();
|
||||
coSupervisorFollower.setFollower(employeeWithCoSupervisor);
|
||||
coSupervisorFollower.setProject(activeProject);
|
||||
coSupervisorFollower.setProjectRole(ProjectTeamMemberRoles.CO_SUPERVISOR);
|
||||
coSupervisorFollower = projectFollowerDao.save(coSupervisorFollower);
|
||||
|
||||
|
||||
ProjectFollower coSupervisorFollower2 = new ProjectFollower();
|
||||
coSupervisorFollower2.setFollower(employeeWithCoSupervisorAndReviewer);
|
||||
coSupervisorFollower2.setProject(activeProject);
|
||||
coSupervisorFollower2.setProjectRole(ProjectTeamMemberRoles.CO_SUPERVISOR);
|
||||
coSupervisorFollower2 = projectFollowerDao.save(coSupervisorFollower2);
|
||||
|
||||
|
||||
inactiveProject = new Project();
|
||||
inactiveProject.setTitle("Inactive project");
|
||||
inactiveProject.addProjectParticipant(studentWithActiveAndInactive);
|
||||
@ -218,13 +199,13 @@ public class TestProjectDaoJPA {
|
||||
inactiveProject.setHeadSupervisor(employeeWithHeadSupervisor);
|
||||
inactiveProject.setProjectClass(projectClass);
|
||||
inactiveProject = projectDao.save(inactiveProject);
|
||||
|
||||
|
||||
ProjectFollower reviewerFollower2 = new ProjectFollower();
|
||||
reviewerFollower2.setFollower(employeeWithCoSupervisorAndReviewer);
|
||||
reviewerFollower2.setProject(inactiveProject);
|
||||
reviewerFollower2.setProjectRole(ProjectTeamMemberRoles.REVIEWER);
|
||||
reviewerFollower2 = projectFollowerDao.save(reviewerFollower2);
|
||||
|
||||
|
||||
completedProject = new Project();
|
||||
completedProject.setTitle("Completed project");
|
||||
completedProject.addProjectParticipant(studentWithActiveAndCompleted);
|
||||
@ -233,121 +214,121 @@ public class TestProjectDaoJPA {
|
||||
completedProject.setHeadSupervisor(employeeWithHeadSupervisor);
|
||||
completedProject.setProjectClass(projectClass);
|
||||
completedProject = projectDao.save(completedProject);
|
||||
|
||||
|
||||
|
||||
|
||||
ProjectFollower unrelatedToActiveProjectFollower = new ProjectFollower();
|
||||
unrelatedToActiveProjectFollower.setProject(inactiveProject);
|
||||
unrelatedToActiveProjectFollower.setProjectRole(ProjectTeamMemberRoles.CO_SUPERVISOR);
|
||||
unrelatedToActiveProjectFollower.setFollower(unrelatedUserEmployee);
|
||||
inactiveProject.getProjectFollowers().add(unrelatedToActiveProjectFollower);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void testFindAll(){
|
||||
public void testFindAll() {
|
||||
List<Project> list = new ArrayList<Project>();
|
||||
list.add(activeProject);
|
||||
list.add(inactiveProject);
|
||||
list.add(completedProject);
|
||||
Assert.assertEquals(list, projectDao.findAll());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void testCountAll() {
|
||||
Assert.assertEquals(3, projectDao.countAll());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void testLoad() {
|
||||
Project p = projectDao.load(activeProject.getId());
|
||||
Assert.assertEquals(p, activeProject);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void testGetProjectsByParticipant(){
|
||||
public void testGetProjectsByParticipant() {
|
||||
List<Project> list = new ArrayList<Project>();
|
||||
list.add(activeProject);
|
||||
list.add(inactiveProject);
|
||||
Assert.assertEquals(list, projectDao.getProjectsByParticipant(userWithActiveAndInactive, null));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
list.add(activeProject);
|
||||
Assert.assertEquals(list, projectDao.getProjectsByParticipant(userWithActiveAndInactive, ProjectStatus.ACTIVE));
|
||||
Assert.assertEquals(list, projectDao.getProjectsByParticipant(userWithActiveAndCompleted, ProjectStatus.ACTIVE));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
list.add(inactiveProject);
|
||||
Assert.assertEquals(list, projectDao.getProjectsByParticipant(userWithActiveAndInactive, ProjectStatus.INACTIVE));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
Assert.assertEquals(list, projectDao.getProjectsByParticipant(userWithActiveAndInactive, ProjectStatus.COMPLETED));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
list.add(activeProject);
|
||||
list.add(completedProject);
|
||||
Assert.assertEquals(list, projectDao.getProjectsByParticipant(userWithActiveAndCompleted, null));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
Assert.assertEquals(list, projectDao.getProjectsByParticipant(userWithActiveAndCompleted, ProjectStatus.INACTIVE));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
list.add(completedProject);
|
||||
Assert.assertEquals(list, projectDao.getProjectsByParticipant(userWithCompleted, null));
|
||||
Assert.assertEquals(list, projectDao.getProjectsByParticipant(userWithCompleted, ProjectStatus.COMPLETED));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
list.add(inactiveProject);
|
||||
Assert.assertEquals(list, projectDao.getProjectsByParticipant(userWithInactive, null));
|
||||
Assert.assertEquals(list, projectDao.getProjectsByParticipant(userWithInactive, ProjectStatus.INACTIVE));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
Assert.assertEquals(list, projectDao.getProjectsByParticipant(userWithInactive, ProjectStatus.ACTIVE));
|
||||
Assert.assertEquals(list, projectDao.getProjectsByParticipant(userWithCompleted, ProjectStatus.ACTIVE));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void testCountProjectsByParticipant(){
|
||||
public void testCountProjectsByParticipant() {
|
||||
Assert.assertEquals(2, projectDao.countProjectsByParticipant(userWithActiveAndCompleted, null));
|
||||
Assert.assertEquals(1, projectDao.countProjectsByParticipant(userWithActiveAndCompleted, ProjectStatus.ACTIVE));
|
||||
Assert.assertEquals(1, projectDao.countProjectsByParticipant(userWithActiveAndCompleted, ProjectStatus.COMPLETED));
|
||||
Assert.assertEquals(0, projectDao.countProjectsByParticipant(userWithActiveAndCompleted, ProjectStatus.INACTIVE));
|
||||
|
||||
|
||||
Assert.assertEquals(2, projectDao.countProjectsByParticipant(userWithActiveAndInactive, null));
|
||||
Assert.assertEquals(1, projectDao.countProjectsByParticipant(userWithActiveAndInactive, ProjectStatus.ACTIVE));
|
||||
Assert.assertEquals(0, projectDao.countProjectsByParticipant(userWithActiveAndInactive, ProjectStatus.COMPLETED));
|
||||
Assert.assertEquals(1, projectDao.countProjectsByParticipant(userWithActiveAndInactive, ProjectStatus.INACTIVE));
|
||||
|
||||
|
||||
Assert.assertEquals(1, projectDao.countProjectsByParticipant(userWithCompleted, null));
|
||||
Assert.assertEquals(0, projectDao.countProjectsByParticipant(userWithCompleted, ProjectStatus.ACTIVE));
|
||||
Assert.assertEquals(1, projectDao.countProjectsByParticipant(userWithCompleted, ProjectStatus.COMPLETED));
|
||||
Assert.assertEquals(0, projectDao.countProjectsByParticipant(userWithCompleted, ProjectStatus.INACTIVE));
|
||||
|
||||
|
||||
Assert.assertEquals(1, projectDao.countProjectsByParticipant(userWithInactive, null));
|
||||
Assert.assertEquals(0, projectDao.countProjectsByParticipant(userWithInactive, ProjectStatus.ACTIVE));
|
||||
Assert.assertEquals(0, projectDao.countProjectsByParticipant(userWithInactive, ProjectStatus.COMPLETED));
|
||||
Assert.assertEquals(1, projectDao.countProjectsByParticipant(userWithInactive, ProjectStatus.INACTIVE));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void testGetProjectsByHeadSupervisor(){
|
||||
public void testGetProjectsByHeadSupervisor() {
|
||||
List<Project> list = new ArrayList<Project>();
|
||||
list.add(activeProject);
|
||||
list.add(completedProject);
|
||||
list.add(inactiveProject);
|
||||
|
||||
|
||||
Assert.assertEquals(list, projectDao.getProjectsByHeadSupervisor(userWithHeadSupervisor, null));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
list.add(activeProject);
|
||||
Assert.assertEquals(list, projectDao.getProjectsByHeadSupervisor(userWithHeadSupervisor, ProjectStatus.ACTIVE));
|
||||
@ -355,161 +336,157 @@ public class TestProjectDaoJPA {
|
||||
list = new ArrayList<Project>();
|
||||
list.add(inactiveProject);
|
||||
Assert.assertEquals(list, projectDao.getProjectsByHeadSupervisor(userWithHeadSupervisor, ProjectStatus.INACTIVE));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
list.add(completedProject);
|
||||
Assert.assertEquals(list, projectDao.getProjectsByHeadSupervisor(userWithHeadSupervisor, ProjectStatus.COMPLETED));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
Assert.assertEquals(list, projectDao.getProjectsByHeadSupervisor(userNotHeadSupervisor, null));
|
||||
Assert.assertEquals(list, projectDao.getProjectsByHeadSupervisor(userNotHeadSupervisor, ProjectStatus.COMPLETED));
|
||||
Assert.assertEquals(list, projectDao.getProjectsByHeadSupervisor(userNotHeadSupervisor, ProjectStatus.INACTIVE));
|
||||
Assert.assertEquals(list, projectDao.getProjectsByHeadSupervisor(userNotHeadSupervisor, ProjectStatus.ACTIVE));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void testGetProjectsByProjectTeamMember(){
|
||||
public void testGetProjectsByProjectTeamMember() {
|
||||
ArrayList<Project> list = new ArrayList<Project>();
|
||||
list.add(activeProject);
|
||||
|
||||
|
||||
Assert.assertEquals(list, projectDao.getProjectsByProjectTeamMember(userWithCoSupervisor, null, null));
|
||||
Assert.assertEquals(list, projectDao.getProjectsByProjectTeamMember(userWithReviewer, null, null));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
list.add(activeProject);
|
||||
list.add(inactiveProject);
|
||||
Assert.assertEquals(list, projectDao.getProjectsByProjectTeamMember(userWithCoSupervisorAndReviewer, null, null));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
list.add(activeProject);
|
||||
Assert.assertEquals(list, projectDao.getProjectsByProjectTeamMember(userWithCoSupervisorAndReviewer, ProjectStatus.ACTIVE, null));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
Assert.assertEquals(list, projectDao.getProjectsByProjectTeamMember(userWithCoSupervisorAndReviewer, ProjectStatus.COMPLETED, null));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
list.add(activeProject);
|
||||
Assert.assertEquals(list, projectDao.getProjectsByProjectTeamMember(userWithCoSupervisorAndReviewer, null, ProjectTeamMemberRoles.CO_SUPERVISOR));
|
||||
|
||||
|
||||
list = new ArrayList<Project>();
|
||||
list.add(inactiveProject);
|
||||
Assert.assertEquals(list, projectDao.getProjectsByProjectTeamMember(userWithCoSupervisorAndReviewer, null, ProjectTeamMemberRoles.REVIEWER));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Rollback
|
||||
@Transactional
|
||||
public void testGetProjetClass(){
|
||||
ProjectClass test = projectClassDao.getProjectClass(ProjectClass.BACHELOR);
|
||||
Assert.assertNotNull(test);
|
||||
Assert.assertEquals(test.getName(), projectClass.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Rollback
|
||||
@Transactional
|
||||
public void testFailToCreateDuplicateProjectClassCode(){
|
||||
boolean created = true;
|
||||
try{
|
||||
ProjectClass test = new ProjectClass(ProjectClass.BACHELOR,"Bachelor","Bachelor degree thesis project");
|
||||
test = projectClassDao.save(test);
|
||||
} catch(JpaSystemException e){
|
||||
created = false;
|
||||
}
|
||||
Assert.assertFalse(created);
|
||||
}
|
||||
@Test
|
||||
@Rollback
|
||||
@Transactional
|
||||
public void testProjectClassConvertUppercase(){
|
||||
String code = "rAndomCase";
|
||||
ProjectClass test = new ProjectClass(code,"Bachelor","Bachelor degree thesis project");
|
||||
test = projectClassDao.save(test);
|
||||
|
||||
Assert.assertEquals(test.getCode(), code.toUpperCase());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Rollback
|
||||
@Transactional
|
||||
public void testIsProjectParticipant() {
|
||||
Project newProject = new Project();
|
||||
newProject.setProjectClass(projectClass);
|
||||
newProject.setTitle("test");
|
||||
newProject = projectDao.save(newProject);
|
||||
|
||||
User newUser = new User();
|
||||
newUser.setFirstName("f");
|
||||
newUser.setLastName("l");
|
||||
newUser = userDao.save(newUser);
|
||||
|
||||
Assert.assertFalse( projectDao.isProjectParticipant( newUser, newProject ) ); //Catches previous EmptyResultDataAccessException
|
||||
Assert.assertFalse( projectDao.isProjectParticipant(unrelatedUser, newProject ) );
|
||||
Assert.assertFalse( projectDao.isProjectParticipant(unrelatedUser, activeProject) );
|
||||
Assert.assertTrue( projectDao.isProjectParticipant(userWithInactive, inactiveProject) );
|
||||
Assert.assertFalse( projectDao.isProjectParticipant(userWithCompleted, inactiveProject) );
|
||||
}
|
||||
|
||||
@Test
|
||||
@Rollback
|
||||
@Transactional
|
||||
public void testIsProjectFollower() {
|
||||
Assert.assertFalse( activeProject.getProjectFollowers().isEmpty() );
|
||||
Assert.assertFalse( inactiveProject.getProjectFollowers().isEmpty() );
|
||||
Assert.assertTrue( completedProject.getProjectFollowers().isEmpty() );
|
||||
Assert.assertTrue( projectDao.isProjectFollower(userWithReviewer, activeProject ));
|
||||
Assert.assertFalse( projectDao.isProjectFollower( unrelatedUser, activeProject) );
|
||||
//Assert.assertFalse( projectDao.isProjectFollower(unrelatedUser, activeProject) );
|
||||
//Assert.assertTrue( projectDao.isProjectParticipant(userWithInactive, inactiveProject) );
|
||||
//Assert.assertFalse( projectDao.isProjectParticipant(userWithCompleted, inactiveProject) );
|
||||
}
|
||||
@Test
|
||||
@Rollback
|
||||
@Transactional
|
||||
public void testGetProjetClass() {
|
||||
ProjectClass test = projectClassDao.getProjectClass(ProjectClass.BACHELOR);
|
||||
Assert.assertNotNull(test);
|
||||
Assert.assertEquals(test.getName(), projectClass.getName());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Rollback
|
||||
@Transactional
|
||||
public void testShouldIncludeAuthorsAndReviewersAndHeadSupervisorInMembers() {
|
||||
Iterator<Member> members = activeProject.getMembers().iterator();
|
||||
|
||||
Assert.assertEquals(new Member(userWithActiveAndCompleted, Member.Type.AUTHOR),
|
||||
members.next());
|
||||
@Test ( expected = DataIntegrityViolationException.class )
|
||||
@Rollback
|
||||
@Transactional
|
||||
public void testFailToCreateDuplicateProjectClassCode() {
|
||||
ProjectClass test = new ProjectClass(ProjectClass.BACHELOR, "Bachelor", "Bachelor degree thesis project");
|
||||
test = projectClassDao.save(test);
|
||||
}
|
||||
|
||||
Assert.assertEquals(new Member(userWithActiveAndInactive, Member.Type.AUTHOR),
|
||||
members.next());
|
||||
|
||||
Assert.assertEquals(new Member(userWithReviewer, Member.Type.REVIEWER),
|
||||
members.next());
|
||||
|
||||
Assert.assertEquals(new Member(userWithHeadSupervisor, Member.Type.SUPERVISOR),
|
||||
members.next());
|
||||
|
||||
Assert.assertFalse(members.hasNext());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Rollback
|
||||
@Transactional
|
||||
public void testShouldFindProjectsBasedOnStartDate() {
|
||||
try {
|
||||
@Test
|
||||
@Rollback
|
||||
@Transactional
|
||||
public void testProjectClassConvertUppercase() {
|
||||
String code = "rAndomCase";
|
||||
ProjectClass test = new ProjectClass(code, "Bachelor", "Bachelor degree thesis project");
|
||||
test = projectClassDao.save(test);
|
||||
|
||||
Assert.assertEquals(test.getCode(), code.toUpperCase());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Rollback
|
||||
@Transactional
|
||||
public void testIsProjectParticipant() {
|
||||
Project newProject = new Project();
|
||||
newProject.setProjectClass(projectClass);
|
||||
newProject.setTitle("test");
|
||||
newProject = projectDao.save(newProject);
|
||||
|
||||
User newUser = new User();
|
||||
newUser.setFirstName("f");
|
||||
newUser.setLastName("l");
|
||||
newUser = userDao.save(newUser);
|
||||
|
||||
Assert.assertFalse(projectDao.isProjectParticipant(newUser, newProject)); //Catches previous EmptyResultDataAccessException
|
||||
Assert.assertFalse(projectDao.isProjectParticipant(unrelatedUser, newProject));
|
||||
Assert.assertFalse(projectDao.isProjectParticipant(unrelatedUser, activeProject));
|
||||
Assert.assertTrue(projectDao.isProjectParticipant(userWithInactive, inactiveProject));
|
||||
Assert.assertFalse(projectDao.isProjectParticipant(userWithCompleted, inactiveProject));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Rollback
|
||||
@Transactional
|
||||
public void testIsProjectFollower() {
|
||||
Assert.assertFalse(activeProject.getProjectFollowers().isEmpty());
|
||||
Assert.assertFalse(inactiveProject.getProjectFollowers().isEmpty());
|
||||
Assert.assertTrue(completedProject.getProjectFollowers().isEmpty());
|
||||
Assert.assertTrue(projectDao.isProjectFollower(userWithReviewer, activeProject));
|
||||
Assert.assertFalse(projectDao.isProjectFollower(unrelatedUser, activeProject));
|
||||
//Assert.assertFalse( projectDao.isProjectFollower(unrelatedUser, activeProject) );
|
||||
//Assert.assertTrue( projectDao.isProjectParticipant(userWithInactive, inactiveProject) );
|
||||
//Assert.assertFalse( projectDao.isProjectParticipant(userWithCompleted, inactiveProject) );
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Rollback
|
||||
@Transactional
|
||||
public void testShouldIncludeAuthorsAndReviewersAndHeadSupervisorInMembers() {
|
||||
Iterator<Member> members = activeProject.getMembers().iterator();
|
||||
|
||||
Assert.assertEquals(new Member(userWithActiveAndCompleted, Member.Type.AUTHOR),
|
||||
members.next());
|
||||
|
||||
Assert.assertEquals(new Member(userWithActiveAndInactive, Member.Type.AUTHOR),
|
||||
members.next());
|
||||
|
||||
Assert.assertEquals(new Member(userWithReviewer, Member.Type.REVIEWER),
|
||||
members.next());
|
||||
|
||||
Assert.assertEquals(new Member(userWithHeadSupervisor, Member.Type.SUPERVISOR),
|
||||
members.next());
|
||||
|
||||
Assert.assertFalse(members.hasNext());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Rollback
|
||||
@Transactional
|
||||
public void testShouldFindProjectsBasedOnStartDate() {
|
||||
try {
|
||||
date10Jan2012 = date.parse("2012-01-10");
|
||||
date1Jan2012 = date.parse("2012-01-01");
|
||||
date15Dec2011 = date.parse("2011-12-15");
|
||||
date1Dec2011 = date.parse("2011-12-01");
|
||||
} catch (ParseException e) {
|
||||
date15Dec2011 = date.parse("2011-12-15");
|
||||
date1Dec2011 = date.parse("2011-12-01");
|
||||
}
|
||||
catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ProjectDao.Params params = new ProjectDao.Params();
|
||||
params.setStartedAfter(date15Dec2011);
|
||||
params.setStartedBefore(date10Jan2012);
|
||||
|
||||
activeProject.setDaisyStartDate(date1Jan2012);
|
||||
completedProject.setDaisyStartDate(date1Dec2011);
|
||||
|
||||
List<Project> projects = projectDao.findProjects(params);
|
||||
Assert.assertEquals(Arrays.asList(new Project[] { activeProject }), projects);
|
||||
}
|
||||
|
||||
ProjectDao.Params params = new ProjectDao.Params();
|
||||
params.setStartedAfter(date15Dec2011);
|
||||
params.setStartedBefore(date10Jan2012);
|
||||
|
||||
activeProject.setDaisyStartDate(date1Jan2012);
|
||||
completedProject.setDaisyStartDate(date1Dec2011);
|
||||
|
||||
List<Project> projects = projectDao.findProjects(params);
|
||||
Assert.assertEquals(Arrays.asList(new Project[]{activeProject}), projects);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user