Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.

Commit 4faa29c

Browse files
authored
Increase the version number for the development of the next release. (#54)
* Increase the version number for the development of the next release. * Set Travis CI Java version to openjdk8 This framework is intended to work with Java 8 on Google App Engine Standard. Newer versions are not supported. * Make platform discovery hermetic in unit tests. This fixes failing Travis CI tests. Now Travis moved to GCE and that environment is reflected in ReportRequest labels in ControlFilter tests. Unit tests shouldn't probe the execution environment, so a hermetic HTTP transport to check for "Metadata Server" existence is passed to the ControlFilter constructor. * Set version to 1.0.12 (drop -SNAPSHOT)
1 parent 5bbf20d commit 4faa29c

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: java
2+
jdk: openjdk8
23
install: ./gradlew assemble -x :endpoints-management-control-appengine-all:assemble -x :endpoints-management-control-all:assemble
34
script: ./gradlew check -x :endpoints-management-control-appengine-all:check -x :endpoints-management-control-all:check
45
after_success:

endpoints-control/src/test/java/com/google/api/control/ControlFilterTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,22 +148,22 @@ public void setUp() {
148148

149149
@Test
150150
public void shouldCallTheChainIfThereIsNoClient() throws IOException, ServletException {
151-
ControlFilter f = new ControlFilter(null, "aProjectId", testTicker, testClock, null);
151+
ControlFilter f = new ControlFilter(null, "aProjectId", testTicker, testClock, new MetadataTransport(false));
152152
f.doFilter(request, response, chain);
153153
verify(chain).doFilter(request, response);
154154
}
155155

156156
@Test
157157
public void shouldNotUseTheClientWithoutAProjectId() throws IOException, ServletException {
158-
ControlFilter f = new ControlFilter(client, null, testTicker, testClock, null);
158+
ControlFilter f = new ControlFilter(client, null, testTicker, testClock, new MetadataTransport(false));
159159
f.doFilter(request, response, chain);
160160
verify(chain).doFilter(request, response);
161161
verify(client, never()).check(capturedCheck.capture());
162162
}
163163

164164
@Test
165165
public void shouldNotUseTheClientIfThereIsNoMethodInfo() throws IOException, ServletException {
166-
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, null);
166+
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, new MetadataTransport(false));
167167
when(request.getAttribute(ConfigFilter.METHOD_INFO_ATTRIBUTE)).thenReturn(null);
168168
f.doFilter(request, response, chain);
169169
verify(chain).doFilter(request, response);
@@ -177,7 +177,7 @@ public void shouldUseTheDefaultLocation() throws IOException, ServletException {
177177
mockRequestAndResponse();
178178
when(client.check(any(CheckRequest.class))).thenReturn(checkResponse);
179179

180-
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, null);
180+
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, new MetadataTransport(false));
181181
f.doFilter(request, response, chain);
182182
verify(client, times(1)).report(capturedReport.capture());
183183
ReportRequest aReport = capturedReport.getValue();
@@ -199,7 +199,7 @@ public void shouldSetBackendLatency() throws IOException, ServletException {
199199
mockRequestAndResponse();
200200
when(client.check(any(CheckRequest.class))).thenReturn(checkResponse);
201201

202-
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, null);
202+
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, new MetadataTransport(false));
203203
f.doFilter(request, response, chain);
204204
verify(client, times(1)).report(capturedReport.capture());
205205
ReportRequest aReport = capturedReport.getValue();
@@ -218,7 +218,7 @@ public void shouldSetBackendLatency() throws IOException, ServletException {
218218

219219
@Test
220220
public void shouldUseTheClientIfConfiguredOk() throws IOException, ServletException {
221-
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, null);
221+
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, new MetadataTransport(false));
222222
mockRequestAndResponse();
223223
when(client.check(any(CheckRequest.class))).thenReturn(checkResponse);
224224

@@ -250,7 +250,7 @@ public void shouldUseTheClientIfConfiguredOk() throws IOException, ServletExcept
250250
public void shouldSendTheDefaultApiKeyIfPresent() throws IOException, ServletException {
251251
String[] defaultKeyNames = {"key", "api_key"};
252252
String testApiKey = "defaultApiKey";
253-
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, null);
253+
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, new MetadataTransport(false));
254254
for (String defaultKeyName : defaultKeyNames) {
255255
mockRequestAndResponse();
256256
when(request.getParameter(defaultKeyName)).thenReturn(testApiKey);
@@ -292,7 +292,7 @@ public void shouldSendTheDefaultApiKeyIfPresent() throws IOException, ServletExc
292292
@Test
293293
public void shouldSendAReportButNotInvokeTheChainIfTheCheckFails()
294294
throws IOException, ServletException {
295-
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, null);
295+
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, new MetadataTransport(false));
296296

297297
// Fail because the project got deleted
298298
CheckResponse deleted = CheckResponse
@@ -335,7 +335,7 @@ public void shouldSendAReportButNotInvokeTheChainIfTheCheckFails()
335335
public void shouldSendAReportButNotInvokeTheChainIfTheCheckFailsOnBadApiKey()
336336
throws IOException, ServletException {
337337
String testApiKey = "defaultApiKey";
338-
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, null);
338+
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, new MetadataTransport(false));
339339

340340
// Fail because the project got deleted
341341
CheckResponse deleted = CheckResponse
@@ -386,7 +386,7 @@ public void shouldSendAReportButNotInvokeTheChainIfTheCheckFailsOnBadApiKey()
386386
@Test
387387
public void shouldSendAReportAndInvokeTheChainIfTheCheckErrors()
388388
throws IOException, ServletException {
389-
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, null);
389+
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, new MetadataTransport(false));
390390

391391
// Return null from check to indicate that transport fail occurred
392392
mockRequestAndResponse();
@@ -419,15 +419,15 @@ public void shouldSendAReportAndInvokeTheChainIfTheCheckErrors()
419419

420420
@Test
421421
public void shouldStopTheClientWhenDestroyed() throws IOException, ServletException {
422-
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, null);
422+
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, new MetadataTransport(false));
423423
f.destroy();
424424
verify(client, times(1)).stop();
425425
}
426426

427427
@Test
428428
public void shouldSendAReportButNotInvokeTheChainWhenNeededApiKeyIsNotProvided()
429429
throws IOException, ServletException {
430-
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, null);
430+
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, new MetadataTransport(false));
431431

432432
// Fail because the api key is needed but no provided
433433
mockRequestAndResponse();
@@ -462,7 +462,7 @@ public void shouldSendAReportButNotInvokeTheChainWhenNeededApiKeyIsNotProvided()
462462
public void shouldSucceedWhenANeededApiKeyIsPresent() throws IOException, ServletException {
463463
String[] defaultKeyNames = {"key", "api_key"};
464464
String testApiKey = "defaultApiKey";
465-
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, null);
465+
ControlFilter f = new ControlFilter(client, TEST_PROJECT_ID, testTicker, testClock, new MetadataTransport(false));
466466
info.setAllowUnregisteredCalls(false); // the means that the API key is necessary
467467

468468
for (String defaultKeyName : defaultKeyNames) {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
sourceCompatibility=1.7
1818
targetCompatibility=1.7
1919

20-
version = 1.0.11
20+
version = 1.0.12
2121
appengineSdkVersion = 1.9.56
2222
autoValueVersion = 1.1
2323
bouncycastleVersion = 1.54

0 commit comments

Comments
 (0)