protected void setParameterizedMetaData( AbstractInstallMetaData parameterizedMetaData, BeanMetaData beanMetaData) { AbstractBeanMetaData abmd = checkIfNotAbstractBeanMetaDataSpecific(beanMetaData); List<InstallMetaData> installs = beanMetaData.getInstalls(); if (installs == null) { installs = new ArrayList<InstallMetaData>(); abmd.setInstalls(installs); } installs.add(parameterizedMetaData); }
protected void testBMD(BeanMetaData bmd) throws Throwable { assertNotNull(bmd); assertEquals(Collections.singleton((Object) "alias"), bmd.getAliases()); assertEquals( Collections.singleton((SupplyMetaData) new AbstractSupplyMetaData("supply")), bmd.getSupplies()); assertEquals( Collections.singleton((DemandMetaData) new AbstractDemandMetaData("demand")), bmd.getDemands()); assertEquals( Collections.singleton((DependencyMetaData) new AbstractDependencyMetaData("depend")), bmd.getDepends()); ConstructorMetaData cmd = bmd.getConstructor(); assertNotNull(cmd); assertEquals(AnnotationTester.class.getName(), cmd.getFactoryClass()); assertEquals("factoryMethod", cmd.getFactoryMethod()); testInstalls(bmd.getInstalls()); testInstalls(bmd.getUninstalls()); List<CallbackMetaData> callbacks = bmd.getInstallCallbacks(); assertNotNull(callbacks); assertEquals(1, callbacks.size()); CallbackMetaData callback = callbacks.get(0); assertTrue(callback.getMethodName().contains("Something")); callbacks = bmd.getUninstallCallbacks(); assertNotNull(callbacks); assertEquals(1, callbacks.size()); callback = callbacks.get(0); assertTrue(callback.getMethodName().contains("Something")); BeanAccessMode mode = bmd.getAccessMode(); if (mode == BeanAccessMode.ALL) { Set<PropertyMetaData> propertys = bmd.getProperties(); assertNotNull(propertys); assertEquals(2, propertys.size()); } else { Set<PropertyMetaData> propertys = bmd.getProperties(); assertNotNull(propertys); assertEquals(1, propertys.size()); PropertyMetaData pmd = propertys.iterator().next(); assertEquals("number", pmd.getName()); assertInstanceOf(pmd.getValue(), AbstractDependencyValueMetaData.class); } testLifecycle(bmd.getCreate(), "myCreate"); testLifecycle(bmd.getStart(), "myStart"); testLifecycle(bmd.getStop(), "myStop"); testLifecycle(bmd.getDestroy(), "myDestroy"); }
protected List<InstallMetaData> getInstalls(BeanMetaData beanMetaData) { return beanMetaData.getInstalls(); }