October 13, 2005

Fooling with uPortal Notes

This is just raw notes from working with Adrian at Lancaster. Ultimately this was me getting up2.4 to work - Adrian did this with up2.5 and after a while I switched and helped him.

Changed tomcat to 8090 and 8095 ports

In the uPortal_rel directory - switch to 8090

csh
foreach i ( `grep -rl localhost:8080 *` )
/bin/rm -rf /tmp/x
echo Converting 8080 to 8090 in $i

sed 's/localhost:8080/localhost:8090/' < "$i" > /tmp/x

cp /tmp/x $i
end

vi "webpages/stylesheets/org/jasig/portal/channels/CContentSubscriber/channel registry.xml"

maven uPortalDeployAll

Did not work so wel because of the firewall at Lancaster.

Going back into uPortal (2.4.3)

ant clean compile

Error.

Addes to build.properties

backport.jar=${lib.path}/backport-util-concurrent.jar

ant compile works now :

ant clean compile deploy db initportal

Also used this to start hsql (on the mac)

http://localhost:8090/uPortal/render.userLayoutRootNode.uP
Cannot start uPortal
Sorry, but a problem is preventing the Portal from starting. The error must be corrected by system administrators. Try again later.

In Portal.log
ERROR [http-8090-Processor21] portal.RDBMUserIdentityStore.[] Sep/23 07:01:41 - RDBMUserIdentityStore::getPortalUID()
java.sql.SQLException: Table not found: UP_USER in statement [SELECT USER_ID, USER_DFLT_USR_ID FROM UP_USER WHERE USER_NAME=?]
oops - had cleaned out hsql *after* ant db ....
All better with a correct DB

start hsql
and then do
ant clean compile deploy db initportal
Moved all of the ogce skins into
./webpages/media/org/jasig/portal/layout/AL_TabColumn/integratedModes/
And restart. Can select amongst the 3 OGCE skins but missing all of the mainborder stuff. Wonder if we need to change the *other integratedModes.xsl file (the 140K one).
cd webpages/stylesheets/org/jasig/portal/layout/AL_TabColumn/integratedModes/
mv integratedModes.xsl integratedModes_old.xsl
cp ~/dev/ogce2/extras-uPortal/skin/integratedModes.xsl .

