conduit r1215 - in trunk: . conduit conduit/modules/NetworkModule data scripts test/python-tests



Author: jstowers
Date: Mon Jan 14 13:58:51 2008
New Revision: 1215
URL: http://svn.gnome.org/viewvc/conduit?rev=1215&view=rev

Log:
2008-01-15  John Stowers  <john stowers gmail com>

	* Makefile.am:
	* conduit/modules/NetworkModule/Makefile.am:
	* data/Makefile.am: Misc autotools fixes

	* conduit/Settings.py: make save settings and gtkmozembed browser default
	
	* scripts/continuous-tester.sh: New script that continually runs the 
	conduit test suite when it detects that SVN has changed

	* test/python-tests/TestCoreSyncWithConversion.py: Test mapping retention
	through the conversion barrier



Added:
   trunk/scripts/continuous-tester.sh   (contents, props changed)
   trunk/test/python-tests/TestCoreSyncWithConversion.py
Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/conduit/Settings.py
   trunk/conduit/modules/NetworkModule/Makefile.am
   trunk/data/Makefile.am

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Mon Jan 14 13:58:51 2008
@@ -8,10 +8,10 @@
 	    -e s/\ DATE\@/`date +%F`/g \
 	< $< > $@
 
-WEBROOT := root www greenbirdsystems com:/var/www/conduit-project.org/files/releases
 release: dist doap.rdf
 	svn cp ../trunk/ ../tags/$(VERSION)	
-	scp $(PACKAGE)-$(VERSION).tar.gz $(WEBROOT)
+	scp $(PACKAGE)-$(VERSION).tar.gz jstowers master gnome org
+	ssh jstowers master gnome org install-module $(PACKAGE)-$(VERSION).tar.gz
 
 DISTCLEANFILES = \
 	intltool-extract \
@@ -30,10 +30,10 @@
 	doap.rdf.in \
 	gnome-doc-utils.make
 
-#Update ChangeLog, NEWS and TODO from http://www.conduit-project.org
+#Update NEWS and TODO from http://www.conduit-project.org
 #Ugly autofoo to support make distcheck pass
 dist-hook:
-	@echo "Generating Changelog, NEWS, TODO"
+	@echo "Generating NEWS, TODO"
 	@if test -d $(top_srcdir)/.svn ; then \
 		wget -q -O $(distdir)/NEWS "http://www.conduit-project.org/wiki/$(VERSION)?format=txt" ; \
 		wget -q -O $(distdir)/TODO "http://www.conduit-project.org/wiki/TODO?format=txt"; ; \

Modified: trunk/conduit/Settings.py
==============================================================================
--- trunk/conduit/Settings.py	(original)
+++ trunk/conduit/Settings.py	Mon Jan 14 13:58:51 2008
@@ -77,19 +77,19 @@
 
     #Default values for conduit settings
     DEFAULTS = {
-        'show_splashscreen'         :   True,       #The splashscreen can be quite useful on slow computers
-        'show_dp_description'       :   False,      #Should the treeview show the dataprovider description
-        'show_status_icon'          :   True,       #Show an icon in the notification area indicating if a sync is running
-        'save_on_exit'              :   False,      #Is the sync set saved on exit automatically?
-        'enable_network'            :   True,       #Should conduit look for other conduits on the local network
-        'enable_removable_devices'  :   True,       #Should conduit support iPods, USB keys, etc
-        'twoway_policy_conflict'    :   "ask",      #ask,replace,skip
-        'twoway_policy_deleted'     :   "ask",      #ask,replace,skip
-        'gui_expanded_columns'      :   [],         #list of expanded column paths in the treeview
-        'gui_hpane_postion'         :   250,        #The hpane seperating the canvas and treeview position
-        'gui_window_size'           :   [],         #W,H
-        'gui_minimize_to_tray'      :   False,      #Behaviour when one minimizes the main window, should it iconify?
-        'web_login_browser'         :   "system"    #When loggin into websites use: "system","gtkmozembed","webkit","gtkhtml"
+        'show_splashscreen'         :   True,           #The splashscreen can be quite useful on slow computers
+        'show_dp_description'       :   False,          #Should the treeview show the dataprovider description
+        'show_status_icon'          :   True,           #Show an icon in the notification area indicating if a sync is running
+        'save_on_exit'              :   True,           #Is the sync set saved on exit automatically?
+        'enable_network'            :   True,           #Should conduit look for other conduits on the local network
+        'enable_removable_devices'  :   True,           #Should conduit support iPods, USB keys, etc
+        'twoway_policy_conflict'    :   "ask",          #ask,replace,skip
+        'twoway_policy_deleted'     :   "ask",          #ask,replace,skip
+        'gui_expanded_columns'      :   [],             #list of expanded column paths in the treeview
+        'gui_hpane_postion'         :   250,            #The hpane seperating the canvas and treeview position
+        'gui_window_size'           :   [],             #W,H
+        'gui_minimize_to_tray'      :   False,          #Behaviour when one minimizes the main window, should it iconify?
+        'web_login_browser'         :   "gtkmozembed"   #When loggin into websites use: "system","gtkmozembed","webkit","gtkhtml"
     }
     CONDUIT_GCONF_DIR = "/apps/conduit/"
         

