@Test public void testCreatePayload() { UpdateNicRequestBinder binder = new UpdateNicRequestBinder(); Nic.Request.UpdatePayload payload = Nic.Request.updatingBuilder() .id("nic-id") .ip("192.168.0.1") .name("nic-name") .dhcpActive(true) .lanId(1) .build(); String actual = binder.createPayload(payload); assertNotNull(actual, "Binder returned null payload"); assertEquals(actual, expectedPayload); }
@Override protected String createPayload(Nic.Request.UpdatePayload payload) { requestBuilder.append("<ws:updateNic>") .append("<request>") .append(format("<nicId>%s</nicId>", payload.id())) .append(formatIfNotEmpty("<ip>%s</ip>", payload.ip())) .append(formatIfNotEmpty("<nicName>%s</nicName>", payload.name())) .append(formatIfNotEmpty("<dhcpActive>%s</dhcpActive>", payload.dhcpActive())) .append(formatIfNotEmpty("<lanId>%s</lanId>", payload.lanId())) .append("</request>") .append("</ws:updateNic>"); return requestBuilder.toString(); }
UpdateNicRequestBinder extends BaseProfitBricksRequestBinder<Nic.Request.UpdatePayload> { @Override protected String createPayload(Nic.Request.UpdatePayload payload) { requestBuilder.append("<ws:updateNic>") .append("<request>") .append(format("<nicId>%s</nicId>", payload.id())) .append(formatIfNotEmpty("<ip>%s</ip>", payload.ip())) .append(formatIfNotEmpty("<nicName>%s</nicName>", payload.name())) .append(formatIfNotEmpty("<dhcpActive>%s</dhcpActive>", payload.dhcpActive())) .append(formatIfNotEmpty("<lanId>%s</lanId>", payload.lanId())) .append("</request>") .append("</ws:updateNic>"); return requestBuilder.toString(); } }
UpdateNicRequestBinder extends BaseProfitBricksRequestBinder<Nic.Request.UpdatePayload> { @Override protected String createPayload(Nic.Request.UpdatePayload payload) { requestBuilder.append("<ws:updateNic>") .append("<request>") .append(format("<nicId>%s</nicId>", payload.id())) .append(formatIfNotEmpty("<ip>%s</ip>", payload.ip())) .append(formatIfNotEmpty("<nicName>%s</nicName>", payload.name())) .append(formatIfNotEmpty("<dhcpActive>%s</dhcpActive>", payload.dhcpActive())) .append(formatIfNotEmpty("<lanId>%s</lanId>", payload.lanId())) .append("</request>") .append("</ws:updateNic>"); return requestBuilder.toString(); } UpdateNicRequestBinder(); }
UpdateNicRequestBinder extends BaseProfitBricksRequestBinder<Nic.Request.UpdatePayload> { @Override protected String createPayload(Nic.Request.UpdatePayload payload) { requestBuilder.append("<ws:updateNic>") .append("<request>") .append(format("<nicId>%s</nicId>", payload.id())) .append(formatIfNotEmpty("<ip>%s</ip>", payload.ip())) .append(formatIfNotEmpty("<nicName>%s</nicName>", payload.name())) .append(formatIfNotEmpty("<dhcpActive>%s</dhcpActive>", payload.dhcpActive())) .append(formatIfNotEmpty("<lanId>%s</lanId>", payload.lanId())) .append("</request>") .append("</ws:updateNic>"); return requestBuilder.toString(); } UpdateNicRequestBinder();  }
UpdateNicRequestBinder extends BaseProfitBricksRequestBinder<Nic.Request.UpdatePayload> { @Override protected String createPayload(Nic.Request.UpdatePayload payload) { requestBuilder.append("<ws:updateNic>") .append("<request>") .append(format("<nicId>%s</nicId>", payload.id())) .append(formatIfNotEmpty("<ip>%s</ip>", payload.ip())) .append(formatIfNotEmpty("<nicName>%s</nicName>", payload.name())) .append(formatIfNotEmpty("<dhcpActive>%s</dhcpActive>", payload.dhcpActive())) .append(formatIfNotEmpty("<lanId>%s</lanId>", payload.lanId())) .append("</request>") .append("</ws:updateNic>"); return requestBuilder.toString(); } UpdateNicRequestBinder();   }