yypsybs
2023-09-09 3cb5a54def670d97301f07170fcaad213bfc54f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Quintiq file version 2.0
#parent: #root
Method CreateDemoDataset
{
  Description: 'Create default demo dataset or create dataset and import from path defined in GetTestDataPath, reusable for other test cases'
  TextBody:
  [*
    opt := DatasetFindOptions::Construct( GlobalParameters_MP::GetDatasetScenarioManager() );
    scenariomanager := MDSScenarioManager::Find( opt );
    
    opt := DatasetFindOptions::Construct();
    mpsync := MDSMPSync::Find( opt );
    
    opt := DatasetFindOptions::Construct()
    mpdomainhandler := MDSMPDomainHandler::Find( opt );
    
    opt := DatasetFindOptions::Construct();
    swfworkflow := MDSSWF_WorkflowDataset::Find( opt );
    
    if ( this.GetDemoScenario() <> "" )
    {
      scenariomanager->( scenariodataset)
      {
        demo := select( scenariodataset, ScenarioMP, scenario, scenario.Name() = this.GetDemoScenario() and scenario.Parent().Name() = this.GetDemoFolder() )    
        if ( isnull( demo ) )
        {
          scenariomanager.CreateDemoScenariosAndImport( this.GetDemoFolder(), this.GetDemoScenario() , mpsync, mpdomainhandler, swfworkflow, "UTF" );
        }
          
      }
    }
    
    // Create scenario and import data if there is a test data path specified
    else if( this.GetTestDataPath() <> "" )
    { 
      scenariomanager->( scenariodataset )
      { 
        scenario := select( scenariodataset, ScenarioMP, scenario, scenario.Name() = this.GetUTFDatasetname() );
        if( isnull( scenario ) )
        {
          this.CreateScenarioAndImportDataFromPath( mpsync, scenariomanager );
        }
      }
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}