#!groovy
// Copyright 2017 Open Networking Foundation (ONF)
//
// Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
// the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
// or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
//
//     TestON is free software: you can redistribute it and/or modify
//     it under the terms of the GNU General Public License as published by
//     the Free Software Foundation, either version 2 of the License, or
//     (at your option) any later version.
//
//     TestON is distributed in the hope that it will be useful,
//     but WITHOUT ANY WARRANTY; without even the implied warranty of
//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//     GNU General Public License for more details.
//
//     You should have received a copy of the GNU General Public License
//     along with TestON.  If not, see <http://www.gnu.org/licenses/>.

// This is the Jenkins script for USECASE-pipeline-<branch>

// set the dependencies.
funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
test_list = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' )
fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )

// init configuration of funcs to be USECASE
fileRelated.init()
test_list.init()
funcs.initialize( "USECASE" );

// read the TestON.property files and save it as a dictionary
def prop = null
prop = funcs.getProperties( "USECASE" )
USECASE_tests = test_list.getTestsFromCategory( "USECASE" )

// save directory and file.
graph_generator_file = fileRelated.trendIndividual
graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-BM/"

// get tests to run.
echo( "Testcases:" )
def testsToRun = null
testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
funcs.printTestToRun( testsToRun )

// save the function of the test running into the dictionary.
def tests = [ : ]
for ( String test : USECASE_tests.keySet() ){
    toBeRun = testsToRun.contains( test )
    def stepName = ( toBeRun ? "" : "Not " ) + "Running $test"
    def pureTestName = ( USECASE_tests[ test ].containsKey( "test" ) ? USECASE_tests[ test ][ "test" ].split().head() : test )
    tests[ stepName ] = funcs.runTest( test, toBeRun, prop, pureTestName, false,
                                       USECASE_tests, graph_generator_file, graph_saved_directory )
}

// get start time of the test.
start = funcs.getCurrentTime()
// run the tests sequentially
for ( test in tests.keySet() ){
    tests[ test ].call()
}

// send the result to slack after USECASE test is done.
funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )

// generate the overall graph for USECASE.
funcs.generateOverallGraph( prop, USECASE_tests, graph_saved_directory )
