Skip to content

Commit 5231f36

Browse files
committed
PR comments REV2
1 parent 0627c2d commit 5231f36

6 files changed

Lines changed: 53 additions & 76 deletions

File tree

google-cloud-storage/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,12 @@
251251
<version>1.7.4</version>
252252
<scope>test</scope>
253253
</dependency>
254+
<dependency>
255+
<groupId>info.picocli</groupId>
256+
<artifactId>picocli</artifactId>
257+
<version>4.7.0</version>
258+
<scope>test</scope>
259+
</dependency>
254260

255261
</dependencies>
256262

ssb/src/main/java/com/google/cloud/CloudMonitoringResult.java renamed to google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/CloudMonitoringResult.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
8+
* http://www.apache.org/licenses/LICENSE-2.0
159
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
1615
*/
1716

18-
package com.google.cloud;
17+
package com.google.cloud.storage.benchmarking;
1918

2019
import com.google.common.base.MoreObjects;
2120
import java.util.Objects;

ssb/src/main/java/com/google/cloud/StorageSharedBenchmarkingCli.java renamed to google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/StorageSharedBenchmarkingCli.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
8+
* http://www.apache.org/licenses/LICENSE-2.0
159
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
1615
*/
1716

18-
package com.google.cloud;
17+
package com.google.cloud.storage.benchmarking;
1918

2019
import com.google.api.core.ApiFuture;
2120
import com.google.api.core.ApiFutures;
@@ -66,7 +65,8 @@ public final class StorageSharedBenchmarkingCli implements Runnable {
6665
@Option(
6766
names = "-object_size",
6867
defaultValue = "1048576..1048576",
69-
description = "any positive integer, or an inclusive range such as min..max where min and max are positive integers")
68+
description =
69+
"any positive integer, or an inclusive range such as min..max where min and max are positive integers")
7070
String objectSize;
7171

7272
@Option(
@@ -88,8 +88,13 @@ public static void main(String[] args) {
8888

8989
@Override
9090
public void run() {
91-
// TODO: Make this a switch once we add more workloads
92-
runWorkload1();
91+
switch (testType) {
92+
case "w1r3":
93+
runWorkload1();
94+
break;
95+
default:
96+
throw new IllegalStateException("Specify a workload to run");
97+
}
9398
}
9499

95100
private void runWorkload1() {

ssb/src/main/java/com/google/cloud/StorageSharedBenchmarkingUtils.java renamed to google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/StorageSharedBenchmarkingUtils.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
8+
* http://www.apache.org/licenses/LICENSE-2.0
159
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
1615
*/
17-
18-
package com.google.cloud;
16+
package com.google.cloud.storage.benchmarking;
1917

2018
import com.google.cloud.storage.Blob;
2119
import com.google.cloud.storage.Storage;
@@ -26,7 +24,8 @@ class StorageSharedBenchmarkingUtils {
2624
public static int DEFAULT_NUMBER_OF_READS = 3;
2725

2826
public static void cleanupObject(Storage storage, Blob created) {
29-
storage.delete(created.getBlobId(), Storage.BlobSourceOption.generationMatch(created.getGeneration()));
27+
storage.delete(
28+
created.getBlobId(), Storage.BlobSourceOption.generationMatch(created.getGeneration()));
3029
}
3130

3231
public static double calculateThroughput(long size, Duration elapsedTime) {

ssb/src/main/java/com/google/cloud/Workload1.java renamed to google-cloud-storage/src/test/java/com/google/cloud/storage/benchmarking/Workload1.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
8+
* http://www.apache.org/licenses/LICENSE-2.0
159
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
1615
*/
1716

18-
package com.google.cloud;
17+
package com.google.cloud.storage.benchmarking;
1918

2019
import com.google.cloud.storage.Blob;
2120
import com.google.cloud.storage.BlobInfo;
@@ -55,7 +54,8 @@ public String call() throws Exception {
5554
System.out.println(
5655
generateCloudMonitoringResult(
5756
"WRITE",
58-
StorageSharedBenchmarkingUtils.calculateThroughput(created.getSize().longValue(), elapsedTimeUpload),
57+
StorageSharedBenchmarkingUtils.calculateThroughput(
58+
created.getSize().longValue(), elapsedTimeUpload),
5959
created)
6060
.toString());
6161
Path tempDir = Paths.get(System.getProperty("java.io.tmpdir"));
@@ -68,7 +68,8 @@ public String call() throws Exception {
6868
System.out.println(
6969
generateCloudMonitoringResult(
7070
"READ[" + i + "]",
71-
StorageSharedBenchmarkingUtils.calculateThroughput(created.getSize().longValue(), elapsedTimeDownload),
71+
StorageSharedBenchmarkingUtils.calculateThroughput(
72+
created.getSize().longValue(), elapsedTimeDownload),
7273
created)
7374
.toString());
7475
}

ssb/pom.xml

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
6+
<artifactId>storage-shared-benchmarking</artifactId>
7+
<version>0.0.1-SNAPSHOT</version><!-- This artifact should not be released -->
8+
69
<parent>
710
<groupId>com.google.cloud.samples</groupId>
811
<artifactId>shared-configuration</artifactId>
912
<version>1.2.0</version>
1013
<relativePath/>
1114
</parent>
1215

13-
<artifactId>ssb</artifactId>
14-
1516
<properties>
1617
<maven.compiler.target>1.8</maven.compiler.target>
1718
<maven.compiler.source>1.8</maven.compiler.source>
@@ -29,40 +30,6 @@
2930
</dependency>
3031
</dependencies>
3132
</dependencyManagement>
32-
<dependencies>
33-
<dependency>
34-
<groupId>info.picocli</groupId>
35-
<artifactId>picocli</artifactId>
36-
<version>4.7.0</version>
37-
</dependency>
38-
<dependency>
39-
<groupId>com.google.cloud</groupId>
40-
<artifactId>google-cloud-storage</artifactId>
41-
<version>2.26.2-SNAPSHOT</version><!-- {x-version-update:google-cloud-storage:current} -->
42-
</dependency>
43-
<dependency>
44-
<groupId>com.google.cloud</groupId>
45-
<artifactId>google-cloud-storage</artifactId>
46-
<version>2.26.2-SNAPSHOT</version><!-- {x-version-update:google-cloud-storage:current} -->
47-
<classifier>tests</classifier>
48-
</dependency>
49-
<dependency>
50-
<groupId>com.google.api</groupId>
51-
<artifactId>gax</artifactId>
52-
</dependency>
53-
<dependency>
54-
<groupId>com.google.api</groupId>
55-
<artifactId>api-common</artifactId>
56-
</dependency>
57-
<dependency>
58-
<groupId>com.google.guava</groupId>
59-
<artifactId>guava</artifactId>
60-
</dependency>
61-
<dependency>
62-
<groupId>com.google.cloud</groupId>
63-
<artifactId>google-cloud-core</artifactId>
64-
</dependency>
65-
</dependencies>
6633

6734
<build>
6835
<!-- This plugin enables building the application to a JAR *not* using Native Image -->
@@ -76,7 +43,7 @@
7643
<manifest>
7744
<addClasspath>true</addClasspath>
7845
<classpathPrefix>dependency-jars/</classpathPrefix>
79-
<mainClass>com.google.cloud.StorageSharedBenchmarkingCli</mainClass>
46+
<mainClass>com.google.cloud.storage.benchmarking.StorageSharedBenchmarkingCli</mainClass>
8047
</manifest>
8148
</archive>
8249
</configuration>

0 commit comments

Comments
 (0)