Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 13f1036

Browse files
author
Takashi Matsuo
committedApr 21, 2016
Added few more sample code for Search API.
* Moved some checkstyle modules to java-repo-tools * Moved some lines in .gitignore to the top level
1 parent e486daf commit 13f1036

19 files changed

+476
-281
lines changed
 

‎.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,8 @@ service-account.json
3030
# intellij
3131
.idea/
3232
*.iml
33+
34+
# Eclipse files
35+
.project
36+
.classpath
37+
.settings

‎appengine/search/.gitignore

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

‎appengine/search/google-checks.xml

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

‎appengine/search/pom.xml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,6 @@ Copyright 2015 Google Inc. All Rights Reserved.
8181
<!-- for hot reload of the web application -->
8282
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
8383
<plugins>
84-
<plugin>
85-
<groupId>org.apache.maven.plugins</groupId>
86-
<artifactId>maven-checkstyle-plugin</artifactId>
87-
<version>2.17</version>
88-
<configuration>
89-
<configLocation>google-checks.xml</configLocation>
90-
<consoleOutput>true</consoleOutput>
91-
<failOnViolation>true</failOnViolation>
92-
<failsOnError>true</failsOnError>
93-
<includeTestSourceDirectory>true</includeTestSourceDirectory>
94-
<suppressionsLocation>suppressions.xml</suppressionsLocation>
95-
</configuration>
96-
<executions>
97-
<execution><goals><goal>check</goal></goals></execution>
98-
</executions>
99-
</plugin>
10084
<plugin>
10185
<groupId>org.apache.maven.plugins</groupId>
10286
<version>3.3</version>

‎appengine/search/src/main/java/com/example/appengine/search/DeleteServlet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
import com.google.appengine.api.search.GetResponse;
2424
// [END delete_import]
2525

26-
//CHECKSTYLE:OFF
26+
// CHECKSTYLE:OFF
2727
import com.google.appengine.api.search.Field;
2828
import com.google.appengine.api.search.Index;
2929
import com.google.appengine.api.search.IndexSpec;
3030
import com.google.appengine.api.search.SearchServiceFactory;
3131
// @formatter:on
32-
//CHECKSTYLE:ON
32+
// CHECKSTYLE:ON
3333

3434
import java.io.IOException;
3535
import java.io.PrintWriter;

‎appengine/search/src/main/java/com/example/appengine/search/IndexServlet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
import com.google.appengine.api.search.IndexSpec;
2424
import com.google.appengine.api.search.SearchServiceFactory;
2525

26-
//CHECKSTYLE:OFF
26+
// CHECKSTYLE:OFF
2727
// [START get_document_import]
2828
import com.google.appengine.api.search.GetRequest;
2929
import com.google.appengine.api.search.GetResponse;
3030
// [END get_document_import]
3131
// @formatter:on
32-
//CHECKSTYLE:ON
32+
// CHECKSTYLE:ON
3333

