List of usage examples for org.apache.commons.lang.builder ReflectionToStringBuilder toString
public static String toString(Object object, ToStringStyle style)
Builds a toString
value through reflection.
From source file:io.reign.AbstractZkEventHandler.java
@Override public void process(WatchedEvent event) { /** log event **/ // log if TRACE if (logger.isTraceEnabled()) { logger.trace("***** Received ZooKeeper Event: {}", ReflectionToStringBuilder.toString(event, ToStringStyle.DEFAULT_STYLE)); }//from www . j av a2s . c o m /** check if we are filtering this event **/ if (filterWatchedEvent(event)) { return; } /** process events **/ switch (event.getType()) { case NodeChildrenChanged: nodeChildrenChanged(event); break; case NodeCreated: nodeCreated(event); break; case NodeDataChanged: nodeDataChanged(event); break; case NodeDeleted: nodeDeleted(event); break; case None: Event.KeeperState eventState = event.getState(); if (eventState == Event.KeeperState.SyncConnected) { connected(event); } else if (eventState == Event.KeeperState.Disconnected) { disconnected(event); } else if (eventState == Event.KeeperState.Expired) { sessionExpired(event); } else { logger.warn("Unhandled event state: eventType={}; eventState={}", event.getType(), event.getState()); } break; default: logger.warn("Unhandled event type: eventType={}; eventState={}", event.getType(), event.getState()); } }
From source file:jp.primecloud.auto.puppet.report.ReportAnalyzerTest.java
@Test @Ignore//from w w w . ja va 2 s . c o m public void testGetMetricsResources() { Map<String, Object> report = reportLoader.loadReport("test", "test.yaml"); List<MetricsResource> metricsResources = reportAnalyzer.getMetricsResources(report); for (MetricsResource metricsResource : metricsResources) { log.trace(ReflectionToStringBuilder.toString(metricsResource, ToStringStyle.SHORT_PREFIX_STYLE)); } assertEquals(8, metricsResources.size()); }
From source file:com.google.cloud.errorreporting.v1beta1.ReportErrorsServiceSmokeTest.java
public static void executeNoCatch(String projectId) throws Exception { try (ReportErrorsServiceClient client = ReportErrorsServiceClient.create()) { ProjectName projectName = ProjectName.create(projectId); String message = "[MESSAGE]"; String service = "[SERVICE]"; ServiceContext serviceContext = ServiceContext.newBuilder().setService(service).build(); String filePath = "path/to/file.lang"; int lineNumber = 42; String functionName = "meaningOfLife"; SourceLocation reportLocation = SourceLocation.newBuilder().setFilePath(filePath) .setLineNumber(lineNumber).setFunctionName(functionName).build(); ErrorContext context = ErrorContext.newBuilder().setReportLocation(reportLocation).build(); ReportedErrorEvent event = ReportedErrorEvent.newBuilder().setMessage(message) .setServiceContext(serviceContext).setContext(context).build(); ReportErrorEventResponse response = client.reportErrorEvent(projectName, event); System.out.println(ReflectionToStringBuilder.toString(response, ToStringStyle.MULTI_LINE_STYLE)); }//from w w w.j av a2 s . co m }
From source file:com.baidu.fsg.uid.worker.entity.WorkerNodeEntity.java
@Override public String toString() { return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); }
From source file:jp.primecloud.auto.zabbix.client.UsergroupClientTest.java
@Test @Ignore/*w ww. j a v a 2s. c om*/ public void testGet() { // ? UsergroupGetParam param = new UsergroupGetParam(); param.setOutput("extend"); List<Usergroup> usergroups = client.usergroup().get(param); for (Usergroup usergroup : usergroups) { log.trace(ReflectionToStringBuilder.toString(usergroup, ToStringStyle.SHORT_PREFIX_STYLE)); } if (usergroups.size() > 0) { // usergroupid??? List<String> usergroupids = new ArrayList<String>(); usergroupids.add(usergroups.get(0).getUsrgrpid()); param.setUsrgrpids(usergroupids); List<Usergroup> usergroups2 = client.usergroup().get(param); assertEquals(1, usergroups2.size()); assertEquals(usergroups.get(0).getUsrgrpid(), usergroups2.get(0).getUsrgrpid()); } }
From source file:jp.primecloud.auto.zabbix.client.ApplicationClientTest.java
@Test @Ignore/*from ww w . j a v a2 s .co m*/ public void testGet() { ApplicationGetParam param = new ApplicationGetParam(); param.setOutput("extend"); List<String> hostids = new ArrayList<String>(); //Hostid??Templateid? hostids.add("10057"); param.setHostids(hostids); List<Application> applications = client.application().get(param); for (Application application : applications) { log.debug(ReflectionToStringBuilder.toString(application, ToStringStyle.SHORT_PREFIX_STYLE)); } }
From source file:jp.primecloud.auto.zabbix.client.TriggerClientTest.java
@Test @Ignore/* w w w . j a v a2 s. c o m*/ public void testGet() { // ? TriggerGetParam param = new TriggerGetParam(); // List<String> list = new ArrayList<String>(); // list.add("19944"); // param.setTriggerids(list); param.setOutput("extend"); List<String> hostids = new ArrayList<String>(); hostids.add("10001"); param.setHostids(hostids); List<Trigger> triggers = client.trigger().get(param); for (Trigger trigger : triggers) { log.debug(ReflectionToStringBuilder.toString(trigger, ToStringStyle.SHORT_PREFIX_STYLE)); } /* if (triggers.size() > 0) { // TriggerId??? List<Integer> triggerIds = new ArrayList<Integer>(); triggerIds.add(triggers.get(0).getTriggerId()); param.set(tempids); List<Template> templates2 = client.template().get(param); assertEquals(1, templates2.size()); assertEquals(templates.get(0).getTemplateid(), templates2.get(0).getTemplateid()); }*/ }
From source file:jp.primecloud.auto.zabbix.client.TemplateClientTest.java
@Test @Ignore/*from w w w . jav a2s. com*/ public void testGet() { // ? TemplateGetParam param = new TemplateGetParam(); param.setOutput("extend"); List<Template> templates = client.template().get(param); for (Template template : templates) { log.trace(ReflectionToStringBuilder.toString(template, ToStringStyle.SHORT_PREFIX_STYLE)); } if (templates.size() > 0) { // templateid??? List<String> tempids = new ArrayList<String>(); tempids.add(templates.get(0).getTemplateid()); param.setTemplateids(tempids); List<Template> templates2 = client.template().get(param); assertEquals(1, templates2.size()); assertEquals(templates.get(0).getTemplateid(), templates2.get(0).getTemplateid()); } }
From source file:com.aol.advertising.qiao.util.cache.PersistentValueWrapper.java
public String toString() { return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); }
From source file:jp.primecloud.auto.common.component.DnsStrategy.java
/** * TODO: /* w ww. ja v a 2 s . c om*/ * * @param fqdn * @param ipAddress */ public void addForward(String fqdn, String ipAddress) { List<String> commands = createCommands(); List<String> stdins = createStdinsCommon(); stdins.addAll(createAddForward(fqdn, ipAddress)); stdins.add("quit"); CommandResult result = execute(commands, stdins); if (result.getExitValue() != 0) { // ???? AutoException exception = new AutoException("ECOMMON-000201", fqdn, ipAddress); exception.addDetailInfo( "result=" + ReflectionToStringBuilder.toString(result, ToStringStyle.SHORT_PREFIX_STYLE)); throw exception; } // ???? long timeout = 10000L; long startTime = System.currentTimeMillis(); while (true) { String hostAddress = getHostAddress(fqdn); if (StringUtils.equals(ipAddress, hostAddress)) { break; } if (System.currentTimeMillis() - startTime > timeout) { // throw new AutoException("ECOMMON-000202", fqdn, ipAddress, hostAddress); } try { Thread.sleep(1000); } catch (InterruptedException ignore) { } } }