That looks bad before you log in :( :( :(
But once you log in and change the skin - things work.

How to change the default skin???
Change immII to ogce-round
vi webpages/stylesheets/org/jasig/portal/layout/AL_TabColumn/integratedModes/integratedModes.sdf
vi properties/db/data.xml
vi webpages/stylesheets/org/jasig/portal/channels/CSkinSelector/skinSelector.xsl
ant clean compile deploy db initportal
Since initportal includes deploy and db, this should be
ant clean compile initportal
All good.

Try now for the portlet
Put war file in sakai-test.war and restart
Some how channel configuration does not work.
sakai-test.SakaiLaunch
Trying to put sakai-test.war into uPortal_rel-2-4-3/lib/portlets
/Chuck

Posted by csev at 03:04 PM

October 06, 2005

UNIT Testing In Sakai

Well I fooled with Unit Testing in Sakai for a few hours and kind of came to a dead end. It was pretty fun and the basic stuff worked. My problem is that I just don't know where to stop when creating mock versions of stuff. I looked at unit tests in the gradebook and common and there is not much interaction witht he rest of Sakai - I want to create unit tests that can interact with the rest of Sakai. But that means firing up components somehow (or mocking that up), firing up component manager (or mocking that up) etc etc. The problem is that with the structure of unit tests it seems that everyone who writes a unit test is responsible for mocking up the entire rest of the system. This is icky when dealing with a system as large as Sakai with a goal of a rich framework that *everything* depends on. So we will need to develop a way to make unit testing easier. Someone other than me will need to figure this out.

But here are my notes. Thanks to Josh and Lance for their examples. This page is a god-send:

http://bugs.sakaiproject.org/confluence/display/ENC/JUnit+Testing

I followed this cookbook and got to the point that the I had a simple unit test working, making its local beans, finding its local beans, using its local beans and then falling on its face.

I adapted Lance's code:

common-composite-component/src/test/org/sakaiproject/component/junit/spring/ApplicationContextBaseTest.java

I removed everything Hibernate from it and got a pure spring version. This worked once you set the variable on the maven call:

maven test -Dsakaiproject.basedir=/Users/csev/dev/sakai

Here is how it looks when it runs:


test:compile:
    [javac] Compiling 1 source file to /Users/csev/dev/sakai/osid/component/target/test-classes
ApplicationContext=org.springframework.context.support.ClassPathXmlApplicationContext: display name [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=2790855]; startup date [Wed Oct 05 23:18:11 EDT 2005]; root of context hierarchy
        org.osid.id.IdManager

ApplicationContext=org.springframework.context.support.ClassPathXmlApplicationContext: display name [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=1183826]; startup date [Wed Oct 05 23:18:11 EDT 2005]; root of context hierarchy
        org.osid.id.IdManager


test:test:
    [junit] Running org.sakaiproject.osid.test.IdManagerTest
Hello from my unit test...
Here we go..
idm=org.sakaiproject.component.osid.id.IdManager@d4461b
Exception...
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.042 sec
BUILD SUCCESSFUL
Total time: 6 seconds
Posted by csev at 08:49 AM

October 04, 2005

Sakai Developer QuickStart

The big picture/outline:

http://cvs.sakaiproject.org/release/2.0.1/SourceInstallGuide.html

The attached script is the "magic developer bootstrap thing" - when it runs - you are in great shape.

Pre-requisites

SVN for Mac:

http://metissian.com/projects/macosx/subversion/

Maven

http://maven.apache.org/start/install.html

Add this to your .bashrc_login (or equivalent)

JAVA_OPTS='-server -Xms512m -Xmx512m -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps'; export JAVA_OPTS;
Shell script - beware line breaks.
#!/bin/csh

# To run this type 
# cd ~/dev
# csh svn-bootstrap.csh

# Pick your Sakai Tag  and checkout type

# Head Check out
set TYPE=trunk
set TAG=sakai

# Tag Check out
#set TYPE=tags
#set TAG=sakai_2-0-0

echo Sakai Checkout Type: $TYPE Tag: $TAG

# set Tomcats ports and version

set TC_PORT=8080
set TC_SHUT=8005
set TOMCAT=5.5.9

echo TOMCAT Version:$TOMCAT Port:$TC_PORT  Shutdown port:$TC_SHUT

set MYPATH=`pwd`

# Download Tomcat using curl if necessary

if ( -d keepzips ) then
  echo keepzips directory exists...
else
  echo Creating keepzips directory ...
  mkdir keepzips
endif

if ( -f keepzips/jakarta-tomcat-$TOMCAT-compat.tar.gz ) then
  echo keepzips/jakarta-tomcat-$TOMCAT-compat.tar.gz exists...
else
  echo Downloading keepzips/jakarta-tomcat-$TOMCAT-compat.tar.gz ...
  cd keepzips
  curl -O http://archive.apache.org/dist/jakarta/tomcat-5/v$TOMCAT/bin/jakarta-tomcat-$TOMCAT-compat.tar.gz
  cd $MYPATH
endif

if ( -f keepzips/jakarta-tomcat-$TOMCAT.tar.gz ) then
  echo keepzips/jakarta-tomcat-$TOMCAT.tar.gz exists...
else 
  echo Downloading keepzips/jakarta-tomcat-$TOMCAT.tar.gz ...
  cd keepzips
  curl -O http://archive.apache.org/dist/jakarta/tomcat-5/v$TOMCAT/bin/jakarta-tomcat-$TOMCAT.tar.gz
  cd $MYPATH
endif

# Set up clean Tomcat directory

rm -rf jakarta-tomcat-$TOMCAT/
rm -rf old-$TAG
mv $TAG old-$TAG

echo Extracting Tomcat...
tar xfz keepzips/jakarta-tomcat-$TOMCAT.tar.gz
echo Extracting Tomcat JDK 1.5 Compatibility patch
tar xfz keepzips/jakarta-tomcat-$TOMCAT-compat.tar.gz

cd  jakarta-tomcat-$TOMCAT/conf
cp server.xml server.sav
cat server.sav | sed s/8080/$TC_PORT/ | sed s/8005/$TC_SHUT/ > server.xml
diff server.sav server.xml
cd ../..

svn co https://source.sakaiproject.org/svn/$TYPE/$TAG

cd $TAG
maven sakai -Dmaven.tomcat.home=$MYPATH/jakarta-tomcat-$TOMCAT/ -D maven.repo.remote=http://www.ibiblio.org/maven/,http://cvs.sakaiproject.org/maven/

cd ..

# Switch to the demo configuration - mostly to make HSQL DB store in a file

mkdir $MYPATH/jakarta-tomcat-$TOMCAT/sakai
cp $TAG/demo/sakai.properties $MYPATH/jakarta-tomcat-$TOMCAT/sakai
cp $TAG/demo/toolOrder.xml $MYPATH/jakarta-tomcat-$TOMCAT/sakai

echo
echo cd jakarta-tomcat-$TOMCAT/logs
echo ../bin/startup.sh
Posted by csev at 11:08 AM