Example usage for org.springframework.beans MutablePropertyValues size

List of usage examples for org.springframework.beans MutablePropertyValues size

Introduction

In this page you can find the example usage for org.springframework.beans MutablePropertyValues size.

Prototype

public int size() 

Source Link

Document

Return the number of PropertyValue entries in the list.

Usage

From source file:org.jolokia.jvmagent.spring.config.SpringConfigTest.java

@Test
public void simpleConfig() throws Exception {
    reader.loadBeanDefinitions(new ClassPathResource("/simple-config.xml"));

    BeanDefinition bd = beanFactory.getBeanDefinition("config");
    assertEquals(bd.getBeanClassName(), SpringJolokiaConfigHolder.class.getName());
    MutablePropertyValues cProps = bd.getPropertyValues();
    assertEquals(cProps.size(), 2);
    verifyConfig(cProps);/* w w  w  .ja v a 2 s.  co  m*/
    assertEquals(cProps.getPropertyValue("order").getValue(), 1000);
}

From source file:org.jolokia.jvmagent.spring.config.SpringConfigTest.java

@Test
public void simpleServer() throws ParserConfigurationException, IOException, SAXException {

    reader.loadBeanDefinitions(new ClassPathResource("/simple-server.xml"));

    BeanDefinition bd = beanFactory.getBeanDefinition("jolokiaServer");
    assertEquals(bd.getBeanClassName(), SpringJolokiaAgent.class.getName());
    MutablePropertyValues props = bd.getPropertyValues();
    assertEquals(props.size(), 2);
    assertEquals(props.getPropertyValue("lookupConfig").getValue(), false);
    BeanDefinition cBd = (BeanDefinition) props.getPropertyValue("config").getValue();
    ;/*from ww  w  .j  ava 2  s  .  c  o  m*/
    assertEquals(cBd.getBeanClassName(), SpringJolokiaConfigHolder.class.getName());
    MutablePropertyValues cProps = cBd.getPropertyValues();
    assertEquals(cProps.size(), 1);
    verifyConfig(cProps);
}

From source file:org.jolokia.support.spring.config.SpringConfigTest.java

@Test
public void logHandlerRef() throws IOException, SAXException, ParserConfigurationException {
    Element element = getElement("/simple-log-ref.xml");
    LogBeanDefinitionParser parser = new LogBeanDefinitionParser();
    BeanDefinition bd = parser.parseInternal(element, null);
    assertEquals(bd.getBeanClassName(), SpringJolokiaLogHandlerHolder.class.getName());
    MutablePropertyValues props = bd.getPropertyValues();
    assertEquals(props.size(), 1);
    assertTrue(props.getPropertyValue("logHandler").getValue() instanceof BeanReference);
    assertEquals(((BeanReference) props.getPropertyValue("logHandler").getValue()).getBeanName(), "logHandler");
}

From source file:org.jolokia.support.spring.config.SpringConfigTest.java

@Test
public void logHandlerType() throws IOException, SAXException, ParserConfigurationException {
    Element element = getElement("/simple-log-type.xml");
    LogBeanDefinitionParser parser = new LogBeanDefinitionParser();
    BeanDefinition bd = parser.parseInternal(element, null);
    assertEquals(bd.getBeanClassName(), SpringJolokiaLogHandlerHolder.class.getName());
    MutablePropertyValues props = bd.getPropertyValues();
    assertEquals(props.size(), 2);
    assertEquals(props.getPropertyValue("type").getValue(), "commons");
    assertEquals(props.getPropertyValue("category").getValue(), "bla");
}

From source file:org.jolokia.support.spring.config.SpringConfigTest.java

@Test
public void simpleServer() throws ParserConfigurationException, IOException, SAXException {

    reader.loadBeanDefinitions(new ClassPathResource("/simple-server.xml"));

    BeanDefinition bd = beanFactory.getBeanDefinition("jolokiaServer");
    assertEquals(bd.getBeanClassName(), SpringJolokiaAgent.class.getName());
    MutablePropertyValues props = bd.getPropertyValues();
    assertEquals(props.size(), 3);
    assertEquals(props.getPropertyValue("lookupConfig").getValue(), false);
    assertEquals(props.getPropertyValue("lookupServices").getValue(), false);
    BeanDefinition cBd = (BeanDefinition) props.getPropertyValue("config").getValue();
    ;/* w  ww  . ja v a 2s .com*/
    assertEquals(cBd.getBeanClassName(), SpringJolokiaConfigHolder.class.getName());
    MutablePropertyValues cProps = cBd.getPropertyValues();
    assertEquals(cProps.size(), 1);
    verifyConfig(cProps);
}

From source file:org.mule.config.spring.parsers.assembly.DefaultBeanAssembler.java

/**
 * Copy the properties from the bean we have been building into the target (typically
 * the parent bean).  In other words, the bean is a facade for the target.
 *
 * <p>This assumes that the source bean has been constructed correctly (ie the decisions about
 * what is ignored, a map, a list, etc) have already been made.   All it does (apart from a
 * direct copy) is merge collections with those on the target when necessary.
 *///  w ww . j av a2 s  . co m
public void copyBeanToTarget() {
    logger.debug("copy " + bean.getBeanDefinition().getBeanClassName() + " -> " + target.getBeanClassName());
    assertTargetPresent();
    MutablePropertyValues targetProperties = target.getPropertyValues();
    MutablePropertyValues beanProperties = bean.getBeanDefinition().getPropertyValues();
    for (int i = 0; i < beanProperties.size(); i++) {
        PropertyValue propertyValue = beanProperties.getPropertyValues()[i];
        addPropertyWithoutReference(targetProperties, new SinglePropertyLiteral(), propertyValue.getName(),
                propertyValue.getValue());
    }
}