diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml
index 3a3c9010af..1e1bfa2868 100644
--- a/google-cloud-storage/pom.xml
+++ b/google-cloud-storage/pom.xml
@@ -251,6 +251,12 @@
1.7.4
test
+
+ info.picocli
+ picocli
+ 4.7.0
+ test
+
diff --git a/ssb/src/main/java/com/google/cloud/CloudMonitoringResult.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/CloudMonitoringResult.java
similarity index 94%
rename from ssb/src/main/java/com/google/cloud/CloudMonitoringResult.java
rename to google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/CloudMonitoringResult.java
index e16c564b06..f9884d12e5 100644
--- a/ssb/src/main/java/com/google/cloud/CloudMonitoringResult.java
+++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/CloudMonitoringResult.java
@@ -5,17 +5,16 @@
* 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.
+ * 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 com.google.cloud;
+package com.google.cloud.storage.benchmarking;
import com.google.common.base.MoreObjects;
import java.util.Objects;
diff --git a/ssb/src/main/java/com/google/cloud/StorageSharedBenchmarkingCli.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/StorageSharedBenchmarkingCli.java
similarity index 86%
rename from ssb/src/main/java/com/google/cloud/StorageSharedBenchmarkingCli.java
rename to google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/StorageSharedBenchmarkingCli.java
index b7d19634e5..387d39348f 100644
--- a/ssb/src/main/java/com/google/cloud/StorageSharedBenchmarkingCli.java
+++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/StorageSharedBenchmarkingCli.java
@@ -5,17 +5,16 @@
* 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.
+ * 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 com.google.cloud;
+package com.google.cloud.storage.benchmarking;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
@@ -66,7 +65,8 @@ public final class StorageSharedBenchmarkingCli implements Runnable {
@Option(
names = "-object_size",
defaultValue = "1048576..1048576",
- description = "any positive integer, or an inclusive range such as min..max where min and max are positive integers")
+ description =
+ "any positive integer, or an inclusive range such as min..max where min and max are positive integers")
String objectSize;
@Option(
@@ -88,8 +88,13 @@ public static void main(String[] args) {
@Override
public void run() {
- // TODO: Make this a switch once we add more workloads
- runWorkload1();
+ switch (testType) {
+ case "w1r3":
+ runWorkload1();
+ break;
+ default:
+ throw new IllegalStateException("Specify a workload to run");
+ }
}
private void runWorkload1() {
diff --git a/ssb/src/main/java/com/google/cloud/StorageSharedBenchmarkingUtils.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/StorageSharedBenchmarkingUtils.java
similarity index 60%
rename from ssb/src/main/java/com/google/cloud/StorageSharedBenchmarkingUtils.java
rename to google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/StorageSharedBenchmarkingUtils.java
index 376bd80962..0407cf7015 100644
--- a/ssb/src/main/java/com/google/cloud/StorageSharedBenchmarkingUtils.java
+++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/StorageSharedBenchmarkingUtils.java
@@ -5,17 +5,15 @@
* 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.
+ * 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 com.google.cloud;
+package com.google.cloud.storage.benchmarking;
import com.google.cloud.storage.Blob;
import com.google.cloud.storage.Storage;
@@ -26,7 +24,8 @@ class StorageSharedBenchmarkingUtils {
public static int DEFAULT_NUMBER_OF_READS = 3;
public static void cleanupObject(Storage storage, Blob created) {
- storage.delete(created.getBlobId(), Storage.BlobSourceOption.generationMatch(created.getGeneration()));
+ storage.delete(
+ created.getBlobId(), Storage.BlobSourceOption.generationMatch(created.getGeneration()));
}
public static double calculateThroughput(long size, Duration elapsedTime) {
diff --git a/ssb/src/main/java/com/google/cloud/Workload1.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/Workload1.java
similarity index 83%
rename from ssb/src/main/java/com/google/cloud/Workload1.java
rename to google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/Workload1.java
index 257176d9cd..9d3de47292 100644
--- a/ssb/src/main/java/com/google/cloud/Workload1.java
+++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/Workload1.java
@@ -5,17 +5,16 @@
* 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.
+ * 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 com.google.cloud;
+package com.google.cloud.storage.benchmarking;
import com.google.cloud.storage.Blob;
import com.google.cloud.storage.BlobInfo;
@@ -55,7 +54,8 @@ public String call() throws Exception {
System.out.println(
generateCloudMonitoringResult(
"WRITE",
- StorageSharedBenchmarkingUtils.calculateThroughput(created.getSize().longValue(), elapsedTimeUpload),
+ StorageSharedBenchmarkingUtils.calculateThroughput(
+ created.getSize().longValue(), elapsedTimeUpload),
created)
.toString());
Path tempDir = Paths.get(System.getProperty("java.io.tmpdir"));
@@ -68,7 +68,8 @@ public String call() throws Exception {
System.out.println(
generateCloudMonitoringResult(
"READ[" + i + "]",
- StorageSharedBenchmarkingUtils.calculateThroughput(created.getSize().longValue(), elapsedTimeDownload),
+ StorageSharedBenchmarkingUtils.calculateThroughput(
+ created.getSize().longValue(), elapsedTimeDownload),
created)
.toString());
}
diff --git a/ssb/pom.xml b/ssb/pom.xml
index d6d2cde589..6dd1fae472 100644
--- a/ssb/pom.xml
+++ b/ssb/pom.xml
@@ -3,6 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
+ storage-shared-benchmarking
+ 0.0.1-SNAPSHOT
+
com.google.cloud.samples
shared-configuration
@@ -10,8 +13,6 @@
- ssb
-
1.8
1.8
@@ -76,7 +77,7 @@
true
dependency-jars/
- com.google.cloud.StorageSharedBenchmarkingCli
+ com.google.cloud.storage.benchmarking.StorageSharedBenchmarkingCli