metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickwallen <...@git.apache.org>
Subject [GitHub] incubator-metron pull request #226: METRON-377 Enable Profiles that Use Non-...
Date Wed, 24 Aug 2016 16:35:36 GMT
Github user nickwallen commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/226#discussion_r76092175
  
    --- Diff: metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/StellarStatisticsFunctionsTest.java
---
    @@ -0,0 +1,244 @@
    +/*
    + *
    + *  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.metron.common.stellar;
    +
    +import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
    +import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
    +import org.apache.metron.common.dsl.Context;
    +import org.apache.metron.common.dsl.ParseException;
    +import org.apache.metron.common.dsl.StellarFunctions;
    +import org.junit.Before;
    +import org.junit.Test;
    +import org.junit.runner.RunWith;
    +import org.junit.runners.Parameterized;
    +
    +import java.util.Arrays;
    +import java.util.Collection;
    +import java.util.HashMap;
    +import java.util.List;
    +import java.util.Map;
    +
    +import static org.junit.Assert.assertEquals;
    +import static org.junit.Assert.assertNotNull;
    +
    +/**
    + * Tests the statistical summary functions of Stellar.
    + */
    +@RunWith(Parameterized.class)
    +public class StellarStatisticsFunctionsTest {
    +
    +  private List<Double> values;
    +  private Map<String, Object> variables;
    +  private DescriptiveStatistics stats;
    +  private SummaryStatistics summaryStats;
    +  private int windowSize;
    +
    +  public StellarStatisticsFunctionsTest(int windowSize) {
    +    this.windowSize = windowSize;
    +  }
    +
    +  @Parameterized.Parameters
    +  public static Collection<Object[]> data() {
    +    // each test will be run against these values for windowSize
    +    return Arrays.asList(new Object[][] {{ 0 }, { 100 }});
    +  }
    +
    +  /**
    +   * Runs a Stellar expression.
    +   * @param expr The expression to run.
    +   * @param variables The variables available to the expression.
    +   */
    +  private static Object run(String expr, Map<String, Object> variables) {
    +    StellarProcessor processor = new StellarProcessor();
    +    return processor.parse(expr, x -> variables.get(x), StellarFunctions.FUNCTION_RESOLVER(),
Context.EMPTY_CONTEXT());
    --- End diff --
    
    Yes.  Will be fixed once I merge in all those changes from METRON-372.  Almost there


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