Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .kokoro/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# set -eo pipefail

function retry_with_backoff {
attempts_left=$1
sleep_seconds=$2
shift 2
command=$@


# store current flag state
flags=$-

# allow a failures to continue
set +e
echo "${command}"
${command}
exit_code=$?

# restore "e" flag
if [[ ${flags} =~ e ]]
then set -e
else set +e
fi

if [[ $exit_code == 0 ]]
then
return 0
Expand All @@ -42,3 +52,8 @@ function retry_with_backoff {

return $exit_code
}

## Helper functionss
function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; }
function msg() { println "$*" >&2; }
function println() { printf '%s\n' "$(now) $*"; }
48 changes: 48 additions & 0 deletions .kokoro/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,51 @@ retry_with_backoff 3 10 \
-Dclirr.skip=true

mvn -B dependency:analyze -DfailOnWarning=true

echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************"
## Run dependency list completeness check
function completenessCheck() {
# Output dep list with compile scope generated using the original pom
msg "Generating dependency list using original pom..."
mvn dependency:list -f pom.xml -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | grep -v ':test$' >.org-list.txt

# Output dep list generated using the flattened pom (test scope deps are ommitted)
msg "Generating dependency list using flattened pom..."
mvn dependency:list -f .flattened-pom.xml -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt

# Compare two dependency lists
msg "Comparing dependency lists..."
diff .org-list.txt .new-list.txt >.diff.txt
if [[ $? == 0 ]]
then
msg "Success. No diff!"
else
msg "Diff found. See below: "
msg "You can also check .diff.txt file located in $1."
cat .diff.txt
return 1
fi
}

# Allow failures to continue running the script
set +e

error_count=0
for path in $(find -name ".flattened-pom.xml")
do
# Check flattened pom in each dir that contains it for completeness
dir=$(dirname "$path")
pushd "$dir"
completenessCheck "$dir"
error_count=$(($error_count + $?))
popd
done

if [[ $error_count == 0 ]]
then
msg "All checks passed."
exit 0
else
msg "Errors found. See log statements above."
exit 1
fi
20 changes: 20 additions & 0 deletions .kokoro/nightly/integration.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,31 @@ env_vars: {
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
}

env_vars: {
key: "JOB_TYPE"
value: "integration"
}
# TODO: remove this after we've migrated all tests and scripts
env_vars: {
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_CLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "ENABLE_BUILD_COP"
value: "true"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
}

