mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
renamed job.getCapacity() in job.getSize()
This commit is contained in:
parent
237075c463
commit
ed9db39fa0
27 changed files with 115 additions and 117 deletions
|
|
@ -75,7 +75,7 @@ public class TestInserter {
|
|||
public void whenInsertingShipmentAndRouteIsClosed_itInsertsCorrectly(){
|
||||
Shipment shipment = mock(Shipment.class);
|
||||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(shipment.getCapacity()).thenReturn(capacity);
|
||||
when(shipment.getSize()).thenReturn(capacity);
|
||||
Vehicle vehicle = mock(Vehicle.class);
|
||||
when(vehicle.getStartLocationId()).thenReturn("vehLoc");
|
||||
when(vehicle.getEndLocationId()).thenReturn("vehLoc");
|
||||
|
|
@ -85,7 +85,7 @@ public class TestInserter {
|
|||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class)).addPickup(shipment).addDelivery(shipment).build();
|
||||
//start - pick(shipment) - del(shipment) - end
|
||||
Shipment shipmentToInsert = mock(Shipment.class);
|
||||
when(shipmentToInsert.getCapacity()).thenReturn(capacity);
|
||||
when(shipmentToInsert.getSize()).thenReturn(capacity);
|
||||
when(shipmentToInsert.getDeliveryLocation()).thenReturn("delLoc");
|
||||
when(shipmentToInsert.getPickupLocation()).thenReturn("pickLoc");
|
||||
InsertionData iData = mock(InsertionData.class);
|
||||
|
|
@ -106,7 +106,7 @@ public class TestInserter {
|
|||
public void whenInsertingShipmentAndRouteIsOpen_itInsertsCorrectlyAndSwitchesEndLocation(){
|
||||
Shipment shipment = mock(Shipment.class);
|
||||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(shipment.getCapacity()).thenReturn(capacity);
|
||||
when(shipment.getSize()).thenReturn(capacity);
|
||||
Vehicle vehicle = mock(Vehicle.class);
|
||||
when(vehicle.isReturnToDepot()).thenReturn(false);
|
||||
when(vehicle.getId()).thenReturn("vehId");
|
||||
|
|
@ -114,7 +114,7 @@ public class TestInserter {
|
|||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class)).addPickup(shipment).addDelivery(shipment).build();
|
||||
//start - pick(shipment) - del(shipment) - end
|
||||
Shipment shipmentToInsert = mock(Shipment.class);
|
||||
when(shipmentToInsert.getCapacity()).thenReturn(capacity);
|
||||
when(shipmentToInsert.getSize()).thenReturn(capacity);
|
||||
when(shipmentToInsert.getDeliveryLocation()).thenReturn("delLoc");
|
||||
when(shipmentToInsert.getPickupLocation()).thenReturn("pickLoc");
|
||||
InsertionData iData = mock(InsertionData.class);
|
||||
|
|
@ -135,14 +135,14 @@ public class TestInserter {
|
|||
public void whenSwitchingVehicleAndRouteIsClosed_newStartAndEndShouldBeTheLocationOfNewVehicle(){
|
||||
Shipment shipment = mock(Shipment.class);
|
||||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(shipment.getCapacity()).thenReturn(capacity);
|
||||
when(shipment.getSize()).thenReturn(capacity);
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehId").setStartLocationId("vehLoc").setType(mock(VehicleType.class)).build();
|
||||
Vehicle newVehicle = VehicleImpl.Builder.newInstance("newVehId").setStartLocationId("newVehLoc").setType(mock(VehicleType.class)).build();
|
||||
|
||||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class)).addPickup(shipment).addDelivery(shipment).build();
|
||||
//start - pick(shipment) - del(shipment) - end
|
||||
Shipment shipmentToInsert = mock(Shipment.class);
|
||||
when(shipmentToInsert.getCapacity()).thenReturn(capacity);
|
||||
when(shipmentToInsert.getSize()).thenReturn(capacity);
|
||||
when(shipmentToInsert.getDeliveryLocation()).thenReturn("delLoc");
|
||||
when(shipmentToInsert.getPickupLocation()).thenReturn("pickLoc");
|
||||
|
||||
|
|
@ -161,14 +161,14 @@ public class TestInserter {
|
|||
public void whenSwitchingVehicleAndRouteIsOpen_endLocationShouldBeTheLocationOfTheLastActivity(){
|
||||
Shipment shipment = mock(Shipment.class);
|
||||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(shipment.getCapacity()).thenReturn(capacity);
|
||||
when(shipment.getSize()).thenReturn(capacity);
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehId").setReturnToDepot(false).setStartLocationId("vehLoc").setType(mock(VehicleType.class)).build();
|
||||
Vehicle newVehicle = VehicleImpl.Builder.newInstance("newVehId").setReturnToDepot(false).setStartLocationId("newVehLoc").setType(mock(VehicleType.class)).build();
|
||||
|
||||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class)).addPickup(shipment).addDelivery(shipment).build();
|
||||
//start - pick(shipment) - del(shipment) - end
|
||||
Shipment shipmentToInsert = mock(Shipment.class);
|
||||
when(shipmentToInsert.getCapacity()).thenReturn(capacity);
|
||||
when(shipmentToInsert.getSize()).thenReturn(capacity);
|
||||
when(shipmentToInsert.getDeliveryLocation()).thenReturn("delLoc");
|
||||
when(shipmentToInsert.getPickupLocation()).thenReturn("pickLoc");
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ public class TestInserter {
|
|||
public void whenInsertingShipmentAtBeginningAndSwitchingVehicleAndRouteIsOpen_endLocationShouldBeTheLocationOfTheLastActivity(){
|
||||
Shipment shipment = mock(Shipment.class);
|
||||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(shipment.getCapacity()).thenReturn(capacity);
|
||||
when(shipment.getSize()).thenReturn(capacity);
|
||||
when(shipment.getDeliveryLocation()).thenReturn("oldShipmentDelLoc");
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehId").setReturnToDepot(false).setStartLocationId("vehLoc").setType(mock(VehicleType.class)).build();
|
||||
Vehicle newVehicle = VehicleImpl.Builder.newInstance("newVehId").setReturnToDepot(false).setStartLocationId("newVehLoc").setType(mock(VehicleType.class)).build();
|
||||
|
|
@ -195,7 +195,7 @@ public class TestInserter {
|
|||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class)).addPickup(shipment).addDelivery(shipment).build();
|
||||
//start - pick(shipment) - del(shipment) - end
|
||||
Shipment shipmentToInsert = mock(Shipment.class);
|
||||
when(shipmentToInsert.getCapacity()).thenReturn(capacity);
|
||||
when(shipmentToInsert.getSize()).thenReturn(capacity);
|
||||
when(shipmentToInsert.getDeliveryLocation()).thenReturn("delLoc");
|
||||
when(shipmentToInsert.getPickupLocation()).thenReturn("pickLoc");
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class HardPickupAndDeliveryShipmentActivityConstraintTest {
|
|||
shipment = mock(Shipment.class);
|
||||
when(shipment.getCapacityDemand()).thenReturn(1);
|
||||
Capacity capacity = Capacity.Builder.newInstance().addDimension(0, 1).build();
|
||||
when(shipment.getCapacity()).thenReturn(capacity);
|
||||
when(shipment.getSize()).thenReturn(capacity);
|
||||
iFacts = new JobInsertionContext(null, null, vehicle, null, 0.0);
|
||||
constraint = new PickupAndDeliverShipmentLoadActivityLevelConstraint(stateManager);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ public class VrpReaderV2Test {
|
|||
VehicleRoutingProblem vrp = builder.build();
|
||||
Service s1 = (Service) vrp.getJobs().get("1");
|
||||
assertEquals(1,s1.getCapacityDemand());
|
||||
assertEquals(1,s1.getCapacity().get(0));
|
||||
assertEquals(1,s1.getSize().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -311,7 +311,7 @@ public class VrpReaderV2Test {
|
|||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||
assertEquals(10,s.getCapacityDemand());
|
||||
assertEquals(10,s.getCapacity().get(0));
|
||||
assertEquals(10,s.getSize().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ public class VrpWriterV2Test {
|
|||
Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
|
||||
Service s1 = Service.Builder.newInstance("1")
|
||||
.addCapacityDimension(0, 20)
|
||||
.addCapacityDimension(1, 200)
|
||||
.addSizeDimension(0, 20)
|
||||
.addSizeDimension(1, 200)
|
||||
.setLocationId("loc").setServiceTime(2.0).build();
|
||||
Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
|
||||
|
||||
|
|
@ -139,9 +139,9 @@ public class VrpWriterV2Test {
|
|||
|
||||
Service s1_read = (Service) vrp.getJobs().get("1");
|
||||
|
||||
assertEquals(2, s1_read.getCapacity().getNuOfDimensions());
|
||||
assertEquals(20, s1_read.getCapacity().get(0));
|
||||
assertEquals(200, s1_read.getCapacity().get(1));
|
||||
assertEquals(2, s1_read.getSize().getNuOfDimensions());
|
||||
assertEquals(20, s1_read.getSize().get(0));
|
||||
assertEquals(200, s1_read.getSize().get(1));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -339,8 +339,8 @@ public class VrpWriterV2Test {
|
|||
Shipment s1 = Shipment.Builder.newInstance("1")
|
||||
.setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
|
||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50)
|
||||
.addCapacityDimension(0, 10)
|
||||
.addCapacityDimension(2, 100)
|
||||
.addSizeDimension(0, 10)
|
||||
.addSizeDimension(2, 100)
|
||||
.build();
|
||||
|
||||
Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
|
||||
|
|
@ -353,13 +353,13 @@ public class VrpWriterV2Test {
|
|||
new VrpXMLReader(vrpToReadBuilder, null).read(infileName);
|
||||
VehicleRoutingProblem readVrp = vrpToReadBuilder.build();
|
||||
|
||||
assertEquals(3,((Shipment)readVrp.getJobs().get("1")).getCapacity().getNuOfDimensions());
|
||||
assertEquals(10,((Shipment)readVrp.getJobs().get("1")).getCapacity().get(0));
|
||||
assertEquals(0,((Shipment)readVrp.getJobs().get("1")).getCapacity().get(1));
|
||||
assertEquals(100,((Shipment)readVrp.getJobs().get("1")).getCapacity().get(2));
|
||||
assertEquals(3,((Shipment)readVrp.getJobs().get("1")).getSize().getNuOfDimensions());
|
||||
assertEquals(10,((Shipment)readVrp.getJobs().get("1")).getSize().get(0));
|
||||
assertEquals(0,((Shipment)readVrp.getJobs().get("1")).getSize().get(1));
|
||||
assertEquals(100,((Shipment)readVrp.getJobs().get("1")).getSize().get(2));
|
||||
|
||||
assertEquals(1,((Shipment)readVrp.getJobs().get("2")).getCapacity().getNuOfDimensions());
|
||||
assertEquals(20,((Shipment)readVrp.getJobs().get("2")).getCapacity().get(0));
|
||||
assertEquals(1,((Shipment)readVrp.getJobs().get("2")).getSize().getNuOfDimensions());
|
||||
assertEquals(20,((Shipment)readVrp.getJobs().get("2")).getSize().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ public class DeliveryTest {
|
|||
@Test
|
||||
public void whenAddingTwoCapDimension_nuOfDimsShouldBeTwo(){
|
||||
Delivery one = (Delivery)Delivery.Builder.newInstance("s").setLocationId("foofoo")
|
||||
.addCapacityDimension(0,2)
|
||||
.addCapacityDimension(1,4)
|
||||
.addSizeDimension(0,2)
|
||||
.addSizeDimension(1,4)
|
||||
.build();
|
||||
assertEquals(2,one.getCapacity().getNuOfDimensions());
|
||||
assertEquals(2,one.getCapacity().get(0));
|
||||
assertEquals(4,one.getCapacity().get(1));
|
||||
assertEquals(2,one.getSize().getNuOfDimensions());
|
||||
assertEquals(2,one.getSize().get(0));
|
||||
assertEquals(4,one.getSize().get(1));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -28,8 +28,8 @@ public class DeliveryTest {
|
|||
public void whenPickupIsBuiltWithoutSpecifyingCapacity_itShouldHvCapWithOneDimAndDimValOfZero(){
|
||||
Delivery one = (Delivery)Delivery.Builder.newInstance("s").setLocationId("foofoo")
|
||||
.build();
|
||||
assertEquals(1,one.getCapacity().getNuOfDimensions());
|
||||
assertEquals(0,one.getCapacity().get(0));
|
||||
assertEquals(1,one.getSize().getNuOfDimensions());
|
||||
assertEquals(0,one.getSize().get(0));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
|
@ -38,8 +38,8 @@ public class DeliveryTest {
|
|||
Delivery one = (Delivery)Delivery.Builder.newInstance("s",1).setLocationId("foofoo")
|
||||
.build();
|
||||
assertEquals(1,one.getCapacityDemand());
|
||||
assertEquals(1,one.getCapacity().getNuOfDimensions());
|
||||
assertEquals(1,one.getCapacity().get(0));
|
||||
assertEquals(1,one.getSize().getNuOfDimensions());
|
||||
assertEquals(1,one.getSize().get(0));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ public class PickupTest {
|
|||
@Test
|
||||
public void whenAddingTwoCapDimension_nuOfDimsShouldBeTwo(){
|
||||
Pickup one = (Pickup)Pickup.Builder.newInstance("s").setLocationId("foofoo")
|
||||
.addCapacityDimension(0,2)
|
||||
.addCapacityDimension(1,4)
|
||||
.addSizeDimension(0,2)
|
||||
.addSizeDimension(1,4)
|
||||
.build();
|
||||
assertEquals(2,one.getCapacity().getNuOfDimensions());
|
||||
assertEquals(2,one.getCapacity().get(0));
|
||||
assertEquals(4,one.getCapacity().get(1));
|
||||
assertEquals(2,one.getSize().getNuOfDimensions());
|
||||
assertEquals(2,one.getSize().get(0));
|
||||
assertEquals(4,one.getSize().get(1));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -28,8 +28,8 @@ public class PickupTest {
|
|||
public void whenPickupIsBuiltWithoutSpecifyingCapacity_itShouldHvCapWithOneDimAndDimValOfZero(){
|
||||
Pickup one = (Pickup)Pickup.Builder.newInstance("s").setLocationId("foofoo")
|
||||
.build();
|
||||
assertEquals(1,one.getCapacity().getNuOfDimensions());
|
||||
assertEquals(0,one.getCapacity().get(0));
|
||||
assertEquals(1,one.getSize().getNuOfDimensions());
|
||||
assertEquals(0,one.getSize().get(0));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
|
@ -38,8 +38,8 @@ public class PickupTest {
|
|||
Pickup one = (Pickup)Pickup.Builder.newInstance("s",1).setLocationId("foofoo")
|
||||
.build();
|
||||
assertEquals(1,one.getCapacityDemand());
|
||||
assertEquals(1,one.getCapacity().getNuOfDimensions());
|
||||
assertEquals(1,one.getCapacity().get(0));
|
||||
assertEquals(1,one.getSize().getNuOfDimensions());
|
||||
assertEquals(1,one.getSize().get(0));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -63,24 +63,24 @@ public class ServiceTest {
|
|||
@Test(expected=IllegalArgumentException.class)
|
||||
public void whenCapacityDimValueIsNegative_throwIllegalStateExpception(){
|
||||
@SuppressWarnings("unused")
|
||||
Service s = Service.Builder.newInstance("s").setLocationId("foo").addCapacityDimension(0, -10).build();
|
||||
Service s = Service.Builder.newInstance("s").setLocationId("foo").addSizeDimension(0, -10).build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenAddingTwoCapDimension_nuOfDimsShouldBeTwo(){
|
||||
Service one = Service.Builder.newInstance("s").setLocationId("foofoo")
|
||||
.addCapacityDimension(0,2)
|
||||
.addCapacityDimension(1,4)
|
||||
.addSizeDimension(0,2)
|
||||
.addSizeDimension(1,4)
|
||||
.build();
|
||||
assertEquals(2,one.getCapacity().getNuOfDimensions());
|
||||
assertEquals(2,one.getSize().getNuOfDimensions());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenShipmentIsBuiltWithoutSpecifyingCapacity_itShouldHvCapWithOneDimAndDimValOfZero(){
|
||||
Service one = Service.Builder.newInstance("s").setLocationId("foofoo")
|
||||
.build();
|
||||
assertEquals(1,one.getCapacity().getNuOfDimensions());
|
||||
assertEquals(0,one.getCapacity().get(0));
|
||||
assertEquals(1,one.getSize().getNuOfDimensions());
|
||||
assertEquals(0,one.getSize().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -88,8 +88,8 @@ public class ServiceTest {
|
|||
Service one = Service.Builder.newInstance("s",1).setLocationId("foofoo")
|
||||
.build();
|
||||
assertEquals(1,one.getCapacityDemand());
|
||||
assertEquals(1,one.getCapacity().getNuOfDimensions());
|
||||
assertEquals(1,one.getCapacity().get(0));
|
||||
assertEquals(1,one.getSize().getNuOfDimensions());
|
||||
assertEquals(1,one.getSize().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class ShipmentTest {
|
|||
@Test(expected=IllegalArgumentException.class)
|
||||
public void whenShipmentIsBuiltWithNegativeDemand_itShouldThrowException_v2(){
|
||||
@SuppressWarnings("unused")
|
||||
Shipment one = Shipment.Builder.newInstance("s").addCapacityDimension(0, -10).setPickupLocation("foo").setDeliveryLocation("foofoo").build();
|
||||
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, -10).setPickupLocation("foo").setDeliveryLocation("foofoo").build();
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
|
|
@ -204,25 +204,25 @@ public class ShipmentTest {
|
|||
public void whenShipmentHasNegativeCapacityVal_throwIllegalStateExpception(){
|
||||
@SuppressWarnings("unused")
|
||||
Shipment one = Shipment.Builder.newInstance("s").setPickupLocation("foo").setDeliveryLocation("foofoo")
|
||||
.addCapacityDimension(0, -2)
|
||||
.addSizeDimension(0, -2)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenAddingTwoCapDimension_nuOfDimsShouldBeTwo(){
|
||||
Shipment one = Shipment.Builder.newInstance("s").setPickupLocation("foo").setDeliveryLocation("foofoo")
|
||||
.addCapacityDimension(0,2)
|
||||
.addCapacityDimension(1,4)
|
||||
.addSizeDimension(0,2)
|
||||
.addSizeDimension(1,4)
|
||||
.build();
|
||||
assertEquals(2,one.getCapacity().getNuOfDimensions());
|
||||
assertEquals(2,one.getSize().getNuOfDimensions());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenShipmentIsBuiltWithoutSpecifyingCapacity_itShouldHvCapWithOneDimAndDimValOfZero(){
|
||||
Shipment one = Shipment.Builder.newInstance("s").setPickupLocation("foo").setPickupCoord(Coordinate.newInstance(0, 0))
|
||||
.setDeliveryLocation("foofoo").build();
|
||||
assertEquals(1,one.getCapacity().getNuOfDimensions());
|
||||
assertEquals(0,one.getCapacity().get(0));
|
||||
assertEquals(1,one.getSize().getNuOfDimensions());
|
||||
assertEquals(0,one.getSize().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -230,7 +230,7 @@ public class ShipmentTest {
|
|||
Shipment one = Shipment.Builder.newInstance("s",1).setPickupLocation("foo").setPickupCoord(Coordinate.newInstance(0, 0))
|
||||
.setDeliveryLocation("foofoo").build();
|
||||
assertEquals(1,one.getCapacityDemand());
|
||||
assertEquals(1,one.getCapacity().getNuOfDimensions());
|
||||
assertEquals(1,one.getCapacity().get(0));
|
||||
assertEquals(1,one.getSize().getNuOfDimensions());
|
||||
assertEquals(1,one.getSize().get(0));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class VehicleRouteBuilderTest {
|
|||
public void whenShipmentIsPickedDeliveredAndDeliveredAgain_throwsException(){
|
||||
Shipment s = mock(Shipment.class);
|
||||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(s.getCapacity()).thenReturn(capacity);
|
||||
when(s.getSize()).thenReturn(capacity);
|
||||
VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(mock(Vehicle.class), mock(Driver.class));
|
||||
builder.addPickup(s);
|
||||
builder.addDelivery(s);
|
||||
|
|
@ -43,7 +43,7 @@ public class VehicleRouteBuilderTest {
|
|||
public void whenShipmentIsPickedUpThoughButHasNotBeenDeliveredAndRouteIsBuilt_throwsException(){
|
||||
Shipment s = mock(Shipment.class);
|
||||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(s.getCapacity()).thenReturn(capacity);
|
||||
when(s.getSize()).thenReturn(capacity);
|
||||
VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(mock(Vehicle.class), mock(Driver.class));
|
||||
builder.addPickup(s);
|
||||
builder.addPickup(mock(Shipment.class));
|
||||
|
|
@ -56,8 +56,8 @@ public class VehicleRouteBuilderTest {
|
|||
Shipment s = mock(Shipment.class);
|
||||
Shipment s2 = mock(Shipment.class);
|
||||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(s.getCapacity()).thenReturn(capacity);
|
||||
when(s2.getCapacity()).thenReturn(capacity);
|
||||
when(s.getSize()).thenReturn(capacity);
|
||||
when(s2.getSize()).thenReturn(capacity);
|
||||
VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(mock(Vehicle.class), mock(Driver.class));
|
||||
builder.addPickup(s);
|
||||
builder.addPickup(s2);
|
||||
|
|
@ -72,8 +72,8 @@ public class VehicleRouteBuilderTest {
|
|||
Shipment s = mock(Shipment.class);
|
||||
Shipment s2 = mock(Shipment.class);
|
||||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(s.getCapacity()).thenReturn(capacity);
|
||||
when(s2.getCapacity()).thenReturn(capacity);
|
||||
when(s.getSize()).thenReturn(capacity);
|
||||
when(s2.getSize()).thenReturn(capacity);
|
||||
Vehicle vehicle = mock(Vehicle.class);
|
||||
when(vehicle.isReturnToDepot()).thenReturn(true);
|
||||
when(vehicle.getStartLocationId()).thenReturn("vehLoc");
|
||||
|
|
@ -92,8 +92,8 @@ public class VehicleRouteBuilderTest {
|
|||
Shipment s = mock(Shipment.class);
|
||||
Shipment s2 = mock(Shipment.class);
|
||||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(s.getCapacity()).thenReturn(capacity);
|
||||
when(s2.getCapacity()).thenReturn(capacity);
|
||||
when(s.getSize()).thenReturn(capacity);
|
||||
when(s2.getSize()).thenReturn(capacity);
|
||||
when(s2.getDeliveryLocation()).thenReturn("delLoc");
|
||||
Vehicle vehicle = mock(Vehicle.class);
|
||||
when(vehicle.isReturnToDepot()).thenReturn(false);
|
||||
|
|
@ -112,8 +112,8 @@ public class VehicleRouteBuilderTest {
|
|||
Shipment s = mock(Shipment.class);
|
||||
Shipment s2 = mock(Shipment.class);
|
||||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(s.getCapacity()).thenReturn(capacity);
|
||||
when(s2.getCapacity()).thenReturn(capacity);
|
||||
when(s.getSize()).thenReturn(capacity);
|
||||
when(s2.getSize()).thenReturn(capacity);
|
||||
when(s2.getDeliveryLocation()).thenReturn("delLoc");
|
||||
Vehicle vehicle = mock(Vehicle.class);
|
||||
when(vehicle.isReturnToDepot()).thenReturn(false);
|
||||
|
|
@ -135,8 +135,8 @@ public class VehicleRouteBuilderTest {
|
|||
Shipment s = mock(Shipment.class);
|
||||
Shipment s2 = mock(Shipment.class);
|
||||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(s.getCapacity()).thenReturn(capacity);
|
||||
when(s2.getCapacity()).thenReturn(capacity);
|
||||
when(s.getSize()).thenReturn(capacity);
|
||||
when(s2.getSize()).thenReturn(capacity);
|
||||
when(s2.getDeliveryLocation()).thenReturn("delLoc");
|
||||
Vehicle vehicle = mock(Vehicle.class);
|
||||
when(vehicle.isReturnToDepot()).thenReturn(false);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class DeliverServiceTest {
|
|||
public void doBefore(){
|
||||
service = (Delivery) Delivery.Builder.newInstance("service").setLocationId("loc").
|
||||
setTimeWindow(TimeWindow.newInstance(1., 2.)).
|
||||
addCapacityDimension(0, 10).addCapacityDimension(1, 100).addCapacityDimension(2, 1000).build();
|
||||
addSizeDimension(0, 10).addSizeDimension(1, 100).addSizeDimension(2, 1000).build();
|
||||
deliver = new DeliverService(service);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class DeliverShipmentTest {
|
|||
.setDeliveryLocation("deliveryLoc")
|
||||
.setPickupTimeWindow(TimeWindow.newInstance(1., 2.))
|
||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3., 4.))
|
||||
.addCapacityDimension(0, 10).addCapacityDimension(1, 100).addCapacityDimension(2, 1000).build();
|
||||
.addSizeDimension(0, 10).addSizeDimension(1, 100).addSizeDimension(2, 1000).build();
|
||||
deliver = new DeliverShipment(shipment);
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ public class DeliverShipmentTest {
|
|||
@Test
|
||||
public void whenGettingCapacity_itShouldReturnItCorrectly(){
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").setPickupLocation("pickLoc").setDeliveryLocation("delLoc")
|
||||
.addCapacityDimension(0, 10).addCapacityDimension(1, 100).build();
|
||||
.addSizeDimension(0, 10).addSizeDimension(1, 100).build();
|
||||
PickupShipment pick = new PickupShipment(shipment);
|
||||
assertEquals(10,pick.getCapacity().get(0));
|
||||
assertEquals(100,pick.getCapacity().get(1));
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class PickupServiceTest {
|
|||
public void doBefore(){
|
||||
service = Service.Builder.newInstance("service").setLocationId("loc").
|
||||
setTimeWindow(TimeWindow.newInstance(1., 2.)).
|
||||
addCapacityDimension(0, 10).addCapacityDimension(1, 100).addCapacityDimension(2, 1000).build();
|
||||
addSizeDimension(0, 10).addSizeDimension(1, 100).addSizeDimension(2, 1000).build();
|
||||
pickup = new PickupService(service);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class PickupShipmentTest {
|
|||
.setDeliveryLocation("deliveryLoc")
|
||||
.setPickupTimeWindow(TimeWindow.newInstance(1., 2.))
|
||||
.setDeliveryTimeWindow(TimeWindow.newInstance(3., 4.))
|
||||
.addCapacityDimension(0, 10).addCapacityDimension(1, 100).addCapacityDimension(2, 1000).build();
|
||||
.addSizeDimension(0, 10).addSizeDimension(1, 100).addSizeDimension(2, 1000).build();
|
||||
pickup = new PickupShipment(shipment);
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ public class PickupShipmentTest {
|
|||
@Test
|
||||
public void whenGettingCapacity_itShouldReturnItCorrectly(){
|
||||
Shipment shipment = Shipment.Builder.newInstance("s").setPickupLocation("pickLoc").setDeliveryLocation("delLoc")
|
||||
.addCapacityDimension(0, 10).addCapacityDimension(1, 100).build();
|
||||
.addSizeDimension(0, 10).addSizeDimension(1, 100).build();
|
||||
PickupShipment pick = new PickupShipment(shipment);
|
||||
assertEquals(10,pick.getCapacity().get(0));
|
||||
assertEquals(100,pick.getCapacity().get(1));
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class ServiceActivityTest {
|
|||
public void doBefore(){
|
||||
service = Service.Builder.newInstance("service").setLocationId("loc").
|
||||
setTimeWindow(TimeWindow.newInstance(1., 2.)).
|
||||
addCapacityDimension(0, 10).addCapacityDimension(1, 100).addCapacityDimension(2, 1000).build();
|
||||
addSizeDimension(0, 10).addSizeDimension(1, 100).addSizeDimension(2, 1000).build();
|
||||
serviceActivity = ServiceActivity.newInstance(service);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class TestTour {
|
|||
|
||||
@Before
|
||||
public void doBefore(){
|
||||
service = Service.Builder.newInstance("yo").addCapacityDimension(0, 10).setLocationId("loc").build();
|
||||
service = Service.Builder.newInstance("yo").addSizeDimension(0, 10).setLocationId("loc").build();
|
||||
act = ServiceActivity.newInstance(service);
|
||||
tour = new TourActivities();
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ public class TestTour {
|
|||
assertEquals(0, tour.getActivities().size());
|
||||
tour.addActivity(act);
|
||||
assertEquals(1, tour.getActivities().size());
|
||||
Service anotherServiceInstance = Service.Builder.newInstance("yo").addCapacityDimension(0, 10).setLocationId("loc").build();
|
||||
Service anotherServiceInstance = Service.Builder.newInstance("yo").addSizeDimension(0, 10).setLocationId("loc").build();
|
||||
assertTrue(service.equals(anotherServiceInstance));
|
||||
boolean removed = tour.removeJob(anotherServiceInstance);
|
||||
assertTrue(removed);
|
||||
|
|
@ -82,7 +82,7 @@ public class TestTour {
|
|||
|
||||
@Test
|
||||
public void whenAddingAShipmentActivity_tourShouldServeShipment(){
|
||||
Shipment s = Shipment.Builder.newInstance("s").addCapacityDimension(0, 1).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
||||
Shipment s = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
||||
TourShipmentActivityFactory fac = new DefaultShipmentActivityFactory();
|
||||
TourActivity pickupShipment = fac.createPickup(s);
|
||||
TourActivity deliverShipment = fac.createDelivery(s);
|
||||
|
|
@ -96,7 +96,7 @@ public class TestTour {
|
|||
|
||||
@Test
|
||||
public void whenRemovingShipment_tourShouldNotServiceItAnymore(){
|
||||
Shipment s = Shipment.Builder.newInstance("s").addCapacityDimension(0, 1).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
||||
Shipment s = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
||||
TourShipmentActivityFactory fac = new DefaultShipmentActivityFactory();
|
||||
TourActivity pickupShipment = fac.createPickup(s);
|
||||
TourActivity deliverShipment = fac.createDelivery(s);
|
||||
|
|
@ -110,7 +110,7 @@ public class TestTour {
|
|||
|
||||
@Test
|
||||
public void whenRemovingShipment_theirCorrespondingActivitiesShouldBeRemoved(){
|
||||
Shipment s = Shipment.Builder.newInstance("s").addCapacityDimension(0, 1).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
||||
Shipment s = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
|
||||
TourShipmentActivityFactory fac = new DefaultShipmentActivityFactory();
|
||||
TourActivity pickupShipment = fac.createPickup(s);
|
||||
TourActivity deliverShipment = fac.createDelivery(s);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue