コード例 #1
0
  public void testUpateNonExistenceFlightPlanObject() {

    // create a flight plan

    FlightPlan flightPlanNotAdded = null;

    try {
      flightPlanNotAdded = new FlightPlan(tailNumber, callSign);
    } catch (MuthurException e) {
      fail(e.getLocalizedMessage());
    }

    flightPlanNotAdded.setSource(source);
    flightPlanNotAdded.setAircraftType(aircraftType);
    flightPlanNotAdded.setPlannedDepartureTimeMSecs(System.currentTimeMillis());
    flightPlanNotAdded.setPlannedArrivalTimeMSecs(System.currentTimeMillis() + 30000);
    flightPlanNotAdded.setCruiseSpeedKts(cruiseSpeedKts);
    flightPlanNotAdded.setCruiseAltitudeFt(cruiseAltitudeFeet);
    flightPlanNotAdded.setRoutePlan(route);
    flightPlanNotAdded.setDepartureCenter(departureCenter);
    flightPlanNotAdded.setArrivalCenter(arrivalCenter);
    flightPlanNotAdded.setDepartureFix(departureFix);
    flightPlanNotAdded.setArrivalFix(arrivalFix);
    flightPlanNotAdded.setPhysicalAircraftClass(physicalClass);
    flightPlanNotAdded.setWeightAircraftClass(weightClass);
    flightPlanNotAdded.setUserAircraftClass(userClass);
    flightPlanNotAdded.setNumOfAircraft(1);
    flightPlanNotAdded.setAirborneEquipmentQualifier(airborneEquipmentQualifier);

    try {
      objectService.updateObject(federationExecutionID, flightPlanNotAdded);
      fail("Should have thrown an exception trying to update a non-existent object.");
    } catch (MuthurException e) {
    }
  }
コード例 #2
0
  public void testAddFlightPlanObject() {

    // create a flight plan

    flightPlan = null;

    try {
      flightPlan = new FlightPlan(tailNumber, callSign);
    } catch (MuthurException e) {
      fail(e.getLocalizedMessage());
    }

    flightPlan.setSource(source);
    flightPlan.setAircraftType(aircraftType);
    flightPlan.setPlannedDepartureTimeMSecs(System.currentTimeMillis());
    flightPlan.setPlannedArrivalTimeMSecs(System.currentTimeMillis() + 30000);
    flightPlan.setCruiseSpeedKts(cruiseSpeedKts);
    flightPlan.setCruiseAltitudeFt(cruiseAltitudeFeet);
    flightPlan.setRoutePlan(route);
    flightPlan.setDepartureCenter(departureCenter);
    flightPlan.setArrivalCenter(arrivalCenter);
    flightPlan.setDepartureFix(departureFix);
    flightPlan.setArrivalFix(arrivalFix);
    flightPlan.setPhysicalAircraftClass(physicalClass);
    flightPlan.setWeightAircraftClass(weightClass);
    flightPlan.setUserAircraftClass(userClass);
    flightPlan.setNumOfAircraft(1);
    flightPlan.setAirborneEquipmentQualifier(airborneEquipmentQualifier);

    // add the flight plan

    try {
      objectService.addDataObject(federationExecutionID, flightPlan);
    } catch (MuthurException e) {
      fail(e.getLocalizedMessage());
    }

    assertObjectExists(flightPlan);
  }
コード例 #3
0
  @Test
  public void testCreateOrUpdateObjectRequestWithFlightPlanObject() {

    FlightPlan flightPlan = null;

    try {
      flightPlan = new FlightPlan(tailNumber, acid);
    } catch (MuthurException e) {
      fail(e.getLocalizedMessage());
    }

    assertNotNull(flightPlan);

    assertEquals(flightPlan.getCallSign(), acid);
    assertEquals(flightPlan.getTailNumber(), tailNumber);
    assertNotNull(flightPlan.getDataObjectUUID());
    assertFalse(flightPlan.getDataObjectUUID().equalsIgnoreCase(""));
    assertTrue(flightPlan.getObjectCreateTimeMSecs() != 0L);

    // flight plan data

    flightPlan.setSource("Flight");
    flightPlan.setAircraftType("B771");
    flightPlan.setPlannedDepartureTimeMSecs(System.currentTimeMillis() + 10);
    flightPlan.setPlannedDepartureRunway("1R");
    flightPlan.setPlannedTaxiOutGate("D31");
    flightPlan.setDepartureFix("DEFIX");
    flightPlan.setDepartureCenter("ZID");

    flightPlan.setPlannedArrivalTimeMSecs(System.currentTimeMillis() + 20);
    flightPlan.setPlannedArrivalRunway("8L");
    flightPlan.setPlannedTaxiInGate("C11");
    flightPlan.setArrivalCenter("ZBW");
    flightPlan.setArrivalFix("ARFIX");

    flightPlan.setCruiseSpeedKts(400);
    flightPlan.setCruiseAltitudeFt(330);
    flightPlan.setRoutePlan("IND..ROD.J29.PLB.J595.BGR..BGR");
    flightPlan.setPhysicalAircraftClass("J");
    flightPlan.setWeightAircraftClass("H");
    flightPlan.setUserAircraftClass("C");
    flightPlan.setNumOfAircraft(1);
    flightPlan.setAirborneEquipmentQualifier("R");
    flightPlan.setFlightPlanStatus(FlightPlanStatus.CANCELLED);

    // create a CreateOrUpdateObjectRequest

    CreateOrUpdateObjectRequest cor = new CreateOrUpdateObjectRequest();
    assertNotNull(cor);

    cor.setFederationExecutionHandle(UUID.randomUUID().toString());
    cor.setFederateRegistrationHandle(UUID.randomUUID().toString());
    cor.setFederationExecutionModelHandle(UUID.randomUUID().toString());
    cor.setSourceOfEvent("NexSim");
    cor.setDataObject(flightPlan);

    // serialize the object

    String corAsXML = cor.serialize();

    writeToFile(cor, false);

    // do standard validation

    assertNotNull(corAsXML);
    assertFalse(corAsXML.equals(""));

    // create another object from previous object's serialized form

    CreateOrUpdateObjectRequest objectFromXML = new CreateOrUpdateObjectRequest();

    try {
      objectFromXML.initialization(corAsXML);
    } catch (MuthurException e) {
      fail(e.getLocalizedMessage());
    }

    // ensure that the two objects are equal

    assertTrue(objectFromXML.equals(cor));

    // get the serialized version of the new object

    String newObjSerializedAsXML = objectFromXML.serialize();

    assertNotNull(newObjSerializedAsXML);
    assertFalse(newObjSerializedAsXML.equals(""));

    IBaseDataObject bdo = objectFromXML.getDataObject();

    assertNotNull(bdo);
    assertTrue(bdo instanceof FlightPlan);

    /** Initialize the internal data object from the serialized containing object */
    try {
      bdo.initialization(newObjSerializedAsXML);
    } catch (MuthurException e) {
      fail(e.getLocalizedMessage());
    }

    // check the serialized form of the data object
    String bdoSerialized = bdo.serialize();
    assertNotNull(bdoSerialized);
  }
