use of com.axway.ats.agent.core.configuration.RemoteLoggingConfigurator in project ats-framework by Axway.
the class TestcaseStateListener method onConfigureAtsAgents.
/**
* This event is send right before running a regular action or starting
* an action queue.
*
* It is also expected to be send between onTestStart and onTestEnd events.
*/
@Override
public void onConfigureAtsAgents(List<String> atsAgents) throws Exception {
if (configuredAgents == null) {
// No TestCase is started so we won't configure the remote agents
return;
}
for (String atsAgent : atsAgents) {
// configure only not configured agents
if (!configuredAgents.contains(atsAgent)) {
// We will try to prevent that adding a 'unique' prefix
synchronized (("ATS_STRING_LOCK-" + atsAgent).intern()) {
if (!configuredAgents.contains(atsAgent)) {
// Pass the logging configuration to the remote agent
RemoteLoggingConfigurator remoteLoggingConfigurator = new RemoteLoggingConfigurator(atsAgent);
new RemoteConfigurationManager().pushConfiguration(atsAgent, remoteLoggingConfigurator);
try {
AgentService agentServicePort = AgentServicePool.getInstance().getClient(atsAgent);
agentServicePort.onTestStart(getCurrentTestCaseState());
} catch (AgentException_Exception ae) {
throw new AgentException(ae.getMessage());
}
configuredAgents.add(atsAgent);
}
}
}
}
}
use of com.axway.ats.agent.core.configuration.RemoteLoggingConfigurator in project ats-framework by Axway.
the class Test_RemoteConfigurationManager method pushConfigurationPositive.
@Test
public void pushConfigurationPositive() throws AgentException, AgentException_Exception {
expect(AgentServicePool.getInstance()).andReturn(mockAgentServicePool);
expect(mockAgentServicePool.getClient("10.0.0.2")).andReturn(mockAgentService);
mockAgentService.pushConfiguration(isA(byte[].class));
replayAll();
new RemoteConfigurationManager().pushConfiguration("10.0.0.2", new RemoteLoggingConfigurator("127.0.0.1"));
// verify results
verifyAll();
// assertTrue( RemoteConfigurationManager.getInstance().isConfigured( "10.0.0.2",
// new RemoteLoggingConfigurator() ) );
}
use of com.axway.ats.agent.core.configuration.RemoteLoggingConfigurator 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();
}
use of com.axway.ats.agent.core.configuration.RemoteLoggingConfigurator in project ats-framework by Axway.
the class Test_RemoteConfigurationManager method pushConfigurationNegativeRuntimeException.
@Test(expected = AgentException.class)
public void pushConfigurationNegativeRuntimeException() 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 RuntimeException());
replayAll();
new RemoteConfigurationManager().pushConfiguration("10.0.0.3", new RemoteLoggingConfigurator("127.0.0.1"));
// verify results
verifyAll();
}
Aggregations