Search in sources :

Example 1 with EntryType

use of org.talend.esb.servicelocator.client.internal.endpoint.EntryType in project tesb-rt-se by Talend.

the class SLPropertiesConverter method createEntry.

private static EntryType createEntry(SLProperties props, String name) {
    EntryType entry = new EntryType();
    entry.setKey(name);
    List<String> jaxbValues = entry.getValue();
    Collection<String> values = props.getValues(name);
    for (String value : values) {
        jaxbValues.add(value);
    }
    return entry;
}
Also used : EntryType(org.talend.esb.servicelocator.client.internal.endpoint.EntryType)

Example 2 with EntryType

use of org.talend.esb.servicelocator.client.internal.endpoint.EntryType in project tesb-rt-se by Talend.

the class SLPropertiesConverterTest method slProperties2JAXBSlPropertiesType.

@Test
public void slProperties2JAXBSlPropertiesType() throws Exception {
    SLPropertiesImpl props = new SLPropertiesImpl();
    props.addProperty(KEY_1, VALUE_1, VALUE_2);
    props.addProperty(KEY_2, VALUE_2, VALUE_3);
    ServiceLocatorPropertiesType jaxbProperties = SLPropertiesConverter.toServiceLocatorPropertiesType(props);
    List<EntryType> entries = jaxbProperties.getEntry();
    List<String> values = entries.get(0).getValue();
    assertEquals(VALUE_1, values.get(0));
}
Also used : EntryType(org.talend.esb.servicelocator.client.internal.endpoint.EntryType) ServiceLocatorPropertiesType(org.talend.esb.servicelocator.client.internal.endpoint.ServiceLocatorPropertiesType) SLPropertiesImpl(org.talend.esb.servicelocator.client.SLPropertiesImpl) Test(org.junit.Test)

Example 3 with EntryType

use of org.talend.esb.servicelocator.client.internal.endpoint.EntryType in project tesb-rt-se by Talend.

the class SLPropertiesConverter method toSLProperties.

public static SLProperties toSLProperties(ServiceLocatorPropertiesType props) {
    SLPropertiesImpl slProperties = new SLPropertiesImpl();
    for (EntryType entry : props.getEntry()) {
        String key = entry.getKey();
        List<String> values = entry.getValue();
        slProperties.addProperty(key, values);
    }
    return slProperties;
}
Also used : EntryType(org.talend.esb.servicelocator.client.internal.endpoint.EntryType) SLPropertiesImpl(org.talend.esb.servicelocator.client.SLPropertiesImpl)

Example 4 with EntryType

use of org.talend.esb.servicelocator.client.internal.endpoint.EntryType in project tesb-rt-se by Talend.

the class SLPropertiesConverter method toServiceLocatorPropertiesType.

public static ServiceLocatorPropertiesType toServiceLocatorPropertiesType(SLProperties props) {
    ObjectFactory of = new ObjectFactory();
    ServiceLocatorPropertiesType slPropertiesType = of.createServiceLocatorPropertiesType();
    List<EntryType> entries = slPropertiesType.getEntry();
    for (String name : props.getPropertyNames()) {
        entries.add(createEntry(props, name));
    }
    return slPropertiesType;
}
Also used : EntryType(org.talend.esb.servicelocator.client.internal.endpoint.EntryType) ObjectFactory(org.talend.esb.servicelocator.client.internal.endpoint.ObjectFactory) ServiceLocatorPropertiesType(org.talend.esb.servicelocator.client.internal.endpoint.ServiceLocatorPropertiesType)

Aggregations

EntryType (org.talend.esb.servicelocator.client.internal.endpoint.EntryType)4 SLPropertiesImpl (org.talend.esb.servicelocator.client.SLPropertiesImpl)2 ServiceLocatorPropertiesType (org.talend.esb.servicelocator.client.internal.endpoint.ServiceLocatorPropertiesType)2 Test (org.junit.Test)1 ObjectFactory (org.talend.esb.servicelocator.client.internal.endpoint.ObjectFactory)1