Modified: trunk/conduit/modules/NetworkModule/Makefile.am
==============================================================================
--- trunk/conduit/modules/NetworkModule/Makefile.am	(original)
+++ trunk/conduit/modules/NetworkModule/Makefile.am	Mon Jan 14 13:58:51 2008
@@ -1,5 +1,5 @@
 conduit_handlersdir = $(libdir)/conduit/modules/NetworkModule
-conduit_handlers_PYTHON = Client.py Server.py Peers.py NetworkModule.py __init__.py
+conduit_handlers_PYTHON = Client.py Server.py Peers.py NetworkModule.py XMLRPCUtils.py __init__.py
 
 clean-local:
 	rm -rf *.pyc *.pyo

Modified: trunk/data/Makefile.am
==============================================================================
--- trunk/data/Makefile.am	(original)
+++ trunk/data/Makefile.am	Mon Jan 14 13:58:51 2008
@@ -46,6 +46,7 @@
 	smugmug.png \
 	boxdotnet.png \
 	flickr.png \
+	shutterfly.png \
 	youtube.png
 
 conduitbindir = $(libdir)/conduit

Added: trunk/scripts/continuous-tester.sh
==============================================================================
--- (empty file)
+++ trunk/scripts/continuous-tester.sh	Mon Jan 14 13:58:51 2008
@@ -0,0 +1,82 @@
+#!/bin/sh
+#Continuously builds and tests conduit from GNOME svn
+TEST_DIR='/tmp/conduittestdir'
+LOGFILE='/home/john/Desktop/conduit-test.log'
+SVN_REPO='http://svn.gnome.org/svn/conduit/trunk'
+TEST_OPTIONS=''
+SLEEP_TIME='1h'
+
+ME=`basename $0`
+USAGE="\
+Usage:\n\
+$ME [OPTIONS]\n\
+Runs the conduit test suite and uploads the results. Defaults to only running\n\
+if the remote repository has changed\n\n\
+Options:\n\
+\t-f, --force\t\tRun the tests even if the repository has not changed\n\
+\t-d, --disable-docs\tDisable buliding of documentation\n\
+\t-l, --loop\t\tRuns in a never ending loop"
+
+FORCE=no
+DOCS=yes
+CNT=-1
+#Check the arguments.
+for option in "$@"; do
+  case "$option" in
+    -h | --help)
+      echo $USAGE
+      exit 0 ;;
+    -f | --force)
+      FORCE=yes ;;
+    -d | --disable-docs)
+      DOCS=no ;;
+    -l | --loop)
+      CNT=1 ;;
+    -*)
+      echo "Unrecognized option: $option\n\n$USAGE"
+      exit 1 ;;
+  esac
+done
+
+if [ ! -d $TEST_DIR ]; then
+    mkdir -p $TEST_DIR
+    svn co $SVN_REPO $TEST_DIR
+    FORCE=yes
+fi
+touch $LOGFILE
+cd $TEST_DIR
+
+#Emulate a do-while loop
+while [ $CNT -ne 0 ]; do
+
+    #Calculate local and remote repository revisions
+    LVERSION=`svnversion $TEST_DIR`
+    RVERSION=`svn info http://svn.gnome.org/svn/conduit/trunk | sed -n 's/^Revision: \([0-9][0-9]*\).*/\1/p'`
+
+    if [ "$LVERSION" != "$RVERSION" -o "$FORCE" = "yes" ]; then
+        echo "`date` Running Test (Revision $LVERSION)" | tee -a $LOGFILE
+        #Run tests (dbus-launch sets a private session bus incase we are
+        #being run from a VT
+        dbus-launch ./scripts/run-tests.sh -$TEST_OPTIONS &>>$LOGFILE
+        
+        #Build packages
+        #./autogen.sh && make && make dist &>/dev/null
+        #Build debs
+        #./build-svn-packages.sh &>/dev/null
+
+        #Build API docs
+        if [ $DOCS = "yes" ]; then
+            ./scripts/make-doc.sh &>/dev/null
+            ./scripts/upload-doc.sh &>/dev/null
+        fi
+    fi
+    
+    echo "`date` Sleeping" | tee -a $LOGFILE
+    sleep $SLEEP_TIME
+    CNT=`expr $CNT + 1`
+done
+
+cd - &>/dev/null
+
+
+