コード例 #4
0
  public void testUpateFlightPlanObjectAttributes() {

    // set the attributes to be updated
    //
    FlightPlan newFlightPlan = new FlightPlan();

    // NOTE: Used only since the unit testing is conducted in the VM.
    // Changing
    // this emulates what would happen if the objects were residing on
    // separate
    // machines and thus address spaces.

    newFlightPlan.setDataObjectUUID(flightPlan.getDataObjectUUID());

    newFlightPlan.setSource(source);
    newFlightPlan.setAircraftType(aircraftType);
    newFlightPlan.setCruiseSpeedKts(cruiseSpeedKts);
    newFlightPlan.setCruiseAltitudeFt(cruiseAltitudeFeet);
    newFlightPlan.setRoutePlan(route);
    newFlightPlan.setPlannedDepartureTimeMSecs(System.currentTimeMillis());
    newFlightPlan.setDepartureCenter(departureCenter);
    newFlightPlan.setDepartureFix(departureFix);
    newFlightPlan.setPlannedArrivalTimeMSecs(System.currentTimeMillis());
    newFlightPlan.setArrivalCenter(arrivalCenter);
    newFlightPlan.setArrivalFix(arrivalFix);
    newFlightPlan.setPhysicalAircraftClass(physicalClass);
    newFlightPlan.setWeightAircraftClass(weightClass);
    newFlightPlan.setUserAircraftClass(userClass);
    newFlightPlan.setNumOfAircraft(1);
    newFlightPlan.setAirborneEquipmentQualifier(airborneEquipmentQualifier);

    Set<String> fieldsToUpdate = new HashSet<String>();
    fieldsToUpdate.add(EventAttributeName.source.toString());
    fieldsToUpdate.add(EventAttributeName.aircraftType.toString());
    fieldsToUpdate.add(EventAttributeName.cruiseSpeedKts.toString());
    fieldsToUpdate.add(EventAttributeName.cruiseAltitudeFt.toString());
    fieldsToUpdate.add(EventAttributeName.routePlan.toString());
    fieldsToUpdate.add(EventAttributeName.plannedDepartureTimeMSecs.toString());
    fieldsToUpdate.add(EventAttributeName.departureCenter.toString());
    fieldsToUpdate.add(EventAttributeName.departureFix.toString());
    fieldsToUpdate.add(EventAttributeName.plannedArrivalTimeMSecs.toString());
    fieldsToUpdate.add(EventAttributeName.arrivalCenter.toString());
    fieldsToUpdate.add(EventAttributeName.arrivalFix.toString());
    fieldsToUpdate.add(EventAttributeName.physicalAircraftClass.toString());
    fieldsToUpdate.add(EventAttributeName.weightAircraftClass.toString());
    fieldsToUpdate.add(EventAttributeName.userAircraftClass.toString());
    fieldsToUpdate.add(EventAttributeName.numOfAircraft.toString());
    fieldsToUpdate.add(EventAttributeName.airborneEquipmentQualifier.toString());

    try {
      objectService.updateObjectAttributes(federationExecutionID, newFlightPlan, fieldsToUpdate);
    } catch (MuthurException e) {
      fail(e.getLocalizedMessage());
    }

    // will retrieve the updated object from the object service and compare
    // it
    // to the object which should accurately test whether the update was
    // applied

    assertObjectExists(flightPlan);
  }