Skip to content

Commit

Permalink
SAK-25544 Upgrade to spring 4.1.8
Browse files Browse the repository at this point in the history
Upgrading Spring to version 4.1.8 required
- Quartz 2.2.1 upgrade
- All xml files were updated to the modern XSD beans definition
- Many Tests were updated to using the newer ContextConfiguration
- Annotation as the old AbstractDependencyInjectionSpringContextTests was
removed and tests are now run with AbstractJUnit4SpringContextTests.
- Hibernate 3.6 is still supported in spring 4.1 but not in spring 4.2
- HibernateTemplate's *All methods were removed
- HibernateTemplate.find* needs explicit cast to List<?>
- All Kernel tests were updated to the junit 4 style, and many others
elsewhere
- Kernel test harness was removed as it's not needed
- ContextLoaderListener had some minor changes and was renamed to
SakaiContextLoaderListener (This is what binds sakai component
application context to webapps)
- GenericDAO lib was added to common and also upgraded to spring 4.1
- RSF was also upgraded to spring 4.1, see RSF-16
  • Loading branch information
ern committed Nov 18, 2015
1 parent 96b0835 commit 1dbccf9
Show file tree
Hide file tree
Showing 455 changed files with 6,147 additions and 8,316 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="org.sakaiproject.announcement.api.AnnouncementService"
class="org.sakaiproject.announcement.impl.DbAnnouncementService"
init-method="init"
destroy-method="destroy"
singleton="true">
destroy-method="destroy">
<property name="memoryService"><ref bean="org.sakaiproject.memory.api.MemoryService"/></property>
<property name="sqlService"><ref bean="org.sakaiproject.db.api.SqlService"/></property>
<property name="contentHostingService"><ref bean="org.sakaiproject.content.api.ContentHostingService"/></property>
Expand Down Expand Up @@ -48,7 +47,7 @@
<bean id="org.sakaiproject.user.api.UserNotificationPreferencesRegistration.announcement"
parent="org.sakaiproject.user.api.UserNotificationPreferencesRegistration"
class="org.sakaiproject.announcement.user.prefs.AnnouncementUserNotificationPreferencesRegistrationImpl"
init-method="init" singleton="true">
init-method="init">
<property name="bundleLocation"><value>annc-noti-prefs</value></property>
<property name="sectionTitleBundleKey"><value>prefs_title</value></property>
<property name="sectionDescriptionBundleKey"><value>prefs_description</value></property>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean parent="org.sakaiproject.entitybroker.entityprovider.AbstractEntityProvider"
class="org.sakaiproject.announcement.entityprovider.AnnouncementEntityProviderImpl">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@
<listener-class>org.sakaiproject.util.ToolListener</listener-class>
</listener>
<listener>
<listener-class>org.sakaiproject.util.ContextLoaderListener</listener-class>
<listener-class>org.sakaiproject.util.SakaiContextLoaderListener</listener-class>
</listener>
</web-app>
27 changes: 3 additions & 24 deletions archive/import-pack/src/webapp/WEB-INF/components.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>



<!-- <bean id="org.sakaiproject.importer.impl.handlers.AnnouncementHandler" -->
<!-- class="org.sakaiproject.importer.impl.handlers.AnnouncementHandler" -->
<!-- singleton="true"> -->
<!-- <property name="announcementService"> -->
<!-- <ref bean="org.sakaiproject.announcement.api.AnnouncementService" /> -->
<!-- </property> -->
<!-- </bean> -->
<!-- <bean id="org.sakaiproject.importer.impl.handlers.SamigoAssessmentHandler" -->
<!-- class="org.sakaiproject.importer.impl.handlers.SamigoAssessmentHandler" -->
<!-- singleton="true"> -->
<!-- </bean> -->
<!-- -->
<!-- <bean id="org.sakaiproject.importer.impl.handlers.SamigoPoolHandler" -->
<!-- class="org.sakaiproject.importer.impl.handlers.SamigoPoolHandler" -->
<!-- singleton="true"> -->
<!-- </bean> -->


