*/
@ManagementProperty(name="runtime-stat", use={ViewUse.STATISTIC})
public void testViewUseField()
throws Exception
{
ManagedPropertyImpl mp = new ManagedPropertyImpl("runtime");
mp.setMetaType(SimpleMetaType.LONG);
mp.setValue(SimpleValueSupport.wrap(1000));
mp.setViewUse(new ViewUse[]{ViewUse.RUNTIME});
assertTrue("has ViewUse.RUNTIME", mp.hasViewUse(ViewUse.RUNTIME));
ManagedPropertyImpl mp2 = new ManagedPropertyImpl("runtime-stat");
mp2.setMetaType(SimpleMetaType.LONG);
mp2.setValue(SimpleValueSupport.wrap(1000));
mp2.setViewUse(new ViewUse[]{ViewUse.RUNTIME, ViewUse.STATISTIC});
assertTrue("has ViewUse.RUNTIME", mp2.hasViewUse(ViewUse.RUNTIME));
assertTrue("has ViewUse.STATISTIC", mp2.hasViewUse(ViewUse.STATISTIC));
ManagedPropertyImpl mp3 = new ManagedPropertyImpl("runtime-stat");
mp3.setMetaType(SimpleMetaType.LONG);
mp3.setValue(SimpleValueSupport.wrap(1000));
mp3.setViewUse(new ViewUse[]{ViewUse.RUNTIME});
HashMap<String, Annotation> annotations = new HashMap<String, Annotation>();
ManagementProperty mpa = getClass().getMethod("testViewUseField", null).getAnnotation(ManagementProperty.class);
annotations.put(ManagementProperty.class.getName(), mpa);
mp3.setAnnotations(annotations);
assertTrue("has ViewUse.RUNTIME", mp3.hasViewUse(ViewUse.RUNTIME));
assertTrue("has ViewUse.STATISTIC", mp3.hasViewUse(ViewUse.STATISTIC));
}