All Downloads are FREE. Search and download functionalities are using the official Maven repository.

core_ingest.tests.barrierTests.pure Maven / Gradle / Ivy

There is a newer version: 4.67.9
Show newest version

import meta::legend::*;
import meta::external::ingest::barrier::*;
import meta::external::ingest::metamodel::*;

function <> meta::external::ingest::tests::testAvailabilityForSingleDataset() : Boolean[1]
{
  fail('Needs fix in plan generation and clustering');

  let prevPublishedWatermark = ^Watermark(watermarkId='watermark1',
                          datasetMarks = [^DatasetMark(datasetName='Dataset1',batchId=1)]);
  
  let currentWM = ^Watermark(watermarkId='watermark2',
                          datasetMarks = [^DatasetMark(datasetName='Dataset1',batchId=3)]);
  
  let ingestConfig = ^IngestConfig(datasetName = 'Dataset1', metadataType = EodBatchMetadata);
  
  let barrierQuery = {
    
      prevPublishedWatermark: Watermark[1] , currentWatermark: Watermark[1] | isDatasetAvailable($ingestConfig, $prevPublishedWatermark, $currentWatermark);

  };

  let result = executeLegendQuery($barrierQuery,[^Pair(first='prevPublishedWatermark',second=$prevPublishedWatermark),^Pair(first='currentWM',second=$currentWM)],^meta::pure::runtime::ExecutionContext(),meta::relational::extension::relationalExtensions());
  
  assertEquals(true,$result);
}

function <> meta::external::ingest::tests::testAvailabilityForMultipleDatasets() : Boolean[1]
{
  fail('Needs fix in plan generation and clustering');

  let prevPublishedWatermark = ^Watermark(watermarkId='watermark1',
                          datasetMarks = [^DatasetMark(datasetName='Dataset1',batchId=1)]);
  
  let currentWM = ^Watermark(watermarkId='watermark2',
                          datasetMarks = [^DatasetMark(datasetName='Dataset1',batchId=3)]);
  
  let ingestConfig1 = ^IngestConfig(datasetName = 'Dataset1', metadataType = EodBatchMetadata);
  
  let ingestConfig2 = ^IngestConfig(datasetName = 'Dataset2', metadataType = EodBatchMetadata);
  
  let barrierQuery = {
    
      prevPublishedWatermark: Watermark[1] , currentWatermark: Watermark[1] | isDatasetAvailable($ingestConfig1, $prevPublishedWatermark, $currentWatermark)
                                                                  && isDatasetAvailable($ingestConfig2, $prevPublishedWatermark, $currentWatermark);
  };

  let result = executeLegendQuery($barrierQuery,[^Pair(first='prevPublishedWatermark',second=$prevPublishedWatermark),^Pair(first='currentWM',second=$currentWM)],^meta::pure::runtime::ExecutionContext(),meta::relational::extension::relationalExtensions());
  
  assertEquals(true,$result);
}

function <> meta::external::ingest::tests::testAvailabilityForSingleDatasetWithFilter() : Boolean[1]
{
  fail('Needs fix in plan generation and clustering');

  let prevPublishedWatermark = ^Watermark(watermarkId='watermark1',
                          datasetMarks = [^DatasetMark(datasetName='Dataset1',batchId=1)]);
  
  let currentWM = ^Watermark(watermarkId='watermark2',
                          datasetMarks = [^DatasetMark(datasetName='Dataset1',batchId=3)]);
  
  let ingestConfig = ^IngestConfig(datasetName = 'Dataset1', metadataType = EodBatchMetadata);
  
  let barrierQuery = {
    
      prevPublishedWatermark: Watermark[1] , currentWatermark: Watermark[1] | isDatasetAvailable($ingestConfig,x | $x.endOfDay, $prevPublishedWatermark, $currentWatermark);

  };

  let result = executeLegendQuery($barrierQuery,[^Pair(first='prevPublishedWatermark',second=$prevPublishedWatermark),^Pair(first='currentWM',second=$currentWM)],^meta::pure::runtime::ExecutionContext(),meta::relational::extension::relationalExtensions());
  
  assertEquals(true,$result);
}

function <> meta::external::ingest::tests::testAvailabilityForMultipleDatasetsWithFilter() : Boolean[1]
{
  fail('Needs fix in plan generation and clustering');

  let prevPublishedWatermark = ^Watermark(watermarkId='watermark1',
                          datasetMarks = [^DatasetMark(datasetName='Dataset1',batchId=1)]);
  
  let currentWM = ^Watermark(watermarkId='watermark2',
                          datasetMarks = [^DatasetMark(datasetName='Dataset1',batchId=3)]);
  
  let ingestConfig1 = ^IngestConfig(datasetName = 'Dataset1', metadataType = EodBatchMetadata);
  
  let ingestConfig2 = ^IngestConfig(datasetName = 'Dataset2', metadataType = EodBatchMetadata);
  
  let barrierQuery = {
    
      prevPublishedWatermark: Watermark[1] , currentWatermark: Watermark[1] | isDatasetAvailable($ingestConfig1,x | $x.endOfDay, $prevPublishedWatermark, $currentWatermark)
                                                                  && isDatasetAvailable($ingestConfig2,x | $x.endOfDay, $prevPublishedWatermark, $currentWatermark);
  };

  let result = executeLegendQuery($barrierQuery,[^Pair(first='prevPublishedWatermark',second=$prevPublishedWatermark),^Pair(first='currentWM',second=$currentWM)],^meta::pure::runtime::ExecutionContext(),meta::relational::extension::relationalExtensions());
  
  assertEquals(true,$result);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy