diff --git a/fcli-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/ssc/SSCTestSpec.groovy b/fcli-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/ssc/SSCTestSpec.groovy new file mode 100644 index 0000000000..a20ddb1f49 --- /dev/null +++ b/fcli-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/ssc/SSCTestSpec.groovy @@ -0,0 +1,35 @@ +/** + * Copyright 2023 Open Text. + * + * The only warranties for products and services of Open Text + * and its affiliates and licensors ("Open Text") are as may + * be set forth in the express warranty statements accompanying + * such products and services. Nothing herein should be construed + * as constituting an additional warranty. Open Text shall not be + * liable for technical or editorial errors or omissions contained + * herein. The information contained herein is subject to change + * without notice. + */ +package com.fortify.cli.ftest.ssc + +import static com.fortify.cli.ftest._common.spec.FcliSessionType.SSC + +import com.fortify.cli.ftest._common.spec.FcliBaseSpec +import com.fortify.cli.ftest._common.spec.FcliSession +import com.fortify.cli.ftest._common.spec.Prefix +import com.fortify.cli.ftest.ssc._common.SSCGlobal + +@Prefix("test") @FcliSession(SSC) +class SSCTestSpec extends FcliBaseSpec { + def setupSpec() { + println "setup" + } + + def "t"() { + println SSCGlobal.AppVersion.eightball.version + when: + def a = "b" + then: + a=="b" + } +} diff --git a/fcli-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/ssc/_common/SSCAppVersionSupplier.groovy b/fcli-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/ssc/_common/SSCAppVersionSupplier.groovy index b0116b6d64..8a78d27599 100644 --- a/fcli-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/ssc/_common/SSCAppVersionSupplier.groovy +++ b/fcli-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/ssc/_common/SSCAppVersionSupplier.groovy @@ -35,7 +35,7 @@ public class SSCAppVersionSupplier implements Closeable, AutoCloseable { - public class SSCAppVersion { + public static class SSCAppVersion { private final String random = System.currentTimeMillis() private final String fcliVariableName = "ssc_appversion_"+random private final String appName = "fcli-"+random diff --git a/fcli-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/ssc/_common/SSCGlobal.groovy b/fcli-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/ssc/_common/SSCGlobal.groovy new file mode 100644 index 0000000000..c0c0a92519 --- /dev/null +++ b/fcli-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/ssc/_common/SSCGlobal.groovy @@ -0,0 +1,55 @@ +package com.fortify.cli.ftest.ssc._common; + +import org.spockframework.runtime.extension.IGlobalExtension + +import com.fortify.cli.ftest._common.Fcli +import com.fortify.cli.ftest.ssc._common.SSCAppVersionSupplier.SSCAppVersion + +import groovy.transform.CompileStatic + +@CompileStatic +class SSCGlobal implements IGlobalExtension { + @Override + public void start() {} + + @Override + public void stop() { + AppVersion.values().each { v->v.close() } + } + + public static enum AppVersion implements Closeable, AutoCloseable { + empty(AppVersion.&initEmpty), + eightball(AppVersion.&initEightball), + + private SSCAppVersion version; + private Closure initVersion; + private AppVersion(Closure initVersion) { + this.initVersion = initVersion; + } + + private static void initEmpty(SSCAppVersion version) { + + } + + private static void initEightball(SSCAppVersion version) { + //Fcli.run("ssc artifact upload -f $fpr1 --appversion ${version.variableRef} --store globalEightBallFpr") + //Fcli.run("ssc artifact wait-for ::globalEightBallFpr:: -i 2s") + } + + public SSCAppVersion getVersion() { + if ( !version ) { + version = new SSCAppVersion().create() + initVersion(version) + } + return version + } + + @Override + public void close() { + if ( version ) { + version.close(); + version = null; + } + } + } +} \ No newline at end of file diff --git a/fcli-other/fcli-functional-test/src/ftest/resources/META-INF/services/org.spockframework.runtime.extension.IGlobalExtension b/fcli-other/fcli-functional-test/src/ftest/resources/META-INF/services/org.spockframework.runtime.extension.IGlobalExtension index a2c482bbb2..e0b3452b41 100644 --- a/fcli-other/fcli-functional-test/src/ftest/resources/META-INF/services/org.spockframework.runtime.extension.IGlobalExtension +++ b/fcli-other/fcli-functional-test/src/ftest/resources/META-INF/services/org.spockframework.runtime.extension.IGlobalExtension @@ -1,3 +1,4 @@ +com.fortify.cli.ftest.ssc._common.SSCGlobal com.fortify.cli.ftest._common.extension.FcliInitializerExtension com.fortify.cli.ftest._common.extension.TestResourceExtension com.fortify.cli.ftest._common.extension.TempPathExtension