Skip to content

Commit d3639dc

Browse files
committed
---
yaml --- r: 327 b: refs/heads/travis c: c79887b h: refs/heads/master i: 325: 2612cfd 323: a52918e 319: 406393c v: v3
1 parent c39568e commit d3639dc

12 files changed

Lines changed: 338 additions & 78 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
---
22
refs/heads/master: 37618dd4a5fdae207ce791875752bbd9f9f705cc
3-
refs/heads/travis: 938b04db4a2e034b976ee52abd241f51fa001ca4
3+
refs/heads/travis: c79887b5500a60403b5ba8fbd444183f53744479

branches/travis/.checkstyle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
4-
<fileset name="all" enabled="true" check-config-name="Google Checks" local="false">
4+
<fileset name="all" enabled="true" check-config-name="Copy of Google Checks" local="false">
55
<file-match-pattern match-pattern="." include-pattern="true"/>
66
</fileset>
77
</fileset-config>

branches/travis/.eclipse-pmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<eclipse-pmd xmlns="http://acanda.ch/eclipse-pmd/0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://acanda.ch/eclipse-pmd/0.8 http://acanda.ch/eclipse-pmd/eclipse-pmd-0.8.xsd">
33
<analysis enabled="true" />
44
<rulesets>
5-
<ruleset name="Full PMD ruleset" ref="full-pmd-ruleset.xml" refcontext="project" />
5+
<ruleset name="Project PMD settings" ref="pmd.xml" refcontext="project" />
66
</rulesets>
77
</eclipse-pmd>

branches/travis/.project

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@
3131
</arguments>
3232
</buildCommand>
3333
<buildCommand>
34-
<name>org.eclipse.wst.validation.validationbuilder</name>
34+
<name>org.eclipse.m2e.core.maven2Builder</name>
3535
<arguments>
3636
</arguments>
3737
</buildCommand>
3838
<buildCommand>
39-
<name>ntut.csie.rleht.builder.RLBuilder</name>
39+
<name>org.eclipse.wst.validation.validationbuilder</name>
4040
<arguments>
4141
</arguments>
4242
</buildCommand>
4343
<buildCommand>
44-
<name>ch.acanda.eclipse.pmd.builder.PMDBuilder</name>
44+
<name>ntut.csie.rleht.builder.RLBuilder</name>
4545
<arguments>
4646
</arguments>
4747
</buildCommand>
4848
<buildCommand>
49-
<name>org.eclipse.m2e.core.maven2Builder</name>
49+
<name>ch.acanda.eclipse.pmd.builder.PMDBuilder</name>
5050
<arguments>
5151
</arguments>
5252
</buildCommand>

branches/travis/.settings/org.eclipse.jdt.core.prefs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonN
88
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
99
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
1010
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
11-
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
1211
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
1312
org.eclipse.jdt.core.compiler.compliance=1.7
1413
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
15-
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
1614
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
1715
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
1816
org.eclipse.jdt.core.compiler.problem.deadCode=warning
@@ -21,7 +19,6 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
2119
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
2220
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
2321
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
24-
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
2522
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
2623
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
2724
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled

branches/travis/full-pmd-ruleset.xml

Lines changed: 0 additions & 46 deletions
This file was deleted.

branches/travis/pmd.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
<rule ref="rulesets/java/basic.xml/CollapsibleIfStatements"/>
8181
<rule ref="rulesets/vm/basic.xml/CollapsibleIfStatements"/>
8282
<rule ref="rulesets/java/comments.xml/CommentContent"/>
83-
<rule ref="rulesets/java/comments.xml/CommentRequired"/>
8483
<rule ref="rulesets/java/comments.xml/CommentSize"/>
8584
<rule ref="rulesets/java/design.xml/CompareObjectsWithEquals"/>
8685
<rule ref="rulesets/java/design.xml/ConfusingTernary"/>
@@ -183,7 +182,6 @@
183182
<rule ref="rulesets/java/coupling.xml/LawOfDemeter"/>
184183
<rule ref="rulesets/java/j2ee.xml/LocalHomeNamingConvention"/>
185184
<rule ref="rulesets/java/j2ee.xml/LocalInterfaceSessionNamingConvention"/>
186-
<rule ref="rulesets/java/optimizations.xml/LocalVariableCouldBeFinal"/>
187185
<rule ref="rulesets/java/logging-java.xml/LoggerIsNotStaticFinal"/>
188186
<rule ref="rulesets/java/design.xml/LogicInversion"/>
189187
<rule ref="rulesets/java/migrating.xml/LongInstantiation"/>
@@ -333,4 +331,4 @@
333331
<rule ref="rulesets/java/naming.xml/VariableNamingConventions"/>
334332
<rule ref="rulesets/java/braces.xml/WhileLoopsMustUseBraces"/>
335333
<rule ref="rulesets/ecmascript/braces.xml/WhileLoopsMustUseBraces"/>
336-
</ruleset>
334+
</ruleset>

