Permalink
Browse files

Initial cleanup

  • Loading branch information...
0 parents commit c74aab498b7c13a4a3b5e336a6030d9bc746d12d @ebi ebi committed Jul 10, 2009
Showing with 1,854 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +48 −0 README
  3. BIN bin/classes/ch/liip/jcr/jack/Jack.class
  4. +166 −0 bin/classes/ch/liip/jcr/jack/Jack.java
  5. +14 −0 bin/classes/jcr.properties
  6. +7 −0 bin/classes/log4j.properties
  7. BIN bin/jack.jar
  8. +6 −0 fixtures/level1/access/base.xml
  9. +15 −0 fixtures/level1/read/base.xml
  10. +11 −0 fixtures/level1/search/base.xml
  11. +50 −0 inc/PHP_importexport.php
  12. +29 −0 inc/baseCase.php
  13. +19 −0 inc/baseSuite.php
  14. +70 −0 inc/bootstrap.php
  15. +40 −0 inc/importexport.php
  16. BIN lib/DavexClient.jar
  17. BIN lib/jackrabbit-api-2.0-alpha3.jar
  18. BIN lib/jackrabbit-core-2.0-alpha3.jar
  19. +11 −0 phpunit.xml
  20. +6 −0 tests/level1/AccessControlTest.php
  21. +17 −0 tests/level1/AccessTest.php
  22. +37 −0 tests/level1/AccessTest/Credentials.php
  23. +72 −0 tests/level1/AccessTest/Repository.php
  24. +46 −0 tests/level1/AccessTest/RepositoryDescriptors.php
  25. +6 −0 tests/level1/ExportTest.php
  26. +26 −0 tests/level1/NamespacesTest.php
  27. +67 −0 tests/level1/NamespacesTest/NamespaceRegistry.php
  28. +76 −0 tests/level1/NamespacesTest/SessionNamespaceRemapping.php
  29. +6 −0 tests/level1/NodeTypesTest.php
  30. +31 −0 tests/level1/ReadTest.php
  31. +230 −0 tests/level1/ReadTest/NodeReadMethods.php
  32. +287 −0 tests/level1/ReadTest/PropertyReadMethods.php
  33. +128 −0 tests/level1/ReadTest/SessionReadMethods.php
  34. +74 −0 tests/level1/ReadTest/WorkspaceReadMethods.php
  35. +36 −0 tests/level1/SearchTest.php
  36. +32 −0 tests/level1/SearchTest/QueryManager.php
  37. +40 −0 tests/level1/SearchTest/QueryObjectXpath.php
  38. +70 −0 tests/level1/SearchTest/QueryResults.php
  39. +68 −0 tests/level1/SearchTest/Row.php
  40. +6 −0 tests/level1/SystemNodeTest.php
  41. +6 −0 tests/level1/XMLMappingsTest.php
