This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git


The following commit(s) were added to refs/heads/main by this push:
     new a5d8602b44 test(workflow-operator): add unit test coverage for 
PropertyNameConstants (#5739)
a5d8602b44 is described below

commit a5d8602b44f8297a15cf7800dde468d7d784b235
Author: Xinyuan Lin <[email protected]>
AuthorDate: Sun Jun 21 23:51:49 2026 -0700

    test(workflow-operator): add unit test coverage for PropertyNameConstants 
(#5739)
    
    ### What changes were proposed in this PR?
    
    Adds a unit-test spec for `PropertyNameConstants` (the `@JsonProperty`
    wire-key constants shared across `LogicalOp` serialization). No
    production-code changes.
    
    | Spec | Source class | Tests |
    | --- | --- | --- |
    | `PropertyNameConstantsSpec` | `PropertyNameConstants` | 5 |
    
    > **Scope note:** this PR originally also bundled
    `OperatorDescriptorUtils` and `PortDescriptor`/`PortDescription` specs.
    Both have since been covered on `main` / by other open PRs:
    > - `OperatorDescriptorUtilsSpec` already merged via #5798 — dropped
    here (it was the merge conflict).
    > - `PortDescriptor` + `PortDescription` are covered by #5832 with one
    spec file per source class (the repo convention) — dropped here to avoid
    a duplicate `PortDescriptorSpec.scala`.
    >
    > This PR is now scoped to its unique contribution,
    `PropertyNameConstants`, and is rebased on current `main`.
    
    ### Any related issues, documentation, discussions?
    
    Follow-up test coverage; see #5798 and #5832 for the de-duplicated
    specs.
    
    ### How was this PR tested?
    
    - `sbt "WorkflowOperator/testOnly
    org.apache.texera.amber.operator.metadata.PropertyNameConstantsSpec"` —
    5 tests, all green
    - `sbt "WorkflowOperator/Test/scalafmtCheck"` and `sbt
    "WorkflowOperator/Test/scalafix --check"` — clean
    - CI to confirm
    
    ### Was this PR authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Code (Opus 4.8 [1M context])
---
 .../metadata/PropertyNameConstantsSpec.scala       | 126 +++++++++++++++++++++
 1 file changed, 126 insertions(+)

diff --git 
a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/metadata/PropertyNameConstantsSpec.scala
 
b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/metadata/PropertyNameConstantsSpec.scala
new file mode 100644
index 0000000000..9afd3b7d0b
--- /dev/null
+++ 
b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/metadata/PropertyNameConstantsSpec.scala
@@ -0,0 +1,126 @@
+/*
+ * 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.operator.metadata
+
+import org.scalatest.flatspec.AnyFlatSpec
+
+class PropertyNameConstantsSpec extends AnyFlatSpec {
+
+  // 
---------------------------------------------------------------------------
+  // Logical-plan keys — each is a stable identifier used in every workflow
+  // JSON we have ever shipped; a rename breaks every persisted plan.
+  // 
---------------------------------------------------------------------------
+
+  "PropertyNameConstants logical-plan keys" should "have their canonical 
String values" in {
+    assert(PropertyNameConstants.OPERATOR_ID == "operatorID")
+    assert(PropertyNameConstants.OPERATOR_TYPE == "operatorType")
+    assert(PropertyNameConstants.ORIGIN_OPERATOR_ID == "origin")
+    assert(PropertyNameConstants.DESTINATION_OPERATOR_ID == "destination")
+    assert(PropertyNameConstants.OPERATOR_LIST == "operators")
+    assert(PropertyNameConstants.OPERATOR_LINK_LIST == "links")
+    assert(PropertyNameConstants.OPERATOR_VERSION == "operatorVersion")
+  }
+
+  // 
---------------------------------------------------------------------------
+  // Common operator-property keys
+  // 
---------------------------------------------------------------------------
+
+  "PropertyNameConstants common-property keys" should "have their canonical 
String values" in {
+    assert(PropertyNameConstants.ATTRIBUTE_NAMES == "attributes")
+    assert(PropertyNameConstants.ATTRIBUTE_NAME == "attribute")
+    assert(PropertyNameConstants.RESULT_ATTRIBUTE_NAME == "resultAttribute")
+    assert(PropertyNameConstants.SPAN_LIST_NAME == "spanListName")
+    assert(PropertyNameConstants.TABLE_NAME == "tableName")
+  }
+
+  // 
---------------------------------------------------------------------------
+  // Physical-plan keys
+  // 
---------------------------------------------------------------------------
+
+  "PropertyNameConstants physical-plan keys" should "have their canonical 
String values" in {
+    assert(PropertyNameConstants.WORKFLOW_ID == "workflowID")
+    assert(PropertyNameConstants.EXECUTION_ID == "executionID")
+    assert(PropertyNameConstants.PARALLELIZABLE == "parallelizable")
+    assert(PropertyNameConstants.LOCATION_PREFERENCE == "locationPreference")
+    assert(PropertyNameConstants.PARTITION_REQUIREMENT == 
"partitionRequirement")
+    assert(PropertyNameConstants.INPUT_PORTS == "inputPorts")
+    assert(PropertyNameConstants.OUTPUT_PORTS == "outputPorts")
+    assert(PropertyNameConstants.IS_ONE_TO_MANY_OP == "isOneToManyOp")
+    assert(PropertyNameConstants.SUGGESTED_WORKER_NUM == "suggestedWorkerNum")
+  }
+
+  // 
---------------------------------------------------------------------------
+  // Distinctness — no two constants alias to the same string
+  // 
---------------------------------------------------------------------------
+
+  "PropertyNameConstants" should "have all constants distinct (no accidental 
aliases)" in {
+    val all = List(
+      PropertyNameConstants.OPERATOR_ID,
+      PropertyNameConstants.OPERATOR_TYPE,
+      PropertyNameConstants.ORIGIN_OPERATOR_ID,
+      PropertyNameConstants.DESTINATION_OPERATOR_ID,
+      PropertyNameConstants.OPERATOR_LIST,
+      PropertyNameConstants.OPERATOR_LINK_LIST,
+      PropertyNameConstants.OPERATOR_VERSION,
+      PropertyNameConstants.ATTRIBUTE_NAMES,
+      PropertyNameConstants.ATTRIBUTE_NAME,
+      PropertyNameConstants.RESULT_ATTRIBUTE_NAME,
+      PropertyNameConstants.SPAN_LIST_NAME,
+      PropertyNameConstants.TABLE_NAME,
+      PropertyNameConstants.WORKFLOW_ID,
+      PropertyNameConstants.EXECUTION_ID,
+      PropertyNameConstants.PARALLELIZABLE,
+      PropertyNameConstants.LOCATION_PREFERENCE,
+      PropertyNameConstants.PARTITION_REQUIREMENT,
+      PropertyNameConstants.INPUT_PORTS,
+      PropertyNameConstants.OUTPUT_PORTS,
+      PropertyNameConstants.IS_ONE_TO_MANY_OP,
+      PropertyNameConstants.SUGGESTED_WORKER_NUM
+    )
+    assert(all.distinct.size == all.size, s"duplicate constant value(s) in: 
$all")
+  }
+
+  it should "carry no leading/trailing whitespace on any constant" in {
+    val all = List(
+      PropertyNameConstants.OPERATOR_ID,
+      PropertyNameConstants.OPERATOR_TYPE,
+      PropertyNameConstants.ORIGIN_OPERATOR_ID,
+      PropertyNameConstants.DESTINATION_OPERATOR_ID,
+      PropertyNameConstants.OPERATOR_LIST,
+      PropertyNameConstants.OPERATOR_LINK_LIST,
+      PropertyNameConstants.OPERATOR_VERSION,
+      PropertyNameConstants.ATTRIBUTE_NAMES,
+      PropertyNameConstants.ATTRIBUTE_NAME,
+      PropertyNameConstants.RESULT_ATTRIBUTE_NAME,
+      PropertyNameConstants.SPAN_LIST_NAME,
+      PropertyNameConstants.TABLE_NAME,
+      PropertyNameConstants.WORKFLOW_ID,
+      PropertyNameConstants.EXECUTION_ID,
+      PropertyNameConstants.PARALLELIZABLE,
+      PropertyNameConstants.LOCATION_PREFERENCE,
+      PropertyNameConstants.PARTITION_REQUIREMENT,
+      PropertyNameConstants.INPUT_PORTS,
+      PropertyNameConstants.OUTPUT_PORTS,
+      PropertyNameConstants.IS_ONE_TO_MANY_OP,
+      PropertyNameConstants.SUGGESTED_WORKER_NUM
+    )
+    all.foreach(c => assert(c == c.trim, s"constant has surrounding 
whitespace: '$c'"))
+  }
+}

Reply via email to