use of org.jvnet.hk2.config.AttributeChanges in project Payara by payara.
the class DirectCreationTest method doTest.
public void doTest() throws TransactionFailure {
AdminService service = habitat.getService(AdminService.class);
ConfigBean serviceBean = (ConfigBean) ConfigBean.unwrap(service);
Class<?>[] subTypes = null;
try {
subTypes = ConfigSupport.getSubElementsTypes(serviceBean);
} catch (ClassNotFoundException e) {
// To change body of catch statement use File | Settings | File Templates.
e.printStackTrace();
throw new RuntimeException(e);
}
ConfigSupport support = getBaseServiceLocator().getService(ConfigSupport.class);
assertNotNull("ConfigSupport not found", support);
for (Class<?> subType : subTypes) {
// TODO: JL force compilation error to mark this probably edit point for grizzly config
if (subType.getName().endsWith("DasConfig")) {
Map<String, String> configChanges = new HashMap<String, String>();
configChanges.put("dynamic-reload-enabled", "true");
configChanges.put("autodeploy-dir", "funky-dir");
support.createAndSet(serviceBean, (Class<? extends ConfigBeanProxy>) subType, configChanges);
break;
}
}
support.createAndSet(serviceBean, DasConfig.class, (List) null);
List<AttributeChanges> profilerChanges = new ArrayList<AttributeChanges>();
String[] values = { "-Xmx512m", "-RFtrq", "-Xmw24" };
ConfigSupport.MultipleAttributeChanges multipleChanges = new ConfigSupport.MultipleAttributeChanges("jvm-options", values);
String[] values1 = { "profile" };
ConfigSupport.MultipleAttributeChanges multipleChanges1 = new ConfigSupport.MultipleAttributeChanges("name", values1);
profilerChanges.add(multipleChanges);
profilerChanges.add(multipleChanges1);
support.createAndSet((ConfigBean) ConfigBean.unwrap(habitat.<JavaConfig>getService(JavaConfig.class)), Profiler.class, profilerChanges);
}
Aggregations