-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from com-pas/develop
Create new release
- Loading branch information
Showing
16 changed files
with
223 additions
and
105 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
SPDX-FileCopyrightText: 2021 Alliander N.V. | ||
SPDX-License-Identifier: Apache-2.0 | ||
--> | ||
<jxb:bindings xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
xmlns:jxb="http://java.sun.com/xml/ns/jaxb" | ||
version="2.1"> | ||
<jxb:bindings schemaLocation="../resources/xsd/SCL_CoMPAS.xsd"> | ||
<jxb:bindings node="//xs:simpleType[@name='tSclFileType']"> | ||
<jxb:typesafeEnumClass ref="org.lfenergy.compas.scl.extensions.model.SclFileType"/> | ||
</jxb:bindings> | ||
</jxb:bindings> | ||
</jxb:bindings> |
30 changes: 30 additions & 0 deletions
30
scl-extension/src/main/java/org/lfenergy/compas/scl/extensions/model/SclFileType.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,30 @@ | ||
// SPDX-FileCopyrightText: 2021 Alliander N.V. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package org.lfenergy.compas.scl.extensions.model; | ||
|
||
import javax.xml.bind.annotation.XmlEnum; | ||
import javax.xml.bind.annotation.XmlType; | ||
|
||
@XmlType(name = "tSclFileType", namespace = "https://www.lfenergy.org/compas/extension/v1") | ||
@XmlEnum | ||
public enum SclFileType { | ||
SSD("Substation Specification Description"), | ||
IID("IED Instance Description"), | ||
ICD("IED Capability Description"), | ||
SCD("Substation Configuration Description"), | ||
CID("Configured IED Description"), | ||
SED("System Exchange Description"), | ||
ISD("IED Specification Description"), | ||
STD("System Template Definition"); | ||
|
||
private final String description; | ||
|
||
SclFileType(String description) { | ||
this.description = description; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
scl-extension/src/test/java/org/lfenergy/compas/scl/extensions/model/AbstractEnumTest.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,26 @@ | ||
// SPDX-FileCopyrightText: 2021 Alliander N.V. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package org.lfenergy.compas.scl.extensions.model; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
abstract class AbstractEnumTest { | ||
@Test | ||
void testEnumCodeCoverage() { | ||
Class<? extends Enum<?>> enumClass = getEnumClass(); | ||
try { | ||
for (var o : (Enum<?>[]) enumClass.getMethod("values").invoke(null)) { | ||
assertNotNull(enumClass.getMethod("valueOf", String.class).invoke(null, o.name())); | ||
} | ||
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException exp) { | ||
throw new RuntimeException(exp); | ||
} | ||
} | ||
|
||
protected abstract Class<? extends Enum<?>> getEnumClass(); | ||
} |
22 changes: 22 additions & 0 deletions
22
scl-extension/src/test/java/org/lfenergy/compas/scl/extensions/model/SclFileTypeTest.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,22 @@ | ||
// SPDX-FileCopyrightText: 2021 Alliander N.V. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package org.lfenergy.compas.scl.extensions.model; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
class SclFileTypeTest extends AbstractEnumTest { | ||
@Override | ||
protected Class<? extends Enum<?>> getEnumClass() { | ||
return SclFileType.class; | ||
} | ||
|
||
@Test | ||
void getDescription_WhenCalledForEveryType_ThenEveryTypeHasADescription() { | ||
for (var type : SclFileType.values()) { | ||
assertNotNull(type.getDescription()); | ||
} | ||
} | ||
} |
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.