eagle-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wujinhu <...@git.apache.org>
Subject [GitHub] incubator-eagle pull request #710: [EAGLE-820] add unit test for eagle-jpm-m...
Date Mon, 05 Dec 2016 02:23:38 GMT
Github user wujinhu commented on a diff in the pull request:

    https://github.com/apache/incubator-eagle/pull/710#discussion_r90795468
  
    --- Diff: eagle-jpm/eagle-jpm-mr-history/src/test/java/org/apache/eagle/jpm/mr/history/storm/JobHistorySpoutTest.java
---
    @@ -0,0 +1,176 @@
    +/*
    + * 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
    + * <p/>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p/>
    + * 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.eagle.jpm.mr.history.storm;
    +
    +import backtype.storm.spout.ISpoutOutputCollector;
    +import backtype.storm.spout.SpoutOutputCollector;
    +import backtype.storm.task.TopologyContext;
    +import com.google.common.collect.Lists;
    +import com.typesafe.config.ConfigFactory;
    +import org.apache.commons.io.FileUtils;
    +import org.apache.curator.framework.CuratorFramework;
    +import org.apache.curator.framework.CuratorFrameworkFactory;
    +import org.apache.curator.framework.imps.CuratorFrameworkState;
    +import org.apache.curator.retry.ExponentialBackoffRetry;
    +import org.apache.curator.retry.RetryNTimes;
    +import org.apache.curator.test.TestingServer;
    +import org.apache.eagle.jpm.mr.history.MRHistoryJobConfig;
    +import org.apache.eagle.jpm.mr.history.crawler.JobHistoryContentFilter;
    +import org.apache.eagle.jpm.mr.history.crawler.JobHistoryContentFilterBuilder;
    +import org.apache.eagle.jpm.util.Constants;
    +import org.apache.eagle.jpm.util.HDFSUtil;
    +import org.apache.hadoop.conf.Configuration;
    +import org.junit.After;
    +import org.junit.Assert;
    +import org.junit.Before;
    +import org.junit.Test;
    +import org.junit.runner.RunWith;
    +import org.powermock.api.mockito.PowerMockito;
    +import org.powermock.core.classloader.annotations.PowerMockIgnore;
    +import org.powermock.core.classloader.annotations.PrepareForTest;
    +import org.powermock.modules.junit4.PowerMockRunner;
    +
    +import java.io.File;
    +import java.io.IOException;
    +import java.lang.reflect.Field;
    +import java.lang.reflect.Method;
    +import java.util.ArrayList;
    +import java.util.Date;
    +import java.util.List;
    +import java.util.regex.Pattern;
    +
    +import static org.mockito.Mockito.*;
    +
    +/**
    + * Created by luokun on 12/1/16.
    + */
    +@RunWith(PowerMockRunner.class)
    +@PrepareForTest({CuratorFrameworkFactory.class, HDFSUtil.class})
    +@PowerMockIgnore({"javax.*", "com.sun.org.*","org.apache.hadoop.conf.*"})
    +public class JobHistorySpoutTest {
    +
    +    private TestingServer server;
    +    private CuratorFramework zookeeper;
    +    private MRHistoryJobConfig appConfig;
    +
    +    @Before
    +    public void setUp() throws Exception {
    +        this.appConfig = MRHistoryJobConfig.newInstance(ConfigFactory.load());
    +        createZk();
    +    }
    +
    +    @After
    +    public void tearDown() throws Exception {
    +        try {
    +            if (zookeeper != null) {
    +                if (!zookeeper.getState().equals(CuratorFrameworkState.STOPPED)) {
    +                    zookeeper.close();
    +                }
    +            }
    +        } catch (Throwable e) {
    +            e.printStackTrace();
    +        } finally {
    +            try {
    +                if (server != null) {
    +                    server.close();
    +                }
    +            } catch (IOException e) {
    +                e.printStackTrace();
    +            }
    +        }
    +    }
    +
    +    @Test
    +    public void testSpout() throws Exception {
    --- End diff --
    
    Is this unit test meaningful? There is no assert about the test data


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message