Merge "Get rid of NetconfMessageFactory"
[controller.git] / opendaylight / netconf / netconf-util / src / test / java / org / opendaylight / controller / netconf / util / messages / NetconfMessageFactoryTest.java
index f8c90836b977ab832bfb6b735df2e7f6d1de0b39..c405d9bcb5c364e014434eda79aa271ae87e5525 100644 (file)
@@ -7,19 +7,26 @@
  */
 package org.opendaylight.controller.netconf.util.messages;
 
-import com.google.common.io.Files;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import io.netty.buffer.Unpooled;
 
 import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
 
-public class NetconfMessageFactoryTest {
+import org.junit.Test;
+import org.opendaylight.controller.netconf.util.handler.NetconfXMLToMessageDecoder;
 
+import com.google.common.io.Files;
 
+public class NetconfMessageFactoryTest {
     @Test
     public void testAuth() throws Exception {
-        NetconfMessageFactory parser = new NetconfMessageFactory();
+        NetconfXMLToMessageDecoder parser = new NetconfXMLToMessageDecoder();
         File authHelloFile = new File(getClass().getResource("/netconfMessages/client_hello_with_auth.xml").getFile());
-        parser.parse(Files.toByteArray(authHelloFile));
 
+        final List<Object> out = new ArrayList<>();
+        parser.decode(null, Unpooled.wrappedBuffer(Files.toByteArray(authHelloFile)), out);
+        assertEquals(1, out.size());
     }
 }