Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import org.apache.texera.service.resource.AccessControlResource
import org.mockito.Mockito._
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}
import org.scalatest.BeforeAndAfterAll

import java.net.{URI, URLEncoder}
import java.nio.charset.StandardCharsets
Expand All @@ -52,7 +52,6 @@ class AccessControlResourceSpec
extends AnyFlatSpec
with Matchers
with BeforeAndAfterAll
with BeforeAndAfterEach
with MockTexeraDB {

private val testURI: String = "http://localhost:8080/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import org.apache.texera.service.MockLakeFS
import org.apache.texera.service.`type`.{ExistingUploadFile, ExistingUploadFilesRequest}
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}
import org.scalatest.BeforeAndAfterAll

import java.io.ByteArrayInputStream
import scala.jdk.CollectionConverters._
Expand All @@ -45,7 +45,6 @@ class ModelApiForUiSpec
with MockTexeraDB
with MockLakeFS
with BeforeAndAfterAll
with BeforeAndAfterEach
with ResourceTestHelpers {

private def mkUser(name: String): User = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import org.apache.texera.dao.jooq.generated.tables.pojos.User
import org.apache.texera.service.MockLakeFS
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}
import org.scalatest.BeforeAndAfterAll

import java.io.{ByteArrayInputStream, ByteArrayOutputStream}
import java.util.zip.ZipInputStream
Expand All @@ -42,7 +42,6 @@ class ModelDownloadResourceSpec
with MockTexeraDB
with MockLakeFS
with BeforeAndAfterAll
with BeforeAndAfterEach
with ResourceTestHelpers {

private def mkUser(name: String): User = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import org.apache.texera.service.MockLakeFS
import org.apache.texera.service.util.CoverImageUtils
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import org.scalatest.{BeforeAndAfterAll, OptionValues}
import org.scalatest.BeforeAndAfterAll

import java.io.ByteArrayInputStream
import java.util.Optional
Expand All @@ -40,7 +40,6 @@ import java.util.Optional
class ModelHubApiSpec
extends AnyFlatSpec
with Matchers
with OptionValues
with MockTexeraDB
with MockLakeFS
with BeforeAndAfterAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ import org.apache.texera.dao.jooq.generated.tables.pojos.{Model, User}
import org.apache.texera.service.MockLakeFS
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}
import org.scalatest.BeforeAndAfterAll

class ModelResourceSpec
extends AnyFlatSpec
with Matchers
with MockTexeraDB
with MockLakeFS
with BeforeAndAfterAll
with BeforeAndAfterEach {
with BeforeAndAfterAll {

private val ownerUser: User = {
val user = new User
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import org.apache.texera.service.MockLakeFS
import org.apache.texera.service.`type`.LakeFSFileNode
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}
import org.scalatest.BeforeAndAfterAll

import java.io.ByteArrayInputStream
import java.nio.charset.StandardCharsets
Expand All @@ -42,7 +42,6 @@ class ModelUploadResourceSpec
with MockTexeraDB
with MockLakeFS
with BeforeAndAfterAll
with BeforeAndAfterEach
with ResourceTestHelpers {

private val ownerUser: User = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ object ConfigGenerator {
schemas: Map[Int, Schema],
used: mutable.Set[(Int, String)],
rowCount: Int,
switches: Map[String, JsonNode] = Map.empty
switches: Map[String, JsonNode]
): Seq[Variant] =
Seq(
merged(
Expand Down Expand Up @@ -1082,8 +1082,8 @@ object ConfigGenerator {
private def enumVariants(
opClass: Class[_ <: LogicalOp],
baseNode: ObjectNode,
pinned: Set[String] = Set.empty,
fill: FillContext = FillContext()
pinned: Set[String],
fill: FillContext
Comment thread
aglinxinyuan marked this conversation as resolved.
Resolved
): Seq[Variant] =
enumSites(opClass, baseNode, "", Map.empty, SchemaScope.of(opClass), fill)
.filterNot(site => pinned.contains(site.pointer.stripPrefix("/")))
Expand Down Expand Up @@ -1417,9 +1417,9 @@ object ConfigGenerator {
schemas: Map[Int, Schema],
used: mutable.Set[(Int, String)],
rowCount: Int,
siblings: JsonNode = noSiblings,
bindings: TypeBindings = Map.empty,
scope: SchemaScope = SchemaScope.empty
siblings: JsonNode,
bindings: TypeBindings,
scope: SchemaScope
): Decision = {
val jp = Option(f.getAnnotation(classOf[JsonProperty]))
val jsonName = jp.map(_.value).filter(_.nonEmpty).getOrElse(f.getName)
Expand Down Expand Up @@ -1469,9 +1469,9 @@ object ConfigGenerator {
schemas: Map[Int, Schema],
used: mutable.Set[(Int, String)],
rowCount: Int,
siblings: JsonNode = noSiblings,
bindings: TypeBindings = Map.empty,
scope: SchemaScope = SchemaScope.empty
siblings: JsonNode,
bindings: TypeBindings,
scope: SchemaScope
): Either[String, JsonNode] = {
val ruled = schemaValueRule(f, scope, siblings).flatMap(ruleFill)
val nested = scope.descend(jsonNameOf(f))
Expand Down Expand Up @@ -1566,8 +1566,8 @@ object ConfigGenerator {
schemas: Map[Int, Schema],
used: mutable.Set[(Int, String)],
rowCount: Int,
bindings: TypeBindings = Map.empty,
scope: SchemaScope = SchemaScope.empty
bindings: TypeBindings,
scope: SchemaScope
): Either[String, JsonNode] =
scalarNode(clazz, None, schemas, used, NumHint(Bounds(None, None), rowCount), bindings, scope)

Expand Down Expand Up @@ -1954,7 +1954,7 @@ object ConfigGenerator {
schemas: Map[Int, Schema],
port: Int,
used: mutable.Set[(Int, String)],
siblings: JsonNode = noSiblings
siblings: JsonNode
): Either[String, String] = {
def take(col: String): String = { used += ((port, col)); col }
Option(f.getAnnotation(classOf[SampleColumn])).map(_.value) match {
Expand Down Expand Up @@ -2079,11 +2079,6 @@ object ConfigGenerator {
permitted.elements().asScala.exists(_.asText == siblings.path(clause.getKey).asText)
}

/** The empty object, for a caller with no sibling context: only the unconditional
* part of a rule can bind.
*/
private def noSiblings: JsonNode = objectMapper.getNodeFactory.objectNode()
Comment thread
aglinxinyuan marked this conversation as resolved.
Resolved

/** Where a field's constraints are read from when its own annotation cannot carry
* them: the operator's finished JSON schema, and the node within it describing the
* object currently being built.
Expand Down Expand Up @@ -2130,15 +2125,10 @@ object ConfigGenerator {
).toOption.map(s => SchemaScope(s, s)).getOrElse(empty)
}

/** The fields an object's conditional `allOf` requires of `row` as it stands. The
* condition is JSON Schema's own `properties`/`const`, not the `valEnum` form a
* Texera rule uses, because this one is read by the validator rather than by the
* form.
*/
private final case class FillContext(
schemas: Map[Int, Schema] = Map.empty,
used: mutable.Set[(Int, String)] = mutable.Set.empty,
rowCount: Int = DefaultRowCount
schemas: Map[Int, Schema],
used: mutable.Set[(Int, String)],
rowCount: Int
)

/** Whether a config holds nothing at this key: absent, null, the empty string a
Expand Down
Loading