branches/travis/pom.xml

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,86 @@
102102
</pluginRepositories>
103103
<build>
104104
<plugins>
105+
<plugin>
106+
<artifactId>maven-antrun-plugin</artifactId>
107+
<version>1.8</version>
108+
<executions>
109+
<execution>
110+
<id>before-integration-test</id>
111+
<phase>pre-integration-test</phase>
112+
<configuration>
113+
<target>
114+
<property name="test_classpath" refid="maven.test.classpath"/>
115+
<java classname="com.google.gcloud.datastore.LocalGcdHelper">
116+
<arg value="START"/>
117+
<classpath>
118+
<pathelement path="${test_classpath}" />
119+
</classpath>
120+
</java>
121+
</target>
122+
</configuration>
123+
<goals>
124+
<goal>run</goal>
125+
</goals>
126+
</execution>
127+
<execution>
128+
<id>after-integration-test</id>
129+
<phase>post-integration-test</phase>
130+
<configuration>
131+
<target>
132+
<property name="test_classpath" refid="maven.test.classpath"/>
133+
<java classname="com.google.gcloud.datastore.LocalGcdHelper">
134+
<arg value="STOP"/>
135+
<classpath>
136+
<pathelement path="${test_classpath}" />
137+
</classpath>
138+
</java>
139+
</target>
140+
</configuration>
141+
<goals>
142+
<goal>run</goal>
143+
</goals>
144+
</execution>
145+
</executions>
146+
</plugin>
147+
<plugin>
148+
<groupId>org.apache.maven.plugins</groupId>
149+
<artifactId>maven-surefire-plugin</artifactId>
150+
<version>2.18.1</version>
151+
<configuration>
152+
<excludes>
153+
<exclude>**/*IntegrationTest.java</exclude>
154+
</excludes>
155+
</configuration>
156+
</plugin>
157+
<plugin>
158+
<groupId>org.apache.maven.plugins</groupId>
159+
<artifactId>maven-failsafe-plugin</artifactId>
160+
<version>2.18.1</version>
161+
<configuration>
162+
<excludes>
163+
<exclude>none</exclude>
164+
</excludes>
165+
<includes>
166+
<include>**/*IntegrationTest.java</include>
167+
</includes>
168+
</configuration>
169+
<executions>
170+
<execution>
171+
<goals>
172+
<goal>integration-test</goal>
173+
<goal>verify</goal>
174+
</goals>
175+
</execution>
176+
</executions>
177+
</plugin>
105178
<plugin>
106179
<artifactId>maven-jar-plugin</artifactId>
107180
<version>2.5</version>
108181
</plugin>
109182
<plugin>
110183
<artifactId>maven-compiler-plugin</artifactId>
111-
<version>3.2</version>
184+
<version>3.1</version>
112185
<configuration>
113186
<source>1.7</source>
114187
<target>1.7</target>

branches/travis/src/main/java/com/google/gcloud/ExceptionHandler.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.google.common.collect.ImmutableList;
99
import com.google.common.collect.ImmutableSet;
1010
import com.google.common.collect.Sets;
11+
import com.google.gcloud.ExceptionHandler.Interceptor.RetryResult;
1112

