aboutsummaryrefslogtreecommitdiffstats
path: root/test/net/java/sip
diff options
context:
space:
mode:
authorBenoit Pradelle <pradelle@java.net>2007-10-11 16:20:19 +0000
committerBenoit Pradelle <pradelle@java.net>2007-10-11 16:20:19 +0000
commitacd777f36024605ec098953fd17bc4a5da4651a9 (patch)
tree8a8b4a8989ace01d6d8643c46085752c3e4416d6 /test/net/java/sip
parentcf383ac1027068ee5a3d5cde350cf1ac76d327f3 (diff)
downloadjitsi-acd777f36024605ec098953fd17bc4a5da4651a9.zip
jitsi-acd777f36024605ec098953fd17bc4a5da4651a9.tar.gz
jitsi-acd777f36024605ec098953fd17bc4a5da4651a9.tar.bz2
Moved FailSafeTransactions to the fileaccess bundle.
Diffstat (limited to 'test/net/java/sip')
-rw-r--r--test/net/java/sip/communicator/slick/fileaccess/FileAccessServiceLick.java1
-rw-r--r--test/net/java/sip/communicator/slick/fileaccess/TestFailSafeTransaction.java (renamed from test/net/java/sip/communicator/slick/slickless/util/TestFailSafeTransaction.java)41
-rw-r--r--test/net/java/sip/communicator/slick/slickless/SlicklessTests.java1
3 files changed, 35 insertions, 8 deletions
diff --git a/test/net/java/sip/communicator/slick/fileaccess/FileAccessServiceLick.java b/test/net/java/sip/communicator/slick/fileaccess/FileAccessServiceLick.java
index f80a387..906c9e2 100644
--- a/test/net/java/sip/communicator/slick/fileaccess/FileAccessServiceLick.java
+++ b/test/net/java/sip/communicator/slick/fileaccess/FileAccessServiceLick.java
@@ -39,6 +39,7 @@ public class FileAccessServiceLick extends TestSuite implements BundleActivator
properties.put("service.pid", getName());
addTestSuite(TestFileAccessService.class);
+ addTestSuite(TestFailSafeTransaction.class);
bundleContext.registerService(getClass().getName(), this, properties);
logger.debug("Successfully registered " + getClass().getName());
diff --git a/test/net/java/sip/communicator/slick/slickless/util/TestFailSafeTransaction.java b/test/net/java/sip/communicator/slick/fileaccess/TestFailSafeTransaction.java
index 4726d64..3008299 100644
--- a/test/net/java/sip/communicator/slick/slickless/util/TestFailSafeTransaction.java
+++ b/test/net/java/sip/communicator/slick/fileaccess/TestFailSafeTransaction.java
@@ -5,10 +5,14 @@
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.slick.slickless.util;
+package net.java.sip.communicator.slick.fileaccess;
import java.io.*;
-import net.java.sip.communicator.util.*;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+import net.java.sip.communicator.service.fileaccess.*;
import junit.framework.*;
/**
@@ -20,6 +24,11 @@ public class TestFailSafeTransaction
extends TestCase
{
/**
+ * The Service that we will be testing.
+ */
+ private FileAccessService fileAccessService = null;
+
+ /**
* Test data to write in the original file
*/
private static final String origData = "this is a test for the fail safe "
@@ -42,6 +51,19 @@ public class TestFailSafeTransaction
private static String tempName = "wzsxedcrfv" + System.currentTimeMillis();
/**
+ * Standart constructor.
+ *
+ * @param name
+ */
+ public TestFailSafeTransaction(String name)
+ {
+ super(name);
+ BundleContext context = FileAccessServiceLick.bc;
+ ServiceReference ref = context
+ .getServiceReference(FileAccessService.class.getName());
+ this.fileAccessService = (FileAccessService) context.getService(ref);
+ }
+ /**
* Tests the commit operation
*/
public void testCommit() {
@@ -53,7 +75,8 @@ public class TestFailSafeTransaction
out.write(origData.getBytes());
// write a modification during a transaction
- FailSafeTransaction trans = new FailSafeTransaction(temp);
+ FailSafeTransaction trans = this.fileAccessService
+ .createFailSafeTransaction(temp);
trans.beginTransaction();
out.write(addedData.getBytes());
@@ -97,7 +120,8 @@ public class TestFailSafeTransaction
out.write(origData.getBytes());
// write a modification during a transaction
- FailSafeTransaction trans = new FailSafeTransaction(temp);
+ FailSafeTransaction trans = this.fileAccessService
+ .createFailSafeTransaction(temp);
trans.beginTransaction();
out.write(wrongData.getBytes());
@@ -141,7 +165,8 @@ public class TestFailSafeTransaction
out.write(origData.getBytes());
// write a modification during a transaction
- FailSafeTransaction trans = new FailSafeTransaction(temp);
+ FailSafeTransaction trans = this.fileAccessService
+ .createFailSafeTransaction(temp);
trans.beginTransaction();
out.write(addedData.getBytes());
@@ -190,8 +215,10 @@ public class TestFailSafeTransaction
out.write(origData.getBytes());
// write a modification during a transaction
- FailSafeTransaction trans = new FailSafeTransaction(temp);
- FailSafeTransaction trans2 = new FailSafeTransaction(temp);
+ FailSafeTransaction trans = this.fileAccessService
+ .createFailSafeTransaction(temp);
+ FailSafeTransaction trans2 = this.fileAccessService
+ .createFailSafeTransaction(temp);
trans.beginTransaction();
out.write(wrongData.getBytes());
diff --git a/test/net/java/sip/communicator/slick/slickless/SlicklessTests.java b/test/net/java/sip/communicator/slick/slickless/SlicklessTests.java
index e927afa..d4eae48 100644
--- a/test/net/java/sip/communicator/slick/slickless/SlicklessTests.java
+++ b/test/net/java/sip/communicator/slick/slickless/SlicklessTests.java
@@ -43,7 +43,6 @@ public class SlicklessTests
addTestSuite(TestXMLUtils.class);
addTestSuite(TestBase64.class);
- addTestSuite(TestFailSafeTransaction.class);
bundleContext.registerService(getClass().getName(), this, properties);
logger.debug("Successfully registered " + getClass().getName());