-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ftest: Partial implementation for global SSC functionality
- Loading branch information
Showing
4 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/ssc/SSCTestSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
.../fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/ssc/_common/SSCGlobal.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...c/ftest/resources/META-INF/services/org.spockframework.runtime.extension.IGlobalExtension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters