public static LoadBalancerUsageRecord toRestApiUsage(Usage dusage) { LoadBalancerUsageRecord rusage = new LoadBalancerUsageRecord(); if (dusage == null) { return null; } rusage.setId(dusage.getId()); rusage.setAverageNumConnections(dusage.getAverageConcurrentConnections()); rusage.setIncomingTransfer(dusage.getIncomingTransfer()); rusage.setOutgoingTransfer(dusage.getOutgoingTransfer()); rusage.setAverageNumConnectionsSsl(dusage.getAverageConcurrentConnectionsSsl()); rusage.setIncomingTransferSsl(dusage.getIncomingTransferSsl()); rusage.setOutgoingTransferSsl(dusage.getOutgoingTransferSsl()); rusage.setNumVips(dusage.getNumVips()); rusage.setNumPolls(dusage.getNumberOfPolls()); rusage.setStartTime(dusage.getStartTime()); rusage.setEndTime(dusage.getEndTime()); rusage.setEventType(dusage.getEventType()); BitTags bitTags = new BitTags(dusage.getTags()); rusage.setSslMode(SslMode.getMode(bitTags).name()); if (bitTags.isTagOn(BitTag.SERVICENET_LB)) { rusage.setVipType(VipType.SERVICENET); } else { rusage.setVipType(VipType.PUBLIC); } return rusage; }
private LoadBalancerUsageRecord newLoadBalancerUsageRecord(Integer id) { LoadBalancerUsageRecord ur = new LoadBalancerUsageRecord(); ur.setAverageNumConnections(3.0); ur.setId(id); ur.setEventType("EmptyEvent"); ur.setIncomingTransfer(new Long(20)); ur.setNumPolls(50); ur.setNumVips(30); ur.setOutgoingTransfer(new Long(30)); ur.setEndTime(Calendar.getInstance()); return ur; }
public static LoadBalancerUsageRecord rndCurrentUsage() { LoadBalancerUsageRecord usage = new LoadBalancerUsageRecord(); usage.setIncomingTransfer((long) rndInt(0, 1000000000)); usage.setOutgoingTransfer((long) rndInt(0, 1000000000)); return usage; }