use of com.axway.ats.agent.webapp.client.AgentException_Exception in project ats-framework by Axway.
the class RemoteConfigurationManager method pushConfiguration.
/**
* Push the provided configuration to the remote Agent
*
* @param atsAgent host to push the configuration to
* @param configurator the configurator
* @throws AgentException
*/
public void pushConfiguration(String atsAgent, Configurator configurator) throws AgentException {
// get the client instance
AgentService agentServicePort = AgentServicePool.getInstance().getClient(atsAgent);
List<Configurator> configurators = new ArrayList<Configurator>();
configurators.add(configurator);
String checkServerLogsStr = ". Check server logs for more details.";
try {
// serialize the configurators
ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutStream = new ObjectOutputStream(byteOutStream);
objectOutStream.writeObject(configurators);
agentServicePort.pushConfiguration(byteOutStream.toByteArray());
log.info("Successfully set the " + configurator.getDescription() + " on ATS Agent at '" + atsAgent + "'");
} catch (IOException ioe) {
// log hint for further serialization issue investigation
String msg = "Could not serialize configurators" + checkServerLogsStr;
log.error(msg, ioe);
throw new AgentException(msg, ioe);
} catch (AgentException_Exception ae) {
String msg = ae.getMessage() + checkServerLogsStr;
log.error(msg, ae);
throw new AgentException(msg, ae.getCause());
} catch (Exception e) {
String msg = e.getMessage() + checkServerLogsStr;
log.error(msg, e);
throw new AgentException(msg, e);
}
}
use of com.axway.ats.agent.webapp.client.AgentException_Exception in project ats-framework by Axway.
the class Test_RemoteConfigurationManager method pushConfigurationNegativeException.
@Test(expected = AgentException.class)
public void pushConfigurationNegativeException() throws AgentException, AgentException_Exception {
expect(AgentServicePool.getInstance()).andReturn(mockAgentServicePool);
expect(mockAgentServicePool.getClient("10.0.0.3")).andReturn(mockAgentService);
mockAgentService.pushConfiguration(isA(byte[].class));
expectLastCall().andThrow(new AgentException_Exception("test", new com.axway.ats.agent.webapp.client.AgentException()));
replayAll();
new RemoteConfigurationManager().pushConfiguration("10.0.0.3", new RemoteLoggingConfigurator("127.0.0.1"));
// verify results
verifyAll();
}
Aggregations