Remove JDBC provider
This was written in a confusing way, storing both metadata and data in
a SQL database, making it only useful for testing which duplicates the
existing transient provider. It has no known users and creates a
maintenance burden.
diff --git a/h2-jdbc/README.md b/h2-jdbc/README.md
deleted file mode 100644
index 0c74dfa..0000000
--- a/h2-jdbc/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-## H2 provider ##
-h2-jdbc is a storage provider for the h2 embedded database. It is implemented using JPA and Hibernate.
-
-## Running the tests ##
-To run the tests you can use this command
-```
-mvn test
-```
-You can also run the integration tests with
-```
-mvn integration-test
-```
diff --git a/h2-jdbc/pom.xml b/h2-jdbc/pom.xml
deleted file mode 100644
index 61df81f..0000000
--- a/h2-jdbc/pom.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.jclouds.labs</groupId>
- <artifactId>jclouds-labs</artifactId>
- <version>2.2.0-SNAPSHOT</version>
- </parent>
- <artifactId>h2-jdbc</artifactId>
- <name>jclouds h2 jdbc provider</name>
- <description>jclouds implementation to target h2 databases</description>
- <packaging>bundle</packaging>
-
- <properties>
- <jclouds.osgi.export>org.jclouds.jdbc*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>org.jclouds*;version="${project.version}",*</jclouds.osgi.import>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>integration</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <parallel>none</parallel>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.jclouds.labs</groupId>
- <artifactId>jdbc</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-blobstore</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-blobstore</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-log4j</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.auto.service</groupId>
- <artifactId>auto-service</artifactId>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-persist</artifactId>
- <version>4.0</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate.javax.persistence</groupId>
- <artifactId>hibernate-jpa-2.1-api</artifactId>
- <version>1.0.0.Final</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <version>4.3.9.Final</version>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <version>1.4.187</version>
- </dependency>
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
-
diff --git a/h2-jdbc/src/main/java/org/jclouds/h2/jdbc/H2JdbcProviderMetadata.java b/h2-jdbc/src/main/java/org/jclouds/h2/jdbc/H2JdbcProviderMetadata.java
deleted file mode 100644
index 93aa6e7..0000000
--- a/h2-jdbc/src/main/java/org/jclouds/h2/jdbc/H2JdbcProviderMetadata.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.h2.jdbc;
-
-import org.jclouds.h2.jdbc.config.H2JdbcBlobStoreContextModule;
-import org.jclouds.jdbc.JdbcApiMetadata;
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.providers.internal.BaseProviderMetadata;
-
-import com.google.auto.service.AutoService;
-
-@AutoService(ProviderMetadata.class)
-public class H2JdbcProviderMetadata extends BaseProviderMetadata {
-
- public static Builder builder() {
- return new Builder();
- }
-
- @Override
- public Builder toBuilder() {
- return builder().fromProviderMetadata(this);
- }
-
- public H2JdbcProviderMetadata() {
- super(builder());
- }
-
- public H2JdbcProviderMetadata(Builder builder) {
- super(builder);
- }
-
- public static class Builder extends BaseProviderMetadata.Builder {
- protected Builder() {
- id("h2-jdbc")
- .name("H2 Jdbc")
- .apiMetadata(new JdbcApiMetadata()
- .toBuilder()
- .defaultModule(H2JdbcBlobStoreContextModule.class)
- .build());
- }
-
- @Override
- public H2JdbcProviderMetadata build() {
- return new H2JdbcProviderMetadata(this);
- }
-
- @Override
- public Builder fromProviderMetadata(ProviderMetadata in) {
- super.fromProviderMetadata(in);
- return this;
- }
- }
-}
diff --git a/h2-jdbc/src/main/java/org/jclouds/h2/jdbc/config/H2JdbcBlobStoreContextModule.java b/h2-jdbc/src/main/java/org/jclouds/h2/jdbc/config/H2JdbcBlobStoreContextModule.java
deleted file mode 100644
index 30064d0..0000000
--- a/h2-jdbc/src/main/java/org/jclouds/h2/jdbc/config/H2JdbcBlobStoreContextModule.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.h2.jdbc.config;
-
-import java.util.Properties;
-
-import org.jclouds.jdbc.config.JdbcBlobStoreContextModule;
-
-import com.google.inject.persist.jpa.JpaPersistModule;
-
-public class H2JdbcBlobStoreContextModule extends JdbcBlobStoreContextModule {
-
- private static final String DEFAULT_FILE = "./jclouds-db";
-
- protected void configure() {
- super.configure();
-
- Properties properties = new Properties();
- properties.setProperty("hibernate.connection.url", "jdbc:h2:" + DEFAULT_FILE);
-
- install(new JpaPersistModule("jclouds-h2").properties(properties));
- }
-
-}
diff --git a/h2-jdbc/src/main/resources/META-INF/persistence.xml b/h2-jdbc/src/main/resources/META-INF/persistence.xml
deleted file mode 100644
index 30a8b35..0000000
--- a/h2-jdbc/src/main/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-
- 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.
-
--->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
- version="1.0">
-
- <persistence-unit name="jclouds-h2" transaction-type="RESOURCE_LOCAL">
- <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
-
- <class>org.jclouds.jdbc.entity.ContainerEntity</class>
- <class>org.jclouds.jdbc.entity.BlobEntity</class>
- <class>org.jclouds.jdbc.entity.ChunkEntity</class>
- <class>org.jclouds.jdbc.entity.PayloadEntity</class>
- <exclude-unlisted-classes>true</exclude-unlisted-classes>
-
- <properties>
- <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
- <property name="hibernate.connection.driver_class" value="org.h2.Driver" />
- <property name="hibernate.connection.user" value="sa" />
- <!-- Allow hibernate to generate our schema -->
- <property name="hibernate.hbm2ddl.auto" value="create" />
- </properties>
- </persistence-unit>
-
-</persistence>
diff --git a/h2-jdbc/src/test/java/org/jclouds/h2/jdbc/H2JdbcProviderTest.java b/h2-jdbc/src/test/java/org/jclouds/h2/jdbc/H2JdbcProviderTest.java
deleted file mode 100644
index 2330ad7..0000000
--- a/h2-jdbc/src/test/java/org/jclouds/h2/jdbc/H2JdbcProviderTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.h2.jdbc;
-
-import org.jclouds.jdbc.JdbcApiMetadata;
-import org.jclouds.providers.internal.BaseProviderMetadataTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "H2JdbcProviderTest")
-public class H2JdbcProviderTest extends BaseProviderMetadataTest {
-
- public H2JdbcProviderTest() {
- super(new H2JdbcProviderMetadata(), new JdbcApiMetadata());
- }
-
-}
diff --git a/h2-jdbc/src/test/java/org/jclouds/h2/jdbc/blobstore/H2JdbcBlobIntegrationTest.java b/h2-jdbc/src/test/java/org/jclouds/h2/jdbc/blobstore/H2JdbcBlobIntegrationTest.java
deleted file mode 100644
index e17aca7..0000000
--- a/h2-jdbc/src/test/java/org/jclouds/h2/jdbc/blobstore/H2JdbcBlobIntegrationTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.h2.jdbc.blobstore;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
-import org.testng.annotations.Test;
-import org.testng.SkipException;
-
-@Test(groups = { "integration" }, singleThreaded = true, testName = "blobstore.H2JdbcBlobIntegrationTest")
-public class H2JdbcBlobIntegrationTest extends BaseBlobIntegrationTest {
- public H2JdbcBlobIntegrationTest() {
- provider = "h2-jdbc";
- }
-
- @Override
- protected Iterable<Module> setupModules() {
- return ImmutableSet.<Module> of(this.getLoggingModule());
- }
-
- @Override
- public void testSetBlobAccess() throws Exception {
- throw new SkipException("jdbc does not support anonymous access");
- }
-}
diff --git a/h2-jdbc/src/test/java/org/jclouds/h2/jdbc/blobstore/H2JdbcContainerIntegrationTest.java b/h2-jdbc/src/test/java/org/jclouds/h2/jdbc/blobstore/H2JdbcContainerIntegrationTest.java
deleted file mode 100644
index 09549ad..0000000
--- a/h2-jdbc/src/test/java/org/jclouds/h2/jdbc/blobstore/H2JdbcContainerIntegrationTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.h2.jdbc.blobstore;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-import org.jclouds.blobstore.integration.internal.BaseContainerIntegrationTest;
-import org.testng.annotations.Test;
-import org.testng.SkipException;
-
-@Test(groups = { "integration" }, singleThreaded = true, testName = "blobstore.H2JdbcContainerIntegrationTest")
-public class H2JdbcContainerIntegrationTest extends BaseContainerIntegrationTest {
- public H2JdbcContainerIntegrationTest() {
- provider = "h2-jdbc";
- }
-
- @Override
- protected Iterable<Module> setupModules() {
- return ImmutableSet.<Module> of(this.getLoggingModule());
- }
-
- @Override
- public void testSetContainerAccess() throws Exception {
- throw new SkipException("jdbc does not support anonymous access");
- }
-
- @Override
- public void testClearWithOptions() throws InterruptedException {
- throw new SkipException("jdbc does not support clear with options");
- }
-}
diff --git a/h2-jdbc/src/test/resources/log4j.properties b/h2-jdbc/src/test/resources/log4j.properties
deleted file mode 100644
index 0815baa..0000000
--- a/h2-jdbc/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-#
-# 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.
-#
-#
-log4j.rootLogger=WARN, A1
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
-log4j.logger.org.hibernate = ERROR
diff --git a/jdbc/README.md b/jdbc/README.md
deleted file mode 100644
index ffcee1c..0000000
--- a/jdbc/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-## Jdbc api ##
-jclouds-jdbc is a storage api for relational databases. It is implemented using Guice Persist and JPA, so the user must
-provide an entity manager and a persistence.xml file with the required data source. An example of the persistence.xml can be
-found [here](https://github.com/jclouds/jclouds-labs/blob/master/jdbc/src/test/resources/META-INF/persistence.xml).
-
-## Running the tests ##
-Jdbc tests set up an embedded database and run the tests against it. To run the tests you can use this command.
-```
-mvn test
-```
-You can also run the integration tests with
-```
-mvn integration-test
-```
diff --git a/jdbc/pom.xml b/jdbc/pom.xml
deleted file mode 100644
index 1b25e2e..0000000
--- a/jdbc/pom.xml
+++ /dev/null
@@ -1,175 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.jclouds.labs</groupId>
- <artifactId>jclouds-labs</artifactId>
- <version>2.2.0-SNAPSHOT</version>
- </parent>
- <groupId>org.apache.jclouds.labs</groupId>
- <artifactId>jdbc</artifactId>
- <name>jclouds jdbc core</name>
- <description>jclouds components to access jdbc</description>
- <packaging>bundle</packaging>
-
- <properties>
- <jclouds.osgi.export>org.jclouds.jdbc*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>org.jclouds*;version="${project.version}",*</jclouds.osgi.import>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-blobstore</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-blobstore</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-log4j</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.auto.service</groupId>
- <artifactId>auto-service</artifactId>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-persist</artifactId>
- <version>4.0</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate.javax.persistence</groupId>
- <artifactId>hibernate-jpa-2.1-api</artifactId>
- <version>1.0.0.Final</version>
- </dependency>
-
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <version>4.3.9.Final</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>eclipselink</artifactId>
- <version>2.6.0</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <artifactId>javax.persistence</artifactId>
- <groupId>org.eclipse.persistence</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>2.3.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <version>1.4.187</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <threadCount>1</threadCount>
- </configuration>
- <executions>
- <execution>
- <id>integration</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <threadCount>1</threadCount>
- <excludes>
- <exclude>**/*LiveTest.java</exclude>
- <exclude>**/Base*Test.java</exclude>
- </excludes>
- <includes>
- <include>**/*IntegrationTest.java</include>
- </includes>
- <systemPropertyVariables>
- <jclouds.blobstore.httpstream.url>${jclouds.blobstore.httpstream.url}</jclouds.blobstore.httpstream.url>
- <jclouds.blobstore.httpstream.md5>${jclouds.blobstore.httpstream.md5}</jclouds.blobstore.httpstream.md5>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>animal-sniffer-maven-plugin</artifactId>
- <configuration>
- <signature>
- <groupId>org.codehaus.mojo.signature</groupId>
- <artifactId>java16</artifactId>
- <version>1.0</version>
- </signature>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.basepom.maven</groupId>
- <artifactId>duplicate-finder-maven-plugin</artifactId>
- <configuration>
- <checkTestClasspath>false</checkTestClasspath>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
-
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/JdbcApiMetadata.java b/jdbc/src/main/java/org/jclouds/jdbc/JdbcApiMetadata.java
deleted file mode 100644
index b478505..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/JdbcApiMetadata.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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;
-
-import com.google.auto.service.AutoService;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-import org.jclouds.apis.ApiMetadata;
-import org.jclouds.apis.internal.BaseApiMetadata;
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.jdbc.config.JdbcBlobStoreContextModule;
-
-import java.net.URI;
-
-/**
- * Implementation of {@link ApiMetadata} for jclouds Jdbc BlobStore
- */
-@AutoService(ApiMetadata.class)
-public class JdbcApiMetadata extends BaseApiMetadata {
-
- @Override
- public Builder toBuilder() {
- return new Builder().fromApiMetadata(this);
- }
-
- public JdbcApiMetadata() {
- super(new Builder());
- }
-
- protected JdbcApiMetadata(Builder builder) {
- super(builder);
- }
-
- public static class Builder extends BaseApiMetadata.Builder<Builder> {
-
- protected Builder() {
- id("jdbc")
- .name("Jdbc BlobStore")
- .identityName("Unused")
- .credentialName("unused")
- .defaultEndpoint("http://localhost/transient")
- .defaultIdentity("unused")
- .defaultCredential("unused")
- .version("1")
- .documentation(URI.create("http://www.jclouds.org/documentation/userguide/blobstore-guide"))
- .view(BlobStoreContext.class)
- .defaultModules(ImmutableSet.<Class<? extends Module>>of(JdbcBlobStoreContextModule.class));
- }
-
- @Override
- public JdbcApiMetadata build() {
- return new JdbcApiMetadata(this);
- }
-
- @Override
- protected Builder self() {
- return this;
- }
- }
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/config/JPAInitializer.java b/jdbc/src/main/java/org/jclouds/jdbc/config/JPAInitializer.java
deleted file mode 100644
index 08dba6e..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/config/JPAInitializer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.config;
-
-import java.io.Closeable;
-
-import org.jclouds.lifecycle.Closer;
-
-import com.google.inject.Inject;
-import com.google.inject.persist.PersistService;
-
-public class JPAInitializer {
-
- @Inject
- private JPAInitializer(final PersistService persistService, Closer closer) {
- persistService.start();
- closer.addToClose(new Closeable() {
- @Override
- public void close() {
- persistService.stop();
- }
- });
- }
-
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/config/JdbcBlobStoreContextModule.java b/jdbc/src/main/java/org/jclouds/jdbc/config/JdbcBlobStoreContextModule.java
deleted file mode 100644
index 3619eb6..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/config/JdbcBlobStoreContextModule.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.config;
-
-import com.google.inject.AbstractModule;
-import org.jclouds.blobstore.BlobRequestSigner;
-import org.jclouds.blobstore.BlobStore;
-import org.jclouds.blobstore.LocalBlobRequestSigner;
-import org.jclouds.blobstore.LocalStorageStrategy;
-import org.jclouds.blobstore.attr.ConsistencyModel;
-import org.jclouds.blobstore.config.BlobStoreObjectModule;
-import org.jclouds.blobstore.config.LocalBlobStore;
-import org.jclouds.blobstore.util.BlobUtils;
-import org.jclouds.jdbc.strategy.JdbcStorageStrategy;
-import org.jclouds.jdbc.util.JdbcBlobUtils;
-
-public class JdbcBlobStoreContextModule extends AbstractModule {
-
- @Override
- protected void configure() {
- bind(JPAInitializer.class).asEagerSingleton();
- bind(BlobStore.class).to(LocalBlobStore.class);
- install(new BlobStoreObjectModule());
- bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT);
- bind(LocalStorageStrategy.class).to(JdbcStorageStrategy.class);
- bind(BlobUtils.class).to(JdbcBlobUtils.class);
- bind(BlobRequestSigner.class).to(LocalBlobRequestSigner.class);
- }
-
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/conversion/BlobEntityToBlob.java b/jdbc/src/main/java/org/jclouds/jdbc/conversion/BlobEntityToBlob.java
deleted file mode 100644
index 9d99778..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/conversion/BlobEntityToBlob.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.conversion;
-
-import com.google.common.base.Function;
-import com.google.common.hash.HashCode;
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobBuilder;
-import org.jclouds.blobstore.domain.StorageType;
-import org.jclouds.jdbc.entity.BlobEntity;
-import org.jclouds.jdbc.entity.PayloadEntity;
-import org.jclouds.jdbc.service.JdbcService;
-import org.jclouds.jdbc.util.JdbcInputStream;
-
-public class BlobEntityToBlob implements Function<BlobEntity, Blob> {
-
- private final Provider<BlobBuilder> blobBuilders;
- private final JdbcService jdbcService;
-
- @Inject
- BlobEntityToBlob(Provider<BlobBuilder> blobBuilders, JdbcService jdbcService) {
- this.blobBuilders = blobBuilders;
- this.jdbcService = jdbcService;
- }
-
- @Override
- public Blob apply(BlobEntity blobEntity) {
- if (blobEntity == null) {
- return null;
- }
-
- PayloadEntity payload = blobEntity.getPayload();
- BlobBuilder builder = blobBuilders.get()
- .name(blobEntity.getKey())
- .userMetadata(blobEntity.getUserMetadata());
-
- if (blobEntity.isDirectory()) {
- builder.type(StorageType.FOLDER);
- }
- else {
- builder.payload(new JdbcInputStream(jdbcService, blobEntity.getPayload().getChunks()));
- }
-
- Blob blob = builder.build();
-
- blob.getMetadata().setContainer(blobEntity.getContainerEntity().getName());
- blob.getMetadata().setCreationDate(blobEntity.getCreationDate());
- blob.getMetadata().setLastModified(blobEntity.getLastModified());
- blob.getMetadata().setSize(blobEntity.getSize());
- blob.getMetadata().setUserMetadata(blobEntity.getUserMetadata());
-
- blob.getMetadata().getContentMetadata().setCacheControl(payload.getCacheControl());
- blob.getMetadata().getContentMetadata().setContentType(payload.getContentType());
- blob.getMetadata().getContentMetadata().setContentDisposition(payload.getContentDisposition());
- blob.getMetadata().getContentMetadata().setContentEncoding(payload.getContentEncoding());
- blob.getMetadata().getContentMetadata().setContentLanguage(payload.getContentLanguage());
- blob.getMetadata().getContentMetadata().setContentLength(payload.getContentLength());
- blob.getMetadata().getContentMetadata().setContentMD5(payload.getContentMD5() == null ?
- null :
- HashCode.fromBytes(payload.getContentMD5()));
- blob.getMetadata().setETag(blobEntity.getEtag());
- blob.getMetadata().getContentMetadata().setExpires(payload.getExpires());
- blob.getMetadata().setTier(blobEntity.getTier());
- return blob;
- }
-
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/conversion/BlobToBlobEntity.java b/jdbc/src/main/java/org/jclouds/jdbc/conversion/BlobToBlobEntity.java
deleted file mode 100644
index d217404..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/conversion/BlobToBlobEntity.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.conversion;
-
-import com.google.common.base.Function;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.MutableBlobMetadata;
-import org.jclouds.io.ContentMetadata;
-import org.jclouds.jdbc.entity.BlobEntity;
-import org.jclouds.jdbc.entity.PayloadEntity;
-
-public class BlobToBlobEntity implements Function<Blob, BlobEntity> {
- @Override
- public BlobEntity apply(Blob blob) {
- MutableBlobMetadata metadata = blob.getMetadata();
- ContentMetadata contentMetadata = metadata.getContentMetadata();
- PayloadEntity payload = PayloadEntity.builder()
- .cacheControl(contentMetadata.getCacheControl())
- .contentDisposition(contentMetadata.getContentDisposition())
- .contentEncoding(contentMetadata.getContentEncoding())
- .contentLanguage(contentMetadata.getContentLanguage())
- .contentLength(contentMetadata.getContentLength())
- .contentMD5(contentMetadata.getContentMD5AsHashCode() == null ?
- null :
- contentMetadata.getContentMD5AsHashCode().asBytes())
- .contentType(contentMetadata.getContentType())
- .expires(contentMetadata.getExpires())
- .build();
- return BlobEntity.builder(null, null)
- .payload(payload)
- .userMetadata(metadata.getUserMetadata())
- .size(blob.getPayload().getContentMetadata().getContentLength())
- .build();
- }
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/entity/BlobEntity.java b/jdbc/src/main/java/org/jclouds/jdbc/entity/BlobEntity.java
deleted file mode 100644
index 9a96a36..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/entity/BlobEntity.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * 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.entity;
-
-import org.jclouds.blobstore.domain.BlobAccess;
-import org.jclouds.blobstore.domain.Tier;
-
-import javax.persistence.CascadeType;
-import javax.persistence.ElementCollection;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToOne;
-import javax.persistence.PrePersist;
-import javax.persistence.Table;
-import java.util.Date;
-import java.util.Map;
-
-@Entity
-@Table
-@IdClass(value = BlobEntityPK.class)
-public class BlobEntity {
-
- @Id
- @ManyToOne
- @JoinColumn(name = "id")
- private ContainerEntity containerEntity;
-
- @Id
- private String key;
-
- @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
- private PayloadEntity payload;
-
- @ElementCollection(fetch = FetchType.EAGER)
- public Map<String, String> userMetadata;
-
- private Date creationDate;
- private Date lastModified;
- private BlobAccess blobAccess;
- private Tier tier;
- private Long size;
- private String etag;
- private boolean directory;
-
- @PrePersist
- private void defaults() {
- this.lastModified = new Date();
- if (this.creationDate == null) {
- this.creationDate = new Date();
- }
- if (blobAccess == null) {
- this.blobAccess = BlobAccess.PRIVATE;
- }
- }
-
- public BlobEntity() {
- }
-
- public BlobEntity(ContainerEntity containerEntity, String key, PayloadEntity payload, Date creationDate, Date lastModified,
- BlobAccess blobAccess, Tier tier, Map<String, String> userMetadata, Long size, String etag, boolean directory) {
- this.containerEntity = containerEntity;
- this.key = key;
- this.creationDate = creationDate;
- this.lastModified = lastModified;
- this.payload = payload;
- this.blobAccess = blobAccess;
- this.tier = tier;
- this.userMetadata = userMetadata;
- this.size = size;
- this.etag = etag;
- this.directory = directory;
- }
-
- public ContainerEntity getContainerEntity() {
- return containerEntity;
- }
-
- public boolean isDirectory() {
- return directory;
- }
-
- public void setDirectory(boolean directory) {
- this.directory = directory;
- }
-
- public void setContainerEntity(ContainerEntity containerEntity) {
- this.containerEntity = containerEntity;
- }
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public PayloadEntity getPayload() {
- return payload;
- }
-
- public void setPayload(PayloadEntity payload) {
- this.payload = payload;
- }
-
- public Date getLastModified() {
- return lastModified;
- }
-
- public void setLastModified(Date lastModified) {
- this.lastModified = lastModified;
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
-
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
- }
-
- public BlobAccess getBlobAccess() {
- return blobAccess;
- }
-
- public void setBlobAccess(BlobAccess blobAccess) {
- this.blobAccess = blobAccess;
- }
-
- public Tier getTier() {
- return tier;
- }
-
- public void setTier(Tier tier) {
- this.tier = tier;
- }
-
- public Map<String, String> getUserMetadata() {
- return userMetadata;
- }
-
- public void setUserMetadata(Map<String, String> userMetadata) {
- this.userMetadata = userMetadata;
- }
-
- public Long getSize() {
- return size;
- }
-
- public void setSize(Long size) {
- this.size = size;
- }
-
- public String getEtag() {
- return etag;
- }
-
- public void setEtag(String etag) {
- this.etag = etag;
- }
-
- public static Builder builder(ContainerEntity containerEntity, String key) {
- return new Builder(containerEntity, key);
- }
-
- public static class Builder {
- private ContainerEntity containerEntity;
- private String key;
- private PayloadEntity payload;
- private BlobAccess blobAccess;
- private Tier tier;
- private Long size;
- private String etag;
- private Map<String, String> userMetadata;
- private boolean directory;
-
- public Builder(ContainerEntity containerEntity, String key) {
- this.containerEntity = containerEntity;
- this.key = key;
- this.directory = false;
- }
-
- public Builder blobAccess(BlobAccess blobAccess) {
- this.blobAccess = blobAccess;
- return this;
- }
-
- public Builder tier(Tier tier) {
- this.tier = tier;
- return this;
- }
-
- public Builder payload(PayloadEntity payload) {
- this.payload = payload;
- return this;
- }
-
- public Builder userMetadata(Map<String, String> userMetadata) {
- this.userMetadata = userMetadata;
- return this;
- }
-
- public Builder size(Long size) {
- this.size = size;
- return this;
- }
-
- public Builder etag(String etag) {
- this.etag = etag;
- return this;
- }
-
- public Builder directory(boolean directory) {
- this.directory = directory;
- return this;
- }
-
- public BlobEntity build() {
- return new BlobEntity(containerEntity, key, payload, null, null, blobAccess, tier, userMetadata, size, etag, directory);
- }
- }
-
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/entity/BlobEntityPK.java b/jdbc/src/main/java/org/jclouds/jdbc/entity/BlobEntityPK.java
deleted file mode 100644
index e57342f..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/entity/BlobEntityPK.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.entity;
-
-import java.io.Serializable;
-
-public class BlobEntityPK implements Serializable {
-
- private Long containerEntity;
- private String key;
-
- public Long getContainerEntity() {
- return containerEntity;
- }
-
- public String getKey() {
- return key;
- }
-
- public BlobEntityPK() {
- }
-
- public BlobEntityPK(Long containerEntity, String key) {
- this.containerEntity = containerEntity;
- this.key = key;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
-
- BlobEntityPK blobEntityPK = (BlobEntityPK) o;
-
- return containerEntity.equals(blobEntityPK.containerEntity) && key.equals(blobEntityPK.key);
- }
-
- @Override
- public int hashCode() {
- int result = containerEntity.hashCode();
- result = 31 * result + key.hashCode();
- return result;
- }
-
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/entity/ChunkEntity.java b/jdbc/src/main/java/org/jclouds/jdbc/entity/ChunkEntity.java
deleted file mode 100644
index 41a8cee..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/entity/ChunkEntity.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.entity;
-
-import org.jclouds.jdbc.reference.JdbcConstants;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Lob;
-import javax.persistence.Table;
-
-@Entity
-@Table
-public class ChunkEntity {
-
- @Id
- @GeneratedValue
- private Long id;
-
- @Lob
- @Column(length = JdbcConstants.DEFAULT_CHUNK_SIZE)
- private byte[] data;
-
- private int size;
-
- public ChunkEntity(byte[] data, int size) {
- this.data = data;
- this.size = size;
- }
-
- public ChunkEntity() {
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public byte[] getData() {
- return data;
- }
-
- public void setData(byte[] data) {
- this.data = data;
- }
-
- public int getSize() {
- return size;
- }
-
- public void setSize(int size) {
- this.size = size;
- }
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/entity/ContainerEntity.java b/jdbc/src/main/java/org/jclouds/jdbc/entity/ContainerEntity.java
deleted file mode 100644
index ab30f06..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/entity/ContainerEntity.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.entity;
-
-import org.jclouds.blobstore.domain.ContainerAccess;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.PrePersist;
-import javax.persistence.Table;
-import java.util.Date;
-
-@Entity
-@Table
-public class ContainerEntity {
-
- @Id
- @GeneratedValue
- private Long id;
-
- @Column(unique = true)
- private String name;
-
- private Date creationDate;
-
- private ContainerAccess containerAccess;
-
- public ContainerEntity() {
- }
-
- public ContainerEntity(Long id, String name, Date creationDate, ContainerAccess containerAccess) {
- this.id = id;
- this.name = name;
- this.creationDate = creationDate;
- this.containerAccess = containerAccess;
- }
-
- @PrePersist
- private void defaults() {
- this.creationDate = new Date();
- if (containerAccess == null) {
- this.containerAccess = ContainerAccess.PRIVATE;
- }
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
-
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
- }
-
- public ContainerAccess getContainerAccess() {
- return containerAccess;
- }
-
- public void setContainerAccess(ContainerAccess containerAccess) {
- this.containerAccess = containerAccess;
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private String name;
- private ContainerAccess containerAccess;
-
- public Builder() {
- }
-
- public Builder name(String name){
- this.name = name;
- return this;
- }
-
- public Builder containerAccess(ContainerAccess containerAccess){
- this.containerAccess = containerAccess;
- return this;
- }
-
- public ContainerEntity build() {
- return new ContainerEntity(null, name, null, containerAccess);
- }
- }
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/entity/PayloadEntity.java b/jdbc/src/main/java/org/jclouds/jdbc/entity/PayloadEntity.java
deleted file mode 100644
index ca71a69..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/entity/PayloadEntity.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * 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.entity;
-
-import com.google.common.collect.ImmutableList;
-
-import javax.persistence.ElementCollection;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import java.util.Date;
-import java.util.List;
-
-@Entity
-public class PayloadEntity {
-
- @Id
- @GeneratedValue
- private Long id;
-
- @ElementCollection(fetch = FetchType.EAGER)
- private List<Long> chunks;
-
- private String cacheControl;
- private String contentType;
- private Long contentLength;
- private byte[] contentMD5;
- private String contentDisposition;
- private String contentLanguage;
- private String contentEncoding;
- private Date expires;
-
- public PayloadEntity(List<Long> chunks, String cacheControl, String contentType, Long contentLength, byte[] contentMD5,
- String contentDisposition, String contentLanguage, String contentEncoding, Date expires) {
- this.chunks = chunks;
- this.cacheControl = cacheControl;
- this.contentType = contentType;
- this.contentLength = contentLength;
- this.contentMD5 = contentMD5;
- this.contentDisposition = contentDisposition;
- this.contentLanguage = contentLanguage;
- this.contentEncoding = contentEncoding;
- this.expires = expires;
- }
-
- public PayloadEntity() {
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public List<Long> getChunks() {
- return chunks;
- }
-
- public void setChunks(List<Long> chunks) {
- this.chunks = chunks;
- }
-
- public String getCacheControl() {
- return cacheControl;
- }
-
- public void setCacheControl(String cacheControl) {
- this.cacheControl = cacheControl;
- }
-
- public String getContentType() {
- return contentType;
- }
-
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
- public Long getContentLength() {
- return contentLength;
- }
-
- public void setContentLength(Long contentLength) {
- this.contentLength = contentLength;
- }
-
- public byte[] getContentMD5() {
- return contentMD5;
- }
-
- public void setContentMD5(byte[] contentMD5) {
- this.contentMD5 = contentMD5;
- }
-
- public String getContentDisposition() {
- return contentDisposition;
- }
-
- public void setContentDisposition(String contentDisposition) {
- this.contentDisposition = contentDisposition;
- }
-
- public String getContentLanguage() {
- return contentLanguage;
- }
-
- public void setContentLanguage(String contentLanguage) {
- this.contentLanguage = contentLanguage;
- }
-
- public String getContentEncoding() {
- return contentEncoding;
- }
-
- public void setContentEncoding(String contentEncoding) {
- this.contentEncoding = contentEncoding;
- }
-
- public Date getExpires() {
- return expires;
- }
-
- public void setExpires(Date expires) {
- this.expires = expires;
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private List<Long> chunks;
- private String cacheControl;
- private String contentType;
- private Long contentLength;
- private byte[] contentMD5;
- private String contentDisposition;
- private String contentLanguage;
- private String contentEncoding;
- private Date expires;
-
- public Builder() {
- this.chunks = ImmutableList.of();
- }
-
- public Builder chunks(List<Long> chunks) {
- this.chunks = chunks;
- return this;
- }
-
- public Builder cacheControl(String cacheControl) {
- this.cacheControl = cacheControl;
- return this;
- }
-
- public Builder contentType(String contentType) {
- this.contentType = contentType;
- return this;
- }
-
- public Builder contentLength(Long contentLength) {
- this.contentLength = contentLength;
- return this;
- }
-
- public Builder contentMD5(byte[] contentMD5) {
- this.contentMD5 = contentMD5;
- return this;
- }
-
- public Builder contentDisposition(String contentDisposition) {
- this.contentDisposition = contentDisposition;
- return this;
- }
-
- public Builder contentLanguage(String contentLanguage) {
- this.contentLanguage = contentLanguage;
- return this;
- }
-
- public Builder contentEncoding(String contentEncoding) {
- this.contentEncoding = contentEncoding;
- return this;
- }
-
- public Builder expires(Date expires) {
- this.expires = expires;
- return this;
- }
-
- public PayloadEntity build() {
- return new PayloadEntity(chunks, cacheControl, contentType, contentLength, contentMD5, contentDisposition, contentLanguage, contentEncoding, expires);
- }
- }
-
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/predicates/validators/JdbcBlobKeyValidator.java b/jdbc/src/main/java/org/jclouds/jdbc/predicates/validators/JdbcBlobKeyValidator.java
deleted file mode 100644
index 7083244..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/predicates/validators/JdbcBlobKeyValidator.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.predicates.validators;
-
-import com.google.inject.Singleton;
-import org.jclouds.predicates.Validator;
-
-/**
- * Validates name for jdbc container blob keys implementation
- *
- * @see org.jclouds.rest.InputParamValidator
- * @see org.jclouds.predicates.Validator
- */
-@Singleton
-public class JdbcBlobKeyValidator extends Validator<String> {
-
- @Override
- public void validate(String name) throws IllegalArgumentException {
- if (name == null || name.length() < 1) {
- throw new IllegalArgumentException("Blob key can not be null or empty");
- }
-
- if (name.startsWith("/")) {
- throw new IllegalArgumentException("Blob key can not start with character /");
- }
- }
-
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/predicates/validators/JdbcContainerNameValidator.java b/jdbc/src/main/java/org/jclouds/jdbc/predicates/validators/JdbcContainerNameValidator.java
deleted file mode 100644
index 1441340..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/predicates/validators/JdbcContainerNameValidator.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.predicates.validators;
-
-import com.google.inject.Singleton;
-import org.jclouds.predicates.Validator;
-
-/**
- * Validates container name for jdbc provider implementation
- *
- * @see org.jclouds.rest.InputParamValidator
- * @see org.jclouds.predicates.Validator
- */
-@Singleton
-public class JdbcContainerNameValidator extends Validator<String> {
-
- @Override
- public void validate(String name) throws IllegalArgumentException {
- if (name == null || name.length() < 1) {
- throw new IllegalArgumentException("Container name can not be null or empty");
- }
-
- if (name.contains("/")) {
- throw new IllegalArgumentException("Container name can not contain character /");
- }
- }
-
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/reference/JdbcConstants.java b/jdbc/src/main/java/org/jclouds/jdbc/reference/JdbcConstants.java
deleted file mode 100644
index 1e629f6..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/reference/JdbcConstants.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.reference;
-
-/**
- * Common constants used in jdbc provider
- */
-public final class JdbcConstants {
-
- public static final int DEFAULT_CHUNK_SIZE = 1024 * 1024;
-
- private JdbcConstants() {
- throw new AssertionError("Intentionally Unimplemented");
- }
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/repository/BlobRepository.java b/jdbc/src/main/java/org/jclouds/jdbc/repository/BlobRepository.java
deleted file mode 100644
index 21b2be7..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/repository/BlobRepository.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.repository;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-import org.jclouds.jdbc.entity.BlobEntity;
-import org.jclouds.jdbc.entity.BlobEntityPK;
-import org.jclouds.jdbc.entity.ContainerEntity;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-@Singleton
-public class BlobRepository extends GenericRepository<BlobEntity, BlobEntityPK> {
-
- @Inject
- private BlobRepository(Provider<EntityManager> entityManager) {
- super(entityManager);
- }
-
- public List<BlobEntity> findBlobsByContainer(ContainerEntity containerEntity) {
- return entityManager.get().createQuery("SELECT b FROM " + entityClass.getName() + " b "
- + "WHERE"
- + " b.containerEntity = :containerEntity", entityClass)
- .setParameter("containerEntity", containerEntity)
- .getResultList();
- }
-
- public List<BlobEntity> findBlobsByDirectory(ContainerEntity containerEntity, String directory) {
- return entityManager.get().createQuery("SELECT b FROM " + entityClass.getName() + " b "
- + "WHERE b.containerEntity = :containerEntity AND b.key != :directoryName AND b.key LIKE :directoryLike ", entityClass)
- .setParameter("containerEntity", containerEntity)
- .setParameter("directoryName", directory)
- .setParameter("directoryLike", directory + "%")
- .getResultList();
- }
-
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/repository/ChunkRepository.java b/jdbc/src/main/java/org/jclouds/jdbc/repository/ChunkRepository.java
deleted file mode 100644
index 5b89e84..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/repository/ChunkRepository.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.repository;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-import org.jclouds.jdbc.entity.ChunkEntity;
-
-import javax.persistence.EntityManager;
-
-@Singleton
-public class ChunkRepository extends GenericRepository<ChunkEntity, Long> {
-
- @Inject
- private ChunkRepository(Provider<EntityManager> entityManager) {
- super(entityManager);
- }
-
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/repository/ContainerRepository.java b/jdbc/src/main/java/org/jclouds/jdbc/repository/ContainerRepository.java
deleted file mode 100644
index 7894683..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/repository/ContainerRepository.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.repository;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-import org.jclouds.jdbc.entity.ContainerEntity;
-
-import javax.persistence.EntityManager;
-import javax.persistence.NoResultException;
-import java.util.List;
-
-@Singleton
-public class ContainerRepository extends GenericRepository<ContainerEntity, Long> {
-
- @Inject
- private ContainerRepository(Provider<EntityManager> entityManager) {
- super(entityManager);
- }
-
- public ContainerEntity findContainerByName(String name) {
- try {
- return entityManager.get().createQuery("SELECT c FROM " + entityClass.getName() + " c WHERE c.name = :name", entityClass)
- .setParameter("name", name)
- .getSingleResult();
- } catch (NoResultException e) {
- return null;
- }
- }
-
- public List<ContainerEntity> findAllContainers() {
- return entityManager.get().createQuery("SELECT c FROM " + entityClass.getName() + " c", entityClass)
- .getResultList();
- }
-
- public void deleteContainerByName(String name) {
- ContainerEntity containerEntity = findContainerByName(name);
- if (containerEntity != null) {
- delete(containerEntity);
- }
- }
-
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/repository/GenericRepository.java b/jdbc/src/main/java/org/jclouds/jdbc/repository/GenericRepository.java
deleted file mode 100644
index 84e896d..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/repository/GenericRepository.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.repository;
-
-import com.google.inject.Provider;
-
-import javax.persistence.EntityManager;
-import java.io.Serializable;
-import java.lang.reflect.ParameterizedType;
-
-public abstract class GenericRepository<T, PK extends Serializable> {
-
- protected final Class<T> entityClass;
- protected final Provider<EntityManager> entityManager;
-
- @SuppressWarnings("unchecked")
- protected GenericRepository(Provider<EntityManager> entityManager) {
- this.entityManager = entityManager;
- this.entityClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
- }
-
- public T create(T entity) {
- entityManager.get().persist(entity);
- return entity;
- }
-
- public T find(PK id) {
- return entityManager.get().find(entityClass, id);
- }
-
- public T save(T entity) {
- return entityManager.get().merge(entity);
- }
-
- public void delete(T entity) {
- entityManager.get().remove(entity);
- }
-
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/service/JdbcService.java b/jdbc/src/main/java/org/jclouds/jdbc/service/JdbcService.java
deleted file mode 100644
index 786f080..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/service/JdbcService.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * 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.service;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.hash.HashCode;
-import com.google.common.hash.Hashing;
-import com.google.common.hash.HashingInputStream;
-import com.google.common.io.ByteStreams;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.persist.Transactional;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobAccess;
-import org.jclouds.blobstore.domain.ContainerAccess;
-import org.jclouds.jdbc.conversion.BlobToBlobEntity;
-import org.jclouds.jdbc.entity.BlobEntity;
-import org.jclouds.jdbc.entity.BlobEntityPK;
-import org.jclouds.jdbc.entity.ChunkEntity;
-import org.jclouds.jdbc.entity.ContainerEntity;
-import org.jclouds.jdbc.entity.PayloadEntity;
-import org.jclouds.jdbc.reference.JdbcConstants;
-import org.jclouds.jdbc.repository.BlobRepository;
-import org.jclouds.jdbc.repository.ChunkRepository;
-import org.jclouds.jdbc.repository.ContainerRepository;
-import org.jclouds.util.Closeables2;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import static com.google.common.io.BaseEncoding.base16;
-
-@Singleton
-public class JdbcService {
-
- private static final String DIRECTORY_MD5 = Hashing.md5().hashBytes(new byte[0]).toString();
-
- private final ContainerRepository containerRepository;
- private final BlobRepository blobRepository;
- private final ChunkRepository chunkRepository;
- private final BlobToBlobEntity blobToBlobEntity;
-
- @Inject
- JdbcService(ContainerRepository containerRepository, BlobRepository blobRepository, ChunkRepository chunkRepository,
- BlobToBlobEntity blobToBlobEntity) {
- this.containerRepository = containerRepository;
- this.blobRepository = blobRepository;
- this.chunkRepository = chunkRepository;
- this.blobToBlobEntity = blobToBlobEntity;
- }
-
- @Transactional
- public void createContainer(String containerName, ContainerAccess access) {
- containerRepository.create(ContainerEntity.builder().name(containerName).containerAccess(access).build());
- }
-
- @Transactional
- public void createContainer(String containerName) {
- createContainer(containerName, null);
- }
-
- @Transactional
- public List<ContainerEntity> findAllContainers() {
- return containerRepository.findAllContainers();
- }
-
- @Transactional
- public ContainerEntity findContainerByName(String containerName) {
- return containerRepository.findContainerByName(containerName);
- }
-
- @Transactional
- public void deleteContainerByName(String containerName) {
- containerRepository.deleteContainerByName(containerName);
- }
-
- @Transactional
- public void setContainerAccessByName(String containerName, ContainerAccess access) {
- ContainerEntity containerEntity = containerRepository.findContainerByName(containerName);
- containerEntity.setContainerAccess(access);
- containerRepository.save(containerEntity);
- }
-
- @Transactional
- public boolean blobExists(String containerName, String key) {
- return findBlobById(containerName, key) != null;
- }
-
- @Transactional(rollbackOn = IOException.class)
- public BlobEntity createOrModifyBlob(String containerName, Blob blob, BlobAccess blobAccess) throws IOException {
- List<Long> chunks;
- HashingInputStream his = new HashingInputStream(Hashing.md5(), blob.getPayload().openStream());
- try {
- chunks = storeData(his);
- } finally {
- Closeables2.closeQuietly(his);
- }
- HashCode actualHashCode = his.hash();
- HashCode expectedHashCode = blob.getPayload().getContentMetadata().getContentMD5AsHashCode();
- if (expectedHashCode != null && !actualHashCode.equals(expectedHashCode)) {
- throw new IOException("MD5 hash code mismatch, actual: " + actualHashCode +
- " expected: " + expectedHashCode);
- }
-
- String key = blob.getMetadata().getName();
- Date creationDate = null;
- BlobEntity oldBlobEntity = findBlobById(containerName, key);
- if (oldBlobEntity != null) {
- creationDate = oldBlobEntity.getCreationDate();
- }
- BlobEntity blobEntity = blobToBlobEntity.apply(blob);
- blobEntity.getPayload().setChunks(chunks);
- blobEntity.setContainerEntity(containerRepository.findContainerByName(containerName));
- blobEntity.setKey(key);
- blobEntity.setBlobAccess(blobAccess);
- blobEntity.setTier(blob.getMetadata().getTier());
- blobEntity.setCreationDate(creationDate);
- blobEntity.setLastModified(new Date());
- blobEntity.setEtag(base16().lowerCase().encode(actualHashCode.asBytes()));
- blobEntity.getPayload().setContentMD5(actualHashCode.asBytes());
-
- BlobEntity result = blobRepository.save(blobEntity);
- return result;
- }
-
- @Transactional
- public BlobEntity createDirectoryBlob(String containerName, Blob blob, BlobAccess blobAccess) {
- BlobEntity blobEntity = BlobEntity.builder(null, null)
- .userMetadata(blob.getMetadata().getUserMetadata())
- .directory(true)
- .payload(PayloadEntity.builder().contentType("application/directory").build())
- .build();
- blobEntity.setContainerEntity(containerRepository.findContainerByName(containerName));
- blobEntity.setKey(blob.getMetadata().getName());
- blobEntity.setBlobAccess(blobAccess);
- blobEntity.setEtag(DIRECTORY_MD5);
- return blobRepository.save(blobEntity);
- }
-
- @Transactional
- public BlobEntity createDirectoryBlob(String containerName, Blob blob) {
- return createDirectoryBlob(containerName, blob, null);
- }
-
- @Transactional(rollbackOn = IOException.class)
- public BlobEntity createOrModifyBlob(String containerName, Blob blob) throws IOException {
- return createOrModifyBlob(containerName, blob, null);
- }
-
- @Transactional
- public BlobEntity findBlobById(String containerName, String key) {
- ContainerEntity containerEntity = containerRepository.findContainerByName(containerName);
- return containerEntity == null ? null : blobRepository.find(new BlobEntityPK(containerEntity.getId(), key));
- }
-
- @Transactional
- public ChunkEntity findChunkById(Long id) {
- return chunkRepository.find(id);
- }
-
- @Transactional
- public List<BlobEntity> findBlobsByContainer(String containerName) {
- return blobRepository.findBlobsByContainer(containerRepository.findContainerByName(containerName));
- }
-
- @Transactional
- public List<BlobEntity> findBlobsByDirectory(String containerName, String directoryName, boolean recursive) {
- ImmutableList.Builder<BlobEntity> result = ImmutableList.builder();
- List<BlobEntity> blobEntities = blobRepository
- .findBlobsByDirectory(containerRepository.findContainerByName(containerName), directoryName);
- result.addAll(blobEntities);
- if (recursive) {
- for (BlobEntity blobEntity : blobEntities) {
- if (blobEntity.isDirectory()) {
- result.addAll(findBlobsByDirectory(containerName, blobEntity.getKey(), true));
- }
- }
- }
- return result.build();
- }
-
- @Transactional
- public void deleteBlobsByContainer(String containerName) {
- List<BlobEntity> blobs = findBlobsByContainer(containerName);
- for (BlobEntity blob : blobs) {
- deleteBlob(containerName, blob.getKey());
- }
- }
-
- @Transactional
- public void deleteBlobsByDirectory(String containerName, String directoryName, boolean recursive) {
- List<BlobEntity> blobs = findBlobsByDirectory(containerName, directoryName, false);
- for (BlobEntity blob : blobs) {
- if (!blob.isDirectory()) {
- deleteBlob(containerName, blob.getKey());
- }
- else {
- if (recursive) {
- deleteBlobsByDirectory(containerName, blob.getKey(), true);
- deleteBlob(containerName, blob.getKey());
- }
- }
- }
- }
-
- @Transactional
- public void deleteBlob(String containerName, String key) {
- BlobEntity blobEntity = findBlobById(containerName, key);
- if (blobEntity != null) {
- deleteChunks(blobEntity.getPayload().getChunks());
- blobRepository.delete(blobEntity);
- }
- }
-
- @Transactional
- public void setBlobAccessById(String containerName, String key, BlobAccess access) {
- BlobEntity blobEntity = findBlobById(containerName, key);
- blobEntity.setBlobAccess(access);
- blobRepository.save(blobEntity);
- }
-
- @Transactional
- private void deleteChunks(List<Long> chunkIds) {
- for (Long chunkId : chunkIds) {
- chunkRepository.delete(chunkRepository.find(chunkId));
- }
- }
-
- @Transactional(rollbackOn = IOException.class)
- private List<Long> storeData(InputStream data) throws IOException {
- ImmutableList.Builder<Long> chunks = ImmutableList.builder();
- while (true) {
- byte[] buffer = new byte[JdbcConstants.DEFAULT_CHUNK_SIZE];
- int bytes = ByteStreams.read(data, buffer, 0, JdbcConstants.DEFAULT_CHUNK_SIZE);
- if (bytes == 0) {
- break;
- } else if (bytes != buffer.length) {
- buffer = Arrays.copyOf(buffer, bytes);
- }
- chunks.add(chunkRepository.create(new ChunkEntity(buffer, bytes)).getId());
- }
- return chunks.build();
- }
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/strategy/JdbcStorageStrategy.java b/jdbc/src/main/java/org/jclouds/jdbc/strategy/JdbcStorageStrategy.java
deleted file mode 100644
index 5cad097..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/strategy/JdbcStorageStrategy.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * 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.strategy;
-
-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;
-import org.jclouds.blobstore.domain.BlobBuilder;
-import org.jclouds.blobstore.domain.ContainerAccess;
-import org.jclouds.blobstore.domain.MutableStorageMetadata;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.domain.StorageType;
-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;
-import org.jclouds.jdbc.entity.ContainerEntity;
-import org.jclouds.jdbc.predicates.validators.JdbcBlobKeyValidator;
-import org.jclouds.jdbc.predicates.validators.JdbcContainerNameValidator;
-import org.jclouds.jdbc.service.JdbcService;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-
-/**
- * JdbcStorageStrategy implements a blob store that stores objects
- * on a jdbc supported database. Content metadata and user attributes are stored in
- * the database as well.
- */
-public class JdbcStorageStrategy implements LocalStorageStrategy {
-
- private final Provider<BlobBuilder> blobBuilders;
- private final JdbcService jdbcService;
- private final JdbcContainerNameValidator jdbcContainerNameValidator;
- private final JdbcBlobKeyValidator jdbcBlobKeyValidator;
- private final BlobEntityToBlob blobEntityToBlob;
- private final Location mockLocation;
-
- @Inject
- JdbcStorageStrategy(Provider<BlobBuilder> blobBuilders,
- JdbcContainerNameValidator jdbcContainerNameValidator, JdbcBlobKeyValidator jdbcBlobKeyValidator,
- JdbcService jdbcService, BlobEntityToBlob blobEntityToBlob)
- throws ClassNotFoundException, IllegalAccessException, InstantiationException, SQLException {
- this.jdbcService = jdbcService;
- this.blobBuilders = blobBuilders;
- this.jdbcContainerNameValidator = jdbcContainerNameValidator;
- this.jdbcBlobKeyValidator = jdbcBlobKeyValidator;
- this.blobEntityToBlob = blobEntityToBlob;
- this.mockLocation = new LocationBuilder()
- .id("jdbc")
- .scope(LocationScope.PROVIDER)
- .description("http://localhost/transient")
- .build();
- }
-
- /**
- * Checks if a container exists
- *
- * @param container the name of the container to check
- * @return true if the container exists, false otherwise
- */
- @Override
- public boolean containerExists(String container) {
- jdbcContainerNameValidator.validate(container);
- return jdbcService.findContainerByName(container) != null;
- }
-
- /**
- * Lists all the container names
- *
- * @return an iterable with the container names
- */
- @Override
- public Collection<String> getAllContainerNames() {
- List<ContainerEntity> containerEntities = jdbcService.findAllContainers();
- ImmutableList.Builder<String> result = ImmutableList.builder();
- for (ContainerEntity c : containerEntities) {
- result.add(c.getName());
- }
- return result.build();
- }
-
- /**
- * Creates a container. The location is ignored.
- *
- * @param container the name of the container to create
- * @param createContainerOptions creation options to the container. defaults the ContainerAccess
- * to ContainerAccess.PRIVATE
- * @return true if the container was created, false otherwise
- */
- @Override
- public boolean createContainerInLocation(String container, Location location,
- CreateContainerOptions createContainerOptions) {
- jdbcContainerNameValidator.validate(container);
-
- ContainerAccess containerAccess = createContainerOptions == null ? ContainerAccess.PRIVATE
- : (createContainerOptions.isPublicRead() ? ContainerAccess.PUBLIC_READ
- : ContainerAccess.PRIVATE);
- try {
- jdbcService.createContainer(container, containerAccess);
- } catch (PersistenceException e) {
- return false;
- } catch (IllegalArgumentException e) {
- return false;
- }
- return true;
- }
-
- /**
- * Gets the container accessibility
- *
- * @param container the name of the container
- * @return a value with the container's accessibility
- */
- @Override
- public ContainerAccess getContainerAccess(String container) {
- return jdbcService.findContainerByName(container).getContainerAccess();
- }
-
- /**
- * Sets the container accessibility
- *
- * @param container the name of the container
- * @param containerAccess the new container access for the container
- */
- @Override
- public void setContainerAccess(String container, ContainerAccess containerAccess) {
- jdbcService.setContainerAccessByName(container, containerAccess);
- }
-
- /**
- * Deletes a container and all the blobs in it
- *
- * @param container the name of the container to delete
- */
- @Override
- public void deleteContainer(String container) {
- jdbcContainerNameValidator.validate(container);
- jdbcService.deleteBlobsByContainer(container);
- jdbcService.deleteContainerByName(container);
- }
-
- /**
- * Deletes all the blobs in a container
- *
- * @param container the name of the container to clear
- */
- @Override
- public void clearContainer(String container) {
- jdbcService.deleteBlobsByContainer(container);
- }
-
- /**
- * Deletes all the blobs in a container
- *
- * @param container the name of the container to clear
- * @param options options to filter what blobs are cleared
- */
- @Override
- public void clearContainer(String container, ListContainerOptions options) {
- Preconditions.checkArgument(options.getPrefix() == null, "prefix not yet implemented");
- if (options.getDir() != null) {
- jdbcService.deleteBlobsByDirectory(container, options.getDir(), true);
- }
- else {
- clearContainer(container);
- }
- }
-
- /**
- * Gets a container's metadata
- *
- * @param containerName the name of the container
- * @return the container's metadata
- */
- @Override
- public StorageMetadata getContainerMetadata(String containerName) {
- ContainerEntity containerEntity = jdbcService.findContainerByName(containerName);
- MutableStorageMetadata metadata = null;
- if (containerEntity != null) {
- metadata = new MutableStorageMetadataImpl();
- metadata.setName(containerName);
- metadata.setType(StorageType.CONTAINER);
- metadata.setLocation(mockLocation);
- metadata.setCreationDate(containerEntity.getCreationDate());
- }
- return metadata;
- }
-
- /**
- * Checks if a blob exists
- *
- * @param container the name of the container containing the blob
- * @param key the blob's key
- * @return true if the blob exists in the container, false otherwise
- */
- @Override
- public boolean blobExists(String container, String key) {
- jdbcContainerNameValidator.validate(container);
- jdbcBlobKeyValidator.validate(key);
- return jdbcService.blobExists(container, key);
- }
-
- /**
- * Lists all the blob keys in a container
- *
- * @param container the name of the container
- * @return the blob keys inside the container
- */
- @Override
- public Iterable<String> getBlobKeysInsideContainer(String container, String prefix) throws IOException {
- List<BlobEntity> blobEntities = jdbcService.findBlobsByContainer(container);
- ImmutableList.Builder<String> result = ImmutableList.builder();
- for (BlobEntity blobEntity : blobEntities) {
- if (prefix != null && !blobEntity.getKey().startsWith(prefix)) {
- continue;
- }
- result.add(blobEntity.getKey());
- }
- return result.build();
- }
-
- /**
- * Gets a blob in a container
- *
- * @param container the name of the container containing the blob
- * @param key the key of the blob to get
- * @return the blob in the container or null if the blob does not exist
- */
- @Override
- public Blob getBlob(String container, String key) {
- return blobEntityToBlob.apply(jdbcService.findBlobById(container, key));
- }
-
- /**
- * Store a blob in a container
- *
- * @param container the name of the container
- * @param blob the blob to store
- * @return the blob's etag
- */
- @Override
- public String putBlob(String container, Blob blob) throws IOException {
- String key = blob.getMetadata().getName();
- jdbcContainerNameValidator.validate(container);
- jdbcBlobKeyValidator.validate(key);
- return jdbcService.createOrModifyBlob(container, blob).getEtag();
- }
-
- /**
- * Removes a blob from a container
- *
- * @param container the name of the container containing the blob
- * @param key the blob's key
- */
- @Override
- public void removeBlob(String container, String key) {
- jdbcService.deleteBlob(container, key);
- }
-
- /**
- * Gets the blob accessibility
- *
- * @param container the name of the container containing the blob
- * @param key the blob's key
- * @return a value with the container's accessibility
- */
- @Override
- public BlobAccess getBlobAccess(String container, String key) {
- return jdbcService.findBlobById(container, key).getBlobAccess();
- }
-
- /**
- * Sets the blob accessibility
- *
- * @param container the name of the container containing the blob
- * @param key the blob's key
- * @param blobAccess the new blob access for the blob
- */
- @Override
- public void setBlobAccess(String container, String key, BlobAccess blobAccess) {
- jdbcService.setBlobAccessById(container, key, blobAccess);
- }
-
- /**
- * Gets the container location
- *
- * @return always return null
- */
- @Override
- public Location getLocation(String container) {
- return mockLocation;
- }
-
- /**
- * Gets the separator used for directory naming
- *
- * @return a string containing "/"
- */
- @Override
- public String getSeparator() {
- return "/";
- }
-
- /**
- * Count the blobs in a container
- *
- * @param container the name of the container
- * @param options options to filter what blobs are counted
- * @return the number of blobs in the container
- */
- public long countBlobs(String container, ListContainerOptions options) {
- return options.getDir() == null ? jdbcService.findBlobsByContainer(container).size()
- : jdbcService.findBlobsByDirectory(container, options.getDir(), options.isRecursive()).size();
- }
-
- /**
- * Checks if a directory exists
- *
- * @param container the name of the container
- * @param directory the name of the directory
- * @return true if the directory exists, false otherwise
- */
- public boolean directoryExists(String container, String directory) {
- Blob blob = getBlob(container, directory);
- return blob != null && "application/directory".equals(
- blob.getMetadata().getContentMetadata().getContentType());
- }
-
- /**
- * Store a blob in a directory
- *
- * @param container the name of the container
- * @param blob the blob to store
- * @return the blob's etag
- */
- private String putDirectoryBlob(final String container, final Blob blob) {
- String blobKey = blob.getMetadata().getName();
- ContentMetadata metadata = blob.getMetadata().getContentMetadata();
- Long contentLength = metadata.getContentLength();
- if (contentLength != null && contentLength != 0) {
- throw new IllegalArgumentException(
- "Directory blob cannot have content: " + blobKey);
- }
- return jdbcService.createDirectoryBlob(container, blob).getEtag();
- }
-
- /**
- * Creates a new directory
- *
- * @param container the name of the container
- * @param directory the name of the directory to create
- */
- public void createDirectory(String container, String directory) {
- Blob blob = blobBuilders.get().name(directory).payload("").build();
- blob.getMetadata().getContentMetadata().setContentType("application/directory");
- putDirectoryBlob(container, blob);
- }
-
- /**
- * Delete an existing directory
- *
- * @param container the name of the container
- * @param directory the name of the directory to delete
- */
- public void deleteDirectory(String container, String directory) {
- BlobEntity entity = jdbcService.findBlobById(container, directory);
- if (entity != null && entity.isDirectory()) {
- jdbcService.deleteBlob(container, directory);
- }
- }
-
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/util/JdbcBlobUtils.java b/jdbc/src/main/java/org/jclouds/jdbc/util/JdbcBlobUtils.java
deleted file mode 100644
index 2327b20..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/util/JdbcBlobUtils.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.util;
-
-import javax.inject.Provider;
-
-import org.jclouds.blobstore.LocalStorageStrategy;
-import org.jclouds.blobstore.domain.BlobBuilder;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.blobstore.util.BlobUtils;
-import org.jclouds.jdbc.strategy.JdbcStorageStrategy;
-
-import com.google.inject.Inject;
-
-/**
- * Implements the {@link BlobUtils} interfaced and act as a bridge to
- * {@link LocalStorageStrategy} when used inside {@link BlobStore}
- */
-public class JdbcBlobUtils implements BlobUtils {
-
- protected final JdbcStorageStrategy storageStrategy;
- protected final Provider<BlobBuilder> blobBuilders;
-
- @Inject
- JdbcBlobUtils(LocalStorageStrategy storageStrategy, Provider<BlobBuilder> blobBuilders) {
- this.storageStrategy = (JdbcStorageStrategy) storageStrategy;
- this.blobBuilders = blobBuilders;
- }
-
- @Override
- public BlobBuilder blobBuilder() {
- return blobBuilders.get();
- }
-
- @Override
- public boolean directoryExists(String container, String directory) {
- return storageStrategy.directoryExists(container, directory);
- }
-
- @Override
- public void createDirectory(String container, String directory) {
- storageStrategy.createDirectory(container, directory);
- }
-
- @Override
- public long countBlobs(String container, ListContainerOptions listContainerOptions) {
- return storageStrategy.countBlobs(container, listContainerOptions);
- }
-
- @Override
- public void clearContainer(String container, ListContainerOptions options) {
- storageStrategy.clearContainer(container, options);
- }
-
- @Override
- public void deleteDirectory(String container, String directory) {
- storageStrategy.deleteDirectory(container, directory);
- }
-
-}
diff --git a/jdbc/src/main/java/org/jclouds/jdbc/util/JdbcInputStream.java b/jdbc/src/main/java/org/jclouds/jdbc/util/JdbcInputStream.java
deleted file mode 100644
index 24e4edc..0000000
--- a/jdbc/src/main/java/org/jclouds/jdbc/util/JdbcInputStream.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.util;
-
-import org.jclouds.jdbc.entity.ChunkEntity;
-import org.jclouds.jdbc.service.JdbcService;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.LinkedHashSet;
-import java.util.List;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-public class JdbcInputStream extends InputStream {
-
- private JdbcService jdbcService;
-
- private final List<Long> chunks;
- private ChunkEntity currentChunk;
- private int bytesRead;
-
- public JdbcInputStream(JdbcService jdbcService, List<Long> chunks) {
- this.jdbcService = checkNotNull(jdbcService, "jdbcService");
- // Need to remove duplicates due to https://hibernate.atlassian.net/browse/HHH-6783
- this.chunks = new ArrayList<Long>(new LinkedHashSet<Long>(checkNotNull(chunks, "chunks")));
- try {
- readNextChunk();
- } catch (IOException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- @Override
- public synchronized int read() throws IOException {
- if (hasFinished()) {
- return -1;
- }
- int b = currentChunk.getData()[bytesRead] & 0xff;
- bytesRead = bytesRead + 1;
- if (bytesRead >= currentChunk.getSize()) {
- readNextChunk();
- }
- return b;
- }
-
- private boolean hasFinished() {
- return currentChunk == null || (chunks.size() == 0 && bytesRead >= currentChunk.getSize());
- }
-
- private void readNextChunk() throws IOException {
- if (chunks.size() > 0) {
- this.currentChunk = jdbcService.findChunkById(chunks.get(0));
- if (currentChunk == null) {
- throw new IOException("Could not find chunk.");
- }
- chunks.remove(0);
- this.bytesRead = 0;
- }
- }
-
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/BaseJdbcBlobStoreTest.java b/jdbc/src/test/java/org/jclouds/jdbc/BaseJdbcBlobStoreTest.java
deleted file mode 100644
index 0fb9eb4..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/BaseJdbcBlobStoreTest.java
+++ /dev/null
@@ -1,736 +0,0 @@
-/*
- * 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;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import com.google.common.io.ByteSource;
-import com.google.inject.Module;
-import com.google.inject.persist.jpa.JpaPersistModule;
-import org.jclouds.ContextBuilder;
-import org.jclouds.blobstore.BlobRequestSigner;
-import org.jclouds.blobstore.BlobStore;
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.ContainerNotFoundException;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.domain.StorageType;
-import org.jclouds.blobstore.options.GetOptions;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.io.Payload;
-import org.jclouds.io.payloads.PhantomPayload;
-import org.jclouds.io.payloads.StringPayload;
-import org.jclouds.util.Closeables2;
-import org.jclouds.util.Strings2;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import static com.google.common.io.BaseEncoding.base16;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.jclouds.utils.TestUtils.randomByteSource;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.FileAssert.fail;
-
-public abstract class BaseJdbcBlobStoreTest {
-
- private static final String CONTAINER_NAME = "test-container";
- private static final String BLOB_NAME = "jclouds-test-blob";
- private static final String PROVIDER = "jdbc";
-
- private final String jpaModuleName;
-
- private BlobStoreContext context = null;
- private BlobStore blobStore = null;
-
- protected BaseJdbcBlobStoreTest(String jpaModuleName) {
- this.jpaModuleName = jpaModuleName;
- }
-
- @BeforeMethod
- protected void setUp() throws Exception {
- context = ContextBuilder.newBuilder(PROVIDER)
- .modules(ImmutableSet.<Module> of(new JpaPersistModule(jpaModuleName)))
- .build(BlobStoreContext.class);
- blobStore = context.getBlobStore();
- }
-
- @AfterMethod
- protected void tearDown() throws IOException {
- context.close();
- }
-
- @Test
- public void testCreateContainerDoesNotExist() {
- assertThat(blobStore.containerExists(CONTAINER_NAME)).isFalse();
- }
-
- @Test
- public void testCreateContainerInLocation() {
- assertThat(blobStore.createContainerInLocation(null, CONTAINER_NAME)).isTrue();
- assertThat(blobStore.containerExists(CONTAINER_NAME)).isTrue();
- }
-
- @Test
- public void testDeleteContainer() {
- assertThat(blobStore.createContainerInLocation(null, CONTAINER_NAME)).isTrue();
- assertThat(blobStore.containerExists(CONTAINER_NAME)).isTrue();
- blobStore.deleteContainer(CONTAINER_NAME);
- assertThat(blobStore.containerExists(CONTAINER_NAME)).isFalse();
- }
-
- @Test
- public void testPutBlob() {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- assertThat(blobStore.blobExists(CONTAINER_NAME, BLOB_NAME)).isFalse();
- createBlobInContainer(CONTAINER_NAME, BLOB_NAME);
- assertThat(blobStore.blobExists(CONTAINER_NAME, BLOB_NAME)).isTrue();
- }
-
- @Test
- public void testListRoot() throws IOException {
- PageSet<? extends StorageMetadata> containersRetrieved = blobStore.list();
- assertTrue(containersRetrieved.isEmpty(), "List operation returns a not empty set of container");
-
- String[] containerNames = {"34343", "aaaa", "bbbbb"};
- Set<String> containersCreated = Sets.newHashSet();
- for (String containerName : containerNames) {
- blobStore.createContainerInLocation(null, containerName);
- containersCreated.add(containerName);
- }
-
- containersRetrieved = blobStore.list();
- assertEquals(containersCreated.size(), containersRetrieved.size(), "Different numbers of container");
-
- for (StorageMetadata data : containersRetrieved) {
- String containerName = data.getName();
- if (!containersCreated.remove(containerName)) {
- fail("Container list contains unexpected value [" + containerName + "]");
- }
- }
- assertTrue(containersCreated.isEmpty(), "List operation doesn't return all values.");
-
- for (String containerName : containerNames) {
- blobStore.deleteContainer(containerName);
- }
- containersRetrieved = blobStore.list();
- assertTrue(containersRetrieved.isEmpty(), "List operation returns a not empty set of container");
- }
-
- @Test
- public void testListNoOptionSingleContainer() throws IOException {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- checkForContainerContent(CONTAINER_NAME, null);
-
- List<String> blobsExpected = createBlobsInContainer(CONTAINER_NAME, "a", 5);
- checkForContainerContent(CONTAINER_NAME, blobsExpected);
- }
-
- @Test
- public void testListRootNonRecursive() throws IOException {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- checkForContainerContent(CONTAINER_NAME, null);
- List<String> result = createBlobsInContainer(CONTAINER_NAME, "a", 4);
- ListContainerOptions options = ListContainerOptions.Builder
- .withDetails()
- .inDirectory("");
- PageSet<? extends StorageMetadata> res = blobStore.list(CONTAINER_NAME, options);
- checkForContainerContent(CONTAINER_NAME, "", result);
- }
-
- @Test(expectedExceptions = ContainerNotFoundException.class)
- public void testListNotExistingContainer() {
- blobStore.list(CONTAINER_NAME);
- }
-
- @Test
- public void testListNoOptionDoubleContainer() throws IOException {
- final String CONTAINER_NAME2 = "container2";
-
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- checkForContainerContent(CONTAINER_NAME, null);
-
- blobStore.createContainerInLocation(null, CONTAINER_NAME2);
- checkForContainerContent(CONTAINER_NAME2, null);
-
- List<String> blobNamesCreatedInContainer1 = createBlobsInContainer(CONTAINER_NAME, "a", 5);
-
- blobStore.createContainerInLocation(null, CONTAINER_NAME2);
- List<String> blobNamesCreatedInContainer2 = createBlobsInContainer(CONTAINER_NAME2, "b", 5);
-
- checkForContainerContent(CONTAINER_NAME, blobNamesCreatedInContainer1);
- checkForContainerContent(CONTAINER_NAME2, blobNamesCreatedInContainer2);
- }
-
- @Test
- public void testListSubdirectory() throws IOException {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- checkForContainerContent(CONTAINER_NAME, null);
-
- createBlobInContainer(CONTAINER_NAME, "bbb/ccc/ddd/1234.jpg");
- createBlobInContainer(CONTAINER_NAME, "4rrr.jpg");
-
- List<String> blobsExpected = Lists.newArrayList();
- blobsExpected.add(createBlobInContainer(CONTAINER_NAME, "rrr/sss/788.jpg"));
- blobsExpected.add(createBlobInContainer(CONTAINER_NAME, "rrr/wet.kpg"));
-
- checkForContainerContent(CONTAINER_NAME, "rrr", blobsExpected);
- checkForContainerContent(CONTAINER_NAME, "rrr/", blobsExpected);
- }
-
- @Test
- public void testClearContainerNotExistingContainer() {
- blobStore.clearContainer(CONTAINER_NAME);
- }
-
- @Test
- public void testClearContainer_NoOptions() throws IOException {
- final String CONTAINER_NAME2 = "containerToClear";
-
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- blobStore.createContainerInLocation(null, CONTAINER_NAME2);
-
- List<String> blobNamesCreatedInContainer1 = createBlobsInContainer(CONTAINER_NAME, "a", 5);
- List<String> blobNamesCreatedInContainer2 = createBlobsInContainer(CONTAINER_NAME2, "b", 5);
-
- checkForContainerContent(CONTAINER_NAME, blobNamesCreatedInContainer1);
- checkForContainerContent(CONTAINER_NAME2, blobNamesCreatedInContainer2);
-
- blobStore.clearContainer(CONTAINER_NAME);
- checkForContainerContent(CONTAINER_NAME, null);
- checkForContainerContent(CONTAINER_NAME2, blobNamesCreatedInContainer2);
-
- blobStore.clearContainer(CONTAINER_NAME2);
- checkForContainerContent(CONTAINER_NAME, null);
- checkForContainerContent(CONTAINER_NAME2, null);
- }
-
- @Test
- public void testCountBlobsNotExistingContainer() {
- blobStore.countBlobs(PROVIDER);
- }
-
- @Test
- public void testCountBlobsNoOptionsEmptyContainer() {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- blobStore.countBlobs(PROVIDER);
- }
-
- @Test
- public void testCountBlobsNoOptions() {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- blobStore.countBlobs(PROVIDER);
- }
-
- @Test
- public void testRemoveBlobSimpleBlobKey() {
- final String BLOB_KEY = createRandomBlobKey(null, ".txt");
-
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- boolean result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
- assertFalse(result, "Blob exists");
-
- createBlobInContainer(CONTAINER_NAME, BLOB_KEY);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
- assertTrue(result, "Blob exists");
-
- blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
- assertFalse(result, "Blob still exists");
- }
-
- @Test
- public void testRemoveBlobTwoSimpleBlobKeys() {
- final String BLOB_KEY1 = createRandomBlobKey();
- final String BLOB_KEY2 = createRandomBlobKey();
-
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- boolean result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
- assertFalse(result, "Blob1 exists");
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
- assertFalse(result, "Blob2 exists");
-
- createBlobInContainer(CONTAINER_NAME, BLOB_KEY1);
- createBlobInContainer(CONTAINER_NAME, BLOB_KEY2);
-
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
- assertTrue(result, "Blob " + BLOB_KEY1 + " doesn't exist");
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
- assertTrue(result, "Blob " + BLOB_KEY2 + " doesn't exist");
-
- blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY1);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
- assertFalse(result, "Blob1 still exists");
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
- assertTrue(result, "Blob2 doesn't exist");
-
- blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY2);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
- assertFalse(result, "Blob2 still exists");
- }
-
- @Test
- public void testRemoveBlobComplexBlobKey() throws IOException {
- final String BLOB_KEY = createRandomBlobKey("aa/bb/cc/dd/", null);
-
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- boolean result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
- assertFalse(result, "Blob exists");
-
- createBlobInContainer(CONTAINER_NAME, BLOB_KEY);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
- assertTrue(result, "Blob doesn't exist");
-
- blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
- assertFalse(result, "Blob still exists");
- }
-
- @Test
- public void testRemoveBlobTwoComplexBlobKeys() throws IOException {
- final String BLOB_KEY1 = createRandomBlobKey("aa/bb/cc/dd/", null);
- final String BLOB_KEY2 = createRandomBlobKey("aa/bb/ee/ff/", null);
-
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
-
- boolean result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
- assertFalse(result, "Blob1 exists");
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
- assertFalse(result, "Blob2 exists");
-
- createBlobInContainer(CONTAINER_NAME, BLOB_KEY1);
- createBlobInContainer(CONTAINER_NAME, BLOB_KEY2);
-
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
- assertTrue(result, "Blob " + BLOB_KEY1 + " doesn't exist");
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
- assertTrue(result, "Blob " + BLOB_KEY2 + " doesn't exist");
-
- blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY1);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
- assertFalse(result, "Blob still exists");
-
- blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY2);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
- assertFalse(result, "Blob still exists");
- }
-
- @Test
- public void testCreateContainersInLocation() {
- final String CONTAINER_NAME2 = "funambol-test-2";
-
- boolean result = blobStore.containerExists(CONTAINER_NAME);
- assertFalse(result, "Container exists");
- result = blobStore.createContainerInLocation(null, CONTAINER_NAME);
- assertTrue(result, "Container not created");
- result = blobStore.containerExists(CONTAINER_NAME);
- assertTrue(result, "Container doesn't exist");
-
- result = blobStore.containerExists(CONTAINER_NAME2);
- assertFalse(result, "Container exists");
- result = blobStore.createContainerInLocation(null, CONTAINER_NAME2);
- assertTrue(result, "Container not created");
- result = blobStore.containerExists(CONTAINER_NAME2);
- assertTrue(result, "Container doesn't exist");
- }
-
- @Test
- public void testPutDirectoryBlobs() {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
-
- String parentKey = createRandomBlobKey("a/b/c/directory-", "/");
- String childKey = createRandomBlobKey(parentKey + "directory-", "/");
-
- blobStore.putBlob(CONTAINER_NAME, createDirBlob(parentKey));
- assertTrue(blobStore.blobExists(CONTAINER_NAME, parentKey));
-
- blobStore.putBlob(CONTAINER_NAME, createDirBlob(childKey));
- assertTrue(blobStore.blobExists(CONTAINER_NAME, childKey));
-
- blobStore.removeBlob(CONTAINER_NAME, parentKey);
- assertFalse(blobStore.blobExists(CONTAINER_NAME, parentKey));
- assertTrue(blobStore.blobExists(CONTAINER_NAME, childKey));
- }
-
- @Test
- public void testGetDirectoryBlob() throws IOException {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
-
- String blobKey = createRandomBlobKey("a/b/c/directory-", "/");
- blobStore.putBlob(CONTAINER_NAME, createDirBlob(blobKey));
-
- assertTrue(blobStore.blobExists(CONTAINER_NAME, blobKey));
-
- Blob blob = blobStore.getBlob(CONTAINER_NAME, blobKey);
- assertEquals(blob.getMetadata().getName(), blobKey, "Created blob name is different");
-
- assertTrue(!blobStore.blobExists(CONTAINER_NAME,
- blobKey.substring(0, blobKey.length() - 1)));
- }
-
- @Test
- public void testPutBlobSimpleName() {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- putBlobAndCheckIt(createRandomBlobKey("putBlob-", ".jpg"));
- putBlobAndCheckIt(createRandomBlobKey("putBlob-", ".jpg"));
- }
-
- @Test
- public void testListDirectoryBlobs() {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- checkForContainerContent(CONTAINER_NAME, null);
-
- List<String> dirs = ImmutableList.of(createRandomBlobKey("directory-", "/"));
- for (String d : dirs) {
- blobStore.putBlob(CONTAINER_NAME, createDirBlob(d));
- assertTrue(blobStore.blobExists(CONTAINER_NAME, d));
- }
- checkForContainerContent(CONTAINER_NAME, dirs);
- }
-
- @Test
- public void testListDirectoryBlobsS3FS() {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- checkForContainerContent(CONTAINER_NAME, null);
-
- String d = createRandomBlobKey("directory-", "");
- blobStore.putBlob(CONTAINER_NAME, createDirBlob(d + "/"));
- assertTrue(blobStore.blobExists(CONTAINER_NAME, d + "/"));
-
- ListContainerOptions options = ListContainerOptions.Builder
- .withDetails()
- .inDirectory("");
- PageSet<? extends StorageMetadata> res = blobStore.list(CONTAINER_NAME, options);
- assertTrue(res.size() == 1);
- assertEquals(res.iterator().next().getName(), d + "/");
- }
-
- @Test
- public void testPutBlobComplexName1() {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- putBlobAndCheckIt(createRandomBlobKey("picture/putBlob-", ".jpg"));
- putBlobAndCheckIt(createRandomBlobKey("video/putBlob-", ".jpg"));
- putBlobAndCheckIt(createRandomBlobKey("putBlob-", ".jpg"));
- putBlobAndCheckIt(createRandomBlobKey("video/putBlob-", ".jpg"));
- }
-
- @Test
- public void testPutBlobComplexName2() {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- putBlobAndCheckIt(createRandomBlobKey("aa/bb/cc/dd/ee/putBlob-", ".jpg"));
- putBlobAndCheckIt(createRandomBlobKey("aa/bb/cc/dd/ee/putBlob-", ".jpg"));
- putBlobAndCheckIt(createRandomBlobKey("putBlob-", ".jpg"));
- }
-
- @Test
- public void testBlobExists() throws IOException {
- String blobKey = createRandomBlobKey();
-
- try {
- blobStore.blobExists(CONTAINER_NAME, blobKey);
- fail();
- } catch (ContainerNotFoundException cnfe) {
- // expected
- }
-
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- boolean result = blobStore.blobExists(CONTAINER_NAME, blobKey);
- assertFalse(result, "Blob exists");
-
- createBlobInContainer(CONTAINER_NAME, blobKey);
- result = blobStore.blobExists(CONTAINER_NAME, blobKey);
- assertTrue(result, "Blob doesn't exist");
-
- blobKey = createRandomBlobKey("ss/asdas/", "");
- result = blobStore.blobExists(CONTAINER_NAME, blobKey);
- assertFalse(result, "Blob exists");
- createBlobInContainer(CONTAINER_NAME, blobKey);
- result = blobStore.blobExists(CONTAINER_NAME, blobKey);
- assertTrue(result, "Blob doesn't exist");
- }
-
- @Test(expectedExceptions = ContainerNotFoundException.class)
- public void testGetBlob_NotExistingContainer() {
- blobStore.getBlob(CONTAINER_NAME, createRandomBlobKey(), null);
- }
-
- @Test
- public void testGetBlob() {
- String blobKey = createRandomBlobKey();
-
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- Blob resultBlob = blobStore.getBlob(CONTAINER_NAME, blobKey, null);
- assertNull(resultBlob, "Blob exists");
-
- createBlobInContainer(CONTAINER_NAME, blobKey);
- resultBlob = blobStore.getBlob(CONTAINER_NAME, blobKey, null);
- assertNotNull(resultBlob, "Blob exists");
- }
-
- @Test
- public void testBlobMetadataWithDefaultMetadata() throws IOException {
- String BLOB_KEY = createRandomBlobKey(null, null);
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- Blob blob = blobStore.blobBuilder(BLOB_KEY)
- .payload(randomByteSource().slice(0, 1024))
- .build();
- blobStore.putBlob(CONTAINER_NAME, blob);
-
- BlobMetadata metadata = blobStore.blobMetadata(CONTAINER_NAME, BLOB_KEY);
- assertNotNull(metadata, "Metadata null");
-
- assertEquals(metadata.getName(), BLOB_KEY, "Wrong blob name");
- assertEquals(metadata.getType(), StorageType.BLOB, "Wrong blob type");
- assertEquals(metadata.getContentMetadata().getContentType(), "application/unknown", "Wrong blob content-type");
- assertEquals(base16().lowerCase().encode(metadata.getContentMetadata().getContentMD5()), metadata.getETag(),
- "Wrong blob MD5");
- assertEquals(metadata.getLocation(), null, "Wrong blob location");
- assertEquals(metadata.getProviderId(), null, "Wrong blob provider id");
- assertEquals(metadata.getUri(), null, "Wrong blob URI");
- assertNotNull(metadata.getUserMetadata(), "No blob UserMetadata");
- assertEquals(metadata.getUserMetadata().size(), 0, "Wrong blob UserMetadata");
- }
-
- @Test
- public void testDeleteContainerNotExistingContainer() {
- blobStore.deleteContainer(CONTAINER_NAME);
- }
-
- @Test
- public void testDeleteContainerEmptyContanier() {
- boolean result;
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
-
- result = blobStore.containerExists(CONTAINER_NAME);
- assertTrue(result, "Container doesn't exists");
-
- blobStore.deleteContainer(CONTAINER_NAME);
- result = blobStore.containerExists(CONTAINER_NAME);
- assertFalse(result, "Container still exists");
- }
-
- @Test
- public void testDeleteContainers() {
- boolean result;
- String CONTAINER_NAME2 = "container-to-delete";
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- blobStore.createContainerInLocation(null, CONTAINER_NAME2);
-
- result = blobStore.containerExists(CONTAINER_NAME);
- assertTrue(result, "Container [" + CONTAINER_NAME + "] doesn't exists");
- result = blobStore.containerExists(CONTAINER_NAME2);
- assertTrue(result, "Container [" + CONTAINER_NAME2 + "] doesn't exists");
-
- createBlobsInContainer(CONTAINER_NAME, "a", 5);
- createBlobsInContainer(CONTAINER_NAME, "b", 5);
-
- // delete first container
- blobStore.deleteContainer(CONTAINER_NAME);
- result = blobStore.containerExists(CONTAINER_NAME);
- assertFalse(result, "Container [" + CONTAINER_NAME + "] still exists");
- result = blobStore.containerExists(CONTAINER_NAME2);
- assertTrue(result, "Container [" + CONTAINER_NAME2 + "] still exists");
- // delete second container
- blobStore.deleteContainer(CONTAINER_NAME2);
- result = blobStore.containerExists(CONTAINER_NAME2);
- assertFalse(result, "Container [" + CONTAINER_NAME2 + "] still exists");
- }
-
- @Test
- public void testInvalidContainerName() {
- String containerName = "file/system";
- try {
- blobStore.createContainerInLocation(null, containerName);
- fail("Wrong container name not recognized");
- } catch (IllegalArgumentException e) {
- }
- try {
- blobStore.containerExists(containerName);
- fail("Wrong container name not recognized");
- } catch (IllegalArgumentException e) {
- }
- }
-
- @Test
- public void testRanges() throws IOException {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- String input = "abcdefgh";
- Payload payload;
- Blob blob = blobStore.blobBuilder("test").payload(new StringPayload(input)).build();
- blobStore.putBlob(CONTAINER_NAME, blob);
-
- GetOptions getOptionsRangeStartAt = new GetOptions();
- getOptionsRangeStartAt.startAt(1);
- Blob blobRangeStartAt = blobStore.getBlob(CONTAINER_NAME, blob.getMetadata().getName(), getOptionsRangeStartAt);
- payload = blobRangeStartAt.getPayload();
- try {
- assertEquals(input.substring(1), Strings2.toStringAndClose(payload.openStream()));
- } finally {
- Closeables2.closeQuietly(payload);
- }
-
- GetOptions getOptionsRangeTail = new GetOptions();
- getOptionsRangeTail.tail(3);
- Blob blobRangeTail = blobStore.getBlob(CONTAINER_NAME, blob.getMetadata().getName(), getOptionsRangeTail);
- payload = blobRangeTail.getPayload();
- try {
- assertEquals(input.substring(5), Strings2.toStringAndClose(payload.openStream()));
- } finally {
- Closeables2.closeQuietly(payload);
- }
-
- GetOptions getOptionsFragment = new GetOptions();
- getOptionsFragment.range(4, 6);
- Blob blobFragment = blobStore.getBlob(CONTAINER_NAME, blob.getMetadata().getName(), getOptionsFragment);
- payload = blobFragment.getPayload();
- try {
- assertEquals(input.substring(4, 7), Strings2.toStringAndClose(payload.openStream()));
- } finally {
- Closeables2.closeQuietly(payload);
- }
- }
-
- @Test
- public void testBlobRequestSigner() throws Exception {
- String containerName = "container";
- String blobName = "blob";
- URI endPoint = new URI("http", "localhost",
- String.format("/transient/%s/%s", containerName, blobName),
- /*fragment=*/ null);
- BlobRequestSigner signer = context.getSigner();
- HttpRequest request;
- HttpRequest expected;
-
- request = signer.signGetBlob(containerName, blobName);
- expected = HttpRequest.builder()
- .method("GET")
- .endpoint(endPoint)
- .headers(request.getHeaders())
- .build();
- assertEquals(expected, request);
-
- Blob blob = blobStore.blobBuilder(blobName).forSigning().build();
- request = signer.signPutBlob(containerName, blob);
- expected = HttpRequest.builder()
- .method("PUT")
- .endpoint(endPoint)
- .headers(request.getHeaders())
- .payload(new PhantomPayload())
- .build();
- assertEquals(expected, request);
- }
-
- private List<String> createBlobsInContainer(String containerName, String prefix, int numberOfFiles) {
- List<String> blobNames = Lists.newArrayList();
- for (int i = 0; i < numberOfFiles; i++) {
- String name = prefix + Integer.toString(i);
- blobNames.add(name);
- createBlobInContainer(containerName, name);
- }
- return blobNames;
- }
-
- private void checkForContainerContent(final String containerName, List<String> expectedBlobKeys) {
- checkForContainerContent(containerName, null, expectedBlobKeys);
- }
-
- private void checkForContainerContent(final String containerName, String inDirectory, List<String> expectedBlobKeys) {
- ListContainerOptions options = ListContainerOptions.Builder.recursive();
- if (null != inDirectory && !"".equals(inDirectory))
- options.inDirectory(inDirectory);
-
- PageSet<? extends StorageMetadata> blobsRetrieved = blobStore.list(containerName, options);
- for (Iterator<? extends StorageMetadata> it = blobsRetrieved.iterator(); it.hasNext();) {
- if (it.next().getType() != StorageType.BLOB) {
- it.remove();
- }
- }
-
- if (null == expectedBlobKeys || 0 == expectedBlobKeys.size()) {
- assertTrue(blobsRetrieved.isEmpty(), "Wrong blob number retrieved in the container [" + containerName + "]");
- return;
- }
-
- Set<String> expectedBlobKeysCopy = Sets.newHashSet();
- for (String value : expectedBlobKeys) {
- expectedBlobKeysCopy.add(value);
- }
- assertEquals(blobsRetrieved.size(), expectedBlobKeysCopy.size(),
- "Wrong blob number retrieved in the container [" + containerName + "]");
- for (StorageMetadata data : blobsRetrieved) {
- String blobName = data.getName();
- if (!expectedBlobKeysCopy.remove(blobName)) {
- fail("List for container [" + containerName + "] contains unexpected value [" + blobName + "]");
- }
- }
- assertTrue(expectedBlobKeysCopy.isEmpty(), "List operation for container [" + containerName
- + "] doesn't return all values.");
- }
-
- private static String createRandomBlobKey(String prefix, String extension) {
- String okPrefix = (null != prefix && !"".equals(prefix)) ? prefix : "testkey-";
- String okExtension = (null != extension && !"".equals(extension)) ? extension : ".jpg";
- return okPrefix + UUID.randomUUID().toString() + okExtension;
- }
-
- public static String createRandomBlobKey() {
- return createRandomBlobKey("", "");
- }
-
- private String createBlobInContainer(String containerName, String blobName) {
- blobStore.putBlob(containerName,
- blobStore.blobBuilder(blobName).payload(randomByteSource().slice(0, 1024)).build());
- return blobName;
- }
-
- private String createBlobInContainer(String containerName) {
- String blobName = createRandomBlobKey();
- blobStore.putBlob(containerName, blobStore.blobBuilder(blobName)
- .payload(randomByteSource().slice(0, 1024))
- .build());
- return blobName;
- }
-
- private Blob createDirBlob(String keyName) {
- return blobStore.blobBuilder(keyName)
- .payload(ByteSource.empty())
- .build();
- }
-
- private void putBlobAndCheckIt(String blobKey) {
- createBlobInContainer(CONTAINER_NAME, blobKey);
- blobStore.getBlob(CONTAINER_NAME, blobKey);
- assertTrue(blobStore.blobExists(CONTAINER_NAME, blobKey));
- }
-
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/EclipselinkH2BlobStoreTest.java b/jdbc/src/test/java/org/jclouds/jdbc/EclipselinkH2BlobStoreTest.java
deleted file mode 100644
index c7b4fe3..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/EclipselinkH2BlobStoreTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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;
-
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "EclipselinkH2BlobStoreTest", singleThreaded = true)
-public class EclipselinkH2BlobStoreTest extends BaseJdbcBlobStoreTest {
-
- protected EclipselinkH2BlobStoreTest() {
- super("jclouds-test-h2");
- }
-
- // For some reason testng needs at least a method here
- public void ohMyTest() {}
-
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/HibernateHsqldbBlobStoreTest.java b/jdbc/src/test/java/org/jclouds/jdbc/HibernateHsqldbBlobStoreTest.java
deleted file mode 100644
index 4002ac8..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/HibernateHsqldbBlobStoreTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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;
-
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "HibernateHsqldbBlobStoreTest", singleThreaded = true)
-public class HibernateHsqldbBlobStoreTest extends BaseJdbcBlobStoreTest {
-
- protected HibernateHsqldbBlobStoreTest() {
- super("jclouds-test-hsqldb");
- }
-
- // For some reason testng needs at least a method here
- public void ohMyTest() {}
-
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/JdbcApiMetadataTest.java b/jdbc/src/test/java/org/jclouds/jdbc/JdbcApiMetadataTest.java
deleted file mode 100644
index 036612d..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/JdbcApiMetadataTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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;
-
-import org.jclouds.blobstore.internal.BaseBlobStoreApiMetadataTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "JdbcApiMetadataTest")
-public class JdbcApiMetadataTest extends BaseBlobStoreApiMetadataTest {
-
- public JdbcApiMetadataTest() {
- super(new JdbcApiMetadata());
- }
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/JdbcInputStreamTest.java b/jdbc/src/test/java/org/jclouds/jdbc/JdbcInputStreamTest.java
deleted file mode 100644
index 0e335b4..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/JdbcInputStreamTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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;
-
-import com.google.common.collect.ImmutableList;
-import org.jclouds.jdbc.service.JdbcService;
-import org.jclouds.jdbc.util.JdbcInputStream;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.io.IOException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-
-@Test(groups = "unit", testName = "JdbcInputStreamTest")
-public class JdbcInputStreamTest {
-
- private JdbcService mockJdbcService;
-
- @BeforeMethod
- public void setUp() {
- mockJdbcService = createNiceMock(JdbcService.class);
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testInvalidIdList() throws IOException {
- expect(mockJdbcService.findChunkById(0L)).andReturn(null);
- new JdbcInputStream(mockJdbcService, ImmutableList.<Long>builder().add(0L).build());
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testNullList() {
- new JdbcInputStream(mockJdbcService, null);
- }
-
- @Test
- public void testEmptyIdList() throws IOException {
- JdbcInputStream jdbcInputStream = new JdbcInputStream(mockJdbcService,
- ImmutableList.<Long>builder().build());
- assertThat(jdbcInputStream.read()).isEqualTo(-1);
- }
-
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/integration/EclipselinkH2BlobIntegrationTest.java b/jdbc/src/test/java/org/jclouds/jdbc/integration/EclipselinkH2BlobIntegrationTest.java
deleted file mode 100644
index 05a0fc0..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/integration/EclipselinkH2BlobIntegrationTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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 com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-import com.google.inject.persist.jpa.JpaPersistModule;
-import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
-import org.testng.annotations.Test;
-import org.testng.SkipException;
-
-@Test(groups = { "integration" }, singleThreaded = true, testName = "blobstore.EclipselinkH2BlobIntegrationTest")
-public class EclipselinkH2BlobIntegrationTest extends BaseBlobIntegrationTest {
- public EclipselinkH2BlobIntegrationTest() {
- provider = "jdbc";
- }
-
- @Override
- protected Iterable<Module> setupModules() {
- return ImmutableSet.<Module> of(this.getLoggingModule(), new JpaPersistModule("jclouds-test-h2"));
- }
-
- @Override
- @Test(groups = { "integration", "live" })
- public void testSetBlobAccess() throws Exception {
- throw new SkipException("jdbc does not support anonymous access");
- }
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/integration/EclipselinkH2ContainerIntegrationTest.java b/jdbc/src/test/java/org/jclouds/jdbc/integration/EclipselinkH2ContainerIntegrationTest.java
deleted file mode 100644
index 871bfd2..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/integration/EclipselinkH2ContainerIntegrationTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-import com.google.inject.persist.jpa.JpaPersistModule;
-import org.jclouds.blobstore.integration.internal.BaseContainerIntegrationTest;
-import org.testng.annotations.Test;
-import org.testng.SkipException;
-
-@Test(groups = { "integration" }, singleThreaded = true, testName = "blobstore.EclipselinkH2ContainerIntegrationTest")
-public class EclipselinkH2ContainerIntegrationTest extends BaseContainerIntegrationTest {
- public EclipselinkH2ContainerIntegrationTest() {
- provider = "jdbc";
- }
-
- @Override
- protected Iterable<Module> setupModules() {
- return ImmutableSet.<Module> of(this.getLoggingModule(), new JpaPersistModule("jclouds-test-h2"));
- }
-
- @Override
- @Test(groups = { "integration", "live" })
- public void testSetContainerAccess() throws Exception {
- throw new SkipException("jdbc does not support anonymous access");
- }
-
- @Override
- public void testClearWithOptions() throws InterruptedException {
- throw new SkipException("jdbc does not support clear with options");
- }
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/integration/EclipselinkH2ServiceIntegrationTest.java b/jdbc/src/test/java/org/jclouds/jdbc/integration/EclipselinkH2ServiceIntegrationTest.java
deleted file mode 100644
index 9d393b6..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/integration/EclipselinkH2ServiceIntegrationTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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"));
- }
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/integration/HibernateHsqldbBlobIntegrationTest.java b/jdbc/src/test/java/org/jclouds/jdbc/integration/HibernateHsqldbBlobIntegrationTest.java
deleted file mode 100644
index 69fc6ef..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/integration/HibernateHsqldbBlobIntegrationTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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 com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-import com.google.inject.persist.jpa.JpaPersistModule;
-import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
-import org.testng.annotations.Test;
-import org.testng.SkipException;
-
-@Test(groups = { "integration" }, singleThreaded = true, testName = "blobstore.HibernateHsqldbBlobIntegrationTest")
-public class HibernateHsqldbBlobIntegrationTest extends BaseBlobIntegrationTest {
- public HibernateHsqldbBlobIntegrationTest() {
- provider = "jdbc";
- }
-
- @Override
- protected Iterable<Module> setupModules() {
- return ImmutableSet.<Module> of(this.getLoggingModule(), new JpaPersistModule("jclouds-test-hsqldb"));
- }
-
- @Override
- @Test(groups = { "integration", "live" })
- public void testSetBlobAccess() throws Exception {
- throw new SkipException("jdbc does not support anonymous access");
- }
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/integration/HibernateHsqldbContainerIntegrationTest.java b/jdbc/src/test/java/org/jclouds/jdbc/integration/HibernateHsqldbContainerIntegrationTest.java
deleted file mode 100644
index c6abbc8..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/integration/HibernateHsqldbContainerIntegrationTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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 java.util.Set;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-import com.google.inject.persist.jpa.JpaPersistModule;
-import org.jclouds.blobstore.integration.internal.BaseContainerIntegrationTest;
-import org.testng.annotations.Test;
-import org.testng.SkipException;
-
-@Test(groups = { "integration" }, singleThreaded = true, testName = "blobstore.HibernateHsqldbContainerIntegrationTest")
-public class HibernateHsqldbContainerIntegrationTest extends BaseContainerIntegrationTest {
- public HibernateHsqldbContainerIntegrationTest() {
- provider = "jdbc";
- }
-
- @Override
- protected Iterable<Module> setupModules() {
- return ImmutableSet.<Module> of(this.getLoggingModule(), new JpaPersistModule("jclouds-test-hsqldb"));
- }
-
- @Override
- public void testBlobNameEscaping(Set<String> blobNames) throws InterruptedException {
- //This test fails due to how hibernate ignores trailing whitespaces in keys.
- }
-
- @Override
- @Test(groups = { "integration", "live" })
- public void testSetContainerAccess() throws Exception {
- throw new SkipException("jdbc does not support anonymous access");
- }
-
- @Override
- public void testClearWithOptions() throws InterruptedException {
- throw new SkipException("jdbc does not support clear with options");
- }
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/integration/HibernateHsqldbServiceIntegrationTest.java b/jdbc/src/test/java/org/jclouds/jdbc/integration/HibernateHsqldbServiceIntegrationTest.java
deleted file mode 100644
index 724d30e..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/integration/HibernateHsqldbServiceIntegrationTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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"));
- }
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/module/TestContextModule.java b/jdbc/src/test/java/org/jclouds/jdbc/module/TestContextModule.java
deleted file mode 100644
index 0798813..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/module/TestContextModule.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.module;
-
-import com.google.inject.AbstractModule;
-import org.jclouds.jdbc.config.JPAInitializer;
-
-public class TestContextModule extends AbstractModule {
-
- @Override
- protected void configure() {
- bind(JPAInitializer.class).asEagerSingleton();
- }
-
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/strategy/BaseJdbcStorageStrategyTest.java b/jdbc/src/test/java/org/jclouds/jdbc/strategy/BaseJdbcStorageStrategyTest.java
deleted file mode 100644
index 7e636cb..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/strategy/BaseJdbcStorageStrategyTest.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * 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.strategy;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-import com.google.inject.persist.PersistService;
-import com.google.inject.persist.jpa.JpaPersistModule;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobAccess;
-import org.jclouds.blobstore.domain.ContainerAccess;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.domain.StorageType;
-import org.jclouds.blobstore.domain.internal.BlobBuilderImpl;
-import org.jclouds.blobstore.options.CreateContainerOptions;
-import org.jclouds.jdbc.module.TestContextModule;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.Date;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.jclouds.utils.TestUtils.randomByteSource;
-
-public abstract class BaseJdbcStorageStrategyTest {
-
- private static final String CONTAINER_NAME = "jclouds-test-container";
- private static final String BLOB_NAME = "jclouds-test-blob";
-
- private final String jpaModuleName;
-
- private JdbcStorageStrategy storageStrategy;
- private Injector injector;
-
- protected BaseJdbcStorageStrategyTest(String jpaModuleName) {
- this.jpaModuleName = jpaModuleName;
- }
-
- @BeforeMethod
- protected void setUp() throws Exception {
- injector = Guice.createInjector(ImmutableSet.<Module> of(new TestContextModule(), new JpaPersistModule(jpaModuleName)));
- storageStrategy = injector.getInstance(JdbcStorageStrategy.class);
- }
-
- @AfterMethod
- protected void tearDown() {
- injector.getInstance(PersistService.class).stop();
- }
-
- @Test
- public void testCreateContainerInLocation() {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, null)).isTrue();
- assertThat(storageStrategy.containerExists(CONTAINER_NAME)).isTrue();
- }
-
- @Test
- public void testCreateDuplicateContainerInLocation() {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, null)).isTrue();
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, null)).isFalse();
- }
-
- @Test
- public void testDefaultContainerAccess() {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, null)).isTrue();
- assertThat(storageStrategy.getContainerAccess(CONTAINER_NAME)).isEqualTo(ContainerAccess.PRIVATE);
- }
-
- @Test
- public void testOverridedPublicContainerAccess() {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, new CreateContainerOptions().publicRead())).isTrue();
- assertThat(storageStrategy.getContainerAccess(CONTAINER_NAME)).isEqualTo(ContainerAccess.PUBLIC_READ);
- }
-
- @Test
- public void testOverridedPrivateContainerAccess() {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, CreateContainerOptions.NONE)).isTrue();
- assertThat(storageStrategy.getContainerAccess(CONTAINER_NAME)).isEqualTo(ContainerAccess.PRIVATE);
- }
-
- @Test
- public void testDeleteContainer() {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, null)).isTrue();
- assertThat(storageStrategy.containerExists(CONTAINER_NAME)).isTrue();
- storageStrategy.deleteContainer(CONTAINER_NAME);
- assertThat(storageStrategy.containerExists(CONTAINER_NAME)).isFalse();
- }
-
- @Test
- public void testGetAllContainerNames() {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME + "1", null, null)).isTrue();
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME + "2", null, null)).isTrue();
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME + "3", null, null)).isTrue();
- assertThat(storageStrategy.getAllContainerNames()).containsExactly(CONTAINER_NAME + "1", CONTAINER_NAME + "2",
- CONTAINER_NAME + "3");
- }
-
- @Test
- public void testGetContainerMetadata() {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, null)).isTrue();
- StorageMetadata storageMetadata = storageStrategy.getContainerMetadata(CONTAINER_NAME);
- assertThat(storageMetadata.getName()).isEqualTo(CONTAINER_NAME);
- assertThat(storageMetadata.getType()).isEqualTo(StorageType.CONTAINER);
- assertThat(storageMetadata.getCreationDate()).isBefore(new Date());
- }
-
- @Test
- public void testBlobDoesNotExist() throws IOException {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, null)).isTrue();
- assertThat(storageStrategy.blobExists(CONTAINER_NAME, BLOB_NAME)).isFalse();
- }
-
- @Test
- public void testPutBlob() throws IOException {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, null)).isTrue();
- storageStrategy.putBlob(CONTAINER_NAME,
- new BlobBuilderImpl().name(BLOB_NAME).payload(randomByteSource().slice(0, 4 * 1024 * 1024)).build());
- assertThat(storageStrategy.blobExists(CONTAINER_NAME, BLOB_NAME)).isTrue();
- }
-
- @Test
- public void testGetBlobKeysInContainer() throws IOException {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, null)).isTrue();
- storageStrategy.putBlob(CONTAINER_NAME,
- new BlobBuilderImpl().name(BLOB_NAME + "1").payload(randomByteSource().slice(0, 4 * 1024 * 1024)).build());
- storageStrategy.putBlob(CONTAINER_NAME,
- new BlobBuilderImpl().name(BLOB_NAME + "2").payload(randomByteSource().slice(0, 4 * 1024 * 1024)).build());
- storageStrategy.putBlob(CONTAINER_NAME, new BlobBuilderImpl()
- .name(BLOB_NAME + "3")
- .payload(randomByteSource().slice(0, 4 * 1024 * 1024))
- .build());
- assertThat(storageStrategy.getBlobKeysInsideContainer(CONTAINER_NAME, null))
- .containsExactly(BLOB_NAME + "1", BLOB_NAME + "2", BLOB_NAME + "3");
- }
-
- @Test
- public void testGetBlob() throws IOException {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, null)).isTrue();
- Blob blob = new BlobBuilderImpl()
- .name(BLOB_NAME)
- .payload(getByteArray('a', 4 * 1024 * 1024))
- .build();
- storageStrategy.putBlob(CONTAINER_NAME, blob);
- InputStream data = storageStrategy.getBlob(CONTAINER_NAME, BLOB_NAME).getPayload().openStream();
- int i;
- while ((i = data.read()) != -1) {
- assertThat((char) i).isEqualTo('a');
- }
- }
-
- @Test
- public void testRemoveBlob() throws IOException {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, null)).isTrue();
- storageStrategy.putBlob(CONTAINER_NAME,
- new BlobBuilderImpl().name(BLOB_NAME).payload(randomByteSource().slice(0, 4 * 1024 * 1024)).build());
- assertThat(storageStrategy.blobExists(CONTAINER_NAME, BLOB_NAME)).isTrue();
- storageStrategy.removeBlob(CONTAINER_NAME, BLOB_NAME);
- assertThat(storageStrategy.blobExists(CONTAINER_NAME, BLOB_NAME)).isFalse();
- }
-
- @Test
- public void testGetBlobAccess() throws IOException {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, null)).isTrue();
- storageStrategy.putBlob(CONTAINER_NAME,
- new BlobBuilderImpl().name(BLOB_NAME).payload(randomByteSource().slice(0, 4 * 1024 * 1024)).build());
- assertThat(storageStrategy.blobExists(CONTAINER_NAME, BLOB_NAME)).isTrue();
- assertThat(storageStrategy.getBlobAccess(CONTAINER_NAME, BLOB_NAME)).isEqualTo(BlobAccess.PRIVATE);
- }
-
- @Test
- public void testClearContainer() throws IOException {
- assertThat(storageStrategy.createContainerInLocation(CONTAINER_NAME, null, null)).isTrue();
- storageStrategy.putBlob(CONTAINER_NAME,
- new BlobBuilderImpl().name(BLOB_NAME + "1").payload(randomByteSource().slice(0, 4 * 1024 * 1024)).build());
- storageStrategy.putBlob(CONTAINER_NAME,
- new BlobBuilderImpl().name(BLOB_NAME + "2").payload(randomByteSource().slice(0, 4 * 1024 * 1024)).build());
- storageStrategy.putBlob(CONTAINER_NAME,
- new BlobBuilderImpl().name(BLOB_NAME + "3").payload(randomByteSource().slice(0, 4 * 1024 * 1024)).build());
- assertThat(storageStrategy.getBlobKeysInsideContainer(CONTAINER_NAME, null))
- .containsExactly(BLOB_NAME + "1", BLOB_NAME + "2", BLOB_NAME + "3");
- storageStrategy.clearContainer(CONTAINER_NAME);
- assertThat(storageStrategy.getBlobKeysInsideContainer(CONTAINER_NAME, null)).isEmpty();
- storageStrategy.deleteContainer(CONTAINER_NAME);
- assertThat(storageStrategy.containerExists(CONTAINER_NAME)).isFalse();
- }
-
- private byte[] getByteArray(char c, int len) {
- byte[] array = new byte[len];
- Arrays.fill(array, (byte) c);
- return array;
- }
-
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/strategy/EclipselinkH2StorageStrategyTest.java b/jdbc/src/test/java/org/jclouds/jdbc/strategy/EclipselinkH2StorageStrategyTest.java
deleted file mode 100644
index 28aa48a..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/strategy/EclipselinkH2StorageStrategyTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.strategy;
-
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "EclipselinkH2StorageStrategyTest", singleThreaded = true)
-public class EclipselinkH2StorageStrategyTest extends BaseJdbcStorageStrategyTest {
-
- public EclipselinkH2StorageStrategyTest() {
- super("jclouds-test-h2");
- }
-
- // For some reason testng needs at least a test here
- public void ohMyTest() {}
-
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/strategy/HibernateHsqldbStorageStrategyTest.java b/jdbc/src/test/java/org/jclouds/jdbc/strategy/HibernateHsqldbStorageStrategyTest.java
deleted file mode 100644
index a0176b5..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/strategy/HibernateHsqldbStorageStrategyTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.strategy;
-
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "HibernateHsqldbStorageStrategyTest", singleThreaded = true)
-public class HibernateHsqldbStorageStrategyTest extends BaseJdbcStorageStrategyTest {
-
- protected HibernateHsqldbStorageStrategyTest() {
- super("jclouds-test-hsqldb");
- }
-
- // For some reason testng needs at least a test here
- public void ohMyTest() {}
-
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/validators/JdbcBlobKeyValidatorTest.java b/jdbc/src/test/java/org/jclouds/jdbc/validators/JdbcBlobKeyValidatorTest.java
deleted file mode 100644
index 94e690c..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/validators/JdbcBlobKeyValidatorTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.validators;
-
-import org.jclouds.jdbc.predicates.validators.JdbcBlobKeyValidator;
-import org.testng.annotations.Test;
-
-
-/**
- * Test class for {@link JdbcBlobKeyValidator } class
- */
-@Test(groups = "unit", testName = "jdbc.JdbcBlobKeyValidatorTest")
-public class JdbcBlobKeyValidatorTest {
-
- private static final JdbcBlobKeyValidator validator = new JdbcBlobKeyValidator();
-
- @Test
- public void testNamesValidity() {
- validator.validate("all.img");
- validator.validate("all/is/ok");
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testEmptyName() {
- validator.validate("");
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testInvalidName() {
- validator.validate("/is/not/ok");
- }
-
-}
diff --git a/jdbc/src/test/java/org/jclouds/jdbc/validators/JdbcContainerNameValidatorTest.java b/jdbc/src/test/java/org/jclouds/jdbc/validators/JdbcContainerNameValidatorTest.java
deleted file mode 100644
index 60d020b..0000000
--- a/jdbc/src/test/java/org/jclouds/jdbc/validators/JdbcContainerNameValidatorTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.validators;
-
-import org.jclouds.jdbc.predicates.validators.JdbcContainerNameValidator;
-import org.testng.annotations.Test;
-
-
-/**
- * Test class for {@link JdbcContainerNameValidator } class
- */
-@Test(groups = "unit", testName = "jdbc.JdbcContainerNameValidatorTest")
-public class JdbcContainerNameValidatorTest {
-
- private static final JdbcContainerNameValidator validator = new JdbcContainerNameValidator();
-
- @Test
- public void testNamesValidity() {
- validator.validate("all.img");
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testEmptyName() {
- validator.validate("");
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testNullName() {
- validator.validate(null);
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testInvalidStartingCharacterInName() {
- validator.validate("/is/not/ok");
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testInvalidEndingCharacterInName() {
- validator.validate("is/not/ok/");
- }
-
-}
diff --git a/jdbc/src/test/resources/META-INF/persistence.xml b/jdbc/src/test/resources/META-INF/persistence.xml
deleted file mode 100644
index d26b8d1..0000000
--- a/jdbc/src/test/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
- version="1.0">
-
- <persistence-unit name="jclouds-test-hsqldb" transaction-type="RESOURCE_LOCAL">
- <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
-
- <class>org.jclouds.jdbc.entity.ContainerEntity</class>
- <class>org.jclouds.jdbc.entity.BlobEntity</class>
- <class>org.jclouds.jdbc.entity.ChunkEntity</class>
- <class>org.jclouds.jdbc.entity.PayloadEntity</class>
- <exclude-unlisted-classes>true</exclude-unlisted-classes>
-
- <properties>
- <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
- <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />
- <!-- Hsqldb must be set to multiversion concurrency control to run the tests correctly -->
- <property name="hibernate.connection.url" value="jdbc:hsqldb:file:target/testdb;shutdown=true;sql.enforce_strict_size=true;hsqldb.tx=mvcc" />
- <property name="hibernate.connection.user" value="sa" />
- <!-- Allow hibernate to generate our schema -->
- <property name="hibernate.hbm2ddl.auto" value="create" />
- <property name="hibernate.order_updates" value="true" />
- <property name="hibernate.order_inserts" value="true" />
- </properties>
- </persistence-unit>
-
- <persistence-unit name="jclouds-test-h2" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
-
- <class>org.jclouds.jdbc.entity.ContainerEntity</class>
- <class>org.jclouds.jdbc.entity.BlobEntity</class>
- <class>org.jclouds.jdbc.entity.ChunkEntity</class>
- <class>org.jclouds.jdbc.entity.PayloadEntity</class>
- <exclude-unlisted-classes>true</exclude-unlisted-classes>
-
- <properties>
- <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
- <property name="javax.persistence.jdbc.url" value="jdbc:h2:./target/h2-2" />
- <property name="javax.persistence.jdbc.user" value="sa" />
- <!-- Allow eclipselink to generate our schema -->
- <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
- <property name="eclipselink.ddl-generation.output-mode" value="database" />
- </properties>
- </persistence-unit>
-
-</persistence>
diff --git a/jdbc/src/test/resources/log4j.properties b/jdbc/src/test/resources/log4j.properties
deleted file mode 100644
index 0815baa..0000000
--- a/jdbc/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-#
-# 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.
-#
-#
-log4j.rootLogger=WARN, A1
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
-log4j.logger.org.hibernate = ERROR
diff --git a/pom.xml b/pom.xml
index 278dc40..5818fd0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,8 +63,6 @@
<module>cloudsigma2-wdc</module>
<module>cloudsigma2-zrh</module>
<module>dimensiondata</module>
- <module>jdbc</module>
- <module>h2-jdbc</module>
<module>joyent-cloudapi</module>
<module>joyentcloud</module>
<module>abiquo</module>