3434
import java.io.IOException;
3535
import java.io.PrintWriter;
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/**
2+
* Copyright 2016 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
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.
15+
*/
16+
17+
package com.example.appengine.search;
18+
19+
import com.google.appengine.api.search.Document;
20+
import com.google.appengine.api.search.Field;
21+
import com.google.appengine.api.search.SearchServiceFactory;
22+
23+
// @formatter:off
24+
// CHECKSTYLE:OFF
25+
// [START schema_import]
26+
import com.google.appengine.api.search.Field.FieldType;
27+
import com.google.appengine.api.search.Index;
28+
import com.google.appengine.api.search.GetIndexesRequest;
29+
import com.google.appengine.api.search.GetResponse;
30+
import com.google.appengine.api.search.Schema;
31+
// [END schema_import]
32+
// @formatter:on
33+
// CHECKSTYLE:ON
34+
35+
import java.io.IOException;
36+
import java.io.PrintWriter;
37+
import java.util.List;
38+
import javax.servlet.http.HttpServlet;
39+
import javax.servlet.http.HttpServletRequest;
40+
import javax.servlet.http.HttpServletResponse;
41+
42+
43+
@SuppressWarnings("serial")
44+
public class SchemaServlet extends HttpServlet {
45+
46+
private static final String SEARCH_INDEX = "schemaIndex";
47+
48+
@Override
49+
public void doGet(HttpServletRequest req, HttpServletResponse resp)
50+
throws IOException {
51+
PrintWriter out = resp.getWriter();
52+
Document doc = Document.newBuilder()
53+
.setId("theOnlyCar")
54+
.addField(Field.newBuilder().setName("maker").setText("Toyota"))
55+
.addField(Field.newBuilder().setName("price").setNumber(300000))
56+
.addField(Field.newBuilder().setName("color").setText("lightblue"))
57+
.addField(Field.newBuilder().setName("model").setText("Prius"))
58+
.build();
59+
try {
60+
Utils.indexADocument(SEARCH_INDEX, doc);
61+
} catch (InterruptedException e) {
62+
// ignore
63+
}
64+
// [START list_schema]
65+
GetResponse<Index> response = SearchServiceFactory.getSearchService().getIndexes(
66+
GetIndexesRequest.newBuilder().setSchemaFetched(true).build());
67+
68+
// List out elements of each Schema
69+
for (Index index : response) {
70+
Schema schema = index.getSchema();
71+
for (String fieldName : schema.getFieldNames()) {
72+
List<FieldType> typesForField = schema.getFieldTypes(fieldName);
73+
// Just printing out the field names and types
74+
for (FieldType type : typesForField) {
75+
out.println(index.getName() + ":" + fieldName + ":" + type.name());
76+
}
77+
}
78+
}
79+
// [START list_schema]
80+
}
81+
}
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
/**
2+
* Copyright 2016 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
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.
15+
*/
16+
17+
package com.example.appengine.search;
18+
19+
import com.google.appengine.api.search.Document;
20+
import com.google.appengine.api.search.Index;
21+
22+
// CHECKSTYLE:OFF
23+
// @formatter:off
24+
// [START search_option_import]
25+
import com.google.appengine.api.search.Field;
26+
import com.google.appengine.api.search.IndexSpec;
27+
import com.google.appengine.api.search.SearchServiceFactory;
28+
import com.google.appengine.api.search.Query;
29+
import com.google.appengine.api.search.QueryOptions;
30+
import com.google.appengine.api.search.Results;
31+
import com.google.appengine.api.search.SearchException;
32+
import com.google.appengine.api.search.SortExpression;
33+
import com.google.appengine.api.search.SortOptions;
34+
import com.google.appengine.api.search.ScoredDocument;
35+
// [END search_option_import]
36+
// @formatter:on
37+
// CHECKSTYLE:ON
38+
39+
import java.io.IOException;
40+
import java.io.PrintWriter;
41+
import java.util.ArrayList;
42+
import java.util.List;
43+
import java.util.logging.Level;
44+
import java.util.logging.Logger;
45+
import javax.servlet.http.HttpServlet;
46+
import javax.servlet.http.HttpServletRequest;
47+
import javax.servlet.http.HttpServletResponse;
48+
49+
50+
/**
51+
* Code snippet for searching with query options.
52+
*/
53+
@SuppressWarnings("serial")
54+
public class SearchOptionServlet extends HttpServlet {
55+
private static final Logger LOG = Logger.getLogger(SearchOptionServlet.class.getSimpleName());
56+
57+
private static final String SEARCH_INDEX = "searchOptionIndex";
58+
59+
private Index getIndex() {
60+
IndexSpec indexSpec = IndexSpec.newBuilder().setName(SEARCH_INDEX).build();
61+
Index index = SearchServiceFactory.getSearchService().getIndex(indexSpec);
62+
return index;
63+
}
64+
65+
private Results<ScoredDocument> doSearch() {
66+
String indexName = SEARCH_INDEX;
67+
// [START search_with_options]
68+
try {
69+
// Build the SortOptions with 2 sort keys
70+
SortOptions sortOptions = SortOptions.newBuilder()
71+
.addSortExpression(SortExpression.newBuilder()
72+
.setExpression("price")
73+
.setDirection(SortExpression.SortDirection.DESCENDING)
74+
.setDefaultValueNumeric(0))
75+
.addSortExpression(SortExpression.newBuilder()
76+
.setExpression("brand")
77+
.setDirection(SortExpression.SortDirection.DESCENDING)
78+
.setDefaultValue(""))
79+
.setLimit(1000)
80+
.build();
81+
82+
// Build the QueryOptions
83+
QueryOptions options = QueryOptions.newBuilder()
84+
.setLimit(25)
85+
.setFieldsToReturn("model", "price", "description")
86+
.setSortOptions(sortOptions)
87+
.build();
88+
89+
// A query string
90+
String queryString = "product: coffee roaster AND price < 500";
91+
92+
// Build the Query and run the search
93+
Query query = Query.newBuilder().setOptions(options).build(queryString);
94+
IndexSpec indexSpec = IndexSpec.newBuilder().setName(indexName).build();
95+
Index index = SearchServiceFactory.getSearchService().getIndex(indexSpec);
96+
Results<ScoredDocument> result = index.search(query);
97+
return result;
98+
} catch (SearchException e) {
99+
// handle exception...
100+
}
101+
return null;
102+
// [END search_with_options]
103+
}
104+
105+
@Override
106+
public void doGet(HttpServletRequest req, HttpServletResponse resp)
107+
throws IOException {
108+
// Put one document to avoid an error
109+
Document document = Document.newBuilder()
110+
.setId("theOnlyCoffeeRoaster")
111+
.addField(Field.newBuilder().setName("price").setNumber(200))
112+
.addField(Field.newBuilder().setName("model").setText("TZ4000"))
113+
.addField(Field.newBuilder().setName("brand").setText("MyBrand"))
114+
.addField(Field.newBuilder().setName("product").setText("coffee roaster"))
115+
.addField(Field.newBuilder()
116+
.setName("description").setText("A coffee bean roaster at home"))
117+
.build();
118+
try {
119+
Utils.indexADocument(SEARCH_INDEX, document);
120+
} catch (InterruptedException e) {
121+
// ignore
122+
}
123+
PrintWriter out = resp.getWriter();
124+
Results<ScoredDocument> result = doSearch();
125+
for (ScoredDocument doc : result.getResults()) {
126+
out.println(doc.toString());
127+
}
128+
}
129+
}

