-
Notifications
You must be signed in to change notification settings - Fork 140
chore: clean up sbt clean compile warnings #5201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kunwp1
wants to merge
6
commits into
apache:main
Choose a base branch
from
kunwp1:chore/fix-sbt-warnings
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
74f5f1b
chore: clean up sbt clean compile warnings
kunwp1 a179076
chore(amber): keep JwtAuth @Deprecated marker per review
kunwp1 bb2c0f1
chore(build): fail Java compilation on deprecation warnings
kunwp1 e99c0ca
test(pybuilder): make BoundaryValidator carriers fully coverable
kunwp1 956949f
Merge branch 'main' into chore/fix-sbt-warnings
kunwp1 8042b6e
Merge branch 'main' into chore/fix-sbt-warnings
kunwp1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
72 changes: 72 additions & 0 deletions
72
...on/pybuilder/src/test/scala/org/apache/texera/amber/pybuilder/BoundaryValidatorSpec.scala
This file contains hidden or 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,72 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.texera.amber.pybuilder | ||
|
|
||
| import org.apache.texera.amber.pybuilder.BoundaryValidator.{CompileTimeContext, RuntimeContext} | ||
| import org.scalatest.funsuite.AnyFunSuite | ||
|
|
||
| /** | ||
| * Characterization tests for the data carriers on `BoundaryValidator`'s | ||
| * companion. In production the macro is the only place that constructs | ||
| * these, so Jacoco never sees them at runtime; this spec pins the | ||
| * apply/accessor contract that the rest of the macro pipeline depends on. | ||
| */ | ||
| class BoundaryValidatorSpec extends AnyFunSuite { | ||
|
|
||
| test("BoundaryValidator companion object is loadable") { | ||
| // Force a direct reference to the outer companion (not just the nested | ||
| // CompileTimeContext / RuntimeContext) so its static initializer is | ||
| // exercised by Jacoco. | ||
| assert(BoundaryValidator.getClass.getName.endsWith("BoundaryValidator$")) | ||
| } | ||
|
|
||
| test("RuntimeContext apply binds every constructor argument to a val") { | ||
| val ctx = RuntimeContext( | ||
| leftPart = "left", | ||
| rightPart = "right", | ||
| prefixSource = "prefix", | ||
| argIndex = 0 | ||
| ) | ||
|
|
||
| assert(ctx.leftPart == "left") | ||
| assert(ctx.rightPart == "right") | ||
| assert(ctx.prefixSource == "prefix") | ||
| assert(ctx.argIndex == 0) | ||
| } | ||
|
|
||
| // Use a plain String for the `Pos` type parameter so the spec doesn't have | ||
| // to pull in a macro `Context`. The class is generic precisely so tests | ||
| // like this can construct it without a Universe. | ||
| test("CompileTimeContext apply binds every constructor argument including the generic errorPos") { | ||
| val ctx = CompileTimeContext[String]( | ||
| leftPart = "left", | ||
| rightPart = "right", | ||
| prefixSource = "prefix", | ||
| argIndex = 3, | ||
| errorPos = "Foo.scala:42" | ||
| ) | ||
|
|
||
| assert(ctx.leftPart == "left") | ||
| assert(ctx.rightPart == "right") | ||
| assert(ctx.prefixSource == "prefix") | ||
| assert(ctx.argIndex == 3) | ||
| assert(ctx.errorPos == "Foo.scala:42") | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
100 changes: 100 additions & 0 deletions
100
...e/src/test/scala/org/apache/texera/service/type/serde/DatasetFileNodeSerializerSpec.scala
This file contains hidden or 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,100 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.texera.service.`type`.serde | ||
|
|
||
| import com.fasterxml.jackson.databind.module.SimpleModule | ||
| import com.fasterxml.jackson.databind.{JsonNode, ObjectMapper} | ||
| import com.fasterxml.jackson.module.scala.DefaultScalaModule | ||
| import org.apache.texera.service.`type`.DatasetFileNode | ||
| import org.scalatest.flatspec.AnyFlatSpec | ||
| import org.scalatest.matchers.should.Matchers | ||
|
|
||
| class DatasetFileNodeSerializerSpec extends AnyFlatSpec with Matchers { | ||
|
|
||
| private val mapper: ObjectMapper = { | ||
| val m = new ObjectMapper() | ||
| // DefaultScalaModule lets Jackson unwrap scala.Option for the "size" field. | ||
| m.registerModule(DefaultScalaModule) | ||
| val module = new SimpleModule() | ||
| module.addSerializer(classOf[DatasetFileNode], new DatasetFileNodeSerializer()) | ||
| m.registerModule(module) | ||
| m | ||
| } | ||
|
|
||
| private def asJson(node: DatasetFileNode): JsonNode = | ||
| mapper.readTree(mapper.writeValueAsString(node)) | ||
|
|
||
| // The serializer dereferences value.getParent().getFilePath(), so every node it | ||
| // sees needs a non-null parent. Tests build a tree rooted at "/" and serialize | ||
| // its descendants. | ||
| private def rootDir: DatasetFileNode = | ||
| new DatasetFileNode("/", "directory", null, "") | ||
|
|
||
| "DatasetFileNodeSerializer" should "serialize a file node with size and no children field" in { | ||
| val root = rootDir | ||
| val owner = new DatasetFileNode("alice@example.com", "directory", root, "alice@example.com") | ||
| val file = new DatasetFileNode("data.csv", "file", owner, "alice@example.com", Some(100L)) | ||
|
|
||
| val json = asJson(file) | ||
|
|
||
| json.get("name").asText() shouldBe "data.csv" | ||
| json.get("type").asText() shouldBe "file" | ||
| json.get("parentDir").asText() shouldBe "/alice@example.com" | ||
| json.get("ownerEmail").asText() shouldBe "alice@example.com" | ||
| json.get("size").asLong() shouldBe 100L | ||
| json.has("children") shouldBe false | ||
| } | ||
|
|
||
| it should "recursively serialize a directory and its children" in { | ||
| val root = rootDir | ||
| val owner = new DatasetFileNode("alice@example.com", "directory", root, "alice@example.com") | ||
| val file = new DatasetFileNode("data.csv", "file", owner, "alice@example.com", Some(100L)) | ||
| val subdir = new DatasetFileNode("subdir", "directory", owner, "alice@example.com") | ||
| val nested = new DatasetFileNode("nested.txt", "file", subdir, "alice@example.com", Some(200L)) | ||
| subdir.children = Some(List(nested)) | ||
| owner.children = Some(List(file, subdir)) | ||
|
|
||
| val json = asJson(owner) | ||
|
|
||
| json.get("name").asText() shouldBe "alice@example.com" | ||
| json.get("type").asText() shouldBe "directory" | ||
| json.get("parentDir").asText() shouldBe "/" | ||
| val children = json.get("children") | ||
| children.isArray shouldBe true | ||
| children.size() shouldBe 2 | ||
| children.get(0).get("name").asText() shouldBe "data.csv" | ||
| children.get(0).get("size").asLong() shouldBe 100L | ||
| children.get(1).get("name").asText() shouldBe "subdir" | ||
| children.get(1).get("children").get(0).get("name").asText() shouldBe "nested.txt" | ||
| children.get(1).get("children").get(0).get("size").asLong() shouldBe 200L | ||
| } | ||
|
|
||
| it should "emit an empty children array for a directory with no children" in { | ||
| val root = rootDir | ||
| val empty = new DatasetFileNode("empty", "directory", root, "alice@example.com") | ||
|
|
||
| val json = asJson(empty) | ||
|
|
||
| json.get("type").asText() shouldBe "directory" | ||
| val children = json.get("children") | ||
| children.isArray shouldBe true | ||
| children.size() shouldBe 0 | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MySQL exec implementation was disabled due to license issue. We can remove this (used for test) for now. @bobbai00 whats our plan to add mysql back?