EMMA Coverage Report (generated Tue Mar 05 16:36:55 GMT 2013)
[all classes][org.springframework.data.elasticsearch.config]

COVERAGE SUMMARY FOR SOURCE FILE [NodeClientBeanDefinitionParser.java]

nameclass, %method, %block, %line, %
NodeClientBeanDefinitionParser.java100% (1/1)100% (4/4)100% (35/35)100% (9/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NodeClientBeanDefinitionParser100% (1/1)100% (4/4)100% (35/35)100% (9/9)
NodeClientBeanDefinitionParser (): void 100% (1/1)100% (3/3)100% (1/1)
getSourcedBeanDefinition (BeanDefinitionBuilder, Element, ParserContext): Abs... 100% (1/1)100% (10/10)100% (3/3)
parseInternal (Element, ParserContext): AbstractBeanDefinition 100% (1/1)100% (13/13)100% (3/3)
setLocalSettings (Element, BeanDefinitionBuilder): void 100% (1/1)100% (9/9)100% (2/2)

1/*
2 * Copyright 2013 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 
17package org.springframework.data.elasticsearch.config;
18 
19import org.springframework.beans.factory.support.AbstractBeanDefinition;
20import org.springframework.beans.factory.support.BeanDefinitionBuilder;
21import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
22import org.springframework.beans.factory.xml.ParserContext;
23import org.springframework.data.elasticsearch.client.NodeClientFactoryBean;
24import org.w3c.dom.Element;
25 
26/**
27 * NodeClientBeanDefinitionParser
28 *
29 * @author Rizwan Idrees
30 * @author Mohsin Husen
31 */
32 
33public class NodeClientBeanDefinitionParser extends AbstractBeanDefinitionParser {
34 
35    @Override
36    protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
37        BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(NodeClientFactoryBean.class);
38        setLocalSettings(element,builder);
39        return getSourcedBeanDefinition(builder, element, parserContext);
40    }
41 
42    private void setLocalSettings(Element element, BeanDefinitionBuilder builder) {
43        builder.addPropertyValue("local", Boolean.valueOf(element.getAttribute("local")));
44    }
45 
46 
47    private AbstractBeanDefinition getSourcedBeanDefinition(BeanDefinitionBuilder builder, Element source,
48                                                            ParserContext context) {
49        AbstractBeanDefinition definition = builder.getBeanDefinition();
50        definition.setSource(context.extractSource(source));
51        return definition;
52    }
53}

[all classes][org.springframework.data.elasticsearch.config]
EMMA 2.0.5312 (C) Vladimir Roubtsov