Example usage for org.apache.commons.lang.builder ToStringBuilder reflectionToString

List of usage examples for org.apache.commons.lang.builder ToStringBuilder reflectionToString

Introduction

In this page you can find the example usage for org.apache.commons.lang.builder ToStringBuilder reflectionToString.

Prototype

public static String reflectionToString(Object object, ToStringStyle style) 

Source Link

Document

Forwards to ReflectionToStringBuilder.

Usage

From source file:org.xlcloud.service.sdk.config.ExceptionHandlingClientFilter.java

@Override
public ClientResponse handle(ClientRequest cr) throws ClientHandlerException {
    ClientResponse r = getNext().handle(cr);
    int statusCode = r.getStatus();
    if (statusCode <= 300) {
        return r;
    } else {/*from   w  w w  . j a v a 2  s.c o m*/
        ExceptionDetails exceptionDetails = r.getEntity(ExceptionDetails.class);
        if (exceptionDetails != null) {
            LOG.error("Got Vcms exception with details: "
                    + ToStringBuilder.reflectionToString(exceptionDetails, ToStringStyle.SHORT_PREFIX_STYLE));
            throwExceptionForStatusCode(statusCode, exceptionDetails);
        }
    }
    return r;
}

From source file:org.xlcloud.service.transformer.VcDefinitionTransformerTest.java

@Test
public void testTwoWayTransform() {
    VirtualClusterDefinition dto = randomVClusterDefinition(Mode.FULL);

    LOG.info("dto: " + ToStringBuilder.reflectionToString(dto, ToStringStyle.MULTI_LINE_STYLE));
    VirtualClusterDefinitionModel modelFromDto = vcDefTransformer.transformFromDto(dto);
    LOG.info("model: " + ToStringBuilder.reflectionToString(modelFromDto, ToStringStyle.MULTI_LINE_STYLE));
    VirtualClusterDefinition dtoFromModel = vcDefTransformer.transformFromModel(modelFromDto);
    LOG.info("dtoFromModel: "
            + ToStringBuilder.reflectionToString(dtoFromModel, ToStringStyle.MULTI_LINE_STYLE));

    assertEquals(dto.getId(), dtoFromModel.getId());
    assertEquals(dto.getName(), dtoFromModel.getName());
    assertEquals(dto.getDescription(), dtoFromModel.getDescription());
    assertEquals(dto.getType(), dtoFromModel.getType());
    assertEquals(dto.getHref(), dtoFromModel.getHref());
    assertTags(dto.getTag(), dtoFromModel.getTag());
}

From source file:org.xlcloud.service.transformer.VirtualClusterTransformerTest.java

@Test
public void testTwoWayTransform() {
    VirtualCluster dto = randomVCluster(Mode.FULL);

    LOG.info("dto: " + ToStringBuilder.reflectionToString(dto, ToStringStyle.MULTI_LINE_STYLE));
    VirtualClusterModel modelFromDto = vcTransformer.transformFromDto(dto);
    LOG.info("model: " + ToStringBuilder.reflectionToString(modelFromDto, ToStringStyle.MULTI_LINE_STYLE));
    VirtualCluster dtoFromModel = vcTransformer.transformFromModel(modelFromDto);
    LOG.info("dtoFromModel: "
            + ToStringBuilder.reflectionToString(dtoFromModel, ToStringStyle.MULTI_LINE_STYLE));

    assertEquals(dto.getId(), dtoFromModel.getId());
    assertEquals(dto.getName(), dtoFromModel.getName());
    assertEquals(dto.getProjectId(), dtoFromModel.getProjectId());
    assertEquals(dto.getVirtualClusterDefinitionId(), dtoFromModel.getVirtualClusterDefinitionId());

    Assert.assertTrue(dto.getSessions().getSession().size() > 0);
    //we don't store sessions in database
    Assert.assertTrue(dtoFromModel.getSessions() == null);

    assertParameters(dto.getParameters(), dtoFromModel.getParameters());
}

From source file:org.xlcloud.xsa.ext.hpc.service.impl.SlurmHpcJobsManager.java

@Override
public HpcJob schedule(String applicationName, HpcJobSubmission jobSubmission)
        throws ValidationException, InternalErrorException, ObjectNotFoundException {
    if (LOG.isDebugEnabled()) {
        LOG.debug("Trying to schedule job, got submission: "
                + ToStringBuilder.reflectionToString(jobSubmission, ToStringStyle.SHORT_PREFIX_STYLE));
    }//from ww w.j a v  a 2s .  co  m

    Application application = applicationsManager.get(applicationName);
    validateJobSubmission(application, jobSubmission);

    List<String> command = new ArrayList<>();
    command.add("sbatch");
    addOption(command, "-J", jobSubmission.getName());

    ExecParams execParams = jobSubmission.getExecParams();
    if (execParams != null) {
        addOption(command, "-N", execParams.getNumNodes());
        addOption(command, "-c", execParams.getNumCores());
    }

    String appWorkDir = workDir + (StringUtils.endsWith(workDir, File.separator) ? "" : File.separator)
            + applicationName;
    addOption(command, "-D", appWorkDir);

    List<String> inputLines = new ArrayList<>();
    inputLines.add("#!/bin/sh");
    for (String singleCommand : application.getCommands()) {
        inputLines.add(singleCommand);
    }
    ProcessExecutionResult result = executor.run(command, inputLines);

    String jobId = jobSubmissionParser.parse(result);
    return get(jobId);
}

From source file:org.xlcloud.xsa.ext.HpcServiceDescriptor.java

@Override
public String toString() {
    return this.getClass().getName() + "["
            + ToStringBuilder.reflectionToString(serviceDescription, ToStringStyle.SHORT_PREFIX_STYLE) + ", "
            + ToStringBuilder.reflectionToString(serviceClasses, ToStringStyle.SHORT_PREFIX_STYLE) + ", "
            + ToStringBuilder.reflectionToString(modelClasses, ToStringStyle.SHORT_PREFIX_STYLE) + "]";
}

From source file:ph.fingra.hadoop.common.BaseObject.java

public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE);
}

From source file:se.inera.certificate.proxy.mappings.local.LocalMapping.java

@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, SIMPLE_STYLE);
}

From source file:uk.nhs.cfh.dsp.snomed.expression.model.impl.AbstractExpressionImpl.java

@Override
@Transient
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}

From source file:uk.nhs.cfh.dsp.snomed.objectmodel.impl.SnomedConceptImpl.java

@Transient
@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}