Route extends NetworkElement { public void removeBackupRoute (Route backupRoute) { if (backupRoute == null) throw new Net2PlanException ("The passed element is NULL"); this.checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); if (!backupRoutes.contains(backupRoute)) throw new Net2PlanException ("This route is not a backup"); backupRoute.cache_routesIAmBackUp.remove(this); this.backupRoutes.remove (backupRoute); if (ErrorHandling.isDebugEnabled()) netPlan.checkCachesConsistency(); } Route(NetPlan netPlan , long id , int index , Demand demand , List<? extends NetworkElement> seqLinksAndResourcesTraversed , AttributeMap attributes); Route getBidirectionalPair(); void setBidirectionalPair(Route r); boolean isBidirectional(); Route createBidirectionalOppositePair(); boolean isServiceChain(); SortedSet<Route> getRoutesIAmBackup(); List<Route> getBackupRoutes(); Triple<Double,List<NetworkElement>,List<Double>> getInitialState(); List<NetworkElement> getPath(); List<NetworkElement> getOppositePath(); boolean isBackupRoute(); boolean hasBackupRoutes(); void addBackupRoute(Route backupRoute); void removeBackupRoute(Route backupRoute); double getCarriedTraffic(); double getOccupiedCapacity(NetworkElement ... e); double getCarriedTrafficInNoFailureState(); double getOccupiedCapacityInNoFailureState(NetworkElement ... e); Demand getDemand(); Node getEgressNode(); Node getFirstAvailableNodeAfterFailures(); Node getFirstAvailableNodeBeforeFailures(); Node getIngressNode(); NetworkLayer getLayer(); double getLengthInKm(); int getNumberOfHops(); double getPropagationDelayInMiliseconds(); double getPropagationSpeedInKmPerSecond(); List<Double> getSeqOccupiedCapacitiesIfNotFailing(); boolean isOccupyingDifferentCapacitiesInDifferentLinksInNoFailureState(); List<Resource> getSeqResourcesTraversed(); List<Link> getSeqLinks(); List<Node> getSeqNodes(); List<Node> getSeqIntermediateNodes(); int getNumberOfTimesIsTraversed(NetworkElement e); SortedSet<SharedRiskGroup> getSRGs(); boolean hasLoops(); boolean isDown(); boolean isTraversingZeroCapLinks(); void remove(); void setCarriedTraffic(double newCarriedTraffic , double newOccupiedLinkAndResourcesCapacities); void setCarriedTraffic(double newCarriedTraffic , List<Double> linkAndResourcesOccupationInformation); void setPath(double newCarriedTraffic , List<? extends NetworkElement> newPath , List<Double> newOccupationInformation); void setSeqLinks(List<Link> seqLinks); @Override String toString(); static List<Link> getSeqLinks(List<? extends NetworkElement> seqLinksAndResources); static List<Resource> getSeqResources(List<? extends NetworkElement> seqLinksAndResources);  }
@Test public void testRemoveBackupRoute() { final Route newSegmScd = np.addServiceChain(scd123, 0, Arrays.asList(1.0 , 2.0 , 3.0), Arrays.asList(link12, res2backup , link23), null); sc123.addBackupRoute(newSegmScd); assertEquals(sc123.getBackupRoutes(), Arrays.asList(newSegmScd)); try { sc123.removeBackupRoute(null); fail ("Should not accept this"); } catch (Net2PlanException e) { } try { sc123.removeBackupRoute(r12); fail (""); } catch (Net2PlanException e) { } sc123.removeBackupRoute(newSegmScd); assertEquals(sc123.getBackupRoutes(), Arrays.asList()); final Route newSegm123 = np.addServiceChain(d13, 0, Arrays.asList(1.0 , 2.0), Arrays.asList(link12, link23), null); r123a.addBackupRoute(newSegm123); assertEquals(r123a.getBackupRoutes(), Arrays.asList(segm13 , newSegm123)); r123a.removeBackupRoute(segm13); assertEquals(r123a.getBackupRoutes(), Arrays.asList(newSegm123)); r123a.removeBackupRoute(newSegm123); assertEquals(r123a.getBackupRoutes(), Arrays.asList()); }