Skip to content

Commit

Permalink
Add DataStream to Spanner IT
Browse files Browse the repository at this point in the history
Signed-off-by: Jeffrey Kinard <jeff@thekinards.com>
  • Loading branch information
Polber committed Dec 13, 2023
1 parent b7e51fd commit 88903da
Show file tree
Hide file tree
Showing 22 changed files with 1,491 additions and 392 deletions.
47 changes: 47 additions & 0 deletions it/conditions/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright (C) 2023 Google Inc.
~
~ 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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.google.cloud.teleport</groupId>
<artifactId>integration-testing-lib</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>it-conditions</artifactId>

<properties>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-it-conditions</artifactId>
</dependency>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
<version>${autovalue.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value-annotations</artifactId>
<version>${autovalue.version}</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.apache.beam.it.conditions;

import com.google.auto.value.AutoValue;
import java.util.List;
import org.apache.commons.lang3.NotImplementedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* The ChainedConditionCheck class provides a base interface for chaining {@link ConditionCheck}
* checks. Each subsequent check will wait on the previous check to complete and return true.
*/
@AutoValue
public abstract class ChainedConditionCheck extends ConditionCheck {

private static final Logger LOG = LoggerFactory.getLogger(ChainedConditionCheck.class);

private int functionIndex = 0;

abstract List<ConditionCheck> conditionChecks();

@Override
public String getDescription() {
return String.format(
"Chained condition check %d/%d...", functionIndex + 1, conditionChecks().size());
}

@Override
public Boolean get() {
LOG.info(getDescription());
if (conditionChecks().get(functionIndex).get()) {
functionIndex++;
}
return functionIndex == conditionChecks().size();
}

@Override
protected CheckResult check() {
throw new NotImplementedException("This check() should never be called.");
}

public static Builder builder(List<ConditionCheck> conditionChecks) {
return new AutoValue_ChainedConditionCheck.Builder().setConditionChecks(conditionChecks);
}

@AutoValue.Builder
public abstract static class Builder {

public abstract Builder setConditionChecks(List<ConditionCheck> setConditionChecks);

abstract ChainedConditionCheck autoBuild();

public ChainedConditionCheck build() {
return autoBuild();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 for working with test artifacts. */
package org.apache.beam.it.conditions;
Loading

0 comments on commit 88903da

Please sign in to comment.