Search in sources :

Example 1 with SQLServerDbWriteAccess

use of com.axway.ats.log.autodb.io.SQLServerDbWriteAccess in project ats-framework by Axway.

the class MachineInfoAgent method updateMachineInfo.

/**
 * Retrieves static info about a machine and stores this info into the
 * log DB
 *
 * @param atsAgent the address of the ATS Agent running on the machine of interest
 * @param dbMachineName the name of the machine as it appears in the DB
 * @throws Exception
 */
@PublicAtsApi
public void updateMachineInfo(@Validate(name = "atsAgent", type = ValidationType.STRING_SERVER_WITH_PORT) String atsAgent, @Validate(name = "dbMachineName", type = ValidationType.STRING_NOT_EMPTY) String dbMachineName) throws Exception {
    // validate input parameters
    atsAgent = HostUtils.getAtsAgentIpAndPort(atsAgent);
    new Validator().validateMethodParameters(new Object[] { atsAgent, dbMachineName });
    log.info("Retrieving info about " + dbMachineName + " from " + atsAgent);
    MachineDescriptionOperations mm = new MachineDescriptionOperations(atsAgent);
    String machineDescriptionString = mm.getDescription();
    log.info("Saving retrieved info about " + dbMachineName + " into the Test Explorer database");
    SQLServerDbWriteAccess dbAccess = new DbAccessFactory().getNewDbWriteAccessObject();
    dbAccess.updateMachineInfo(dbMachineName, machineDescriptionString, true);
    log.info("Successfully updated the info about " + dbMachineName);
}
Also used : SQLServerDbWriteAccess(com.axway.ats.log.autodb.io.SQLServerDbWriteAccess) DbAccessFactory(com.axway.ats.log.autodb.io.DbAccessFactory) MachineDescriptionOperations(com.axway.ats.agent.components.system.operations.clients.MachineDescriptionOperations) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

MachineDescriptionOperations (com.axway.ats.agent.components.system.operations.clients.MachineDescriptionOperations)1 PublicAtsApi (com.axway.ats.common.PublicAtsApi)1 Validator (com.axway.ats.core.validation.Validator)1 DbAccessFactory (com.axway.ats.log.autodb.io.DbAccessFactory)1 SQLServerDbWriteAccess (com.axway.ats.log.autodb.io.SQLServerDbWriteAccess)1