1 /*******************************************************************************
2 * ============LICENSE_START====================================================
4 * * ===========================================================================
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * * ===========================================================================
7 * * Licensed under the Apache License, Version 2.0 (the "License");
8 * * you may not use this file except in compliance with the License.
9 * * You may obtain a copy of the License at
11 * * http://www.apache.org/licenses/LICENSE-2.0
13 * * Unless required by applicable law or agreed to in writing, software
14 * * distributed under the License is distributed on an "AS IS" BASIS,
15 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * * See the License for the specific language governing permissions and
17 * * limitations under the License.
18 * * ============LICENSE_END====================================================
21 ******************************************************************************/
22 package org.onap.aaf.cadi.test.wsse;
24 import java.io.FileInputStream;
26 import javax.xml.stream.events.XMLEvent;
28 import org.junit.Test;
29 import org.onap.aaf.cadi.wsse.XEvent;
30 import org.onap.aaf.cadi.wsse.XReader;
32 public class JU_XReader {
33 //TODO: Gabe [JUnit] Class not found error
35 public void test() throws Exception {
36 FileInputStream fis = new FileInputStream("test/CBUSevent.xml");
38 XReader xr = new XReader(fis);
40 XEvent xe = xr.nextEvent();
41 switch(xe.getEventType()) {
42 case XMLEvent.START_DOCUMENT:
43 System.out.println("Start Document");
45 case XMLEvent.START_ELEMENT:
46 System.out.println("Start Event: " + xe.asStartElement().getName());
48 case XMLEvent.END_ELEMENT:
49 System.out.println("End Event: " + xe.asEndElement().getName());
51 case XMLEvent.CHARACTERS:
52 System.out.println("Characters: " + xe.asCharacters().getData());
54 case XMLEvent.COMMENT:
55 System.out.println("Comment: " + ((XEvent.Comment)xe).value);