Package org.apache.ivy.core.module.descriptor

Examples of org.apache.ivy.core.module.descriptor.ExtraInfoHolder


            getClass().getResource("test-extrainfo.xml"), true);
        assertNotNull(md);
        assertEquals(2, md.getExtraInfo().size());
        assertEquals("56576", md.getExtraInfo().get("e:someExtra"));
        assertEquals(2, md.getExtraInfos().size());
        ExtraInfoHolder firstExtraInfoElement = md.getExtraInfos().get(0);
        assertEquals("e:someExtra", firstExtraInfoElement.getName());
        assertEquals("56576", firstExtraInfoElement.getContent());
        assertEquals(0, firstExtraInfoElement.getAttributes().size());
        assertEquals(0, firstExtraInfoElement.getNestedExtraInfoHolder().size());
        ExtraInfoHolder secondExtraInfoElement = md.getExtraInfos().get(1);
        assertEquals("e:someExtraWithAttributes", secondExtraInfoElement.getName());
        assertEquals("", secondExtraInfoElement.getContent());
        assertEquals(2, secondExtraInfoElement.getAttributes().size());
        assertEquals("foo", secondExtraInfoElement.getAttributes().get("attr1"));
        assertEquals("bar", secondExtraInfoElement.getAttributes().get("attr2"));
        assertEquals(0, secondExtraInfoElement.getNestedExtraInfoHolder().size());
    }
View Full Code Here


            getClass().getResource("test-extrainfo-nested.xml"), true);
        assertNotNull(md);
        assertEquals(4, md.getExtraInfo().size());
        assertEquals("56576", md.getExtraInfo().get("e:someExtra"));
        assertEquals(2, md.getExtraInfos().size());
        ExtraInfoHolder someExtraElement = md.getExtraInfos().get(0);
        assertEquals("e:someExtra", someExtraElement.getName());
        assertEquals("56576", someExtraElement.getContent());
        assertEquals(0, someExtraElement.getAttributes().size());
        assertEquals(0, someExtraElement.getNestedExtraInfoHolder().size());
        ExtraInfoHolder someExtraElementWithAttributes = md.getExtraInfos().get(1);
        assertEquals("e:someExtraWithAttributes", someExtraElementWithAttributes.getName());
        assertEquals("", someExtraElementWithAttributes.getContent());
        assertEquals(2, someExtraElementWithAttributes.getAttributes().size());
        assertEquals("foo", someExtraElementWithAttributes.getAttributes().get("attr1"));
        assertEquals("bar", someExtraElementWithAttributes.getAttributes().get("attr2"));
        assertEquals(1, someExtraElementWithAttributes.getNestedExtraInfoHolder().size());
        ExtraInfoHolder anotherExtraInfoElement = someExtraElementWithAttributes
                .getNestedExtraInfoHolder().get(0);
        assertEquals("e:anotherExtraInfo", anotherExtraInfoElement.getName());
        assertEquals("", anotherExtraInfoElement.getContent());
        assertEquals(1, anotherExtraInfoElement.getAttributes().size());
        assertEquals("foobar", anotherExtraInfoElement.getAttributes().get("myattribute"));
        assertEquals(1, anotherExtraInfoElement.getNestedExtraInfoHolder().size());
        ExtraInfoHolder yetAnotherExtraInfoElement = anotherExtraInfoElement
                .getNestedExtraInfoHolder().get(0);
        assertEquals("e:yetAnotherExtraInfo", yetAnotherExtraInfoElement.getName());
        assertEquals("", yetAnotherExtraInfoElement.getContent());
        assertEquals(1, yetAnotherExtraInfoElement.getAttributes().size());
        assertEquals("value", yetAnotherExtraInfoElement.getAttributes().get("anAttribute"));
        assertEquals(0, yetAnotherExtraInfoElement.getNestedExtraInfoHolder().size());
    }
View Full Code Here

                    // nothing to do, we don't store this
                } else if (state == State.EXTRA_INFO || state == State.INFO
                        && isOtherNamespace(qName)) {
                    buffer = new StringBuffer();
                    state = State.EXTRA_INFO;
                    ExtraInfoHolder extraInfo = new ExtraInfoHolder();
                    extraInfo.setName(qName);
                    for (int i = 0; i < attributes.getLength(); i++) {
                        extraInfo.getAttributes().put(attributes.getQName(i),
                            attributes.getValue(i));
                    }
                    extraInfoStack.push(extraInfo);
                } else if ("configurations".equals(qName)) {
                    configurationStarted(attributes);
View Full Code Here

                state = State.INFO;
            } else if (state == State.EXTRA_INFO) {
                String content = buffer == null ? "" : buffer.toString();
                buffer = null;
                getMd().addExtraInfo(qName, content);
                ExtraInfoHolder extraInfo = extraInfoStack.pop();
                extraInfo.setContent(content);
                if (extraInfoStack.isEmpty()) {
                    getMd().addExtraInfo(extraInfo);
                    state = State.INFO;
                } else {
                    ExtraInfoHolder parentHolder = extraInfoStack.peek();
                    parentHolder.getNestedExtraInfoHolder().add(extraInfo);
                }
            } else if (state == State.DESCRIPTION) {
                if (buffer.toString().endsWith("<" + qName + ">")) {
                    buffer.deleteCharAt(buffer.length() - 1);
                    buffer.append("/>");
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.module.descriptor.ExtraInfoHolder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.