@@ -0,0 +1 @@
+derby.log
48 README
@@ -0,0 +1,48 @@
+Usage:
+Run phpunit inside of the root directory.
+
+For usage with Zend you probably have to execute it manually like
+this:
+
+/usr/local/zend/bin/php-cli /usr/local/zend/bin/phpunit tests/level1/ReadTest.php
+
+Dependencies:
+java in PATH
+PHPUnit in PATH
+PHPUnit in include_path
+
+How to test your own code:
+You need to change the phpunit.xml and write your own bootstrap file. The file
+needs to provide the following:
+function getRepository(config) which returns the repository
+function getJCRSession(config) which returns the session
+function getSimpleCredentials(user, password) which returns simpleCredentials
+constants necessary to the JCR 1.0/JSR-170 specs
+
+Installing PHPUnit:
+Make sure you use the pear from Zend.
+See http://www.phpunit.de/manual/current/en/installation.html
+$ /usr/local/zend/bin/pear install phpunit
+
+Setting up Jackrabbit:
+- Create tests workspace which is different from your default workspace.
+See http://jackrabbit.apache.org/jackrabbit-configuration.html#JackrabbitConfiguration-Workspaceconfiguration
+Or:
+- Go to the directory you started jackrabbit-standalone (eg. /opt/svn/jackrabbit/jackrabbit-standalone/target)
+- cd jackrabbit
+- cd workspaces
+- cp -r default tests
+- cd tests
+- change <Workspace name="default"> to <Workspace name="tests">
+- start jackrabbit again
+
+
+
+
+Setting up submodules:
+
+After the first clone, don't forget to
+
+git submodule init
+git submodule update
+
Binary file not shown.
@@ -0,0 +1,166 @@
+
+package ch.liip.jcr.jack;
+
+import java.util.Properties;
+import java.io.*;
+import javax.jcr.*;
+import org.apache.jackrabbit.core.TransientRepository;
+import ch.liip.jcr.davex.DavexClient;
+
+/**
+Import or export the entire repository.
+
+Importing autodetects whether you have a system view or document view file.
+For exporting, there are two separate commands:
+ * export for system view
+ * exportdocument for document view
+
+Export and import are done on path specified in src/jcr.properties as repository-base-xpath
+Import is done with behavior IMPORT_UUID_COLLISION_THROW, that is if there already is something in the repository and that happens to have the same UUID, the import will fail.
+Our primary goal is to replace the complete repository contents.
+
+The program can be controlled by a couple of parameters that are given in the form param=value.
+Parameters are specified after the import / export switch and the filename
+ * username, password: credentials for login
+ * repository-base-xpath: path to export to file / import file to
+ * workspace: workspace to export / import
+ * transport: davex to connect to a server, local to start an own jackrabbit server
+ * storage: davex transport only. url for davex connection
+ * jackrabbit-config, jackrabbit-home: local transport only. path to jackrabbit data folder
+
+Default values for all parameters are set in jcr.properties
+*/
+public class Jack {
+ public static void main(String[] args) throws Throwable {
+ if (args.length < 2) {
+ System.out.println("usage: java -jar jack.jar (import|export|exportdocument) file.xml");
+ System.exit(2);
+ }
+ Jack j = new Jack(args);
+
+ int errorState = 0;
+ try {
+ if ("import".equals(args[0])) {
+ j.doImport(args[1]);
+ } else if ("export".equals(args[0])) {
+ j.doExport(args[1]);
+ } else if ("exportdocument".equals(args[0])) {
+ j.doExportDocument(args[1]);
+ } else {
+ System.out.println("Unrecognized command "+args[0]);
+ }
+ } catch(Throwable t) {
+ System.err.println("Operation failed:");
+ System.err.println(t.getMessage());
+ errorState = 1;
+ } finally {
+ j.close();
+ }
+ System.exit(errorState);
+ }
+
+ //protected DavexClient client;
+ protected Repository repository;
+ protected Session session;
+ protected Properties config;
+ public Jack(String[] args) throws Throwable {
+ InputStream is = getClass().getClassLoader().getResourceAsStream("jcr.properties");
+ if (is==null) throw new Exception("Could not find jcr.properties inside the jar");
+ config = new Properties();
+ config.load(is);
+ is.close();
+ for (int i=2; i<args.length; i++) {
+ String pv[] = args[i].split("=",2);
+ if (pv.length != 2) throw new Exception("Invalid parameter "+args[i]);
+ config.setProperty(pv[0], pv[1]);
+ }
+
+ String t = config.getProperty("transport");
+ if ("local".equals(t)) {
+ repository = new TransientRepository(config.getProperty("jackrabbit-config"),
+ config.getProperty("jackrabbit-home"));
+ } else if ("davex".equals(t)) {
+ //network access (fails because of obscure logging library incompatibilites)
+ DavexClient client = new DavexClient(config.getProperty("storage"));
+ repository = client.getRepository();
+ } else {
+ throw new Exception("Unknown transport requested: "+config.getProperty("transport"));
+ }
+
+ SimpleCredentials cred = new SimpleCredentials(config.getProperty("username"),
+ config.getProperty("password").toCharArray());
+ session = repository.login(cred, config.getProperty("workspace"));
+ }
+ public void close() {
+ session.logout();
+ }
+ protected void finalize() {
+ this.close();
+ }
+
+ public void doExport(String filepath) throws Exception {
+ File f = new File(filepath);
+ if (f.exists()) {
+ throw new IllegalArgumentException("Export file "+filepath+" is existing, can not export");
+ }
+ try {
+ FileOutputStream os = new FileOutputStream(f);
+ //export all including binary, recursive
+ session.exportSystemView(config.getProperty("repository-base-xpath","/"), os, false, false);
+ os.close();
+ } catch(Throwable t) {
+ throw new Exception("Failed to export repository at " +
+ config.getProperty("repository-base-xpath","/") + " to file "+filepath+"\n"+t.toString());
+ }
+ System.out.println("Exported the repository to "+f);
+ }
+
+ public void doExportDocument(String filepath) throws Exception {
+ File f = new File(filepath);
+ if (f.exists()) {
+ throw new IllegalArgumentException("Export file "+filepath+" is existing, can not export");
+ }
+ try {
+ FileOutputStream os = new FileOutputStream(f);
+ //export all including binary, recursive
+ session.exportDocumentView(config.getProperty("repository-base-xpath","/"), os, false, false);
+ os.close();
+ } catch(Throwable t) {
+ throw new Exception("Failed to export repository at " +
+ config.getProperty("repository-base-xpath","/") + " to file "+filepath+"\n"+t.toString());
+ }
+ System.out.println("Exported the repository to "+f);
+ }
+
+ public void doImport(String filepath) throws Exception {
+ File f = new File(filepath);
+ if (! f.exists()) {
+ throw new IllegalArgumentException("File "+filepath+" not existing, can not import");
+ }
+ try {
+ //Clear repository first
+ Node rootNode = session.getRootNode();
+ NodeIterator nodeList = rootNode.getNodes();
+ while (nodeList.hasNext()) {
+ Node node = nodeList.nextNode();
+ if (!node.getName().equals("jcr:system")) {
+ node.remove();
+ session.save();
+ }
+ }
+ FileInputStream data = new FileInputStream(f);
+ session.importXML(config.getProperty("repository-base-xpath","/"), data,
+ ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING);
+ } catch(Throwable t) {
+ throw new Exception("Failed to import repository to "+
+ config.getProperty("repository-base-xpath","/") +
+ " from file "+filepath+"\n"+t.toString());
+ }
+ try {
+ session.save();
+ } catch(Throwable t) {
+ throw new Exception("Failed to save the imported repository: "+t.toString());
+ }
+ System.out.println("Imported the repository from "+f);
+ }
+}
@@ -0,0 +1,14 @@
+username = admin
+password = admin
+repository-base-xpath = /
+workspace = tests
+
+#how to connect to the repository. for now, we have local and davex
+transport = davex
+
+#for davex
+storage = http://localhost:8080/server
+
+#local instance:
+jackrabbit-config = ../jackrabbit/jackrabbit-standalone/target/jackrabbit/repository.xml
+jackrabbit-home = ../jackrabbit/jackrabbit-standalone/target/jackrabbit/repository/
@@ -0,0 +1,7 @@
+### direct log messages to stdout ###
+log4j.appender.err=org.apache.log4j.ConsoleAppender
+log4j.appender.err.Target=System.err
+log4j.appender.err.layout=org.apache.log4j.PatternLayout
+log4j.appender.err.layout.ConversionPattern=[%5p] %d{ISO8601} %c{1}:%L - %m%n
+
+log4j.rootLogger=WARN, err
Binary file not shown.
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tests_level1_access_base xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:rep="internal" xmlns:crx="http://www.day.com/crx/1.0" xmlns:vlt="http://www.day.com/jcr/vault/1.0" xmlns:lx="http://flux-cms.org/2.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:xs="http://www.w3.org/2001/XMLSchema" jcr:primaryType="nt:folder" jcr:created="2009-04-27T13:00:54.082+02:00">
+ <index.txt jcr:primaryType="nt:file" jcr:created="2009-04-27T13:01:04.758+02:00">
+ <jcr:content jcr:primaryType="nt:unstructured" jcr:data="aDEuIENoYXB0ZXIgMSBUaXRsZQoKCiogZm9vCiogYmFyCioqIGZvbzIKKiogZm9vMwoqIGZvbzAKCnx8IGhlYWRlciB8fCBiYXIgfHwKfCBoIHwgaiB8IAoKW0Zvb3wgaHR0cDovL2xpaXAuY2hdCgp7Y29kZX0KaGVsbG8gd29ybGQKe2NvZGV9CgojIGZvbwojIGIKCgpoMi4gU2VjdGlvbiAxLjEgVGl0bGUKCgpTdWJzZWN0aW9uIDEuMS4xIFRpdGxlCn5+fn5+fn5+fn5+fn5+fn5+fn5+fn4KClNlY3Rpb24gMS4yIFRpdGxlCi0tLS0tLS0tLS0tLS0tLS0tCgpDaGFwdGVyIDIgVGl0bGUKPT09PT09PT09PT09PT09Cg==" jcr:lastModified="2009-04-27T13:01:07.472+02:00" jcr:mimeType="text/plain"/>
+ </index.txt>
+</tests_level1_access_base>
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tests_level1_access_base xmlns:test="http://liip.to/jackalope" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:rep="internal" xmlns:crx="http://www.day.com/crx/1.0" xmlns:vlt="http://www.day.com/jcr/vault/1.0" xmlns:lx="http://flux-cms.org/2.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:xs="http://www.w3.org/2001/XMLSchema" jcr:primaryType="nt:folder" jcr:created="2009-04-27T13:00:54.082+02:00">
+ <index.txt jcr:primaryType="nt:file" jcr:created="2009-04-27T13:01:04.758+02:00">
+ <jcr:content jcr:primaryType="nt:unstructured" jcr:data="aDEuIENoYXB0ZXIgMSBUaXRsZQoKCiogZm9vCiogYmFyCioqIGZvbzIKKiogZm9vMwoqIGZvbzAKCnx8IGhlYWRlciB8fCBiYXIgfHwKfCBoIHwgaiB8IAoKW0Zvb3wgaHR0cDovL2xpaXAuY2hdCgp7Y29kZX0KaGVsbG8gd29ybGQKe2NvZGV9CgojIGZvbwojIGIKCgpoMi4gU2VjdGlvbiAxLjEgVGl0bGUKCgpTdWJzZWN0aW9uIDEuMS4xIFRpdGxlCn5+fn5+fn5+fn5+fn5+fn5+fn5+fn4KClNlY3Rpb24gMS4yIFRpdGxlCi0tLS0tLS0tLS0tLS0tLS0tCgpDaGFwdGVyIDIgVGl0bGUKPT09PT09PT09PT09PT09Cg==" jcr:lastModified="2009-04-27T13:01:07.472+02:00" jcr:mimeType="text/plain"/>
+ </index.txt>
+ <idExample jcr:primaryType="nt:file" jcr:mixinTypes="mix:referenceable" jcr:uuid="842e61c0-09ab-42a9-87c0-308ccc90e6f4" jcr:created="2009-04-27T13:01:04.758+02:00">
+ <jcr:content jcr:primaryType="nt:unstructured" jcr:data="aDEuIENoYXB0ZXIgMSBUaXRsZQoKCiogZm9vCiogYmFyCioqIGZvbzIKKiogZm9vMwoqIGZvbzAKCnx8IGhlYWRlciB8fCBiYXIgfHwKfCBoIHwgaiB8IAoKW0Zvb3wgaHR0cDovL2xpaXAuY2hdCgp7Y29kZX0KaGVsbG8gd29ybGQKe2NvZGV9CgojIGZvbwojIGIKCgpoMi4gU2VjdGlvbiAxLjEgVGl0bGUKCgpTdWJzZWN0aW9uIDEuMS4xIFRpdGxlCn5+fn5+fn5+fn5+fn5+fn5+fn5+fn4KClNlY3Rpb24gMS4yIFRpdGxlCi0tLS0tLS0tLS0tLS0tLS0tCgpDaGFwdGVyIDIgVGl0bGUKPT09PT09PT09PT09PT09Cg==" jcr:lastModified="2009-04-27T13:01:07.472+02:00" jcr:mimeType="text/plain"/>
+ </idExample>
+ <test:namespacedNode jcr:primaryType="nt:folder" />
+ <emptyExample jcr:primaryType="nt:folder"/>
+ <multiValueProperty jcr:primaryType="nt:folder" jcr:mixinTypes="mix:referenceable mix:versionable"/>
+ <numberPropertyNode jcr:primaryType="nt:file" jcr:created="2009-04-27T13:01:04.758+02:00">
+ <jcr:content jcr:primaryType="nt:unstructured" longNumber="999" jcr:data="aDEuIENoYXB0ZXIgMSBUaXRsZQoKCiogZm9vCiogYmFyCioqIGZvbzIKKiogZm9vMwoqIGZvbzAKCnx8IGhlYWRlciB8fCBiYXIgfHwKfCBoIHwgaiB8IAoKW0Zvb3wgaHR0cDovL2xpaXAuY2hdCgp7Y29kZX0KaGVsbG8gd29ybGQKe2NvZGV9CgojIGZvbwojIGIKCgpoMi4gU2VjdGlvbiAxLjEgVGl0bGUKCgpTdWJzZWN0aW9uIDEuMS4xIFRpdGxlCn5+fn5+fn5+fn5+fn5+fn5+fn5+fn4KClNlY3Rpb24gMS4yIFRpdGxlCi0tLS0tLS0tLS0tLS0tLS0tCgpDaGFwdGVyIDIgVGl0bGUKPT09PT09PT09PT09PT09Cg==" jcr:lastModified="2009-04-27T13:01:07.472+02:00" jcr:mimeType="text/plain"/>
+ </numberPropertyNode>
+</tests_level1_access_base>
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tests_level1_search_base xmlns:test="http://liip.to/jackalope" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:rep="internal" xmlns:crx="http://www.day.com/crx/1.0" xmlns:vlt="http://www.day.com/jcr/vault/1.0" xmlns:lx="http://flux-cms.org/2.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:xs="http://www.w3.org/2001/XMLSchema" jcr:primaryType="nt:folder" jcr:created="2009-04-27T13:00:54.082+02:00">
+ <index.txt jcr:primaryType="nt:file" jcr:created="2009-04-27T13:01:04.758+02:00">
+ <jcr:content jcr:primaryType="nt:unstructured" jcr:data="aDEuIENoYXB0ZXIgMSBUaXRsZQoKCiogZm9vCiogYmFyCioqIGZvbzIKKiogZm9vMwoqIGZvbzAKCnx8IGhlYWRlciB8fCBiYXIgfHwKfCBoIHwgaiB8IAoKW0Zvb3wgaHR0cDovL2xpaXAuY2hdCgp7Y29kZX0KaGVsbG8gd29ybGQKe2NvZGV9CgojIGZvbwojIGIKCgpoMi4gU2VjdGlvbiAxLjEgVGl0bGUKCgpTdWJzZWN0aW9uIDEuMS4xIFRpdGxlCn5+fn5+fn5+fn5+fn5+fn5+fn5+fn4KClNlY3Rpb24gMS4yIFRpdGxlCi0tLS0tLS0tLS0tLS0tLS0tCgpDaGFwdGVyIDIgVGl0bGUKPT09PT09PT09PT09PT09Cg==" jcr:lastModified="2009-04-27T13:01:07.472+02:00" jcr:mimeType="text/plain"/>
+ </index.txt>
+ <idExample jcr:primaryType="nt:file" jcr:mixinTypes="mix:referenceable" jcr:uuid="842e61c0-09ab-42a9-87c0-308ccc90e6f4" jcr:created="2009-04-27T13:01:04.758+02:00">
+ <jcr:content jcr:primaryType="nt:unstructured" jcr:data="aDEuIENoYXB0ZXIgMSBUaXRsZQoKCiogZm9vCiogYmFyCioqIGZvbzIKKiogZm9vMwoqIGZvbzAKCnx8IGhlYWRlciB8fCBiYXIgfHwKfCBoIHwgaiB8IAoKW0Zvb3wgaHR0cDovL2xpaXAuY2hdCgp7Y29kZX0KaGVsbG8gd29ybGQKe2NvZGV9CgojIGZvbwojIGIKCgpoMi4gU2VjdGlvbiAxLjEgVGl0bGUKCgpTdWJzZWN0aW9uIDEuMS4xIFRpdGxlCn5+fn5+fn5+fn5+fn5+fn5+fn5+fn4KClNlY3Rpb24gMS4yIFRpdGxlCi0tLS0tLS0tLS0tLS0tLS0tCgpDaGFwdGVyIDIgVGl0bGUKPT09PT09PT09PT09PT09Cg==" jcr:lastModified="2009-04-27T13:01:07.472+02:00" jcr:mimeType="text/plain"/>
+ </idExample>
+ <test:namespacedNode jcr:primaryType="nt:folder" />
+ <emptyExample jcr:primaryType="nt:folder"/>
+</tests_level1_search_base>
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Uses the same session mechanism as the tests to so it's necessarry
+ * that importing and exporting is working in your implementation
+ *
+ * This is a temporary solution untill our java solution is properly
+ * working.
+ */
+ class jackalope_importexport {
+
+ protected $fixturePath;
+ protected $session;
+ protected $configKeys = array('jcr.url', 'jcr.user', 'jcr.pass', 'jcr.workspace', 'jcr.transport');
+
+
+ public function __construct($path) {
+ $this->fixturePath = dirname(__FILE__) . '/../fixtures/' . $path . '/';
+ if (!is_dir($this->fixturePath)) {
+ throw new Exception('Not a valid directory: ' . $this->fixturePath);
+ }
+
+ $cfg = array();
+ foreach ($this->configKeys as $cfgKey) {
+ $cfg[substr($cfgKey, 4)] = $GLOBALS[$cfgKey];
+ }
+ $this->session = getJCRSession($cfg);
+ if (! $this->session instanceOf phpCR_Session) {
+ throw new Exception('Could not get JCR session');
+ }
+
+ }
+
+ public function import($fixture) {
+ $fixture = $this->fixturePath . $fixture;
+ if (!is_readable($fixture)) {
+ throw new Exception('Fixture not found at: ' . $fixture);
+ }
+
+ $this->session->importXML('/', $fixture, 1);
+ $this->session->save();
+ $this->session->logout();
+ }
+
+ public function export() {
+ $tmp = tmpfile();
+ $this->session->exportDocumentView('/', $tmp, 1, 0);
+ return readfile($tmp);
+ }
+ }
+
@@ -0,0 +1,29 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+
+abstract class jackalope_baseCase extends PHPUnit_Framework_TestCase {
+ protected $path = ''; // Describes the path to the test
+
+ protected $config;
+ protected $configKeys = array('jcr.url', 'jcr.user', 'jcr.pass', 'jcr.workspace', 'jcr.transport');
+
+ protected function setUp() {
+ foreach ($this->configKeys as $cfgKey) {
+ $this->config[substr($cfgKey, 4)] = $GLOBALS[$cfgKey];
+ }
+ }
+
+ protected function assertSimpleCredentials($user, $password) {
+ $cr = getSimpleCredentials($user, $password);
+ $this->assertTrue(is_object($cr));
+ $this->assertTrue($cr instanceOf phpCR_CredentialsInterface);
+ return $cr;
+ }
+
+ protected function assertSession($cfg, $credentials = null) {
+ $ses = getJCRSession($cfg, $credentials);
+ $this->assertTrue(is_object($ses));
+ $this->assertTrue($ses instanceOf phpCR_SessionInterface);
+ return $ses;
+ }
+}
@@ -0,0 +1,19 @@
+<?php
+require_once(dirname(__FILE__) . '/importexport.php');
+require_once 'PHPUnit/Framework.php';
+
+abstract class jackalope_baseSuite extends PHPUnit_Framework_TestSuite {
+ protected $ie; // Holds the import export instance
+ protected $path = '';
+ protected $configKeys = array('jcr.url', 'jcr.user', 'jcr.pass', 'jcr.workspace', 'jcr.transport');
+
+ public function setUp() {
+ parent::setUp();
+ $this->sharedFixture = array();
+ foreach ($this->configKeys as $cfgKey) {
+ $this->sharedFixture['config'][substr($cfgKey, 4)] = $GLOBALS[$cfgKey];
+ }
+
+ $this->sharedFixture['ie'] = new jackalope_importexport($this->path);
+ }
+}
Oops, something went wrong.

0 comments on commit c74aab4

Please sign in to comment.