View Javadoc

1   package org.kuali.common.deploy;
2   
3   import java.util.Arrays;
4   import java.util.List;
5   
6   import org.jasypt.util.text.BasicTextEncryptor;
7   import org.junit.Test;
8   import org.kuali.common.deploy.monitoring.AppDynamicsMonitoring;
9   import org.kuali.common.deploy.monitoring.MachineAgent;
10  
11  /**
12   * @deprecated
13   */
14  @Deprecated
15  public class AppDynamicsMonitoringTest {
16  
17  	@Test
18  	public void test() {
19  		try {
20  			org.kuali.common.util.secure.DefaultSecureChannel channel = new org.kuali.common.util.secure.DefaultSecureChannel();
21  			channel.setUsername("root");
22  			channel.setHostname("env16.ks.kuali.org");
23  			channel.setStrictHostKeyChecking(false);
24  			channel.setUseConfigFile(false);
25  			channel.setPrivateKeyStrings(getPrivateKeys());
26  
27  			AppDynamicsMonitoring adm = new AppDynamicsMonitoring();
28  			adm.setUser("tomcat");
29  			adm.setGroup("tomcat");
30  			adm.setMachineAgent(getMachineAgent());
31  			// adm.setChannel(channel);
32  
33  			channel.open();
34  			adm.stop();
35  			adm.prepare();
36  			adm.start();
37  			channel.close();
38  
39  		} catch (Exception e) {
40  			e.printStackTrace();
41  		}
42  	}
43  
44  	protected MachineAgent getMachineAgent() {
45  		MachineAgent agent = new MachineAgent();
46  		agent.setTmpDir("/usr/local/machine-agent/tmp");
47  		agent.setLogsDir("/usr/local/machine-agent/logs");
48  		agent.setStartupCommand("java -jar /usr/local/machine-agent/machineagent.jar");
49  		return agent;
50  	}
51  
52  	protected List<String> getPrivateKeys() {
53  		BasicTextEncryptor bte = new BasicTextEncryptor();
54  		bte.setPassword(System.getProperty("kuali.enc.password"));
55  		String encryptedKey = "O3coQZzv5DtdDiYB3GfslTltWCrk1KIoAJDDGgAT7tP83GYs9Rxxe6JpdaX54Vk4akBu84y5IzHOQ356EYGT/IYL7IN4n8kYchGmuz5RHKD2m8dTuEUiUoHgIvhu80iBg/ZzMHanL/U64ZQK3tWXy/Uz1DaD8F+BXBFvAXfnwOW91j9TRsGkPOJRmJjgOb/CfXPU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SObR5WGGoWfbILeebjcbkOaSVXZ79ryjYxS7wFT1Lw1Q433H1X8h53G7Nh5gCNAazU6jPjzjfBMeXFJEyrmj/QIIrIwgknGR+k42TfIntILduOWBFPIr+ddwlozcXrHe6s09LcXg0oCxJGXdbKiLyJcKF42E1o/kKUCNe/smvp7XFIcqifFAcjyVGwF9JAfAqbv1X3xq08f49kmYGtmAim6SaQWrBmlhlFlzcg83NQdQJ0PpNq3zyPdJ+GHQ0pKcxy3ezZHz3Tvhtt+BeYa4tHxHdvNgjnxGKYcBPIZVbZ0+Ir65kP4IHrWeG4OvGOJh1LBYV2XkNCc9qTDHS1yAQI5lexFHvAdRbgEUcnc/InPtZY9NoLtid/gJGyuIK0LHvNpDusv46Ev0mlX1LBa0mW+koPobJoWT3ONb+iVb7rfVCewurGGwEMz2SSBcHS3VRUCGUmuGNoLypkgb0hXuX+PM393Ch4AJTCrYha2bk7qsLge4S0impcWeaccvJx7dDLGZOP5Vc+QiVdlMsy3tZKqTdN/VTphtQIEFN7SxnBgXRhqQLz4zdFQ2VIYt6KcdJTrb5/y6YzPWGxp85JcWg6GC/uT1M9vEqkBW4qvclYPyHaRSmcT1ezdxLulMAhsp2xJtG82Rn0AlNNfSG8PXyC5bCA4W3ogTKMe6eUJd7OXAPoiNNtFahnnXMprAQTXgAprx3ojbpJzFuOdcvafFXdQQqWhXZMcdsn3J70XhRKmmkgJ3Qtr67JPLCcphagOmz06TbPzo4VruEOdc25MD1CJLrviQ3w3ON11FW9dqATXbsFO6hQNkGOraltAZgc9t5w/eVbMVGM4B6xyV6khSg0g21f9wf84qW+yrhlmNcUJviA9iBhndSUPmNIBytOOV/h0Y+Y/e/inu4CSlylysK34ZZcsd41xtxFt3pWdj5df6r3UliDpqLLm9JaPBs10UJReA";
56  		String decryptedKey = bte.decrypt(encryptedKey);
57  		return Arrays.asList(decryptedKey);
58  	}
59  }