This file contains hidden or 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
jsonServer = | |
new GenericContainer("zhenik/json-server") | |
.withExposedPorts(80) | |
// all containers put in same network | |
.withNetwork(network) | |
.withEnv("ID_MAP", "id") | |
// all containers put in same network | |
.withNetworkAliases("json-server") | |
// mount volume | |
.withClasspathResourceMapping( |
This file contains hidden or 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
/** | |
* Base test abstract class contains setup to | |
* initialize testing environment. | |
*/ | |
public abstract class ContainersTestBaseIT { | |
// singleton containers https://www.testcontainers.org/test_framework_integration/manual_lifecycle_control/#singleton-containers | |
static { | |
final Network commonNetwork = Network.newNetwork(); | |
setZookeeperAndKafka(commonNetwork); |
This file contains hidden or 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
public class ApplicationIT { | |
@ClassRule | |
public static final EmbeddedSingleNodeKafkaCluster CLUSTER = | |
new EmbeddedSingleNodeKafkaCluster(); | |
@Test | |
public void clusterIsRunning() { | |
assertTrue(CLUSTER.isRunning()); | |
} |
This file contains hidden or 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
@Test | |
public void testTopologyAvro_statefulProcessors() throws IOException, RestClientException { | |
/** Arrange */ | |
final String storeName = "same-name"; | |
final SpecificAvroSerde<Person> serde = new SpecificAvroSerde<>(schemaRegistryClient); | |
final Map<String, String> schema = | |
Collections.singletonMap( | |
AbstractKafkaAvroSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, | |
"wat-ever-url-anyway-it-is-mocked"); |
This file contains hidden or 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
// stateful | |
public static Topology topologyCountUsersWithSameName( | |
String sourceTopic, | |
String sinkTopic, | |
final Serde<Person> personSerdes, | |
final String storeName) { | |
final StreamsBuilder builder = new StreamsBuilder(); | |
builder.stream(sourceTopic, Consumed.with(Serdes.String(), personSerdes)) | |
.groupBy((key, value) -> value.getName()) |
This file contains hidden or 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
private TopologyTestDriver testDriver; | |
private MockSchemaRegistryClient schemaRegistryClient; | |
@Before | |
public void start() { | |
schemaRegistryClient = new MockSchemaRegistryClient(); | |
} | |
@After | |
public void tearDown() { |
This file contains hidden or 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
# Created by .ignore support plugin (hsz.mobi) | |
### Maven template | |
target/ | |
pom.xml.tag | |
pom.xml.releaseBackup | |
pom.xml.versionsBackup | |
pom.xml.next | |
release.properties | |
dependency-reduced-pom.xml | |
buildNumber.properties |
This file contains hidden or 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
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.StringJoiner; | |
/** | |
* Created by NIK on 27.11.15. | |
*/ | |
public class Main2 { | |
public static void main(String[] args) { |
This file contains hidden or 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
import java.util.ArrayList; | |
import java.util.Arrays; | |
/** | |
* Created by NIK on 27.11.15. | |
*/ | |
public class Main { | |
public static void main(String[] args) { |
NewerOlder