-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#684] Metadata: Make IDs and HREFs unique across multiple DMN files
- Loading branch information
1 parent
7688d2e
commit 25cc8ad
Showing
15 changed files
with
243 additions
and
170 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
49 changes: 49 additions & 0 deletions
49
dmn-core/src/test/java/com/gs/dmn/transformation/DMNToManifestTransformerTest.java
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,49 @@ | ||
/* | ||
* Copyright 2016 Goldman Sachs. | ||
* | ||
* 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 com.gs.dmn.transformation; | ||
|
||
import com.gs.dmn.ast.ObjectFactory; | ||
import com.gs.dmn.ast.TDefinitions; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class DMNToManifestTransformerTest { | ||
private static TDefinitions DEFINITIONS; | ||
|
||
@BeforeAll | ||
public static void setUp() { | ||
DEFINITIONS = new ObjectFactory().createTDefinitions(); | ||
DEFINITIONS.setNamespace("namespace"); | ||
} | ||
@Test | ||
void testSingleModel() { | ||
assertEquals("id-123", DMNToManifestTransformer.uniqueId("id-123", DEFINITIONS, false)); | ||
// implicit namespace | ||
assertEquals("id-123", DMNToManifestTransformer.uniqueHref("#id-123", DEFINITIONS, false)); | ||
// explicit namespace | ||
assertEquals("id-123", DMNToManifestTransformer.uniqueHref("namespace#id-123", DEFINITIONS, false)); | ||
} | ||
|
||
@Test | ||
void testMultipleModels() { | ||
assertEquals("namespace#id-123", DMNToManifestTransformer.uniqueId("id-123", DEFINITIONS, true)); | ||
// implicit namespace | ||
assertEquals("namespace#id-123", DMNToManifestTransformer.uniqueHref("#id-123", DEFINITIONS, true)); | ||
// same explicit namespace | ||
assertEquals("namespace#id-123", DMNToManifestTransformer.uniqueHref("namespace#id-123", DEFINITIONS, true)); | ||
// different explicit namespace | ||
assertEquals("namespace1#id-123", DMNToManifestTransformer.uniqueHref("namespace1#id-123", DEFINITIONS, true)); | ||
} | ||
} |
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.