Skip to content

Commit 378cbe4

Browse files
committed
For #5670: update runFormRunner()
1 parent a8fae0f commit 378cbe4

10 files changed

+29
-29
lines changed

form-runner/jvm/src/test/scala/org/orbeon/oxf/fr/ActionsFormat20182Test.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ActionsFormat20182Test
3434
describe("Binary HTTP service within `fr:data-iterate` conditionally sets attachment") {
3535

3636
val (processorService, docOpt, _) =
37-
runFormRunner("issue", "4067", "new", document = "", initialize = true)
37+
runFormRunner("issue", "4067", "new", initialize = true)
3838

3939
val doc = docOpt.get
4040

@@ -62,7 +62,7 @@ class ActionsFormat20182Test
6262
describe("HTTP service error within `fr:data-iterate`") {
6363

6464
val (processorService, docOpt, _) =
65-
runFormRunner("issue", "4075", "new", document = "", initialize = true)
65+
runFormRunner("issue", "4075", "new", initialize = true)
6666

6767
val doc = docOpt.get
6868

@@ -78,7 +78,7 @@ class ActionsFormat20182Test
7878
describe("#4116: explicit iteration context with `fr:data-iterate`") {
7979

8080
val (processorService, docOpt, _) =
81-
runFormRunner("issue", "4116", "new", document = "", initialize = true)
81+
runFormRunner("issue", "4116", "new", initialize = true)
8282

8383
val doc = docOpt.get
8484

@@ -95,7 +95,7 @@ class ActionsFormat20182Test
9595
describe("#4204: nested `fr:data-iterate`") {
9696

9797
val (processorService, docOpt, _) =
98-
runFormRunner("issue", "4204", "new", document = "", initialize = true)
98+
runFormRunner("issue", "4204", "new", initialize = true)
9999

100100
val doc = docOpt.get
101101

form-runner/jvm/src/test/scala/org/orbeon/oxf/fr/CacheTest.scala

+5-6
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
*/
1414
package org.orbeon.oxf.fr
1515

16-
import org.orbeon.connection.{BufferedContent, StreamedContent}
17-
import org.orbeon.oxf.http.HttpMethod
16+
import cats.syntax.option.*
17+
import org.orbeon.connection.StreamedContent
1818
import org.orbeon.oxf.test.TestHttpClient.{CacheEvent, StaticState}
1919
import org.orbeon.oxf.test.{DocumentTestBase, ResourceManagerSupport}
20-
import org.orbeon.oxf.util.PathUtils
20+
import org.orbeon.oxf.util.*
2121
import org.orbeon.oxf.xforms.state.XFormsStaticStateCache
2222
import org.scalatest.funspec.AnyFunSpecLike
23-
import org.orbeon.oxf.util.*
2423

2524

2625
class CacheTest
@@ -53,15 +52,15 @@ class CacheTest
5352
.map(_._1.template.isDefined)
5453

5554
// First time may or may not pass
56-
val (_, _, events1) = runFormRunner("tests", form, mode, document = Id1, query = query, content = content, initialize = true)
55+
val (_, _, events1) = runFormRunner("tests", form, mode, documentId = Id1.some, query = query, content = content, initialize = true)
5756

5857
it(s"initial hit `$expectedInitialHit` for $form/$mode/${PathUtils.encodeSimpleQuery(query)}") {
5958
assert(staticStateFoundOpt(events1).contains(expectedInitialHit))
6059
// NOTE: no XFCD because the form has `xxf:no-updates="true"`.
6160
}
6261

6362
// Second time with different document must always pass
64-
val (_, _, events2) = runFormRunner("tests", form, mode, document = Id2, query = query, content = content, initialize = true)
63+
val (_, _, events2) = runFormRunner("tests", form, mode, documentId = Id2.some, query = query, content = content, initialize = true)
6564

6665
it(s"second hit `true` for $form/$mode/${PathUtils.encodeSimpleQuery(query)}") {
6766
assert(staticStateFoundOpt(events2).contains(true))

form-runner/jvm/src/test/scala/org/orbeon/oxf/fr/DatasetsTest.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import org.orbeon.oxf.xforms.event.EventCollector
1919
import org.orbeon.xforms.Constants
2020
import org.scalatest.funspec.AnyFunSpecLike
2121

22+
2223
class DatasetsTest
2324
extends DocumentTestBase
2425
with ResourceManagerSupport
@@ -31,7 +32,7 @@ class DatasetsTest
3132
it("must call services and actions and return expected dataset values") {
3233

3334
val (processorService, Some(doc), _) =
34-
runFormRunner("tests", "datasets", "new", document = "", initialize = true)
35+
runFormRunner("tests", "datasets", "new", initialize = true)
3536

3637
withTestExternalContext { _ =>
3738
withFormRunnerDocument(processorService, doc) {

form-runner/jvm/src/test/scala/org/orbeon/oxf/fr/FormRunnerSupport.scala

+11-11
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,20 @@ trait FormRunnerSupport extends DocumentTestBase {
6161
setControlValueWithEventSearchNested("fr-language-selector-select", lang)
6262

6363
def runFormRunner(
64-
app : String,
65-
form : String,
66-
mode : String,
67-
formVersion : String = "", // not used yet
68-
document : String = "", // not used yet
69-
query : IterableOnce[(String, String)] = Nil,
70-
initialize : Boolean = true,
71-
content : Option[StreamedContent] = None,
72-
attributes : Map[String, AnyRef] = Map.empty
64+
app : String,
65+
form : String,
66+
mode : String,
67+
formVersion: String = "", // not used yet
68+
documentId : Option[String] = None,
69+
query : IterableOnce[(String, String)] = Nil,
70+
initialize : Boolean = true,
71+
content : Option[StreamedContent] = None,
72+
attributes : Map[String, AnyRef] = Map.empty
7373
): (ProcessorService, Option[XFormsContainingDocument], List[CacheEvent]) = {
7474

7575
val (processorService, response, _, events) =
7676
TestHttpClient.connect(
77-
url = PathUtils.recombineQuery(s"/fr/$app/$form/$mode", query),
77+
url = PathUtils.recombineQuery(s"/fr/$app/$form/$mode${documentId map ("/" +) getOrElse ""}", query),
7878
method = if (content.isDefined) POST else GET,
7979
headers = Map.empty,
8080
content = content,
@@ -103,7 +103,7 @@ trait FormRunnerSupport extends DocumentTestBase {
103103

104104
val (processorService, response, _, _) =
105105
TestHttpClient.connect(
106-
url = PathUtils.recombineQuery(s"/fr/${if (background) "service/"}$app/$form/$mode${documentId.map("/" +).getOrElse("")}", query),
106+
url = PathUtils.recombineQuery(s"/fr/${if (background) "service/" else ""}$app/$form/$mode${documentId.map("/" +).getOrElse("")}", query),
107107
method = if (content.isDefined) POST else GET,
108108
headers = Map.empty,
109109
content = content

form-runner/jvm/src/test/scala/org/orbeon/oxf/fr/ItemsetActionTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ItemsetActionTest
4747
describe("Form Runner itemset actions") {
4848

4949
val (processorService, docOpt, _) =
50-
runFormRunner("tests", "itemset-action", "new", document = "", initialize = true)
50+
runFormRunner("tests", "itemset-action", "new", initialize = true)
5151

5252
val doc = docOpt.get
5353

form-runner/jvm/src/test/scala/org/orbeon/oxf/fr/SendTest.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class SendTest
152152
it(s"""must pass with `$DataFormatVersionName = "${dataFormatVersion.entryName}"`, `prune = "$prune"` and `$PruneMetadataName = "$pruneMetadata"`""") {
153153

154154
val (processorService, docOpt, _) =
155-
runFormRunner("tests", "send-action", "new", document = "", initialize = true)
155+
runFormRunner("tests", "send-action", "new", initialize = true)
156156

157157
withTestExternalContext { _ =>
158158
withFormRunnerDocument(processorService, docOpt.get) {
@@ -210,7 +210,7 @@ class SendTest
210210
</metadata>
211211

212212
val (processorService, docOpt, _) =
213-
runFormRunner("tests", "send-action", "new", document = "", initialize = true)
213+
runFormRunner("tests", "send-action", "new", initialize = true)
214214

215215
withTestExternalContext { _ =>
216216
withFormRunnerDocument(processorService, docOpt.get) {

form-runner/jvm/src/test/scala/org/orbeon/oxf/fr/SimpleDataMigrationTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class SimpleDataMigrationTest
5555
app = appName,
5656
form = formName,
5757
mode = "new",
58-
document = "",
58+
documentId = None,
5959
query = List(
6060
FormRunnerPersistence.DataFormatVersionName -> incomingData._2.entryName,
6161
FormRunnerPersistence.DataMigrationBehaviorName -> dataMigrationBehavior.entryName,

form-runner/jvm/src/test/scala/org/orbeon/oxf/fr/SynchronizeRepeatedContentTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SynchronizeRepeatedContentTest
2929
describe("Form Runner `<fr:synchronize-repeated-content>` component") {
3030

3131
val (processorService, docOpt, _) =
32-
runFormRunner("issue", "3833", "new", document = "", initialize = true)
32+
runFormRunner("issue", "3833", "new", initialize = true)
3333

3434
val doc = docOpt.get
3535

form-runner/jvm/src/test/scala/org/orbeon/oxf/fr/WizardTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class WizardTest
3434
it("must control strict navigation") {
3535

3636
val (processorService, Some(doc), _) =
37-
runFormRunner("tests", "wizard", "new", document = "", initialize = true)
37+
runFormRunner("tests", "wizard", "new", initialize = true)
3838

3939
withTestExternalContext { _ =>
4040
withFormRunnerDocument(processorService, doc) {

form-runner/jvm/src/test/scala/org/orbeon/oxf/fr/process/RollbackTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class RollbackTest
6666
it(desc) {
6767

6868
val (processorService, docOpt, _) =
69-
runFormRunner("tests", "process-rollback", "new", document = "", initialize = true)
69+
runFormRunner("tests", "process-rollback", "new", initialize = true)
7070

7171
withTestExternalContext { _ =>
7272
withFormRunnerDocument(processorService, docOpt.get) {

0 commit comments

Comments
 (0)