[ 
https://issues.apache.org/jira/browse/FLINK-4110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15346750#comment-15346750
 ] 

ASF GitHub Bot commented on FLINK-4110:
---------------------------------------

Github user tzulitai commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2153#discussion_r68272113
  
    --- Diff: 
flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/test/java/TestSkeleton.java
 ---
    @@ -0,0 +1,184 @@
    +/*
    + * 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 ${package};
    +
    +
    +import org.apache.flink.api.common.functions.FlatMapFunction;
    +import org.apache.flink.api.java.tuple.Tuple1;
    +import org.apache.flink.configuration.ConfigConstants;
    +import org.apache.flink.configuration.Configuration;
    +import org.apache.flink.streaming.api.datastream.DataStream;
    +import 
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
    +import org.apache.flink.streaming.api.functions.source.SourceFunction;
    +import org.apache.flink.test.util.ForkableFlinkMiniCluster;
    +import org.apache.flink.test.util.SuccessException;
    +import org.apache.flink.test.util.TestUtils;
    +import org.apache.flink.util.Collector;
    +import org.junit.AfterClass;
    +import org.junit.Assert;
    +import org.junit.BeforeClass;
    +import org.junit.Test;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +/**
    + * Skeleton class showing how to write integration tests against a running 
embedded Flink
    + * testing cluster.
    + */
    +public class TestSkeleton {
    +
    +   protected static final Logger LOG = 
LoggerFactory.getLogger(TestSkeleton.class);
    +   private static ForkableFlinkMiniCluster flink;
    +   private static int flinkPort;
    +
    +   /**
    +    * Start a re-usable Flink mini cluster
    +    */
    +   @BeforeClass
    +   public static void setupFlink() {
    +           Configuration flinkConfig = new Configuration();
    +           
flinkConfig.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, 1);
    +           
flinkConfig.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, 8);
    +           
flinkConfig.setInteger(ConfigConstants.TASK_MANAGER_MEMORY_SIZE_KEY, 16);
    +           
flinkConfig.setString(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY, "0 
s");
    +
    +           flink = new ForkableFlinkMiniCluster(flinkConfig, false);
    +           flink.start();
    +
    +           flinkPort = flink.getLeaderRPCPort();
    +           LOG.info("Started a Flink testing cluster on port {}", 
flinkPort);
    +   }
    +
    +
    +   /**
    +    * This test uses a finite stream. The TestingSource will stop after 
1000 elements have been send.
    --- End diff --
    
    send --> sent


> Provide testing skeleton in quickstarts
> ---------------------------------------
>
>                 Key: FLINK-4110
>                 URL: https://issues.apache.org/jira/browse/FLINK-4110
>             Project: Flink
>          Issue Type: Improvement
>          Components: Build System, Quickstarts
>    Affects Versions: 1.1.0
>            Reporter: Robert Metzger
>
> Users often ask how they can test their Flink code.
> I suggest to provide a very simple skeleton / example in the quickstarts, 
> showing how its done.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to