Added: trunk/test/python-tests/TestCoreSyncWithConversion.py
==============================================================================
--- (empty file)
+++ trunk/test/python-tests/TestCoreSyncWithConversion.py	Mon Jan 14 13:58:51 2008
@@ -0,0 +1,125 @@
+#common sets up the conduit environment
+from common import *
+
+import conduit
+from conduit.datatypes import DataType
+from conduit.dataproviders.DataProvider import TwoWay
+
+import datetime
+
+FOO_MTIME = datetime.datetime(1983,8,16)
+BAR_MTIME = datetime.datetime(2007,2,23)
+DB_DEBUG = True
+
+class _DataType(DataType.DataType):
+    def __init__(self, data, **kwargs):
+        DataType.DataType.__init__(self)
+        self.data = data                
+    def get_hash(self):
+        return hash( self.data )
+                
+class _TwoWay(TwoWay):
+    _module_type_ = "twoway"
+    def __init__(self, *args):
+        TwoWay.__init__(self)
+        
+    def _get_data(self, LUID):
+        dat = self.data_klass(LUID)
+        dat.set_mtime(self.mtime)
+        dat.set_UID(LUID)
+        return dat
+        
+    def initialize(self):
+        return True
+
+    def get_all(self):
+        TwoWay.get_all(self)
+        return self.data
+
+    def get(self, LUID):
+        return self._get_data(LUID)
+
+    def put(self, data, overwrite, LUID=None):
+        TwoWay.put(self, data, overwrite, LUID)
+        self.data.append(data.data)
+        f = self._get_data(data.data)
+        return f.get_rid()
+        
+    def get_UID(self):
+        return ""
+        
+class FooDataType(_DataType):
+    _name_ = "foo"
+        
+class FooTwoWay(_TwoWay):
+    _in_type_ = "foo"
+    _out_type_ = "foo"
+
+    def __init__(self, *args):
+        _TwoWay.__init__(self)
+        self.data = ['A']
+        self.mtime = FOO_MTIME
+        self.data_klass = FooDataType
+
+class BarDataType(_DataType):
+    _name_ = "bar"
+        
+class BarTwoWay(_TwoWay):
+    _in_type_ = "bar"
+    _out_type_ = "bar"
+
+    def __init__(self, *args):
+        _TwoWay.__init__(self)
+        self.data = ['M']
+        self.mtime = BAR_MTIME
+        self.data_klass = BarDataType
+
+class FooBarConverter(object):
+    def __init__(self):
+        self.conversions =  {
+                "foo,bar"           : self.foo_to_bar,
+                "bar,foo"           : self.bar_to_foo
+        }
+    def foo_to_bar(self, data, **kwargs):
+        return data
+        
+    def bar_to_foo(self, data, **kwargs):
+        return data
+
+#Setup the test environment
+test = SimpleSyncTest()
+
+#instantiate modules and add with wrappers
+source = FooTwoWay()
+sink = BarTwoWay()
+conv = FooBarConverter()
+
+convDpw = test.wrap_dataprovider(conv)
+sourceDpw = test.wrap_dataprovider(source)
+sinkDpw = test.wrap_dataprovider(sink)
+
+test.type_converter._add_converter(convDpw)
+test.prepare(
+        sourceDpw, 
+        sinkDpw
+        )
+test.set_two_way_sync(True)
+
+#Check both source and sink get data
+so,sk = test.sync(debug=DB_DEBUG)
+ok("Sync'd data", so == 2 and sk == 2)
+
+
+
+#Modify t
+sink.mtime=datetime.datetime(2007,2,24)
+test.sync(debug=DB_DEBUG)
+
+maps = conduit.GLOBALS.mappingDB.get_mappings_for_dataproviders(
+                            sourceUID=sink.get_UID(),
+                            sinkUID=source.get_UID()
+                            )
+print maps
+#ok("MappingDB saved all relationships
+
+finished()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]