1213
import java.io.Serializable;
1314
import java.lang.reflect.Method;
@@ -139,10 +140,10 @@ static final class RetryInfo implements Serializable {
139140

140141
private static final long serialVersionUID = -4264634837841455974L;
141142
private final Class<? extends Exception> exception;
142-
private final Interceptor.RetryResult retry;
143+
private final RetryResult retry;
143144
private final Set<RetryInfo> children = Sets.newHashSet();
144145

145-
RetryInfo(Class<? extends Exception> exception, Interceptor.RetryResult retry) {
146+
RetryInfo(Class<? extends Exception> exception, RetryResult retry) {
146147
this.exception = checkNotNull(exception);
147148
this.retry = retry;
148149
}
@@ -173,10 +174,10 @@ private ExceptionHandler(Builder builder) {
173174
Sets.intersection(retriableExceptions, nonRetriableExceptions).isEmpty(),
174175
"Same exception was found in both retriable and non-retriable sets");
175176
for (Class<? extends Exception> exception : retriableExceptions) {
176-
addToRetryInfos(retryInfos, new RetryInfo(exception, Interceptor.RetryResult.RETRY));
177+
addToRetryInfos(retryInfos, new RetryInfo(exception, RetryResult.RETRY));
177178
}
178179
for (Class<? extends Exception> exception : nonRetriableExceptions) {
179-
addToRetryInfos(retryInfos, new RetryInfo(exception, Interceptor.RetryResult.ABORT));
180+
addToRetryInfos(retryInfos, new RetryInfo(exception, RetryResult.ABORT));
180181
}
181182
}
182183

@@ -241,14 +242,13 @@ public Set<Class<? extends Exception>> getNonRetriableExceptions() {
241242

242243
boolean shouldRetry(Exception ex) {
243244
for (Interceptor interceptor : interceptors) {
244-
Interceptor.RetryResult retryResult = interceptor.shouldRetry(ex);
245+
RetryResult retryResult = interceptor.shouldRetry(ex);
245246
if (retryResult != null) {
246247
return retryResult.booleanValue();
247248
}
248249
}
249250
RetryInfo retryInfo = findMostSpecificRetryInfo(retryInfos, ex.getClass());
250-
Interceptor.RetryResult retryResult =
251-
retryInfo == null ? Interceptor.RetryResult.ABORT : retryInfo.retry;
251+
RetryResult retryResult = retryInfo == null ? RetryResult.ABORT : retryInfo.retry;
252252
for (Interceptor interceptor : interceptors) {
253253
retryResult = firstNonNull(interceptor.shouldRetry(ex, retryResult), retryResult);
254254
}

branches/travis/src/test/java/com/google/gcloud/datastore/DatastoreServiceTest.java renamed to branches/travis/src/test/java/com/google/gcloud/datastore/DatastoreServiceIntegrationTest.java

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,23 @@
1717
import com.google.gcloud.datastore.StructuredQuery.PropertyFilter;
1818

1919
import org.easymock.EasyMock;
20+
import org.junit.After;
2021
import org.junit.Before;
2122
import org.junit.Test;
2223
import org.junit.runner.RunWith;
2324
import org.junit.runners.JUnit4;
2425

26+
import java.io.IOException;
2527
import java.util.Collections;
2628
import java.util.HashMap;
2729
import java.util.Iterator;
2830
import java.util.List;
2931
import java.util.Map;
3032

3133
@RunWith(JUnit4.class)
32-
public class DatastoreServiceTest {
34+
public class DatastoreServiceIntegrationTest {
3335

34-
private static final String DATASET = "dataset1";
36+
private static final String DATASET = LocalGcdHelper.DEFAULT_DATASET;
3537
private static final String KIND1 = "kind1";
3638
private static final String KIND2 = "kind2";
3739
private static final NullValue NULL_VALUE = NullValue.of();
@@ -70,19 +72,16 @@ public class DatastoreServiceTest {
7072
private DatastoreServiceOptions options;
7173
private DatastoreService datastore;
7274
private DatastoreHelper helper;
75+
private LocalGcdHelper gcdHelper;
7376

7477
@Before
75-
public void setUp() {
76-
// TODO(ozarov): document that this test depends on a local gcd running.
77-
// Unfortunately, the gcd tool is not bundled with the cloud SDK and need
78-
// to be downloaded independently from
79-
// https://cloud.google.com/datastore/docs/tools/devserver (b/16372095).
80-
// To start the gcd run:
81-
// gcd.sh create dataset1; gcd.sh start dataset1
82-
// We should have an option to start the gcd from maven/ant.
78+
public void setUp() throws IOException, InterruptedException {
79+
if (!LocalGcdHelper.isActive(DATASET)) {
80+
gcdHelper = LocalGcdHelper.start(DATASET);
81+
}
8382
options = DatastoreServiceOptions.builder()
8483
.dataset(DATASET)
85-
.host("http://localhost:8080")
84+
.host("http://localhost:" + LocalGcdHelper.PORT)
8685
.build();
8786
datastore = DatastoreServiceFactory.getDefault(options);
8887
helper = DatastoreHelper.createFor(datastore);
@@ -91,6 +90,13 @@ public void setUp() {
9190
datastore.add(ENTITY1, ENTITY2);
9291
}
9392

93+
@After
94+
public void tearDown() throws IOException, InterruptedException {
95+
if (gcdHelper != null) {
96+
gcdHelper.stop();
97+
}
98+
}
99+
94100
@Test
95101
public void testGetOptions() {
96102
assertSame(options, datastore.options());

0 commit comments

Comments
 (0)