File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed
main/java/org/lfenergy/compas/scl2007b4/model
test/java/org/lfenergy/compas/scl2007b4/model Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change 1+ // SPDX-FileCopyrightText: 2023 RTE FRANCE
2+ //
3+ // SPDX-License-Identifier: Apache-2.0
4+
5+ @ XmlSchema (
6+ namespace = "http://www.iec.ch/61850/2003/SCL" ,
7+ xmlns = {
8+ @ XmlNs (namespaceURI = "http://www.iec.ch/61850/2003/SCL" , prefix = "" ),
9+ @ XmlNs (namespaceURI = "https://www.lfenergy.org/compas/extension/v1" , prefix = "compas" )
10+ },
11+ elementFormDefault = XmlNsForm .QUALIFIED )
12+
13+
14+ package org .lfenergy .compas .scl2007b4 .model ;
15+
16+ import javax .xml .bind .annotation .XmlNs ;
17+ import javax .xml .bind .annotation .XmlNsForm ;
18+ import javax .xml .bind .annotation .XmlSchema ;
19+
20+ /* This file is used by the Marshaller to set prefix "compas" for Compas Privates when marshalling JAXB objects */
Original file line number Diff line number Diff line change 1+ // SPDX-FileCopyrightText: 2023 RTE FRANCE
2+ //
3+ // SPDX-License-Identifier: Apache-2.0
4+
5+ package org .lfenergy .compas .scl2007b4 .model ;
6+
7+ import org .junit .jupiter .api .Test ;
8+ import org .lfenergy .compas .sct .commons .scl .PrivateService ;
9+ import org .lfenergy .compas .sct .commons .testhelpers .MarshallerWrapper ;
10+
11+ import static org .assertj .core .api .Assertions .assertThat ;
12+
13+ class NamespaceConfigurationTest {
14+
15+ @ Test
16+ void marshalling_SCL_and_Compas_Privates_should_set_correct_prefix () {
17+ // Given
18+ SCL scl = createValidScl ();
19+ TPrivate aCompasPrivate = PrivateService .createPrivate (TCompasSclFileType .SCD );
20+ scl .getPrivate ().add (aCompasPrivate );
21+ // When
22+ String result = MarshallerWrapper .marshall (scl );
23+ // Then
24+ assertThat (result )
25+ .containsPattern ("(?s)<SCL[^>]* xmlns=\" http://www\\ .iec\\ .ch/61850/2003/SCL\" " )
26+ .containsPattern ("(?s)<SCL[^>]* xmlns:compas=\" https://www\\ .lfenergy\\ .org/compas/extension/v1\" " );
27+ }
28+
29+ private static SCL createValidScl () {
30+ SCL scl = new SCL ();
31+ scl .setVersion ("2007" );
32+ scl .setRevision ("B" );
33+ scl .setRelease ((short ) 4 );
34+ THeader tHeader = new THeader ();
35+ tHeader .setId ("headerId" );
36+ scl .setHeader (tHeader );
37+ return scl ;
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments