* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.netconf.mdsal.notification.impl.ops;
import static org.junit.Assert.assertTrue;
-import com.google.common.collect.Lists;
import java.io.IOException;
import java.util.Date;
+import java.util.Set;
import org.custommonkey.xmlunit.DetailedDiff;
import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.XMLUnit;
import org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier;
+import org.junit.BeforeClass;
import org.junit.Test;
+import org.opendaylight.mdsal.binding.dom.codec.impl.di.DefaultBindingDOMCodecFactory;
+import org.opendaylight.mdsal.binding.generator.impl.DefaultBindingRuntimeGenerator;
import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.notifications.NetconfNotification;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfCapabilityChange;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfCapabilityChangeBuilder;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.parser.api.YangParserException;
+import org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory;
import org.xml.sax.SAXException;
public class NotificationsTransformUtilTest {
-
private static final Date DATE = new Date();
private static final String INNER_NOTIFICATION =
"<netconf-capability-change xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-notifications\">"
+ "</eventTime>"
+ "</notification>";
+ private static NotificationsTransformUtil UTIL;
+
+ @BeforeClass
+ public static void beforeClass() throws YangParserException {
+ UTIL = new NotificationsTransformUtil(new DefaultYangParserFactory(), new DefaultBindingRuntimeGenerator(),
+ new DefaultBindingDOMCodecFactory());
+ }
+
@Test
public void testTransform() throws Exception {
final NetconfCapabilityChangeBuilder netconfCapabilityChangeBuilder = new NetconfCapabilityChangeBuilder();
- netconfCapabilityChangeBuilder.setAddedCapability(Lists.newArrayList(new Uri("uri1"), new Uri("uri1")));
- netconfCapabilityChangeBuilder.setDeletedCapability(Lists.newArrayList(new Uri("uri4"), new Uri("uri3")));
+ netconfCapabilityChangeBuilder.setAddedCapability(Set.of(new Uri("uri1")));
+ netconfCapabilityChangeBuilder.setDeletedCapability(Set.of(new Uri("uri4"), new Uri("uri3")));
final NetconfCapabilityChange capabilityChange = netconfCapabilityChangeBuilder.build();
- final NetconfNotification transform = NotificationsTransformUtil.transform(capabilityChange, DATE,
+ final NetconfNotification transform = UTIL.transform(capabilityChange, DATE,
SchemaPath.create(true, NetconfCapabilityChange.QNAME));
final String serialized = XmlUtil.toString(transform.getDocument());