@Test(dependsOnMethods = {"testInstantiation", "testDefinition"}) public void testToString() { ShareableResource rc = new ShareableResource("foo"); rc.setConsumption(vms.get(0), 1); rc.setConsumption(vms.get(1), 2); rc.setConsumption(vms.get(2), 3); Assert.assertNotNull(rc.toString()); }
@Override public String toString() { StringJoiner joiner = new StringJoiner(",", String.format("rc:%s:", rcId), ""); for (Node n: nodesCapacity.keySet()) { int c = nodesCapacity.get(n); joiner.add(String.format("<node %s,%d>", n, c)); } StringJoiner vmJoiner = new StringJoiner(","); for (VM vm: vmsConsumption.keySet()) { int c = vmsConsumption.get(vm); vmJoiner.add(String.format("<VM %s,%d>", vm, c)); } return String.format("%s%s", joiner, vmJoiner); }
ShareableResource implements ModelView { @Override public String toString() { StringJoiner joiner = new StringJoiner(",", String.format("rc:%s:", rcId), ""); for (Node n: nodesCapacity.keySet()) { int c = nodesCapacity.get(n); joiner.add(String.format("<node %s,%d>", n, c)); } StringJoiner vmJoiner = new StringJoiner(","); for (VM vm: vmsConsumption.keySet()) { int c = vmsConsumption.get(vm); vmJoiner.add(String.format("<VM %s,%d>", vm, c)); } return String.format("%s%s", joiner, vmJoiner); } }
ShareableResource implements ModelView { @Override public String toString() { StringJoiner joiner = new StringJoiner(",", String.format("rc:%s:", rcId), ""); for (Node n: nodesCapacity.keySet()) { int c = nodesCapacity.get(n); joiner.add(String.format("<node %s,%d>", n, c)); } StringJoiner vmJoiner = new StringJoiner(","); for (VM vm: vmsConsumption.keySet()) { int c = vmsConsumption.get(vm); vmJoiner.add(String.format("<VM %s,%d>", vm, c)); } return String.format("%s%s", joiner, vmJoiner); } ShareableResource(String r);  ShareableResource(String id, int defCapacity, int defConsumption); }
ShareableResource implements ModelView { @Override public String toString() { StringJoiner joiner = new StringJoiner(",", String.format("rc:%s:", rcId), ""); for (Node n: nodesCapacity.keySet()) { int c = nodesCapacity.get(n); joiner.add(String.format("<node %s,%d>", n, c)); } StringJoiner vmJoiner = new StringJoiner(","); for (VM vm: vmsConsumption.keySet()) { int c = vmsConsumption.get(vm); vmJoiner.add(String.format("<VM %s,%d>", vm, c)); } return String.format("%s%s", joiner, vmJoiner); } ShareableResource(String r);  ShareableResource(String id, int defCapacity, int defConsumption); int getConsumption(VM vm); int getCapacity(Node n); Set<VM> getDefinedVMs(); Set<Node> getDefinedNodes(); ShareableResource setConsumption(VM vm, int val); ShareableResource setConsumption(int val, VM... vms); ShareableResource setCapacity(Node n, int val); ShareableResource setCapacity(int val, Node... nodes); void unset(VM vm); void unset(Node n); void unset(VM... vms); void unset(Node... nodes); boolean consumptionDefined(VM vm); boolean capacityDefined(Node n); @Override String getIdentifier(); static String getIdentifier(String rcId); String getResourceIdentifier(); int getDefaultConsumption(); int getDefaultCapacity(); @Override boolean equals(Object o); @Override int hashCode(); @Override ShareableResource copy(); @Override String toString(); @Override boolean substituteVM(VM oldRef, VM newRef); int sumConsumptions(Collection<VM> ids, boolean undef); int sumCapacities(Collection<Node> ids, boolean undef); static ShareableResource get(Model mo, String id); }
ShareableResource implements ModelView { @Override public String toString() { StringJoiner joiner = new StringJoiner(",", String.format("rc:%s:", rcId), ""); for (Node n: nodesCapacity.keySet()) { int c = nodesCapacity.get(n); joiner.add(String.format("<node %s,%d>", n, c)); } StringJoiner vmJoiner = new StringJoiner(","); for (VM vm: vmsConsumption.keySet()) { int c = vmsConsumption.get(vm); vmJoiner.add(String.format("<VM %s,%d>", vm, c)); } return String.format("%s%s", joiner, vmJoiner); } ShareableResource(String r);  ShareableResource(String id, int defCapacity, int defConsumption); int getConsumption(VM vm); int getCapacity(Node n); Set<VM> getDefinedVMs(); Set<Node> getDefinedNodes(); ShareableResource setConsumption(VM vm, int val); ShareableResource setConsumption(int val, VM... vms); ShareableResource setCapacity(Node n, int val); ShareableResource setCapacity(int val, Node... nodes); void unset(VM vm); void unset(Node n); void unset(VM... vms); void unset(Node... nodes); boolean consumptionDefined(VM vm); boolean capacityDefined(Node n); @Override String getIdentifier(); static String getIdentifier(String rcId); String getResourceIdentifier(); int getDefaultConsumption(); int getDefaultCapacity(); @Override boolean equals(Object o); @Override int hashCode(); @Override ShareableResource copy(); @Override String toString(); @Override boolean substituteVM(VM oldRef, VM newRef); int sumConsumptions(Collection<VM> ids, boolean undef); int sumCapacities(Collection<Node> ids, boolean undef); static ShareableResource get(Model mo, String id); static final String VIEW_ID_BASE; static final int DEFAULT_NO_VALUE; }