diff --git a/Datastream.php b/Datastream.php
index 1c502b8..b906fa6 100644
--- a/Datastream.php
+++ b/Datastream.php
@@ -1089,6 +1089,13 @@ protected function checksumMagicProperty($function, $value) {
return $this->generalReadOnly('dsChecksum', 'none', $function, $value);
}
+ /**
+ * @see AbstractDatastream::checksumType
+ */
+ protected function checksumTypeMagicProperty($function, $value) {
+ return $this->generalReadOnly('dsChecksumType', 'DISABLED', $function, $value);
+ }
+
/**
* @see AbstractDatastream::url
*/
diff --git a/tests/DatastreamTest.php b/tests/DatastreamTest.php
index 73b09d5..5161a38 100644
--- a/tests/DatastreamTest.php
+++ b/tests/DatastreamTest.php
@@ -17,6 +17,8 @@ protected function setUp() {
$this->api = new FedoraApi($connection);
$cache = new SimpleCache();
$this->repository = new FedoraRepository($this->api, $cache);
+ $describe = $this->api->a->describeRepository();
+ $this->fedoraVersion = isset($describe['repositoryVersion']) ? $describe['repositoryVersion'] : NULL;
// create an object
$string1 = FedoraTestHelpers::randomString(10);
@@ -204,7 +206,22 @@ public function testContentsSet() {
$this->assertEquals(3, $newds->size);
}
- public function testContentSetUrl() {
+ public function testContentSetUrlHttp() {
+ $temp = tempnam(sys_get_temp_dir(), 'tuque');
+ $this->ds->setContentFromUrl(LOC_HTTP_URL);
+ $actual = file_get_contents(LOC_HTTP_URL);
+ $this->assertEquals($actual, $this->ds->content);
+ $this->ds->getContent($temp);
+ $this->assertEquals($actual, file_get_contents($temp));
+ unlink($temp);
+ }
+
+ public function testContentSetUrlHttps() {
+ // Get the Fedora version as there is currently a bug that needs
+ // investigation in 3.6.2 that breaks the tests otherwise.
+ if ($this->fedoraVersion === '3.6.2') {
+ $this->markTestSkipped('Is a bug in 3.6.2 that requires investigation.');
+ }
$temp = tempnam(sys_get_temp_dir(), 'tuque');
$this->ds->setContentFromUrl(TEST_PNG_URL);
$actual = file_get_contents(TEST_PNG_URL);
@@ -244,7 +261,29 @@ public function testContentXFromFile() {
$this->assertEquals('', trim($newds->content));
}
- public function testContentXFromUrl() {
+ public function testContentXFromUrlHttpLoc() {
+ $file = getcwd() . '/tests/test_data/loc.xml';
+ $data = file_get_contents($file);
+ $this->x->setContentFromUrl(LOC_HTTP_URL);
+ $newds = new FedoraDatastream($this->testDsidX, $this->object, $this->repository);
+ $this->assertEquals(trim($data), trim($newds->content));
+ }
+
+ /**
+ * @expectedException RepositoryException
+ */
+ public function testContentXFromUrlHttpsLoc() {
+ $file = getcwd() . '/tests/test_data/loc.xml';
+ $data = file_get_contents($file);
+ $this->x->setContentFromUrl(LOC_HTTPS_URL);
+ $newds = new FedoraDatastream($this->testDsidX, $this->object, $this->repository);
+ $this->assertEquals(trim($data), trim($newds->content));
+ }
+
+ /**
+ * @expectedException RepositoryException
+ */
+ public function testContentXFromUrlHttps() {
$data = <<
@@ -257,6 +296,26 @@ public function testContentXFromUrl() {
$this->assertEquals($data, trim($newds->content));
}
+ public function testContentMFromHttpsUrl() {
+ // Get the Fedora version as there is currently a bug that needs
+ // investigation in 3.6.2 that breaks the tests otherwise.
+ if ($this->fedoraVersion === '3.6.2') {
+ $this->markTestSkipped('Is a bug in 3.6.2 that requires investigation.');
+ }
+ $data = <<
+
+
+
+
+foo;
+ $new_ds = $this->object->constructDatastream('fcreporocks', 'M');
+ $new_ds->content = 'nom';
+ $this->object->ingestDatastream($new_ds);
+ $this->object[$new_ds->id]->setContentFromUrl(TEST_XML_URL);
+ $this->assertEquals($data, trim($new_ds->content));
+ }
+
public function testVersions() {
$this->assertEquals(1, count($this->ds));
$this->ds->label = 'foot';
@@ -379,4 +438,18 @@ public function testLockingRefresh() {
}
$this->fail();
}
+
+ public function testDatastreamVersionPropertiesExistWithDefaultValues() {
+ $new_ds = $this->object->constructDatastream('woot', 'M');
+ $new_ds->mimeType = 'text/plain';
+ $new_ds->content = 'initial version';
+ $this->object->ingestDatastream($new_ds);
+ $new_ds->content = 'version 2';
+
+ foreach ($this->object['woot'] as $ds) {
+ $this->assertEquals($ds->checksum, 'none');
+ $this->assertEquals($ds->checksumType, 'DISABLED');
+ }
+
+ }
}
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index b14d009..58a0cd7 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -2,9 +2,11 @@
-
+
+
+
+
+
diff --git a/tests/scripts/travis_setup.sh b/tests/scripts/travis_setup.sh
index 556b531..fb2f1c0 100755
--- a/tests/scripts/travis_setup.sh
+++ b/tests/scripts/travis_setup.sh
@@ -16,7 +16,7 @@ tar xf islandora_tomcat.$FEDORA_VERSION.tar.gz
cd islandora_tomcat
export CATALINA_HOME='.'
export FEDORA_HOME=fedora
-export JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -Djavax.net.ssl.trustStore=$CATALINA_HOME/fedora/server/truststore -Djavax.net.ssl.trustStorePassword=tomcat"
+export JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled"
# Needed for Fedora 3.8.1
if [ $FEDORA_VERSION = "3.8.1" ]; then
diff --git a/tests/test_data/loc.xml b/tests/test_data/loc.xml
new file mode 100644
index 0000000..c9f05a1
--- /dev/null
+++ b/tests/test_data/loc.xml
@@ -0,0 +1,43 @@
+
+
+ Emergence and Dissolvence in the Self-Organization of Complex Systems
+
+
+ Testa
+ Bernard
+
+ author
+
+
+
+ Kier
+ Lamont B.
+
+ author
+
+
+ text
+ http://www.mdpi.org/entropy/papers/e2010001.pdf
+
+
+ Entropy
+
+
+ continuing
+
+
+
+ 2
+
+
+ no.
+ 1
+
+
+ 17
+ 17
+
+ 2000
+
+
+
diff --git a/tests/travis.xml b/tests/travis.xml
index 85d73e9..bb01bdf 100644
--- a/tests/travis.xml
+++ b/tests/travis.xml
@@ -5,5 +5,7 @@
+
+