use of com.google.api.expr.v1alpha1.ListValue in project osate2 by osate.
the class Issue2264Test method testInstantiation.
@Test
public void testInstantiation() throws Exception {
AadlPackage pkg = testHelper.parseFile(FILE);
Optional<Classifier> impl = pkg.getOwnedPublicSection().getOwnedClassifiers().stream().filter(c -> c.getName().equals("S.i")).findFirst();
SystemInstance instance = InstantiateModel.instantiate((ComponentImplementation) impl.get());
Assert.assertEquals("S_i_Instance", instance.getName());
ConnectionInstance conni = instance.getConnectionInstances().get(0);
Assert.assertEquals("a1.o -> a2.i", conni.getName());
PropertyExpression pe = conni.getOwnedPropertyAssociations().get(0).getOwnedValues().get(0).getOwnedValue();
Assert.assertEquals(1, ((ListValue) pe).getOwnedListElements().size());
pe = ((ListValue) pe).getOwnedListElements().get(0);
InstanceObject io = ((InstanceReferenceValue) pe).getReferencedInstanceObject();
Assert.assertEquals("b", io.getName());
}
use of com.google.api.expr.v1alpha1.ListValue in project osate2 by osate.
the class Issue2265Test method testInstantiation.
@Test
public void testInstantiation() throws Exception {
AadlPackage pkg = testHelper.parseFile(FILE);
Optional<Classifier> impl = pkg.getOwnedPublicSection().getOwnedClassifiers().stream().filter(c -> c.getName().equals("top.i")).findFirst();
SystemInstance instance = InstantiateModel.instantiate((ComponentImplementation) impl.get());
Assert.assertEquals("top_i_Instance", instance.getName());
ComponentInstance a = instance.getComponentInstances().get(0);
Assert.assertEquals("a", a.getName());
PropertyExpression pe = a.getOwnedPropertyAssociations().get(0).getOwnedValues().get(0).getOwnedValue();
Assert.assertEquals(1, ((ListValue) pe).getOwnedListElements().size());
pe = ((ListValue) pe).getOwnedListElements().get(0);
AbstractNamedValue nv = ((NamedValue) pe).getNamedValue();
Assert.assertEquals("Ada95", ((EnumerationLiteral) nv).getName());
ConnectionInstance conni = instance.getConnectionInstances().get(0);
Assert.assertEquals("sub1.out1 -> sub2.in1", conni.getName());
pe = conni.getOwnedPropertyAssociations().get(0).getOwnedValues().get(0).getOwnedValue();
Assert.assertEquals(1, ((ListValue) pe).getOwnedListElements().size());
pe = ((ListValue) pe).getOwnedListElements().get(0);
InstanceObject io = ((InstanceReferenceValue) pe).getReferencedInstanceObject();
Assert.assertEquals("theBus2", io.getName());
}
use of com.google.api.expr.v1alpha1.ListValue in project osate2 by osate.
the class Arinc653 method getHmErrorIdLevels.
public static Optional<List<HmErrorIdLevelType>> getHmErrorIdLevels(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getHmErrorIdLevels_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return Optional.of(((ListValue) resolved).getOwnedListElements().stream().map(element1 -> {
PropertyExpression resolved1 = CodeGenUtil.resolveNamedValue(element1, lookupContext, mode);
return new HmErrorIdLevelType(resolved1, lookupContext, mode);
}).collect(Collectors.toList()));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
use of com.google.api.expr.v1alpha1.ListValue in project osate2 by osate.
the class Arinc653 method getModuleSchedule.
public static Optional<List<ScheduleWindow>> getModuleSchedule(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getModuleSchedule_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return Optional.of(((ListValue) resolved).getOwnedListElements().stream().map(element1 -> {
PropertyExpression resolved1 = CodeGenUtil.resolveNamedValue(element1, lookupContext, mode);
return new ScheduleWindow(resolved1, lookupContext, mode);
}).collect(Collectors.toList()));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
use of com.google.api.expr.v1alpha1.ListValue in project osate2 by osate.
the class Arinc653 method getHmErrorIdActions.
public static Optional<List<HmErrorIdActionType>> getHmErrorIdActions(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getHmErrorIdActions_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return Optional.of(((ListValue) resolved).getOwnedListElements().stream().map(element1 -> {
PropertyExpression resolved1 = CodeGenUtil.resolveNamedValue(element1, lookupContext, mode);
return new HmErrorIdActionType(resolved1, lookupContext, mode);
}).collect(Collectors.toList()));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
Aggregations