‎appengine/search/src/main/java/com/example/appengine/search/SearchServlet.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
import com.google.appengine.api.search.StatusCode;
2727
// [END search_document_import]
2828

29-
//CHECKSTYLE:OFF
29+
// CHECKSTYLE:OFF
3030
import com.google.appengine.api.search.Index;
3131
import com.google.appengine.api.search.IndexSpec;
3232
import com.google.appengine.api.search.SearchServiceFactory;
3333
// @formatter:on
34-
//CHECKSTYLE:ON
34+
// CHECKSTYLE:ON
3535

3636
import java.io.IOException;
3737
import java.io.PrintWriter;
@@ -73,7 +73,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp)
7373
int delay = 2;
7474
while (true) {
7575
try {
76-
String queryString = "product: piano AND price < 5000";
76+
String queryString = "product = piano AND price < 5000";
7777
Results<ScoredDocument> results = getIndex().search(queryString);
7878

7979
// Iterate over the documents in the results
@@ -99,7 +99,19 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp)
9999
}
100100
break;
101101
}
102-
// [START search_document]
102+
// [END search_document]
103+
// We don't test the search result below, but we're fine if it runs without errors.
103104
out.println("Search performed");
105+
Index index = getIndex();
106+
// [START simple_search_1]
107+
index.search("rose water");
108+
// [END simple_search_1]
109+
// [START simple_search_2]
110+
index.search("1776-07-04");
111+
// [END simple_search_2]
112+
// [START simple_search_3]
113+
// search for documents with pianos that cost less than $5000
114+
index.search("product = piano AND price < 5000");
115+
// [END simple_search_3]
104116
}
105117
}

‎appengine/search/src/main/webapp/WEB-INF/web.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@
2727
<servlet-name>search</servlet-name>
2828
<url-pattern>/search</url-pattern>
2929
</servlet-mapping>
30+
<servlet>
31+
<servlet-name>search_option</servlet-name>
32+
<servlet-class>com.example.appengine.search.SearchOptionServlet</servlet-class>
33+
</servlet>
34+
<servlet-mapping>
35+
<servlet-name>search_option</servlet-name>
36+
<url-pattern>/search_option</url-pattern>
37+
</servlet-mapping>
3038
<servlet>
3139
<servlet-name>delete</servlet-name>
3240
<servlet-class>com.example.appengine.search.DeleteServlet</servlet-class>
@@ -35,4 +43,12 @@
3543
<servlet-name>delete</servlet-name>
3644
<url-pattern>/delete</url-pattern>
3745
</servlet-mapping>
46+
<servlet>
47+
<servlet-name>schema</servlet-name>
48+
<servlet-class>com.example.appengine.search.SchemaServlet</servlet-class>
49+
</servlet>
50+
<servlet-mapping>
51+
<servlet-name>schema</servlet-name>
52+
<url-pattern>/schema</url-pattern>
53+
</servlet-mapping>
3854
</web-app>

‎appengine/search/src/test/java/com/example/appengine/search/DeleteServletTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2016 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
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.
15+
*/
16+
117
package com.example.appengine.search;
218

319
import static com.google.common.truth.Truth.assertThat;

‎appengine/search/src/test/java/com/example/appengine/search/DocumentServletTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2016 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
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.
15+
*/
16+
117
package com.example.appengine.search;
218

319
import static com.google.common.truth.Truth.assertThat;

‎appengine/search/src/test/java/com/example/appengine/search/IndexServletTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2016 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
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.
15+
*/
16+
117
package com.example.appengine.search;
218

