-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/1693 api v3 delete recreate (#2055)
* #1693 API v3: VersionedModel v3 disable/enable + usedIn - integrationTest cases added - 2 levels of .../used-in exist ( /{name}/used-in & /{name}/{version}/used-in). The former is used in disable checking. - UsedIn - empty/nonEmpty normalization V2 alternated between None and Some(Seq.empty) in various places, V3 consistently returns None for no references groups. - `NamedLatestVersion` generalized into a multipurpose `NamedVersion`. Small updates, thanks @benedeki - API v3 summary (NamedVersion) now contains `disabled` information - mainly on GET ...{/name} - disable fail due to nonEmpty used in now carries a wrapper with an error message (`UsedIn` wrapped in `EntityInUseException`) - Future {throw x}` replaced with `Future.failed(x)` in rest_api, cleanup
- Loading branch information
Showing
38 changed files
with
1,343 additions
and
217 deletions.
There are no files selected for viewing
This file contains 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 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
21 changes: 21 additions & 0 deletions
21
data-model/src/main/scala/za/co/absa/enceladus/model/versionedModel/NamedVersion.scala
This file contains 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,21 @@ | ||
/* | ||
* Copyright 2018 ABSA Group Limited | ||
* | ||
* Licensed 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 za.co.absa.enceladus.model.versionedModel | ||
|
||
/** | ||
* V3 Wrapper for [[za.co.absa.enceladus.model.versionedModel.VersionedSummary]] | ||
*/ | ||
case class NamedVersion(name: String, version: Int, disabled: Boolean) |
This file contains 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
73 changes: 73 additions & 0 deletions
73
data-model/src/test/scala/za/co/absa/enceladus/model/UsedInTest.scala
This file contains 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,73 @@ | ||
/* | ||
* Copyright 2018 ABSA Group Limited | ||
* | ||
* Licensed 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 za.co.absa.enceladus.model | ||
|
||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
import za.co.absa.enceladus.model.menas.MenasReference | ||
|
||
class UsedInTest extends AnyFlatSpec with Matchers { | ||
|
||
private val exampleRef = MenasReference(Some("collection1"), "entity1", 1) | ||
|
||
"UsedIn" should "correctly evaluate .nonEmpty" in { | ||
UsedIn(Some(Seq(exampleRef)), Some(Seq(exampleRef))).nonEmpty shouldBe true | ||
UsedIn(Some(Seq(exampleRef)), Some(Seq.empty)).nonEmpty shouldBe true | ||
UsedIn(Some(Seq(exampleRef)), None).nonEmpty shouldBe true | ||
|
||
UsedIn(Some(Seq.empty), Some(Seq(exampleRef))).nonEmpty shouldBe true | ||
UsedIn(None, Some(Seq(exampleRef))).nonEmpty shouldBe true | ||
|
||
UsedIn(Some(Seq.empty), Some(Seq.empty)).nonEmpty shouldBe false | ||
UsedIn(None, Some(Seq.empty)).nonEmpty shouldBe false | ||
UsedIn(Some(Seq.empty), None).nonEmpty shouldBe false | ||
UsedIn(None, None).nonEmpty shouldBe false | ||
} | ||
|
||
it should "correctly evaluate .empty" in { | ||
UsedIn(Some(Seq(exampleRef)), Some(Seq(exampleRef))).isEmpty shouldBe false | ||
UsedIn(Some(Seq(exampleRef)), Some(Seq.empty)).isEmpty shouldBe false | ||
UsedIn(Some(Seq(exampleRef)), None).isEmpty shouldBe false | ||
|
||
UsedIn(Some(Seq.empty), Some(Seq(exampleRef))).isEmpty shouldBe false | ||
UsedIn(None, Some(Seq(exampleRef))).isEmpty shouldBe false | ||
|
||
UsedIn(Some(Seq.empty), Some(Seq.empty)).isEmpty shouldBe true | ||
UsedIn(None, Some(Seq.empty)).isEmpty shouldBe true | ||
UsedIn(Some(Seq.empty), None).isEmpty shouldBe true | ||
UsedIn(None, None).isEmpty shouldBe true | ||
} | ||
|
||
it should "normalize" in { | ||
UsedIn(Some(Seq(exampleRef)), Some(Seq(exampleRef))).normalized shouldBe UsedIn(Some(Seq(exampleRef)), Some(Seq(exampleRef))) | ||
|
||
UsedIn(Some(Seq(exampleRef)), Some(Seq.empty)).normalized shouldBe UsedIn(Some(Seq(exampleRef)), None) | ||
UsedIn(Some(Seq(exampleRef)), None).normalized shouldBe UsedIn(Some(Seq(exampleRef)), None) | ||
|
||
UsedIn(Some(Seq.empty), Some(Seq(exampleRef))).normalized shouldBe UsedIn(None, Some(Seq(exampleRef))) | ||
UsedIn(None, Some(Seq(exampleRef))).normalized shouldBe UsedIn(None, Some(Seq(exampleRef))) | ||
|
||
UsedIn(Some(Seq.empty), Some(Seq.empty)).normalized shouldBe UsedIn(None, None) | ||
UsedIn(None, None).normalized shouldBe UsedIn(None, None) | ||
|
||
|
||
|
||
|
||
} | ||
|
||
|
||
|
||
} |
This file contains 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 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 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 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 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 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
Oops, something went wrong.