Search in sources :

Example 11 with DefaultStellarStatefulExecutor

use of org.apache.metron.stellar.common.DefaultStellarStatefulExecutor in project metron by apache.

the class BatchProfilerIntegrationTest method setup.

@BeforeEach
public void setup() {
    readerProperties = new Properties();
    profilerProperties = new Properties();
    // the output will be written to a mock HBase table
    String tableName = HBASE_TABLE_NAME.get(profilerProperties, String.class);
    String columnFamily = HBASE_COLUMN_FAMILY.get(profilerProperties, String.class);
    profilerProperties.put(HBASE_TABLE_PROVIDER.getKey(), MockHBaseTableProvider.class.getName());
    // create the mock hbase table
    MockHBaseTableProvider.addToCache(tableName, columnFamily);
    // define the globals required by `PROFILE_GET`
    Map<String, Object> global = new HashMap<String, Object>() {

        {
            put(PROFILER_HBASE_TABLE.getKey(), tableName);
            put(PROFILER_COLUMN_FAMILY.getKey(), columnFamily);
            put(PROFILER_HBASE_TABLE_PROVIDER.getKey(), MockHBaseTableProvider.class.getName());
        }
    };
    // create the stellar execution environment
    executor = new DefaultStellarStatefulExecutor(new SimpleFunctionResolver().withClass(GetProfile.class).withClass(FixedLookback.class).withClass(WindowLookback.class).withClass(DataStructureFunctions.Length.class).withClass(StringFunctions.GetFirst.class).withClass(StellarStatisticsFunctions.Count.class).withClass(StellarStatisticsFunctions.Sum.class), new Context.Builder().with(Context.Capabilities.GLOBAL_CONFIG, () -> global).build());
}
Also used : MockHBaseTableProvider(org.apache.metron.hbase.mock.MockHBaseTableProvider) HashMap(java.util.HashMap) Properties(java.util.Properties) StringFunctions(org.apache.metron.stellar.dsl.functions.StringFunctions) FixedLookback(org.apache.metron.profiler.client.stellar.FixedLookback) DefaultStellarStatefulExecutor(org.apache.metron.stellar.common.DefaultStellarStatefulExecutor) SimpleFunctionResolver(org.apache.metron.stellar.dsl.functions.resolver.SimpleFunctionResolver) StellarStatisticsFunctions(org.apache.metron.statistics.StellarStatisticsFunctions) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

DefaultStellarStatefulExecutor (org.apache.metron.stellar.common.DefaultStellarStatefulExecutor)11 SimpleFunctionResolver (org.apache.metron.stellar.dsl.functions.resolver.SimpleFunctionResolver)10 MockHBaseTableProvider (org.apache.metron.hbase.mock.MockHBaseTableProvider)6 BeforeEach (org.junit.jupiter.api.BeforeEach)6 ColumnBuilder (org.apache.metron.profiler.hbase.ColumnBuilder)4 RowKeyBuilder (org.apache.metron.profiler.hbase.RowKeyBuilder)4 SaltyRowKeyBuilder (org.apache.metron.profiler.hbase.SaltyRowKeyBuilder)4 ValueOnlyColumnBuilder (org.apache.metron.profiler.hbase.ValueOnlyColumnBuilder)4 HashMap (java.util.HashMap)3 JSONObject (org.json.simple.JSONObject)3 Table (org.apache.hadoop.hbase.client.Table)2 ProfileWriter (org.apache.metron.profiler.client.ProfileWriter)2 FixedLookback (org.apache.metron.profiler.client.stellar.FixedLookback)2 StellarStatefulExecutor (org.apache.metron.stellar.common.StellarStatefulExecutor)2 Properties (java.util.Properties)1 GetDataBuilder (org.apache.curator.framework.api.GetDataBuilder)1 TableProvider (org.apache.metron.hbase.TableProvider)1 StandAloneProfiler (org.apache.metron.profiler.StandAloneProfiler)1 VerboseProfile (org.apache.metron.profiler.client.stellar.VerboseProfile)1 StellarStatisticsFunctions (org.apache.metron.statistics.StellarStatisticsFunctions)1