319
import static com.google.common.truth.Truth.assertThat;
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/**
2+
* Copyright 2016 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
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.
15+
*/
16+
17+
package com.example.appengine.search;
18+
19+
import static com.google.common.truth.Truth.assertThat;
20+
import static org.mockito.Mockito.when;
21+
22+
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
23+
import org.junit.After;
24+
import org.junit.Before;
25+
import org.junit.Test;
26+
import org.mockito.Mock;
27+
import org.mockito.MockitoAnnotations;
28+
29+
import java.io.PrintWriter;
30+
import java.io.StringWriter;
31+
import javax.servlet.http.HttpServletRequest;
32+
import javax.servlet.http.HttpServletResponse;
33+
34+
public class SchemaServletTest {
35+
private final LocalServiceTestHelper helper = new LocalServiceTestHelper();
36+
37+
@Mock private HttpServletRequest mockRequest;
38+
@Mock private HttpServletResponse mockResponse;
39+
private StringWriter responseWriter;
40+
private SchemaServlet servletUnderTest;
41+
42+
@Before
43+
public void setUp() throws Exception {
44+
MockitoAnnotations.initMocks(this);
45+
helper.setUp();
46+
47+
// Set up a fake HTTP response.
48+
responseWriter = new StringWriter();
49+
when(mockResponse.getWriter()).thenReturn(new PrintWriter(responseWriter));
50+
51+
servletUnderTest = new SchemaServlet();
52+
}
53+
54+
@After
55+
public void tearDown() {
56+
helper.tearDown();
57+
}
58+
59+
@Test
60+
public void doGet_successfulyInvoked() throws Exception {
61+
servletUnderTest.doGet(mockRequest, mockResponse);
62+
String content = responseWriter.toString();
63+
assertThat(content)
64+
.named("SchemaServlet response")
65+
.contains("schemaIndex:maker:TEXT");
66+
assertThat(content)
67+
.named("SchemaServlet response")
68+
.contains("schemaIndex:price:NUMBER");
69+
assertThat(content)
70+
.named("SchemaServlet response")
71+
.contains("schemaIndex:color:TEXT");
72+
assertThat(content)
73+
.named("SchemaServlet response")
74+
.contains("schemaIndex:model:TEXT");
75+
}
76+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* Copyright 2016 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
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.
15+
*/
16+
17+
package com.example.appengine.search;
18+
19+
import static com.google.common.truth.Truth.assertThat;
20+
import static org.mockito.Mockito.when;
21+
22+
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
23+
import org.junit.After;
24+
import org.junit.Before;
25+
import org.junit.Test;
26+
import org.mockito.Mock;
27+
import org.mockito.MockitoAnnotations;
28+
29+
import java.io.PrintWriter;
30+
import java.io.StringWriter;
31+
import javax.servlet.http.HttpServletRequest;
32+
import javax.servlet.http.HttpServletResponse;
33+
34+
public class SearchOptionServletTest {
35+
private final LocalServiceTestHelper helper = new LocalServiceTestHelper();
36+
37+
@Mock private HttpServletRequest mockRequest;
38+
@Mock private HttpServletResponse mockResponse;
39+
private StringWriter responseWriter;
40+
private SearchOptionServlet servletUnderTest;
41+
42+
@Before
43+
public void setUp() throws Exception {
44+
MockitoAnnotations.initMocks(this);
45+
helper.setUp();
46+
47+
// Set up a fake HTTP response.
48+
responseWriter = new StringWriter();
49+
when(mockResponse.getWriter()).thenReturn(new PrintWriter(responseWriter));
50+
51+
servletUnderTest = new SearchOptionServlet();
52+
}
53+
54+
@After
55+
public void tearDown() {
56+
helper.tearDown();
57+
}
58+
59+
@Test
60+
public void doGet_successfulyInvoked() throws Exception {
61+
servletUnderTest.doGet(mockRequest, mockResponse);
62+
assertThat(responseWriter.toString())
63+
.named("SearchOptionServlet response")
64+
.contains("documentId=theOnlyCoffeeRoaster");
65+
}
66+
}

‎appengine/search/src/test/java/com/example/appengine/search/SearchServletTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2016 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
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.
15+
*/
16+
117
package com.example.appengine.search;
218

319
import static com.google.common.truth.Truth.assertThat;

‎appengine/search/src/test/java/com/example/appengine/search/UtilsTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2016 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
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.
15+
*/
16+
117
package com.example.appengine.search;
218

319
import static com.google.common.truth.Truth.assertThat;

‎appengine/search/suppressions.xml

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

‎java-repo-tools/google-checks.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,11 @@
213213
<module name="EmptyCatchBlock">
214214
<property name="exceptionVariableName" value="expected"/>
215215
</module>
216+
<module name="FileContentsHolder"/>
216217
</module>
217218

218219
<!-- Allow silencing rules with annotations http://stackoverflow.com/a/22556386/101923 -->
219220
<module name="SuppressWarningsFilter" />
221+
<!-- Allow silencing with comment http://stackoverflow.com/questions/4023185 -->
222+
<module name="SuppressionCommentFilter" />
220223
</module>

0 commit comments

Comments
 (0)
Please sign in to comment.