apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davidyan74 <...@git.apache.org>
Subject [GitHub] apex-malhar pull request #343: [Review Only] APEXMALHAR-1701: Deduper using ...
Date Fri, 15 Jul 2016 21:58:55 GMT
Github user davidyan74 commented on a diff in the pull request:

    https://github.com/apache/apex-malhar/pull/343#discussion_r71046708
  
    --- Diff: library/src/test/java/org/apache/apex/malhar/lib/dedup/WindowedDeduperTest.java
---
    @@ -0,0 +1,160 @@
    +/**
    + * 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.apex.malhar.lib.dedup;
    +
    +import java.util.Date;
    +import java.util.List;
    +import java.util.Random;
    +
    +import org.joda.time.Duration;
    +import org.junit.Assert;
    +import org.junit.BeforeClass;
    +import org.junit.Test;
    +
    +import org.apache.apex.malhar.lib.window.Accumulation;
    +import org.apache.apex.malhar.lib.window.Tuple;
    +import org.apache.apex.malhar.lib.window.Tuple.TimestampedTuple;
    +import org.apache.apex.malhar.lib.window.WindowOption;
    +import org.apache.apex.malhar.lib.window.WindowState;
    +import org.apache.apex.malhar.lib.window.impl.InMemoryWindowedStorage;
    +
    +import com.google.common.collect.Lists;
    +
    +import com.datatorrent.api.Context.OperatorContext;
    +import com.datatorrent.lib.helper.OperatorContextTestHelper;
    +import com.datatorrent.lib.testbench.CollectorTestSink;
    +import com.datatorrent.lib.util.TestUtils;
    +import com.datatorrent.stram.engine.WindowGenerator;
    +
    +public class WindowedDeduperTest
    +{
    +  private static final int OPERATOR_ID = 0;
    +  private static AbstractWindowedDeduper<TestPojo> dedup;
    +  private static final int WINDOW_SPAN = 10;
    +  private static final int FIXED_WATERMARK = 30;
    +
    +  /**
    +   * Windowed Deduper Test Implementation
    +   * Tuples of type {@link TestPojo}
    +   */
    +  public static class WindowedDeduperImpl extends AbstractWindowedDeduper<TestPojo>
    +  {
    +    @Override
    +    protected Object getKey(TestPojo tuple)
    +    {
    +      return tuple.getKey();
    +    }
    +  }
    +
    +  @SuppressWarnings({ "rawtypes", "unchecked" })
    +  @BeforeClass
    +  public static void setup()
    +  {
    +    dedup = new WindowedDeduperImpl();
    +    // Define accumulation
    +    Accumulation dedupAccum = new DedupAccumulation<TestPojo>();
    +    dedup.setAccumulation(dedupAccum);
    +    // Set storage to InMemory implementation
    +    dedup.setDataStorage(new InMemoryWindowedStorage<List<TestPojo>>());
    +    // Set retraction storage. Not used, but is required by the abstract operator.
    +    dedup.setRetractionStorage(new InMemoryWindowedStorage<TestPojo>());
    --- End diff --
    
    I see where the problem is. I have a fix here in my newest review-only PR: #345 


---
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