@Test public void toCommandInfo_calib_test() throws Exception { YConfiguration.setupTest("refmdb"); XtceDbFactory.reset(); XtceDb db = XtceDbFactory.getInstance("refmdb"); MetaCommand cmd1 = db.getMetaCommand("/REFMDB/SUBSYS1/CALIB_TC"); CommandInfo commandInfo = XtceToGpbAssembler.toCommandInfo(cmd1, DetailLevel.FULL); assertEquals("CALIB_TC", commandInfo.getName()); assertEquals("enumeration", commandInfo.getArgument(3).getType().getEngType()); assertEquals("value0", commandInfo.getArgument(3).getType().getEnumValue(0).getLabel()); assertEquals("value2", commandInfo.getArgument(3).getType().getEnumValue(2).getLabel()); assertTrue("should not have a range set", !commandInfo.getArgument(0).getType().hasRangeMin()); }
public static CommandInfo toCommandInfo(MetaCommand cmd, DetailLevel detail) { CommandInfo.Builder cb = CommandInfo.newBuilder(); cb.setName(cmd.getName()); cb.setQualifiedName(cmd.getQualifiedName()); if (detail == DetailLevel.SUMMARY || detail == DetailLevel.FULL) { if (cmd.getShortDescription() != null) { cb.setShortDescription(cmd.getShortDescription()); } if (cmd.getLongDescription() != null) { cb.setLongDescription(cmd.getLongDescription()); } if (cmd.getAliasSet() != null) { Map<String, String> aliases = cmd.getAliasSet().getAliases(); for (Entry<String, String> me : aliases.entrySet()) { cb.addAlias(NamedObjectId.newBuilder().setName(me.getValue()).setNamespace(me.getKey())); } } if (cmd.getAncillaryData() != null) { for (AncillaryData data : cmd.getAncillaryData()) { cb.putAncillaryData(data.getName(), toAncillaryDataInfo(data)); } } if (cmd.getDefaultSignificance() != null) { cb.setSignificance(toSignificanceInfo(cmd.getDefaultSignificance())); } if (cmd.getArgumentList() != null) { for (Argument xtceArgument : cmd.getArgumentList()) { cb.addArgument(toArgumentInfo(xtceArgument)); } } if (cmd.getArgumentAssignmentList() != null) { for (ArgumentAssignment xtceAssignment : cmd.getArgumentAssignmentList()) { cb.addArgumentAssignment(toArgumentAssignmentInfo(xtceAssignment)); } } cb.setAbstract(cmd.isAbstract()); if (cmd.getTransmissionConstraintList() != null) { for (TransmissionConstraint xtceConstraint : cmd.getTransmissionConstraintList()) { cb.addConstraint(toTransmissionConstraintInfo(xtceConstraint)); } } if (cmd.getCommandContainer() != null) { CommandContainer container = cmd.getCommandContainer(); cb.setCommandContainer(toCommandContainerInfo(container, DetailLevel.FULL)); } if (detail == DetailLevel.SUMMARY) { if (cmd.getBaseMetaCommand() != null) { cb.setBaseCommand(toCommandInfo(cmd.getBaseMetaCommand(), DetailLevel.LINK)); } } else if (detail == DetailLevel.FULL) { if (cmd.getBaseMetaCommand() != null) { cb.setBaseCommand(toCommandInfo(cmd.getBaseMetaCommand(), DetailLevel.FULL)); } } for (CommandVerifier verifier : cmd.getCommandVerifiers()) { cb.addVerifier(toVerifierInfo(verifier)); } } return cb.build(); }
XtceToGpbAssembler { public static CommandInfo toCommandInfo(MetaCommand cmd, DetailLevel detail) { CommandInfo.Builder cb = CommandInfo.newBuilder(); cb.setName(cmd.getName()); cb.setQualifiedName(cmd.getQualifiedName()); if (detail == DetailLevel.SUMMARY || detail == DetailLevel.FULL) { if (cmd.getShortDescription() != null) { cb.setShortDescription(cmd.getShortDescription()); } if (cmd.getLongDescription() != null) { cb.setLongDescription(cmd.getLongDescription()); } if (cmd.getAliasSet() != null) { Map<String, String> aliases = cmd.getAliasSet().getAliases(); for (Entry<String, String> me : aliases.entrySet()) { cb.addAlias(NamedObjectId.newBuilder().setName(me.getValue()).setNamespace(me.getKey())); } } if (cmd.getAncillaryData() != null) { for (AncillaryData data : cmd.getAncillaryData()) { cb.putAncillaryData(data.getName(), toAncillaryDataInfo(data)); } } if (cmd.getDefaultSignificance() != null) { cb.setSignificance(toSignificanceInfo(cmd.getDefaultSignificance())); } if (cmd.getArgumentList() != null) { for (Argument xtceArgument : cmd.getArgumentList()) { cb.addArgument(toArgumentInfo(xtceArgument)); } } if (cmd.getArgumentAssignmentList() != null) { for (ArgumentAssignment xtceAssignment : cmd.getArgumentAssignmentList()) { cb.addArgumentAssignment(toArgumentAssignmentInfo(xtceAssignment)); } } cb.setAbstract(cmd.isAbstract()); if (cmd.getTransmissionConstraintList() != null) { for (TransmissionConstraint xtceConstraint : cmd.getTransmissionConstraintList()) { cb.addConstraint(toTransmissionConstraintInfo(xtceConstraint)); } } if (cmd.getCommandContainer() != null) { CommandContainer container = cmd.getCommandContainer(); cb.setCommandContainer(toCommandContainerInfo(container, DetailLevel.FULL)); } if (detail == DetailLevel.SUMMARY) { if (cmd.getBaseMetaCommand() != null) { cb.setBaseCommand(toCommandInfo(cmd.getBaseMetaCommand(), DetailLevel.LINK)); } } else if (detail == DetailLevel.FULL) { if (cmd.getBaseMetaCommand() != null) { cb.setBaseCommand(toCommandInfo(cmd.getBaseMetaCommand(), DetailLevel.FULL)); } } for (CommandVerifier verifier : cmd.getCommandVerifiers()) { cb.addVerifier(toVerifierInfo(verifier)); } } return cb.build(); } }
XtceToGpbAssembler { public static CommandInfo toCommandInfo(MetaCommand cmd, DetailLevel detail) { CommandInfo.Builder cb = CommandInfo.newBuilder(); cb.setName(cmd.getName()); cb.setQualifiedName(cmd.getQualifiedName()); if (detail == DetailLevel.SUMMARY || detail == DetailLevel.FULL) { if (cmd.getShortDescription() != null) { cb.setShortDescription(cmd.getShortDescription()); } if (cmd.getLongDescription() != null) { cb.setLongDescription(cmd.getLongDescription()); } if (cmd.getAliasSet() != null) { Map<String, String> aliases = cmd.getAliasSet().getAliases(); for (Entry<String, String> me : aliases.entrySet()) { cb.addAlias(NamedObjectId.newBuilder().setName(me.getValue()).setNamespace(me.getKey())); } } if (cmd.getAncillaryData() != null) { for (AncillaryData data : cmd.getAncillaryData()) { cb.putAncillaryData(data.getName(), toAncillaryDataInfo(data)); } } if (cmd.getDefaultSignificance() != null) { cb.setSignificance(toSignificanceInfo(cmd.getDefaultSignificance())); } if (cmd.getArgumentList() != null) { for (Argument xtceArgument : cmd.getArgumentList()) { cb.addArgument(toArgumentInfo(xtceArgument)); } } if (cmd.getArgumentAssignmentList() != null) { for (ArgumentAssignment xtceAssignment : cmd.getArgumentAssignmentList()) { cb.addArgumentAssignment(toArgumentAssignmentInfo(xtceAssignment)); } } cb.setAbstract(cmd.isAbstract()); if (cmd.getTransmissionConstraintList() != null) { for (TransmissionConstraint xtceConstraint : cmd.getTransmissionConstraintList()) { cb.addConstraint(toTransmissionConstraintInfo(xtceConstraint)); } } if (cmd.getCommandContainer() != null) { CommandContainer container = cmd.getCommandContainer(); cb.setCommandContainer(toCommandContainerInfo(container, DetailLevel.FULL)); } if (detail == DetailLevel.SUMMARY) { if (cmd.getBaseMetaCommand() != null) { cb.setBaseCommand(toCommandInfo(cmd.getBaseMetaCommand(), DetailLevel.LINK)); } } else if (detail == DetailLevel.FULL) { if (cmd.getBaseMetaCommand() != null) { cb.setBaseCommand(toCommandInfo(cmd.getBaseMetaCommand(), DetailLevel.FULL)); } } for (CommandVerifier verifier : cmd.getCommandVerifiers()) { cb.addVerifier(toVerifierInfo(verifier)); } } return cb.build(); }  }
XtceToGpbAssembler { public static CommandInfo toCommandInfo(MetaCommand cmd, DetailLevel detail) { CommandInfo.Builder cb = CommandInfo.newBuilder(); cb.setName(cmd.getName()); cb.setQualifiedName(cmd.getQualifiedName()); if (detail == DetailLevel.SUMMARY || detail == DetailLevel.FULL) { if (cmd.getShortDescription() != null) { cb.setShortDescription(cmd.getShortDescription()); } if (cmd.getLongDescription() != null) { cb.setLongDescription(cmd.getLongDescription()); } if (cmd.getAliasSet() != null) { Map<String, String> aliases = cmd.getAliasSet().getAliases(); for (Entry<String, String> me : aliases.entrySet()) { cb.addAlias(NamedObjectId.newBuilder().setName(me.getValue()).setNamespace(me.getKey())); } } if (cmd.getAncillaryData() != null) { for (AncillaryData data : cmd.getAncillaryData()) { cb.putAncillaryData(data.getName(), toAncillaryDataInfo(data)); } } if (cmd.getDefaultSignificance() != null) { cb.setSignificance(toSignificanceInfo(cmd.getDefaultSignificance())); } if (cmd.getArgumentList() != null) { for (Argument xtceArgument : cmd.getArgumentList()) { cb.addArgument(toArgumentInfo(xtceArgument)); } } if (cmd.getArgumentAssignmentList() != null) { for (ArgumentAssignment xtceAssignment : cmd.getArgumentAssignmentList()) { cb.addArgumentAssignment(toArgumentAssignmentInfo(xtceAssignment)); } } cb.setAbstract(cmd.isAbstract()); if (cmd.getTransmissionConstraintList() != null) { for (TransmissionConstraint xtceConstraint : cmd.getTransmissionConstraintList()) { cb.addConstraint(toTransmissionConstraintInfo(xtceConstraint)); } } if (cmd.getCommandContainer() != null) { CommandContainer container = cmd.getCommandContainer(); cb.setCommandContainer(toCommandContainerInfo(container, DetailLevel.FULL)); } if (detail == DetailLevel.SUMMARY) { if (cmd.getBaseMetaCommand() != null) { cb.setBaseCommand(toCommandInfo(cmd.getBaseMetaCommand(), DetailLevel.LINK)); } } else if (detail == DetailLevel.FULL) { if (cmd.getBaseMetaCommand() != null) { cb.setBaseCommand(toCommandInfo(cmd.getBaseMetaCommand(), DetailLevel.FULL)); } } for (CommandVerifier verifier : cmd.getCommandVerifiers()) { cb.addVerifier(toVerifierInfo(verifier)); } } return cb.build(); }  static ContainerInfo toContainerInfo(SequenceContainer c, DetailLevel detail); static SequenceEntryInfo toSequenceEntryInfo(SequenceEntry e, DetailLevel detail); static FixedValueInfo toFixedValueInfo(FixedValueEntry entry); static RepeatInfo toRepeatInfo(Repeat xtceRepeat, DetailLevel detail); static CommandContainerInfo toCommandContainerInfo(CommandContainer container, DetailLevel detail); static CommandInfo toCommandInfo(MetaCommand cmd, DetailLevel detail); static ArgumentInfo toArgumentInfo(Argument xtceArgument); static ArgumentAssignmentInfo toArgumentAssignmentInfo(ArgumentAssignment xtceArgument); static TransmissionConstraintInfo toTransmissionConstraintInfo(TransmissionConstraint xtceConstraint); static VerifierInfo toVerifierInfo(CommandVerifier xtceVerifier); static ComparisonInfo toComparisonInfo(Comparison xtceComparison); static ComparisonInfo.OperatorType toOperatorType(OperatorType xtceOperator); static SignificanceInfo toSignificanceInfo(Significance xtceSignificance); static SignificanceLevelType toSignificanceLevelType(Levels level); static ParameterInfo toParameterInfo(ParameterInstanceRef ref); static ParameterInfo toParameterInfo(Parameter p, DetailLevel detail); static AncillaryDataInfo toAncillaryDataInfo(AncillaryData data); static ParameterTypeInfo toParameterTypeInfo(ParameterType parameterType, DetailLevel detail); static ArgumentTypeInfo toArgumentTypeInfo(ArgumentType argumentType); static List<ComparisonInfo> toComparisons(MatchCriteria matchCriteria); static DataEncodingInfo toDataEncodingInfo(DataEncoding xtceDataEncoding); static String toTextualEncoding(StringDataEncoding sde); static Mdb.EnumValue toEnumValue(ValueEnumeration xtceValue); static UnitInfo toUnitInfo(UnitType ut); static CalibratorInfo toCalibratorInfo(Calibrator calibrator); static AlarmInfo toAlarmInfo(NumericAlarm numericAlarm); static AlarmInfo toAlarmInfo(EnumerationAlarm enumerationAlarm); static Mdb.EnumerationAlarm toEnumerationAlarm(EnumerationAlarmItem xtceAlarmItem); static AlgorithmInfo toAlgorithmInfo(Algorithm a, DetailLevel detail); static InputParameterInfo toInputParameterInfo(InputParameter xtceInput); static OutputParameterInfo toOutputParameterInfo(OutputParameter xtceOutput); static SpaceSystemInfo toSpaceSystemInfo(SpaceSystem ss); }
XtceToGpbAssembler { public static CommandInfo toCommandInfo(MetaCommand cmd, DetailLevel detail) { CommandInfo.Builder cb = CommandInfo.newBuilder(); cb.setName(cmd.getName()); cb.setQualifiedName(cmd.getQualifiedName()); if (detail == DetailLevel.SUMMARY || detail == DetailLevel.FULL) { if (cmd.getShortDescription() != null) { cb.setShortDescription(cmd.getShortDescription()); } if (cmd.getLongDescription() != null) { cb.setLongDescription(cmd.getLongDescription()); } if (cmd.getAliasSet() != null) { Map<String, String> aliases = cmd.getAliasSet().getAliases(); for (Entry<String, String> me : aliases.entrySet()) { cb.addAlias(NamedObjectId.newBuilder().setName(me.getValue()).setNamespace(me.getKey())); } } if (cmd.getAncillaryData() != null) { for (AncillaryData data : cmd.getAncillaryData()) { cb.putAncillaryData(data.getName(), toAncillaryDataInfo(data)); } } if (cmd.getDefaultSignificance() != null) { cb.setSignificance(toSignificanceInfo(cmd.getDefaultSignificance())); } if (cmd.getArgumentList() != null) { for (Argument xtceArgument : cmd.getArgumentList()) { cb.addArgument(toArgumentInfo(xtceArgument)); } } if (cmd.getArgumentAssignmentList() != null) { for (ArgumentAssignment xtceAssignment : cmd.getArgumentAssignmentList()) { cb.addArgumentAssignment(toArgumentAssignmentInfo(xtceAssignment)); } } cb.setAbstract(cmd.isAbstract()); if (cmd.getTransmissionConstraintList() != null) { for (TransmissionConstraint xtceConstraint : cmd.getTransmissionConstraintList()) { cb.addConstraint(toTransmissionConstraintInfo(xtceConstraint)); } } if (cmd.getCommandContainer() != null) { CommandContainer container = cmd.getCommandContainer(); cb.setCommandContainer(toCommandContainerInfo(container, DetailLevel.FULL)); } if (detail == DetailLevel.SUMMARY) { if (cmd.getBaseMetaCommand() != null) { cb.setBaseCommand(toCommandInfo(cmd.getBaseMetaCommand(), DetailLevel.LINK)); } } else if (detail == DetailLevel.FULL) { if (cmd.getBaseMetaCommand() != null) { cb.setBaseCommand(toCommandInfo(cmd.getBaseMetaCommand(), DetailLevel.FULL)); } } for (CommandVerifier verifier : cmd.getCommandVerifiers()) { cb.addVerifier(toVerifierInfo(verifier)); } } return cb.build(); }  static ContainerInfo toContainerInfo(SequenceContainer c, DetailLevel detail); static SequenceEntryInfo toSequenceEntryInfo(SequenceEntry e, DetailLevel detail); static FixedValueInfo toFixedValueInfo(FixedValueEntry entry); static RepeatInfo toRepeatInfo(Repeat xtceRepeat, DetailLevel detail); static CommandContainerInfo toCommandContainerInfo(CommandContainer container, DetailLevel detail); static CommandInfo toCommandInfo(MetaCommand cmd, DetailLevel detail); static ArgumentInfo toArgumentInfo(Argument xtceArgument); static ArgumentAssignmentInfo toArgumentAssignmentInfo(ArgumentAssignment xtceArgument); static TransmissionConstraintInfo toTransmissionConstraintInfo(TransmissionConstraint xtceConstraint); static VerifierInfo toVerifierInfo(CommandVerifier xtceVerifier); static ComparisonInfo toComparisonInfo(Comparison xtceComparison); static ComparisonInfo.OperatorType toOperatorType(OperatorType xtceOperator); static SignificanceInfo toSignificanceInfo(Significance xtceSignificance); static SignificanceLevelType toSignificanceLevelType(Levels level); static ParameterInfo toParameterInfo(ParameterInstanceRef ref); static ParameterInfo toParameterInfo(Parameter p, DetailLevel detail); static AncillaryDataInfo toAncillaryDataInfo(AncillaryData data); static ParameterTypeInfo toParameterTypeInfo(ParameterType parameterType, DetailLevel detail); static ArgumentTypeInfo toArgumentTypeInfo(ArgumentType argumentType); static List<ComparisonInfo> toComparisons(MatchCriteria matchCriteria); static DataEncodingInfo toDataEncodingInfo(DataEncoding xtceDataEncoding); static String toTextualEncoding(StringDataEncoding sde); static Mdb.EnumValue toEnumValue(ValueEnumeration xtceValue); static UnitInfo toUnitInfo(UnitType ut); static CalibratorInfo toCalibratorInfo(Calibrator calibrator); static AlarmInfo toAlarmInfo(NumericAlarm numericAlarm); static AlarmInfo toAlarmInfo(EnumerationAlarm enumerationAlarm); static Mdb.EnumerationAlarm toEnumerationAlarm(EnumerationAlarmItem xtceAlarmItem); static AlgorithmInfo toAlgorithmInfo(Algorithm a, DetailLevel detail); static InputParameterInfo toInputParameterInfo(InputParameter xtceInput); static OutputParameterInfo toOutputParameterInfo(OutputParameter xtceOutput); static SpaceSystemInfo toSpaceSystemInfo(SpaceSystem ss);  }