use of com.axway.ats.agent.webapp.client.configuration.RemoteConfigurationManager in project ats-framework by Axway.
the class AgentConfigurationClient method applyConfigurationAndReloadAgentComponents.
/**
* Apply the new settings
*
* @param agentSettings a list with Agent settings to change
* @throws AgentException
*/
private void applyConfigurationAndReloadAgentComponents(Properties agentSettings) throws AgentException {
// include the Agent configuration
AgentConfigurator agentConfigurator = new AgentConfigurator(agentSettings);
List<Configurator> configurators = new ArrayList<Configurator>();
configurators.add(agentConfigurator);
if (atsAgent.equals(LOCAL_JVM)) {
// executed in the JVM of the test executor
// the already loaded Agent components are first unloaded
MainComponentLoader.getInstance().destroy();
// the initialization procedure implicitly applies the new configurations
// and then loads up again the Agent components
MainComponentLoader.getInstance().initialize(configurators);
} else {
// send the new configuration to the remote Agent instance
new RemoteConfigurationManager().pushConfiguration(atsAgent, agentConfigurator);
}
}
use of com.axway.ats.agent.webapp.client.configuration.RemoteConfigurationManager 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.webapp.client.configuration.RemoteConfigurationManager 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.webapp.client.configuration.RemoteConfigurationManager 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.webapp.client.configuration.RemoteConfigurationManager 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