before_action {
fetch_keystore {
keystore_resource {
Expand Down
8 changes: 7 additions & 1 deletion .kokoro/nightly/samples.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ env_vars: {
value: "samples"
}

# TODO: remove this after we've migrated all tests and scripts
env_vars: {
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
value: "java-docs-samples-testing"
}

env_vars: {
key: "GOOGLE_CLOUD_PROJECT"
value: "java-docs-samples-testing"
}

env_vars: {
Expand Down
14 changes: 10 additions & 4 deletions .kokoro/presubmit/integration.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ env_vars: {
value: "integration"
}

# TODO: remove this after we've migrated all tests and scripts
env_vars: {
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
key: "GOOGLE_CLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
}

before_action {
Expand Down
14 changes: 10 additions & 4 deletions .kokoro/presubmit/samples.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ env_vars: {
value: "samples"
}

# TODO: remove this after we've migrated all tests and scripts
env_vars: {
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
key: "GCLOUD_PROJECT"
value: "java-docs-samples-testing"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
key: "GOOGLE_CLOUD_PROJECT"
value: "java-docs-samples-testing"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
}

before_action {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.google.pubsub.v1.CreateSnapshotRequest;
import com.google.pubsub.v1.DeleteSnapshotRequest;
import com.google.pubsub.v1.DeleteSubscriptionRequest;
import com.google.pubsub.v1.GetSnapshotRequest;
import com.google.pubsub.v1.GetSubscriptionRequest;
import com.google.pubsub.v1.ListSnapshotsRequest;
import com.google.pubsub.v1.ListSnapshotsResponse;
Expand Down Expand Up @@ -861,6 +862,110 @@ public final UnaryCallable<DeleteSubscriptionRequest, Empty> deleteSubscriptionC
return stub.deleteSubscriptionCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Gets the configuration details of a snapshot. Snapshots are used in &lt;a
* href="https://cloud.google.com/pubsub/docs/replay-overview"&gt;Seek&lt;/a&gt; operations, which
* allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment
* state of messages in an existing subscription to the state captured by a snapshot.
*
* <p>Sample code:
*
* <pre><code>
* try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
* ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
* Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
* }
* </code></pre>
*
* @param snapshot Required. The name of the snapshot to get. Format is
* `projects/{project}/snapshots/{snap}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
/* package-private */ final Snapshot getSnapshot(ProjectSnapshotName snapshot) {
GetSnapshotRequest request =
GetSnapshotRequest.newBuilder()
.setSnapshot(snapshot == null ? null : snapshot.toString())
.build();
return getSnapshot(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Gets the configuration details of a snapshot. Snapshots are used in &lt;a
* href="https://cloud.google.com/pubsub/docs/replay-overview"&gt;Seek&lt;/a&gt; operations, which
* allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment
* state of messages in an existing subscription to the state captured by a snapshot.
*
* <p>Sample code:
*
* <pre><code>
* try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
* ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
* Snapshot response = subscriptionAdminClient.getSnapshot(snapshot.toString());
* }
* </code></pre>
*
* @param snapshot Required. The name of the snapshot to get. Format is
* `projects/{project}/snapshots/{snap}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
/* package-private */ final Snapshot getSnapshot(String snapshot) {
GetSnapshotRequest request = GetSnapshotRequest.newBuilder().setSnapshot(snapshot).build();
return getSnapshot(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Gets the configuration details of a snapshot. Snapshots are used in &lt;a
* href="https://cloud.google.com/pubsub/docs/replay-overview"&gt;Seek&lt;/a&gt; operations, which
* allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment
* state of messages in an existing subscription to the state captured by a snapshot.
*
* <p>Sample code:
*
* <pre><code>
* try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
* ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
* GetSnapshotRequest request = GetSnapshotRequest.newBuilder()
* .setSnapshot(snapshot.toString())
* .build();
* Snapshot response = subscriptionAdminClient.getSnapshot(request);
* }
* </code></pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
/* package-private */ final Snapshot getSnapshot(GetSnapshotRequest request) {
return getSnapshotCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Gets the configuration details of a snapshot. Snapshots are used in &lt;a
* href="https://cloud.google.com/pubsub/docs/replay-overview"&gt;Seek&lt;/a&gt; operations, which
* allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment
* state of messages in an existing subscription to the state captured by a snapshot.
*
* <p>Sample code:
*
* <pre><code>
* try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
* ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
* GetSnapshotRequest request = GetSnapshotRequest.newBuilder()
* .setSnapshot(snapshot.toString())
* .build();
* ApiFuture&lt;Snapshot&gt; future = subscriptionAdminClient.getSnapshotCallable().futureCall(request);
* // Do something
* Snapshot response = future.get();
* }
* </code></pre>
*/
/* package-private */ final UnaryCallable<GetSnapshotRequest, Snapshot> getSnapshotCallable() {
return stub.getSnapshotCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Modifies the ack deadline for a specific message. This method is useful to indicate that more
Expand Down Expand Up @@ -1989,7 +2094,7 @@ public final UnaryCallable<SeekRequest, SeekResponse> seekCallable() {
/**
* Sets the access control policy on the specified resource. Replaces any existing policy.
*
* <p>Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
* <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -2046,7 +2151,7 @@ public final Policy setIamPolicy(String resource, Policy policy) {
/**
* Sets the access control policy on the specified resource. Replaces any existing policy.
*
* <p>Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
* <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -2142,7 +2247,7 @@ public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() {
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns permissions that a caller has on the specified resource. If the resource does not
* exist, this will return an empty set of permissions, not a NOT_FOUND error.
* exist, this will return an empty set of permissions, not a `NOT_FOUND` error.
*
* <p>Note: This operation is designed to be used for building permission-aware UIs and
* command-line tools, not for authorization checking. This operation may "fail open" without
Expand Down Expand Up @@ -2209,7 +2314,7 @@ public final TestIamPermissionsResponse testIamPermissions(
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns permissions that a caller has on the specified resource. If the resource does not
* exist, this will return an empty set of permissions, not a NOT_FOUND error.
* exist, this will return an empty set of permissions, not a `NOT_FOUND` error.
*
* <p>Note: This operation is designed to be used for building permission-aware UIs and
* command-line tools, not for authorization checking. This operation may "fail open" without
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import com.google.pubsub.v1.CreateSnapshotRequest;
import com.google.pubsub.v1.DeleteSnapshotRequest;
import com.google.pubsub.v1.DeleteSubscriptionRequest;
import com.google.pubsub.v1.GetSnapshotRequest;
import com.google.pubsub.v1.GetSubscriptionRequest;
import com.google.pubsub.v1.ListSnapshotsRequest;
import com.google.pubsub.v1.ListSnapshotsResponse;
Expand Down Expand Up @@ -122,6 +123,11 @@ public UnaryCallSettings<DeleteSubscriptionRequest, Empty> deleteSubscriptionSet
return ((SubscriberStubSettings) getStubSettings()).deleteSubscriptionSettings();
}

/** Returns the object with the settings used for calls to getSnapshot. */
/* package-private */ UnaryCallSettings<GetSnapshotRequest, Snapshot> getSnapshotSettings() {
return ((SubscriberStubSettings) getStubSettings()).getSnapshotSettings();
}

/** Returns the object with the settings used for calls to modifyAckDeadline. */
/* package-private */ UnaryCallSettings<ModifyAckDeadlineRequest, Empty>
modifyAckDeadlineSettings() {
Expand Down Expand Up @@ -318,6 +324,12 @@ public UnaryCallSettings.Builder<Subscription, Subscription> createSubscriptionS
return getStubSettingsBuilder().deleteSubscriptionSettings();
}

/** Returns the builder for the settings used for calls to getSnapshot. */
/* package-private */ UnaryCallSettings.Builder<GetSnapshotRequest, Snapshot>
getSnapshotSettings() {
return getStubSettingsBuilder().getSnapshotSettings();
}

/** Returns the builder for the settings used for calls to modifyAckDeadline. */
/* package-private */ UnaryCallSettings.Builder<ModifyAckDeadlineRequest, Empty>
modifyAckDeadlineSettings() {
Expand Down
Loading