<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ public void execute(String opaqueContext){
i++;
}
if(newItems.size() > 0){
getHibernateTemplate().saveOrUpdateAll(newItems);
for (PeerAssessmentItem item : newItems) {
getHibernateTemplate().saveOrUpdate(item);
}
}
}
} catch (IdUnusedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public boolean removeModelAnswer(AssignmentModelAnswerItem mItem)
*/
public AssignmentModelAnswerItem getModelAnswer(String assignmentId)
{
List<AssignmentModelAnswerItem> rvList = (getHibernateTemplate().findByNamedQueryAndNamedParam("findModelAnswerByAssignmentId", "id", assignmentId));
List<AssignmentModelAnswerItem> rvList = (List<AssignmentModelAnswerItem>) getHibernateTemplate().findByNamedQueryAndNamedParam("findModelAnswerByAssignmentId", "id", assignmentId);
if (rvList != null && rvList.size() == 1)
{
return rvList.get(0);
Expand Down Expand Up @@ -322,7 +322,7 @@ public boolean removeNoteItem(AssignmentNoteItem mItem)
*/
public AssignmentNoteItem getNoteItem(String assignmentId)
{
List<AssignmentNoteItem> rvList = (getHibernateTemplate().findByNamedQueryAndNamedParam("findNoteItemByAssignmentId", "id", assignmentId));
List<AssignmentNoteItem> rvList = (List<AssignmentNoteItem>) getHibernateTemplate().findByNamedQueryAndNamedParam("findNoteItemByAssignmentId", "id", assignmentId);
if (rvList != null && rvList.size() == 1)
{
return rvList.get(0);
Expand Down Expand Up @@ -401,7 +401,7 @@ public boolean cleanAllPurposeItemAccess(AssignmentAllPurposeItem mItem)
*/
public AssignmentAllPurposeItem getAllPurposeItem(String assignmentId)
{
List<AssignmentAllPurposeItem> rvList = (getHibernateTemplate().findByNamedQueryAndNamedParam("findAllPurposeItemByAssignmentId", "id", assignmentId));
List<AssignmentAllPurposeItem> rvList = (List<AssignmentAllPurposeItem>) getHibernateTemplate().findByNamedQueryAndNamedParam("findAllPurposeItemByAssignmentId", "id", assignmentId);
if (rvList != null && rvList.size() == 1)
{
return rvList.get(0);
Expand Down
18 changes: 8 additions & 10 deletions assignment/assignment-impl/pack/src/webapp/WEB-INF/components.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="org.sakaiproject.assignment.api.AssignmentService"
class="org.sakaiproject.assignment.impl.DbAssignmentService"
init-method="init"
destroy-method="destroy"
singleton="true">
destroy-method="destroy">
<property name="contentHostingService"><ref bean="org.sakaiproject.content.api.ContentHostingService"/></property>
<property name="memoryService"><ref bean="org.sakaiproject.memory.api.MemoryService"/></property>
<property name="sqlService"><ref bean="org.sakaiproject.db.api.SqlService"/></property>
Expand Down Expand Up @@ -42,8 +41,7 @@

<bean id="org.sakaiproject.assignment.taggable.api.AssignmentActivityProducer"
class="org.sakaiproject.assignment.taggable.impl.AssignmentActivityProducerImpl"
init-method="init"
singleton="true">
init-method="init">
<property name="assignmentService">
<ref bean="org.sakaiproject.assignment.api.AssignmentService" />
</property>
Expand Down Expand Up @@ -95,7 +93,7 @@

<bean id="org.sakaiproject.assignment.impl.AssignmentSupplementItemServiceImpl"
class="org.sakaiproject.assignment.impl.AssignmentSupplementItemServiceImpl"
singleton="true" init-method="init" destroy-method="destroy">
init-method="init" destroy-method="destroy">
<property name="sessionFactory">
<ref
bean="org.sakaiproject.springframework.orm.hibernate.GlobalSessionFactory" />
Expand All @@ -116,7 +114,7 @@

<bean id="org.sakaiproject.assignment.impl.AssignmentGradeInfoProvider"
class="org.sakaiproject.assignment.impl.AssignmentGradeInfoProvider"
singleton="true" lazy-init="false" init-method="init" destroy-method="destroy">
lazy-init="false" init-method="init" destroy-method="destroy">
<property name="assignmentService" ref="org.sakaiproject.assignment.api.AssignmentService"/>
<property name="gradebookExternalAssessmentService" ref="org_sakaiproject_service_gradebook_GradebookExternalAssessmentService"/>
<property name="authzGroupService" ref="org.sakaiproject.authz.api.AuthzGroupService"/>
Expand All @@ -143,7 +141,7 @@

<bean id="org.sakaiproject.assignment.api.AssignmentPeerAssessmentServiceImpl"
class="org.sakaiproject.assignment.impl.AssignmentPeerAssessmentServiceImpl"
singleton="true" init-method="init" destroy-method="destroy">
init-method="init" destroy-method="destroy">
<property name="sessionFactory">
<ref bean="org.sakaiproject.springframework.orm.hibernate.GlobalSessionFactory" />
</property>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<!-- entity providers -->
<bean
parent="org.sakaiproject.entitybroker.entityprovider.AbstractEntityProvider"
Expand Down
2 changes: 1 addition & 1 deletion assignment/assignment-tool/tool/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@
<listener-class>org.sakaiproject.util.ToolListener</listener-class>
</listener>
<listener>
<listener-class>org.sakaiproject.util.ContextLoaderListener</listener-class>
<listener-class>org.sakaiproject.util.SakaiContextLoaderListener</listener-class>
</listener>
</web-app>
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<beans>


<!-- ENTITY PROVIDERS START -->
<bean parent="org.sakaiproject.entitybroker.entityprovider.AbstractEntityProvider"
class="org.sakaiproject.blti.entityprovider.BLTIEventsEntityProvider">
Expand Down
2 changes: 1 addition & 1 deletion basiclti/basiclti-blis/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</servlet-mapping>

<listener>
<listener-class>org.sakaiproject.util.ContextLoaderListener</listener-class>
<listener-class>org.sakaiproject.util.SakaiContextLoaderListener</listener-class>
</listener>

</web-app>
34 changes: 13 additions & 21 deletions basiclti/basiclti-pack/src/webapp/WEB-INF/components.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<beans>
<bean id="org.sakaiproject.basiclti.service.BasicLTISecurityService"
class="org.sakaiproject.basiclti.impl.BasicLTISecurityServiceImpl"
init-method="init"
destroy-method="destroy"
singleton="true">
destroy-method="destroy">
</bean>

<bean id="org.sakaiproject.lti.api.LTIService"
class="org.sakaiproject.lti.impl.DBLTIService"
init-method="init"
destroy-method="destroy"
singleton="true">
destroy-method="destroy">
<property name="sqlService"><ref bean="org.sakaiproject.db.api.SqlService"/></property>
<property name="eventTrackingService"><ref bean="org.sakaiproject.event.api.EventTrackingService"/></property>
<property name="usageSessionService"><ref bean="org.sakaiproject.event.api.UsageSessionService"/></property>
Expand All @@ -23,47 +22,40 @@
</bean>

<bean id="org.sakaiproject.lti.api.UserFinderOrCreator"
class="org.sakaiproject.lti.impl.UserFinderOrCreatorImpl"
singleton="true">
class="org.sakaiproject.lti.impl.UserFinderOrCreatorImpl">
<property name="userDirectoryService"><ref bean="org.sakaiproject.user.api.UserDirectoryService"/></property>
</bean>

<bean id="org.sakaiproject.lti.api.SiteEmailPreferenceSetter"
class="org.sakaiproject.lti.impl.SiteEmailPreferenceSetterImpl"
singleton="true">
class="org.sakaiproject.lti.impl.SiteEmailPreferenceSetterImpl">
<property name="preferencesService"><ref bean="org.sakaiproject.user.api.PreferencesService"/></property>
</bean>

<bean id="org.sakaiproject.lti.api.UserLocaleSetter"
class="org.sakaiproject.lti.impl.UserLocaleSetterImpl"
singleton="true">
class="org.sakaiproject.lti.impl.UserLocaleSetterImpl">
<property name="preferencesService"><ref bean="org.sakaiproject.user.api.PreferencesService"/></property>
</bean>

<bean id="org.sakaiproject.lti.api.UserPictureSetter"
class="org.sakaiproject.lti.impl.UserPictureSetterImpl"
singleton="true">
class="org.sakaiproject.lti.impl.UserPictureSetterImpl">
<property name="profileImageLogic"><ref bean="org.sakaiproject.profile2.logic.ProfileImageLogic"/></property>
<property name="profilePreferencesLogic"><ref bean="org.sakaiproject.profile2.logic.ProfilePreferencesLogic"/></property>
</bean>

<bean id="org.sakaiproject.lti.api.LTIRoleMapper"
class="org.sakaiproject.lti.impl.LTIRoleMapperImpl"
singleton="true">
class="org.sakaiproject.lti.impl.LTIRoleMapperImpl">
<property name="siteService"><ref bean="org.sakaiproject.site.api.SiteService"/></property>
<property name="serverConfigurationService"><ref bean="org.sakaiproject.component.api.ServerConfigurationService"/></property>
</bean>

<bean id="org.sakaiproject.lti.api.SiteMembershipUpdater"
class="org.sakaiproject.lti.impl.SiteMembershipUpdaterImpl"
singleton="true">
class="org.sakaiproject.lti.impl.SiteMembershipUpdaterImpl">
<property name="roleMapper"><ref bean="org.sakaiproject.lti.api.LTIRoleMapper"/></property>
<property name="siteService"><ref bean="org.sakaiproject.site.api.SiteService"/></property>
</bean>

<bean id="org.sakaiproject.lti.api.SiteMembershipsSynchroniser"
class="org.sakaiproject.lti.impl.SiteMembershipsSynchroniserImpl"
singleton="true">
class="org.sakaiproject.lti.impl.SiteMembershipsSynchroniserImpl">
<property name="userFinderOrCreator"><ref bean="org.sakaiproject.lti.api.UserFinderOrCreator"/></property>
<property name="serverConfigurationService"><ref bean="org.sakaiproject.component.api.ServerConfigurationService"/></property>
<property name="siteMembershipUpdater"><ref bean="org.sakaiproject.lti.api.SiteMembershipUpdater"/></property>
Expand All @@ -78,7 +70,7 @@

<bean id="org.sakaiproject.api.app.scheduler.JobBeanWrapper.ltiSiteMemberships"
class="org.sakaiproject.component.app.scheduler.jobs.SpringStatefulJobBeanWrapper"
singleton="true" init-method="init">
init-method="init">
<property name="beanId"><value>org.sakaiproject.lti.impl.jobs.SiteMembershipsSyncJob</value></property>
<property name="jobName"><value>Synchronise LTI Site Memberships</value></property>
<property name="schedulerManager"><ref bean="org.sakaiproject.api.app.scheduler.SchedulerManager" /></property>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<beans>


<!-- ENTITY PROVIDERS START -->
<bean parent="org.sakaiproject.entitybroker.entityprovider.AbstractEntityProvider"
class="org.sakaiproject.blti.entityprovider.BLTIEventsEntityProvider">
Expand Down
2 changes: 1 addition & 1 deletion basiclti/basiclti-portlet/src/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</servlet-mapping>

<listener>
<listener-class>org.sakaiproject.util.ContextLoaderListener</listener-class>
<listener-class>org.sakaiproject.util.SakaiContextLoaderListener</listener-class>
</listener>

</web-app>
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
package org.sakaiproject.calendar.impl;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.sakaiproject.calendar.api.ExternalSubscription;
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
import org.sakaiproject.calendar.impl.BaseExternalSubscription;
import org.sakaiproject.calendar.impl.SubscriptionCache;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;

public class IntegrationTests extends AbstractDependencyInjectionSpringContextTests {
@ContextConfiguration(locations={"/calendar-caches.xml", "/test-resources.xml"})
public class IntegrationTests extends AbstractJUnit4SpringContextTests {

private SubscriptionCache cache;

protected String[] getConfigPaths() {
return new String[]{"/calendar-caches.xml", "/test-resources.xml"};
}

protected void onSetUp() {
cache = (SubscriptionCache) getApplicationContext().getBean("org.sakaiproject.calendar.impl.BaseExternalCacheSubscriptionService.institutionalCache");
@Before
public void onSetUp() {
cache = (SubscriptionCache) applicationContext.getBean("org.sakaiproject.calendar.impl.BaseExternalCacheSubscriptionService.institutionalCache");
}

@Test
public void testNothing() {
assertNull(cache.get("not-in-cache"));
Assert.assertNull(cache.get("not-in-cache"));
}

@Test
public void testCacheRoundtrip() throws InterruptedException {
ExternalSubscription subscription = new BaseExternalSubscription();
subscription.setSubscriptionUrl("http://example.com");
subscription.setSubscriptionName("Example");
subscription.setContext("context");
subscription.setInstitutional(false);
cache.put(subscription);
assertEquals(subscription, cache.get("http://example.com"));
Assert.assertEquals(subscription, cache.get("http://example.com"));
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<beans>
<!-- This is the bean that reloads a calendar in a particular case -->
<bean id="org.sakaiproject.calendar.impl.ExternalCalendarElementRefresher"
class="org.sakaiproject.calendar.impl.MockExternalCalendarElementRefresher">
Expand Down
Loading

0 comments on commit 1dbccf9

Please sign in to comment.