public void testParseXml() throws Exception { PayloadXmlMsgParser parser = new PayloadXmlMsgParser(TEST_XML); PayloadArrayWrapper profile = (PayloadArrayWrapper) parser.getPayloadDescriptor(); PlistDebug.logTest(profile.toString()); assertEquals(profile, createProfile()); assertEquals(parser.getPayload(PayloadBase.PAYLOAD_TYPE_MEMORY_POLICY), getPolicy()); assertTrue( ObjectComparator.equals( parser.getPayload(PayloadBase.PAYLOAD_TYPE_MEMORY_POLICY), getPolicy())); }
private PayloadArrayWrapper createWrapper() { PayloadArrayWrapper wrapper = new PayloadArrayWrapper(); wrapper.setPayloadDescription("描述文件描述。wjl 测试"); wrapper.setPayloadDisplayName("Pekall MDM Profile"); wrapper.setPayloadIdentifier("com.pekall.profile"); wrapper.setPayloadOrganization("Pekall Capital"); wrapper.setPayloadType("Configuration"); wrapper.setPayloadUUID("2ED160FF-4B6C-47DD-8105-769231367D2A"); wrapper.setPayloadVersion(1); wrapper.setPayloadRemovalDisallowed(true); return wrapper; }
public void testXml2Bean() throws Exception { NSDictionary dictionary = (NSDictionary) PlistXmlParser.fromXml(EnrollProfileData.ENROLL_PROFILE); PayloadArrayWrapper wrapper = (PayloadArrayWrapper) PlistBeanConverter.createBeanFromNdict(dictionary, PayloadArrayWrapper.class); assertEquals(wrapper.getPayloadDescription(), "描述文件描述。wjl 测试"); assertEquals(wrapper.getPayloadDisplayName(), "Pekall MDM Profile"); assertEquals(wrapper.getPayloadIdentifier(), "com.pekall.profile"); assertEquals(wrapper.getPayloadOrganization(), "Pekall Capital"); assertEquals(wrapper.getPayloadType(), "Configuration"); assertEquals(wrapper.getPayloadUUID(), "2ED160FF-4B6C-47DD-8105-769231367D2A"); assertEquals(wrapper.getPayloadVersion(), 1); assertEquals(wrapper.getPayloadContent().size(), 7); PlistDebug.logTest("Bean: " + wrapper.toString()); }
private PayloadArrayWrapper createProfile() { PayloadArrayWrapper wrapper = createWrapper(); wrapper.addPayLoadContent(getPolicy()); return wrapper; }
public void testTwoWay() throws Exception { PayloadXmlMsgParser parser = new PayloadXmlMsgParser(TEST_XML); PayloadArrayWrapper profile = (PayloadArrayWrapper) parser.getPayloadDescriptor(); assertEquals(TEST_XML, profile.toXml()); }
public void testGenXml() throws Exception { PayloadArrayWrapper profile = createProfile(); String xml = profile.toXml(); PlistDebug.logTest(xml); assertEquals(xml, TEST_XML); }