You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by za...@apache.org on 2015/08/18 01:36:39 UTC
jclouds-labs git commit: JCLOUDS-826: BaseServiceIntegrationTest for
jdbc
Repository: jclouds-labs
Updated Branches:
refs/heads/master b1aebb7bf -> dc6a14b51
JCLOUDS-826: BaseServiceIntegrationTest for jdbc
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/dc6a14b5
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/dc6a14b5
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/dc6a14b5
Branch: refs/heads/master
Commit: dc6a14b51faca29b74335b37623c8346cf4ab14d
Parents: b1aebb7
Author: Roman Coedo <ro...@gmail.com>
Authored: Sun Aug 16 18:26:49 2015 +0200
Committer: Zack Shoylev <za...@rackspace.com>
Committed: Mon Aug 17 18:28:27 2015 -0500
----------------------------------------------------------------------
.../jdbc/strategy/JdbcStorageStrategy.java | 31 +++++++++++------
.../EclipselinkH2ServiceIntegrationTest.java | 36 ++++++++++++++++++++
.../HibernateHsqldbServiceIntegrationTest.java | 36 ++++++++++++++++++++
3 files changed, 93 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/dc6a14b5/jdbc/src/main/java/org/jclouds/jdbc/strategy/JdbcStorageStrategy.java
----------------------------------------------------------------------
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/strategy/JdbcStorageStrategy.java b/jdbc/src/main/java/org/jclouds/jdbc/strategy/JdbcStorageStrategy.java
index 1ef5050..5138d64 100644
--- a/jdbc/src/main/java/org/jclouds/jdbc/strategy/JdbcStorageStrategy.java
+++ b/jdbc/src/main/java/org/jclouds/jdbc/strategy/JdbcStorageStrategy.java
@@ -16,7 +16,15 @@
*/
package org.jclouds.jdbc.strategy;
-import com.google.common.collect.ImmutableList;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.inject.Provider;
+import javax.persistence.PersistenceException;
+
import org.jclouds.blobstore.LocalStorageStrategy;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.BlobAccess;
@@ -29,6 +37,8 @@ import org.jclouds.blobstore.domain.internal.MutableStorageMetadataImpl;
import org.jclouds.blobstore.options.CreateContainerOptions;
import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
import org.jclouds.io.ContentMetadata;
import org.jclouds.jdbc.conversion.BlobEntityToBlob;
import org.jclouds.jdbc.entity.BlobEntity;
@@ -37,13 +47,7 @@ import org.jclouds.jdbc.predicates.validators.JdbcBlobKeyValidator;
import org.jclouds.jdbc.predicates.validators.JdbcContainerNameValidator;
import org.jclouds.jdbc.service.JdbcService;
-import javax.inject.Inject;
-import javax.inject.Provider;
-import javax.persistence.PersistenceException;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.List;
+import com.google.common.collect.ImmutableList;
/**
* JdbcStorageStrategy implements a blob store that stores objects
@@ -57,6 +61,7 @@ public class JdbcStorageStrategy implements LocalStorageStrategy {
private final JdbcContainerNameValidator jdbcContainerNameValidator;
private final JdbcBlobKeyValidator jdbcBlobKeyValidator;
private final BlobEntityToBlob blobEntityToBlob;
+ private final Location mockLocation;
@Inject
JdbcStorageStrategy(Provider<BlobBuilder> blobBuilders,
@@ -68,6 +73,11 @@ public class JdbcStorageStrategy implements LocalStorageStrategy {
this.jdbcContainerNameValidator = jdbcContainerNameValidator;
this.jdbcBlobKeyValidator = jdbcBlobKeyValidator;
this.blobEntityToBlob = blobEntityToBlob;
+ this.mockLocation = new LocationBuilder()
+ .id("jdbc")
+ .scope(LocationScope.PROVIDER)
+ .description("http://localhost/transient")
+ .build();
}
/**
@@ -197,7 +207,7 @@ public class JdbcStorageStrategy implements LocalStorageStrategy {
metadata = new MutableStorageMetadataImpl();
metadata.setName(containerName);
metadata.setType(StorageType.CONTAINER);
- metadata.setLocation(null);
+ metadata.setLocation(mockLocation);
metadata.setCreationDate(containerEntity.getCreationDate());
}
return metadata;
@@ -302,7 +312,7 @@ public class JdbcStorageStrategy implements LocalStorageStrategy {
*/
@Override
public Location getLocation(String container) {
- return null;
+ return mockLocation;
}
/**
@@ -382,4 +392,5 @@ public class JdbcStorageStrategy implements LocalStorageStrategy {
jdbcService.deleteBlob(container, directory);
}
}
+
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/dc6a14b5/jdbc/src/test/java/org/jclouds/jdbc/integration/EclipselinkH2ServiceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/integration/EclipselinkH2ServiceIntegrationTest.java b/jdbc/src/test/java/org/jclouds/jdbc/integration/EclipselinkH2ServiceIntegrationTest.java
new file mode 100644
index 0000000..9d393b6
--- /dev/null
+++ b/jdbc/src/test/java/org/jclouds/jdbc/integration/EclipselinkH2ServiceIntegrationTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.jdbc.integration;
+
+import org.jclouds.blobstore.integration.internal.BaseServiceIntegrationTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
+import com.google.inject.persist.jpa.JpaPersistModule;
+
+@Test(groups = { "integration" }, singleThreaded = true, testName = "blobstore.EclipselinkH2ServiceIntegrationTest")
+public class EclipselinkH2ServiceIntegrationTest extends BaseServiceIntegrationTest {
+ public EclipselinkH2ServiceIntegrationTest() {
+ provider = "jdbc";
+ }
+
+ @Override
+ protected Iterable<Module> setupModules() {
+ return ImmutableSet.<Module> of(this.getLoggingModule(), new JpaPersistModule("jclouds-test-h2"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/dc6a14b5/jdbc/src/test/java/org/jclouds/jdbc/integration/HibernateHsqldbServiceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/integration/HibernateHsqldbServiceIntegrationTest.java b/jdbc/src/test/java/org/jclouds/jdbc/integration/HibernateHsqldbServiceIntegrationTest.java
new file mode 100644
index 0000000..724d30e
--- /dev/null
+++ b/jdbc/src/test/java/org/jclouds/jdbc/integration/HibernateHsqldbServiceIntegrationTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.jdbc.integration;
+
+import org.jclouds.blobstore.integration.internal.BaseServiceIntegrationTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
+import com.google.inject.persist.jpa.JpaPersistModule;
+
+@Test(groups = { "integration" }, singleThreaded = true, testName = "blobstore.HibernateHsqldbServiceIntegrationTest")
+public class HibernateHsqldbServiceIntegrationTest extends BaseServiceIntegrationTest {
+ public HibernateHsqldbServiceIntegrationTest() {
+ provider = "jdbc";
+ }
+
+ @Override
+ protected Iterable<Module> setupModules() {
+ return ImmutableSet.<Module> of(this.getLoggingModule(), new JpaPersistModule("jclouds-test-hsqldb"));
+ }
+}