-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: multiple dbs support * feedback * review feedback * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update graalvm kokoro configs * remove parameterized on test * add reflect-config.json * temporarily remove parameterization on ITDatastoreTest * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feedback * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix json file Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
625e896
commit fab1ece
Showing
39 changed files
with
2,366 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
...to-client/src/test/java/com/google/datastore/v1/client/it/ITDatastoreProtoClientTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* Copyright 2022 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* 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. | ||
*/ | ||
package com.google.datastore.v1.client.it; | ||
|
||
import static com.google.datastore.v1.client.DatastoreHelper.makeFilter; | ||
import static com.google.datastore.v1.client.DatastoreHelper.makeValue; | ||
|
||
import com.google.datastore.v1.Filter; | ||
import com.google.datastore.v1.KindExpression; | ||
import com.google.datastore.v1.PartitionId; | ||
import com.google.datastore.v1.PropertyFilter; | ||
import com.google.datastore.v1.Query; | ||
import com.google.datastore.v1.client.Datastore; | ||
import com.google.datastore.v1.client.DatastoreException; | ||
import com.google.datastore.v1.client.DatastoreHelper; | ||
import java.io.IOException; | ||
import java.security.GeneralSecurityException; | ||
import java.util.List; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class ITDatastoreProtoClientTest { | ||
|
||
private static Datastore DATASTORE; | ||
|
||
private static PartitionId PARTITION; | ||
|
||
private static final String KIND = "test-kind"; | ||
private static final String PROJECT_ID = System.getenv(DatastoreHelper.PROJECT_ID_ENV_VAR); | ||
|
||
@Before | ||
public void setUp() throws GeneralSecurityException, IOException { | ||
DATASTORE = DatastoreHelper.getDatastoreFromEnv(); | ||
} | ||
|
||
@Test | ||
public void testQuerySplitterWithDefaultDb() throws DatastoreException { | ||
Filter propertyFilter = | ||
makeFilter("foo", PropertyFilter.Operator.EQUAL, makeValue("value")).build(); | ||
Query query = | ||
Query.newBuilder() | ||
.addKind(KindExpression.newBuilder().setName(KIND).build()) | ||
.setFilter(propertyFilter) | ||
.build(); | ||
|
||
PARTITION = PartitionId.newBuilder().setProjectId(PROJECT_ID).build(); | ||
|
||
List<Query> splits = | ||
DatastoreHelper.getQuerySplitter().getSplits(query, PARTITION, 2, DATASTORE); | ||
splits.forEach( | ||
split -> { | ||
Assert.assertEquals(KIND, split.getKind(0).getName()); | ||
Assert.assertEquals(propertyFilter, split.getFilter()); | ||
}); | ||
} | ||
|
||
@Test | ||
public void testQuerySplitterWithDb() throws DatastoreException { | ||
Filter propertyFilter = | ||
makeFilter("foo", PropertyFilter.Operator.EQUAL, makeValue("value")).build(); | ||
Query query = | ||
Query.newBuilder() | ||
.addKind(KindExpression.newBuilder().setName(KIND).build()) | ||
.setFilter(propertyFilter) | ||
.build(); | ||
|
||
PARTITION = PartitionId.newBuilder().setProjectId(PROJECT_ID).setDatabaseId("test-db").build(); | ||
|
||
List<Query> splits = | ||
DatastoreHelper.getQuerySplitter().getSplits(query, PARTITION, 2, DATASTORE); | ||
splits.forEach( | ||
split -> { | ||
Assert.assertEquals(KIND, split.getKind(0).getName()); | ||
Assert.assertEquals(propertyFilter, split.getFilter()); | ||
}); | ||
} | ||
} |
Oops, something went wrong.