+ final NetconfState model = new NetconfState(service);
+ final String xml = XmlUtil.toString(new JaxBSerializer().toXml(model)).replaceAll("\\s", "");
+
+ assertThat(xml, CoreMatchers.containsString(
+ "<schema>" +
+ "<format>yang</format>" +
+ "<identifier>id</identifier>" +
+ "<location>NETCONF</location>" +
+ "<namespace>localhost</namespace>" +
+ "<version>v1</version>" +
+ "</schema>"));
+
+ assertThat(xml, CoreMatchers.containsString(
+ "<session>" +
+ "<session-id>1</session-id>" +
+ "<in-bad-rpcs>0</in-bad-rpcs>" +
+ "<in-rpcs>0</in-rpcs>" +
+ "<login-time>2010-10-10T12:32:32Z</login-time>" +
+ "<out-notifications>0</out-notifications>" +
+ "<out-rpc-errors>0</out-rpc-errors>" +
+ "<ncme:session-identifier>client</ncme:session-identifier>" +
+ "<source-host>192.168.1.1</source-host>" +
+ "<transport>ncme:netconf-tcp</transport>" +
+ "<username>username</username>" +
+ "</session>"));
+ }
+
+ private Schema getMockSchema(final String id, final String version, final Class<Yang> format) {
+ final Schema mock = mock(Schema.class);
+
+ doReturn(format).when(mock).getFormat();
+ doReturn(id).when(mock).getIdentifier();
+ doReturn(new Uri("localhost")).when(mock).getNamespace();
+ doReturn(version).when(mock).getVersion();
+ doReturn(Lists.newArrayList(new Schema.Location(Schema.Location.Enumeration.NETCONF))).when(mock).getLocation();
+ doReturn(new SchemaKey(format, id, version)).when(mock).getKey();
+ return mock;