@Test public void testCreatePayload() { CreateLoadBalancerRequestBinder binder = new CreateLoadBalancerRequestBinder(); String actual = binder.createPayload( LoadBalancer.Request.creatingBuilder() .dataCenterId("datacenter-id") .name("load-balancer-name") .algorithm(Algorithm.ROUND_ROBIN) .ip("10.0.0.1") .lanId(2) .serverIds(ImmutableList.<String>of( "server-id-1", "server-id-2")) .build()); assertNotNull(actual, "Binder returned null payload"); assertEquals(actual, expectedPayload); }
@Override protected String createPayload(LoadBalancer.Request.CreatePayload payload) { requestBuilder.append("<ws:createLoadBalancer>") .append("<request>") .append(format("<dataCenterId>%s</dataCenterId>", payload.dataCenterId())) .append(format("<loadBalancerName>%s</loadBalancerName>", payload.name())) .append(format("<loadBalancerAlgorithm>%s</loadBalancerAlgorithm>", payload.algorithm())) .append(format("<ip>%s</ip>", payload.ip())) .append(format("<lanId>%s</lanId>", payload.lanId())); for (String serverId : payload.serverIds()) requestBuilder.append(format("<serverIds>%s</serverIds>", serverId)); requestBuilder .append("</request>") .append("</ws:createLoadBalancer>"); return requestBuilder.toString(); }
CreateLoadBalancerRequestBinder extends BaseProfitBricksRequestBinder<LoadBalancer.Request.CreatePayload> { @Override protected String createPayload(LoadBalancer.Request.CreatePayload payload) { requestBuilder.append("<ws:createLoadBalancer>") .append("<request>") .append(format("<dataCenterId>%s</dataCenterId>", payload.dataCenterId())) .append(format("<loadBalancerName>%s</loadBalancerName>", payload.name())) .append(format("<loadBalancerAlgorithm>%s</loadBalancerAlgorithm>", payload.algorithm())) .append(format("<ip>%s</ip>", payload.ip())) .append(format("<lanId>%s</lanId>", payload.lanId())); for (String serverId : payload.serverIds()) requestBuilder.append(format("<serverIds>%s</serverIds>", serverId)); requestBuilder .append("</request>") .append("</ws:createLoadBalancer>"); return requestBuilder.toString(); } }
CreateLoadBalancerRequestBinder extends BaseProfitBricksRequestBinder<LoadBalancer.Request.CreatePayload> { @Override protected String createPayload(LoadBalancer.Request.CreatePayload payload) { requestBuilder.append("<ws:createLoadBalancer>") .append("<request>") .append(format("<dataCenterId>%s</dataCenterId>", payload.dataCenterId())) .append(format("<loadBalancerName>%s</loadBalancerName>", payload.name())) .append(format("<loadBalancerAlgorithm>%s</loadBalancerAlgorithm>", payload.algorithm())) .append(format("<ip>%s</ip>", payload.ip())) .append(format("<lanId>%s</lanId>", payload.lanId())); for (String serverId : payload.serverIds()) requestBuilder.append(format("<serverIds>%s</serverIds>", serverId)); requestBuilder .append("</request>") .append("</ws:createLoadBalancer>"); return requestBuilder.toString(); } CreateLoadBalancerRequestBinder(); }
CreateLoadBalancerRequestBinder extends BaseProfitBricksRequestBinder<LoadBalancer.Request.CreatePayload> { @Override protected String createPayload(LoadBalancer.Request.CreatePayload payload) { requestBuilder.append("<ws:createLoadBalancer>") .append("<request>") .append(format("<dataCenterId>%s</dataCenterId>", payload.dataCenterId())) .append(format("<loadBalancerName>%s</loadBalancerName>", payload.name())) .append(format("<loadBalancerAlgorithm>%s</loadBalancerAlgorithm>", payload.algorithm())) .append(format("<ip>%s</ip>", payload.ip())) .append(format("<lanId>%s</lanId>", payload.lanId())); for (String serverId : payload.serverIds()) requestBuilder.append(format("<serverIds>%s</serverIds>", serverId)); requestBuilder .append("</request>") .append("</ws:createLoadBalancer>"); return requestBuilder.toString(); } CreateLoadBalancerRequestBinder();  }
CreateLoadBalancerRequestBinder extends BaseProfitBricksRequestBinder<LoadBalancer.Request.CreatePayload> { @Override protected String createPayload(LoadBalancer.Request.CreatePayload payload) { requestBuilder.append("<ws:createLoadBalancer>") .append("<request>") .append(format("<dataCenterId>%s</dataCenterId>", payload.dataCenterId())) .append(format("<loadBalancerName>%s</loadBalancerName>", payload.name())) .append(format("<loadBalancerAlgorithm>%s</loadBalancerAlgorithm>", payload.algorithm())) .append(format("<ip>%s</ip>", payload.ip())) .append(format("<lanId>%s</lanId>", payload.lanId())); for (String serverId : payload.serverIds()) requestBuilder.append(format("<serverIds>%s</serverIds>", serverId)); requestBuilder .append("</request>") .append("</ws:createLoadBalancer>"); return requestBuilder.toString(); } CreateLoadBalancerRequestBinder();   }