File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
main/java/org/lfenergy/compas/sct/commons/scl
test/java/org/lfenergy/compas/sct/commons/scl Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,21 @@ public static TPrivate createPrivate(TCompasSystemVersion compasSystemVersion) {
159159 return createPrivate (objectFactory .createSystemVersion (compasSystemVersion ));
160160 }
161161
162+ /**
163+ * Create a single Private of type COMPAS-Topo
164+ * containing all given TCompasTopo
165+ * @param compasTopos list of TCompasTopo
166+ * @return created Private
167+ */
168+ public static TPrivate createPrivate (List <TCompasTopo > compasTopos ) {
169+ TPrivate tPrivate = new TPrivate ();
170+ tPrivate .setType (PrivateEnum .COMPAS_TOPO .getPrivateType ());
171+ tPrivate .getContent ().addAll (
172+ compasTopos .stream ().map (objectFactory ::createTopo ).toList ()
173+ );
174+ return tPrivate ;
175+ }
176+
162177 /**
163178 * Create Private of given type as parameter
164179 * @param jaxbElement content of Private to create
Original file line number Diff line number Diff line change @@ -579,4 +579,19 @@ private static TIED createTIED() {
579579 SCL sclFromFile = SclTestMarshaller .getSCLFromFile ("/scd-ied-dtt-com-import-stds/std.xml" );
580580 return sclFromFile .getIED ().get (0 );
581581 }
582+
583+ @ Test
584+ void createPrivate_compas_Topo_should_succeed (){
585+ // Given
586+ TCompasTopo tCompasTopo1 = new TCompasTopo ();
587+ TCompasTopo tCompasTopo2 = new TCompasTopo ();
588+ List <TCompasTopo > compasTopos = List .of (tCompasTopo1 , tCompasTopo2 );
589+ // When
590+ TPrivate result = PrivateService .createPrivate (compasTopos );
591+ // Then
592+ assertThat (result .getContent ())
593+ .map (JAXBElement .class ::cast )
594+ .map (JAXBElement ::getValue )
595+ .containsExactly (tCompasTopo1 , tCompasTopo2 );
596+ }
582597}
You can’t perform that action at this time.
0 commit comments