Skip to content

Commit

Permalink
[FLINK-8982][E2E Tests] Add test for known failure of queryable state
Browse files Browse the repository at this point in the history
  • Loading branch information
florianschmidt1994 committed Apr 3, 2018
1 parent a666455 commit 1b77d82
Show file tree
Hide file tree
Showing 11 changed files with 861 additions and 2 deletions.
158 changes: 158 additions & 0 deletions flink-end-to-end-tests/flink-queryable-state-test/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
https://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="https://maven.apache.org/POM/4.0.0"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>flink-end-to-end-tests</artifactId>
<groupId>org.apache.flink</groupId>
<version>1.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>flink-queryable-state-test_${scala.binary.version}</artifactId>
<name>flink-queryable-state-test</name>

<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-statebackend-rocksdb_2.11</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>

<executions>
<!-- ClassLoaderTestProgram -->
<execution>
<id>ClassLoaderTestProgram</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>ClassLoaderTestProgram</classifier>

<archive>
<manifestEntries>
<program-class>org.apache.flink.streaming.tests.ClassLoaderTestProgram</program-class>
</manifestEntries>
</archive>

<includes>
<include>org/apache/flink/streaming/tests/ClassLoaderTestProgram.class</include>
<include>org/apache/flink/runtime/taskmanager/TaskManager.class</include>
<include>.version.properties</include>
</includes>
</configuration>
</execution>

<execution>
<id>QueryableStateEmailApp</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>QueryableStateEmailApp</classifier>
<archive>
<manifestEntries>
<program-class>
org.apache.flink.streaming.tests.queryablestate.QsBugPoc
</program-class>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>

<execution>
<id>QueryableStateEmailClient</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadeTestJar>false</shadeTestJar>
<shadedArtifactAttached>false</shadedArtifactAttached>
<createDependencyReducedPom>false</createDependencyReducedPom>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>
org.apache.flink.streaming.tests.queryablestate.QsBugClient
</mainClass>
</transformer>
</transformers>
<finalName>QueryableStateEmailClient</finalName>
<!-- TODO: This includes all dependencies, might need to be reduced -->
</configuration>
</execution>
</executions>
</plugin>

<!--simplify the name of the testing JARs for referring to them in the end-to-end test scripts-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>rename</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<copy file="${project.basedir}/target/flink-queryable-state-test_${scala.binary.version}-${project.version}-ClassLoaderTestProgram.jar" tofile="${project.basedir}/target/ClassLoaderTestProgram.jar" />
<copy file="${project.basedir}/target/flink-queryable-state-test_${scala.binary.version}-${project.version}-QueryableStateEmailApp.jar" tofile="${project.basedir}/target/QueryableStateEmailApp.jar" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* 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
*
* https://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.flink.streaming.tests.queryablestate;

import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

/**
* POJO representing an email.
*/
public class Email {

private EmailId emailId;
private Instant timestamp;
private String foo;
private LabelSurrogate label;

public Email(EmailId emailId, Instant timestamp, String foo, LabelSurrogate label) {
this.emailId = emailId;
this.timestamp = timestamp;
this.foo = foo;
this.label = label;
}

public EmailId getEmailId() {
return emailId;
}

public void setEmailId(EmailId emailId) {
this.emailId = emailId;
}

public Instant getTimestamp() {
return timestamp;
}

public void setTimestamp(Instant timestamp) {
this.timestamp = timestamp;
}

public String getFoo() {
return foo;
}

public void setFoo(String foo) {
this.foo = foo;
}

public LabelSurrogate getLabel() {
return label;
}

public void setLabel(LabelSurrogate label) {
this.label = label;
}

public String getDate() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.of("UTC"));
return formatter.format(timestamp);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* 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
*
* https://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.flink.streaming.tests.queryablestate;

import java.io.Serializable;
import java.util.Objects;

/**
* Javadoc.
*/
public class EmailId implements Serializable {

private static final long serialVersionUID = 4308637895987331290L;
private String emailId;

public EmailId() {

}

public EmailId(String emailId) {
this.emailId = Objects.requireNonNull(emailId);
}

public void setEmailId(String emailId) {
this.emailId = emailId;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

EmailId emailId1 = (EmailId) o;

return Objects.equals(emailId, emailId1.emailId);
}

@Override
public int hashCode() {
return Objects.hash(emailId);
}

public String getEmailId() {
return emailId;
}

@Override
public String toString() {
return "EmailId{" +
"emailId='" + emailId + '\'' +
'}';
}
}
Loading

0 comments on commit 1b77d82

Please sign in to comment.