Skip to content
Closed
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
@@ -0,0 +1,44 @@
/*
* 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.visualization.boxViolinPlot

import org.apache.texera.amber.util.JSONUtils.objectMapper
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

class BoxViolinPlotQuartileFunctionSpec extends AnyFlatSpec with Matchers {

"BoxViolinPlotQuartileFunction" should "map each constant to its wire value" in {
BoxViolinPlotQuartileFunction.LINEAR.getQuartiletype shouldBe "linear"
BoxViolinPlotQuartileFunction.INCLUSIVE.getQuartiletype shouldBe "inclusive"
BoxViolinPlotQuartileFunction.EXCLUSIVE.getQuartiletype shouldBe "exclusive"
BoxViolinPlotQuartileFunction.values() should have length 3
}

"BoxViolinPlotQuartileFunction" should "round-trip through Jackson using its wire value" in {
objectMapper.writeValueAsString(
BoxViolinPlotQuartileFunction.INCLUSIVE
) shouldBe "\"inclusive\""
objectMapper.readValue(
"\"inclusive\"",
classOf[BoxViolinPlotQuartileFunction]
) shouldBe BoxViolinPlotQuartileFunction.INCLUSIVE
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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.visualization.contourPlot

import org.apache.texera.amber.util.JSONUtils.objectMapper
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

class ContourPlotColoringFunctionSpec extends AnyFlatSpec with Matchers {

"ContourPlotColoringFunction" should "map each constant to its wire value" in {
ContourPlotColoringFunction.HEATMAP.getColoringMethod shouldBe "heatmap"
ContourPlotColoringFunction.LINES.getColoringMethod shouldBe "lines"
ContourPlotColoringFunction.NONE.getColoringMethod shouldBe "none"
ContourPlotColoringFunction.values() should have length 3
}

"ContourPlotColoringFunction" should "round-trip through Jackson using its wire value" in {
objectMapper.writeValueAsString(ContourPlotColoringFunction.LINES) shouldBe "\"lines\""
objectMapper.readValue(
"\"lines\"",
classOf[ContourPlotColoringFunction]
) shouldBe ContourPlotColoringFunction.LINES
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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.visualization.hierarchychart

import org.apache.texera.amber.util.JSONUtils.objectMapper
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

class HierarchyChartTypeSpec extends AnyFlatSpec with Matchers {

"HierarchyChartType" should "map each constant to its wire value" in {
HierarchyChartType.TREEMAP.getPlotlyExpressApiName shouldBe "treemap"
HierarchyChartType.SUNBURSTCHART.getPlotlyExpressApiName shouldBe "sunburst"
HierarchyChartType.values() should have length 2
}

"HierarchyChartType" should "round-trip through Jackson using its wire value" in {
objectMapper.writeValueAsString(HierarchyChartType.SUNBURSTCHART) shouldBe "\"sunburst\""
objectMapper.readValue(
"\"sunburst\"",
classOf[HierarchyChartType]
) shouldBe HierarchyChartType.SUNBURSTCHART
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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.visualization.histogram2d

import org.apache.texera.amber.util.JSONUtils.objectMapper
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

class NormalizationTypeSpec extends AnyFlatSpec with Matchers {

"NormalizationType" should "map each constant to its wire value" in {
NormalizationType.DENSITY.getValue shouldBe "density"
NormalizationType.PROBABILITY.getValue shouldBe "probability"
NormalizationType.PERCENT.getValue shouldBe "percent"
NormalizationType.values() should have length 3
}

"NormalizationType" should "round-trip through Jackson using its wire value" in {
objectMapper.writeValueAsString(NormalizationType.PERCENT) shouldBe "\"percent\""
objectMapper.readValue(
"\"percent\"",
classOf[NormalizationType]
) shouldBe NormalizationType.PERCENT
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* 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.visualization.lineChart

import org.apache.texera.amber.util.JSONUtils.objectMapper
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

class LineModeSpec extends AnyFlatSpec with Matchers {

"LineMode" should "map each constant to its wire mode" in {
LineMode.LINE.getMode shouldBe "line"
LineMode.DOTS.getMode shouldBe "dots"
LineMode.LINE_WITH_DOTS.getMode shouldBe "line with dots"
LineMode.values() should have length 3
}

"LineMode.getModeInPlotly" should "translate to the Plotly mode string" in {
LineMode.LINE.getModeInPlotly shouldBe "lines"
LineMode.DOTS.getModeInPlotly shouldBe "markers"
LineMode.LINE_WITH_DOTS.getModeInPlotly shouldBe "lines+markers"
}

"LineMode.fromString" should "resolve wire modes case-insensitively and reject unknowns" in {
LineMode.fromString("line with dots") shouldBe LineMode.LINE_WITH_DOTS
LineMode.fromString("DOTS") shouldBe LineMode.DOTS
intercept[IllegalArgumentException](LineMode.fromString("zigzag"))
}

"LineMode" should "round-trip through Jackson using its wire mode" in {
objectMapper.writeValueAsString(LineMode.LINE_WITH_DOTS) shouldBe "\"line with dots\""
objectMapper.readValue("\"dots\"", classOf[LineMode]) shouldBe LineMode.DOTS
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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.visualization.radarPlot

import org.apache.texera.amber.util.JSONUtils.objectMapper
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

class RadarPlotLinePatternSpec extends AnyFlatSpec with Matchers {

"RadarPlotLinePattern" should "map each constant to its wire value" in {
RadarPlotLinePattern.SOLID.getLinePattern shouldBe "solid"
RadarPlotLinePattern.DASH.getLinePattern shouldBe "dash"
RadarPlotLinePattern.DOT.getLinePattern shouldBe "dot"
RadarPlotLinePattern.values() should have length 3
}

"RadarPlotLinePattern" should "round-trip through Jackson using its wire value" in {
objectMapper.writeValueAsString(RadarPlotLinePattern.DASH) shouldBe "\"dash\""
objectMapper.readValue(
"\"dash\"",
classOf[RadarPlotLinePattern]
) shouldBe RadarPlotLinePattern.DASH
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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.visualization.rangeSlider

import org.apache.texera.amber.util.JSONUtils.objectMapper
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

class RangeSliderHandleDuplicateFunctionSpec extends AnyFlatSpec with Matchers {

"RangeSliderHandleDuplicateFunction" should "map each constant to its wire value" in {
RangeSliderHandleDuplicateFunction.NOTHING.getFunctionType shouldBe "Nothing"
RangeSliderHandleDuplicateFunction.MEAN.getFunctionType shouldBe "Mean"
RangeSliderHandleDuplicateFunction.SUM.getFunctionType shouldBe "Sum"
RangeSliderHandleDuplicateFunction.values() should have length 3
}

"RangeSliderHandleDuplicateFunction" should "round-trip through Jackson using its wire value" in {
objectMapper.writeValueAsString(RangeSliderHandleDuplicateFunction.MEAN) shouldBe "\"Mean\""
objectMapper.readValue(
"\"Mean\"",
classOf[RangeSliderHandleDuplicateFunction]
) shouldBe RangeSliderHandleDuplicateFunction.MEAN
}
}
Loading