Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AttachmentTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AttachmentTest.java?rev=1712279&r1=1712278&r2=1712279&view=diff ============================================================================== --- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AttachmentTest.java (original) +++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AttachmentTest.java Tue Nov 3 12:34:06 2015 @@ -23,6 +23,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PushbackInputStream; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -102,7 +103,7 @@ public class AttachmentTest extends Abst attachment.setMimeType("text/xml"); attachment.addHeaders(getHeaders(attachmentId)); attachment.setId(attachmentId); - attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); ByteArrayOutputStream baos = new ByteArrayOutputStream(); { @@ -121,7 +122,7 @@ public class AttachmentTest extends Abst securityProperties.setAttachmentCallbackHandler(attachmentCallbackHandler); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -146,7 +147,7 @@ public class AttachmentTest extends Abst Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0); byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream()); - Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); Assert.assertEquals("text/xml", responseAttachment.getMimeType()); } @@ -158,7 +159,7 @@ public class AttachmentTest extends Abst attachment.setMimeType("text/xml"); attachment.addHeaders(getHeaders(attachmentId)); attachment.setId(attachmentId); - attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); ByteArrayOutputStream baos = new ByteArrayOutputStream(); { @@ -177,7 +178,7 @@ public class AttachmentTest extends Abst securityProperties.setAttachmentCallbackHandler(attachmentCallbackHandler); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -199,7 +200,7 @@ public class AttachmentTest extends Abst List<Attachment> attachments = new ArrayList<Attachment>(); attachment.setSourceStream(new ByteArrayInputStream( - SOAPUtil.SAMPLE_SOAP_MSG.replace("15", "16").getBytes("UTF-8"))); + SOAPUtil.SAMPLE_SOAP_MSG.replace("15", "16").getBytes(StandardCharsets.UTF_8))); attachments.add(attachment); attachmentRequestCallback.setAttachments(attachments); } @@ -226,7 +227,7 @@ public class AttachmentTest extends Abst attachment.setMimeType("text/xml"); attachment.addHeaders(getHeaders(attachmentId)); attachment.setId(attachmentId); - attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); ByteArrayOutputStream baos = new ByteArrayOutputStream(); { @@ -245,7 +246,7 @@ public class AttachmentTest extends Abst securityProperties.setAttachmentCallbackHandler(attachmentCallbackHandler); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -271,7 +272,7 @@ public class AttachmentTest extends Abst Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0); byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream()); - Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); Assert.assertEquals("text/xml", responseAttachment.getMimeType()); } @@ -283,7 +284,7 @@ public class AttachmentTest extends Abst attachment.setMimeType("text/xml"); attachment.addHeaders(getHeaders(attachmentId)); attachment.setId(attachmentId); - attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); ByteArrayOutputStream baos = new ByteArrayOutputStream(); { @@ -302,7 +303,7 @@ public class AttachmentTest extends Abst securityProperties.setAttachmentCallbackHandler(attachmentCallbackHandler); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -352,14 +353,14 @@ public class AttachmentTest extends Abst attachment[0].setMimeType("text/xml"); attachment[0].addHeaders(getHeaders(attachment1Id)); attachment[0].setId(attachment1Id); - attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); final String attachment2Id = UUID.randomUUID().toString(); attachment[1] = new Attachment(); attachment[1].setMimeType("text/plain"); attachment[1].addHeaders(getHeaders(attachment2Id)); attachment[1].setId(attachment2Id); - attachment[1].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment[1].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); ByteArrayOutputStream baos = new ByteArrayOutputStream(); { @@ -378,7 +379,7 @@ public class AttachmentTest extends Abst securityProperties.setAttachmentCallbackHandler(attachmentCallbackHandler); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -404,7 +405,7 @@ public class AttachmentTest extends Abst Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0); byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream()); - Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); Assert.assertEquals("text/xml", responseAttachment.getMimeType()); } @@ -416,7 +417,7 @@ public class AttachmentTest extends Abst attachment.setMimeType("text/xml"); attachment.addHeaders(getHeaders(attachmentId)); attachment.setId(attachmentId); - attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); AttachmentCallbackHandler attachmentCallbackHandler = new AttachmentCallbackHandler(Collections.singletonList(attachment)); List<Attachment> encryptedAttachments = attachmentCallbackHandler.getResponseAttachments(); @@ -434,7 +435,7 @@ public class AttachmentTest extends Abst securityProperties.setAttachmentCallbackHandler(attachmentCallbackHandler); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -472,7 +473,7 @@ public class AttachmentTest extends Abst Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0); byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream()); - Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); Assert.assertEquals("text/xml", responseAttachment.getMimeType()); Map<String, String> attHeaders = responseAttachment.getHeaders(); @@ -486,7 +487,7 @@ public class AttachmentTest extends Abst attachment.setMimeType("text/xml"); attachment.addHeaders(getHeaders(attachmentId)); attachment.setId(attachmentId); - attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); AttachmentCallbackHandler attachmentCallbackHandler = new AttachmentCallbackHandler(Collections.singletonList(attachment)); List<Attachment> encryptedAttachments = attachmentCallbackHandler.getResponseAttachments(); @@ -504,7 +505,7 @@ public class AttachmentTest extends Abst securityProperties.setAttachmentCallbackHandler(attachmentCallbackHandler); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -547,7 +548,7 @@ public class AttachmentTest extends Abst // Different behaviour here for different JDKs... try { byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream()); - Assert.assertFalse(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + Assert.assertFalse(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); Assert.assertEquals("text/xml", responseAttachment.getMimeType()); Map<String, String> attHeaders = responseAttachment.getHeaders(); @@ -576,7 +577,7 @@ public class AttachmentTest extends Abst attachment.setMimeType("text/xml"); attachment.addHeaders(getHeaders(attachmentId)); attachment.setId(attachmentId); - attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); AttachmentCallbackHandler attachmentCallbackHandler = new AttachmentCallbackHandler(Collections.singletonList(attachment)); List<Attachment> encryptedAttachments = attachmentCallbackHandler.getResponseAttachments(); @@ -623,7 +624,7 @@ public class AttachmentTest extends Abst Assert.assertFalse(attachmentCallbackHandler.getResponseAttachments().isEmpty()); Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0); byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream()); - Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); Assert.assertEquals("text/xml", responseAttachment.getMimeType()); Map<String, String> attHeaders = responseAttachment.getHeaders(); @@ -638,7 +639,7 @@ public class AttachmentTest extends Abst attachment.setMimeType("text/xml"); attachment.addHeaders(getHeaders(attachmentId)); attachment.setId(attachmentId); - attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); AttachmentCallbackHandler attachmentCallbackHandler = new AttachmentCallbackHandler(Collections.singletonList(attachment)); @@ -657,7 +658,7 @@ public class AttachmentTest extends Abst securityProperties.setAttachmentCallbackHandler(attachmentCallbackHandler); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -696,7 +697,7 @@ public class AttachmentTest extends Abst Assert.assertFalse(attachmentCallbackHandler.getResponseAttachments().isEmpty()); Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0); byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream()); - Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); Assert.assertEquals("text/xml", responseAttachment.getMimeType()); Map<String, String> attHeaders = responseAttachment.getHeaders(); @@ -711,7 +712,7 @@ public class AttachmentTest extends Abst attachment.setMimeType("text/xml"); attachment.addHeaders(getHeaders(attachmentId)); attachment.setId(attachmentId); - attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); AttachmentCallbackHandler attachmentCallbackHandler = new AttachmentCallbackHandler(Collections.singletonList(attachment)); @@ -730,7 +731,7 @@ public class AttachmentTest extends Abst securityProperties.setAttachmentCallbackHandler(attachmentCallbackHandler); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -777,7 +778,7 @@ public class AttachmentTest extends Abst Assert.assertFalse(attachmentCallbackHandler.getResponseAttachments().isEmpty()); Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0); byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream()); - Assert.assertFalse(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + Assert.assertFalse(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); Assert.assertEquals("text/xml", responseAttachment.getMimeType()); } @@ -792,14 +793,14 @@ public class AttachmentTest extends Abst attachment[0].setMimeType("text/xml"); attachment[0].addHeaders(getHeaders(attachment1Id)); attachment[0].setId(attachment1Id); - attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); final String attachment2Id = UUID.randomUUID().toString(); attachment[1] = new Attachment(); attachment[1].setMimeType("text/plain"); attachment[1].addHeaders(getHeaders(attachment2Id)); attachment[1].setId(attachment2Id); - attachment[1].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment[1].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); AttachmentCallbackHandler attachmentCallbackHandler = new AttachmentCallbackHandler(Arrays.asList(attachment)); @@ -818,7 +819,7 @@ public class AttachmentTest extends Abst securityProperties.setAttachmentCallbackHandler(attachmentCallbackHandler); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -840,7 +841,7 @@ public class AttachmentTest extends Abst Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0); byte[] attachment1Bytes = readInputStream(responseAttachment.getSourceStream()); - Assert.assertTrue(Arrays.equals(attachment1Bytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + Assert.assertTrue(Arrays.equals(attachment1Bytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); Assert.assertEquals("text/xml", responseAttachment.getMimeType()); Map<String, String> att1Headers = responseAttachment.getHeaders(); Assert.assertEquals(6, att1Headers.size()); @@ -848,7 +849,7 @@ public class AttachmentTest extends Abst responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(1); byte[] attachment2Bytes = readInputStream(responseAttachment.getSourceStream()); - Assert.assertTrue(Arrays.equals(attachment2Bytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + Assert.assertTrue(Arrays.equals(attachment2Bytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); Assert.assertEquals("text/plain", responseAttachment.getMimeType()); Map<String, String> att2Headers = responseAttachment.getHeaders(); Assert.assertEquals(6, att2Headers.size()); @@ -863,7 +864,7 @@ public class AttachmentTest extends Abst attachment[0].setMimeType("text/xml"); attachment[0].addHeaders(getHeaders(attachmentId)); attachment[0].setId(attachmentId); - attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); ByteArrayOutputStream baos = new ByteArrayOutputStream(); { @@ -899,7 +900,7 @@ public class AttachmentTest extends Abst }); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -948,7 +949,7 @@ public class AttachmentTest extends Abst } byte[] attachmentBytes = readInputStream(attachment[0].getSourceStream()); - Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); Assert.assertEquals("text/xml", attachment[0].getMimeType()); Map<String, String> attHeaders = attachment[0].getHeaders(); @@ -964,7 +965,7 @@ public class AttachmentTest extends Abst attachment[0].setMimeType("text/xml"); attachment[0].addHeaders(getHeaders(attachmentId)); attachment[0].setId(attachmentId); - attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); ByteArrayOutputStream baos = new ByteArrayOutputStream(); { @@ -1000,7 +1001,7 @@ public class AttachmentTest extends Abst }); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -1057,7 +1058,7 @@ public class AttachmentTest extends Abst attachment[0].setMimeType("text/xml"); attachment[0].addHeaders(getHeaders(attachmentId)); attachment[0].setId(attachmentId); - attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); ByteArrayOutputStream baos = new ByteArrayOutputStream(); { @@ -1093,7 +1094,7 @@ public class AttachmentTest extends Abst }); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -1142,7 +1143,7 @@ public class AttachmentTest extends Abst } byte[] attachmentBytes = readInputStream(attachment[0].getSourceStream()); - Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); Assert.assertEquals("text/xml", attachment[0].getMimeType()); Map<String, String> attHeaders = attachment[0].getHeaders(); @@ -1158,7 +1159,7 @@ public class AttachmentTest extends Abst attachment[0].setMimeType("text/xml"); attachment[0].addHeaders(getHeaders(attachmentId)); attachment[0].setId(attachmentId); - attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8"))); + attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8))); ByteArrayOutputStream baos = new ByteArrayOutputStream(); { @@ -1194,7 +1195,7 @@ public class AttachmentTest extends Abst }); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close();
Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/DerivedKeyTokenTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/DerivedKeyTokenTest.java?rev=1712279&r1=1712278&r2=1712279&view=diff ============================================================================== --- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/DerivedKeyTokenTest.java (original) +++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/DerivedKeyTokenTest.java Tue Nov 3 12:34:06 2015 @@ -21,6 +21,7 @@ package org.apache.wss4j.stax.test; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Arrays; @@ -110,7 +111,7 @@ public class DerivedKeyTokenTest extends securityProperties.setEncryptionKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_ThumbprintIdentifier); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -311,7 +312,7 @@ public class DerivedKeyTokenTest extends securityProperties.setEncryptionKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_ThumbprintIdentifier); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -439,7 +440,7 @@ public class DerivedKeyTokenTest extends securityProperties.setSignatureUser("receiver"); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -562,7 +563,7 @@ public class DerivedKeyTokenTest extends securityProperties.setDerivedKeyKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_ThumbprintIdentifier); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -693,7 +694,7 @@ public class DerivedKeyTokenTest extends securityProperties.setDerivedKeyKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_SkiKeyIdentifier); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -827,7 +828,7 @@ public class DerivedKeyTokenTest extends securityProperties.setDerivedKeyTokenReference(WSSConstants.DerivedKeyTokenReference.EncryptedKey); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/EncDecryptionTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/EncDecryptionTest.java?rev=1712279&r1=1712278&r2=1712279&view=diff ============================================================================== --- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/EncDecryptionTest.java (original) +++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/EncDecryptionTest.java Tue Nov 3 12:34:06 2015 @@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.lang.reflect.Field; +import java.nio.charset.StandardCharsets; import java.security.KeyStore; import java.security.cert.X509Certificate; import java.util.ArrayList; @@ -2168,7 +2169,7 @@ public class EncDecryptionTest extends A securityProperties.setEncryptionKeyTransportAlgorithm("http://www.w3.org/2009/xmlenc11#rsa-oaep"); securityProperties.setEncryptionKeyTransportDigestAlgorithm("http://www.w3.org/2001/04/xmldsig-more#sha384"); securityProperties.setEncryptionKeyTransportMGFAlgorithm("http://www.w3.org/2009/xmlenc11#mgf1sha384"); - securityProperties.setEncryptionKeyTransportOAEPParams(Base64.decode("ZHVtbXkxMjM=".getBytes("UTF-8"))); + securityProperties.setEncryptionKeyTransportOAEPParams(Base64.decode("ZHVtbXkxMjM=".getBytes(StandardCharsets.UTF_8))); InputStream sourceDocument = this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml"); baos = doOutboundSecurity(securityProperties, sourceDocument); @@ -2236,7 +2237,7 @@ public class EncDecryptionTest extends A properties.put(WSHandlerConstants.ENC_KEY_TRANSPORT, "http://www.w3.org/2009/xmlenc11#rsa-oaep"); properties.put(WSHandlerConstants.ENC_DIGEST_ALGO, "http://www.w3.org/2001/04/xmldsig-more#sha384"); properties.put(WSHandlerConstants.ENC_MGF_ALGO, "http://www.w3.org/2009/xmlenc11#mgf1sha384"); - //properties.put(WSHandlerConstants.ENC_OAEP_PARAMS, Base64.decode("ZHVtbXkxMjM=".getBytes("UTF-8"))); + //properties.put(WSHandlerConstants.ENC_OAEP_PARAMS, Base64.decode("ZHVtbXkxMjM=".getBytes(StandardCharsets.UTF_8))); Document securedDocument = doOutboundSecurityWithWSS4J(sourceDocument, action, properties); @@ -2512,7 +2513,7 @@ public class EncDecryptionTest extends A ); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); try { Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/HeaderOrderingTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/HeaderOrderingTest.java?rev=1712279&r1=1712278&r2=1712279&view=diff ============================================================================== --- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/HeaderOrderingTest.java (original) +++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/HeaderOrderingTest.java Tue Nov 3 12:34:06 2015 @@ -21,6 +21,7 @@ package org.apache.wss4j.stax.test; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -76,7 +77,7 @@ public class HeaderOrderingTest extends ); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -124,7 +125,7 @@ public class HeaderOrderingTest extends ); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -173,7 +174,7 @@ public class HeaderOrderingTest extends ); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -222,7 +223,7 @@ public class HeaderOrderingTest extends ); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -270,7 +271,7 @@ public class HeaderOrderingTest extends ); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -322,7 +323,7 @@ public class HeaderOrderingTest extends ); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -375,7 +376,7 @@ public class HeaderOrderingTest extends ); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -429,7 +430,7 @@ public class HeaderOrderingTest extends ); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -496,7 +497,7 @@ public class HeaderOrderingTest extends ); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -565,7 +566,7 @@ public class HeaderOrderingTest extends ); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -671,7 +672,7 @@ public class HeaderOrderingTest extends securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", securityEventList); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), securityEventList); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -745,7 +746,7 @@ public class HeaderOrderingTest extends ); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/InteroperabilityTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/InteroperabilityTest.java?rev=1712279&r1=1712278&r2=1712279&view=diff ============================================================================== --- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/InteroperabilityTest.java (original) +++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/InteroperabilityTest.java Tue Nov 3 12:34:06 2015 @@ -25,6 +25,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.StringWriter; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.EnumSet; import java.util.Iterator; @@ -712,7 +713,7 @@ public class InteroperabilityTest extend securityProperties.setUseReqSigCertForEncryption(true); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", securityEventList); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), securityEventList); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -758,7 +759,7 @@ public class InteroperabilityTest extend securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -812,7 +813,7 @@ public class InteroperabilityTest extend securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/MultipleActionTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/MultipleActionTest.java?rev=1712279&r1=1712278&r2=1712279&view=diff ============================================================================== --- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/MultipleActionTest.java (original) +++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/MultipleActionTest.java Tue Nov 3 12:34:06 2015 @@ -20,6 +20,7 @@ package org.apache.wss4j.stax.test; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @@ -62,7 +63,7 @@ public class MultipleActionTest extends securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -103,7 +104,7 @@ public class MultipleActionTest extends securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/OutputChainTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/OutputChainTest.java?rev=1712279&r1=1712278&r2=1712279&view=diff ============================================================================== --- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/OutputChainTest.java (original) +++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/OutputChainTest.java Tue Nov 3 12:34:06 2015 @@ -21,6 +21,7 @@ package org.apache.wss4j.stax.test; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @@ -52,7 +53,7 @@ public class OutputChainTest extends Abs OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); ByteArrayOutputStream baos = new ByteArrayOutputStream(); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -96,7 +97,7 @@ public class OutputChainTest extends Abs OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); ByteArrayOutputStream baos = new ByteArrayOutputStream(); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -129,7 +130,7 @@ public class OutputChainTest extends Abs OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); ByteArrayOutputStream baos = new ByteArrayOutputStream(); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/PasswordEncryptorTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/PasswordEncryptorTest.java?rev=1712279&r1=1712278&r2=1712279&view=diff ============================================================================== --- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/PasswordEncryptorTest.java (original) +++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/PasswordEncryptorTest.java Tue Nov 3 12:34:06 2015 @@ -21,6 +21,7 @@ package org.apache.wss4j.stax.test; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Properties; @@ -71,7 +72,7 @@ public class PasswordEncryptorTest exten securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SecurityContextTokenTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SecurityContextTokenTest.java?rev=1712279&r1=1712278&r2=1712279&view=diff ============================================================================== --- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SecurityContextTokenTest.java (original) +++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SecurityContextTokenTest.java Tue Nov 3 12:34:06 2015 @@ -21,6 +21,7 @@ package org.apache.wss4j.stax.test; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -109,7 +110,7 @@ public class SecurityContextTokenTest ex securityProperties.setDerivedKeyTokenReference(WSSConstants.DerivedKeyTokenReference.SecurityContextToken); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -319,7 +320,7 @@ public class SecurityContextTokenTest ex securityProperties.setDerivedKeyTokenReference(WSSConstants.DerivedKeyTokenReference.SecurityContextToken); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureConfirmationTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureConfirmationTest.java?rev=1712279&r1=1712278&r2=1712279&view=diff ============================================================================== --- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureConfirmationTest.java (original) +++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureConfirmationTest.java Tue Nov 3 12:34:06 2015 @@ -21,6 +21,7 @@ package org.apache.wss4j.stax.test; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -116,7 +117,7 @@ public class SignatureConfirmationTest e securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", securityEventList); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), securityEventList); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -211,7 +212,7 @@ public class SignatureConfirmationTest e securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", securityEventList); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), securityEventList); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -259,7 +260,7 @@ public class SignatureConfirmationTest e }; OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>(), securityEventListener); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>(), securityEventListener); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -355,7 +356,7 @@ public class SignatureConfirmationTest e }; OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>(), securityEventListener); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>(), securityEventListener); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureEncryptionTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureEncryptionTest.java?rev=1712279&r1=1712278&r2=1712279&view=diff ============================================================================== --- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureEncryptionTest.java (original) +++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureEncryptionTest.java Tue Nov 3 12:34:06 2015 @@ -21,6 +21,7 @@ package org.apache.wss4j.stax.test; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.security.Key; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; @@ -161,7 +162,7 @@ public class SignatureEncryptionTest ext baos = new ByteArrayOutputStream(); XMLStreamWriter xmlStreamWriter = - wsSecOut.processOutMessage(baos, "UTF-8", outboundSecurityContext); + wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), outboundSecurityContext); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(sourceDocument); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -253,7 +254,7 @@ public class SignatureEncryptionTest ext baos = new ByteArrayOutputStream(); XMLStreamWriter xmlStreamWriter = - wsSecOut.processOutMessage(baos, "UTF-8", outboundSecurityContext); + wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), outboundSecurityContext); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(sourceDocument); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -355,7 +356,7 @@ public class SignatureEncryptionTest ext baos = new ByteArrayOutputStream(); XMLStreamWriter xmlStreamWriter = - wsSecOut.processOutMessage(baos, "UTF-8", outboundSecurityContext); + wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), outboundSecurityContext); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(sourceDocument); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureTest.java?rev=1712279&r1=1712278&r2=1712279&view=diff ============================================================================== --- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureTest.java (original) +++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureTest.java Tue Nov 3 12:34:06 2015 @@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.security.Security; import java.util.ArrayList; import java.util.HashMap; @@ -91,7 +92,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -170,7 +171,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -250,7 +251,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -297,7 +298,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); try { @@ -327,7 +328,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -452,7 +453,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -502,7 +503,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -544,7 +545,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -626,7 +627,7 @@ public class SignatureTest extends Abstr securityProperties.setIncludeSignatureToken(true); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -671,7 +672,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new org.apache.wss4j.stax.test.CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -752,7 +753,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new org.apache.wss4j.stax.test.CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -806,7 +807,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new org.apache.wss4j.stax.test.CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -888,7 +889,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new org.apache.wss4j.stax.test.CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -969,7 +970,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new org.apache.wss4j.stax.test.CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -1052,7 +1053,7 @@ public class SignatureTest extends Abstr securityProperties.setIncludeSignatureToken(true); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -1110,7 +1111,7 @@ public class SignatureTest extends Abstr ); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -1220,7 +1221,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -1296,7 +1297,7 @@ public class SignatureTest extends Abstr securityProperties.setCallbackHandler(new CallbackHandlerImpl()); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -1392,7 +1393,7 @@ public class SignatureTest extends Abstr securityProperties.setSignatureAlgorithm("http://www.w3.org/2000/09/xmldsig#dsa-sha1"); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -1461,7 +1462,7 @@ public class SignatureTest extends Abstr securityProperties.setSignatureAlgorithm("http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512"); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -1597,7 +1598,7 @@ public class SignatureTest extends Abstr WSSSecurityProperties securityProperties = ConfigurationConverter.convert(config); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -1684,7 +1685,7 @@ public class SignatureTest extends Abstr ); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); try { Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/TimestampTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/TimestampTest.java?rev=1712279&r1=1712278&r2=1712279&view=diff ============================================================================== --- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/TimestampTest.java (original) +++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/TimestampTest.java Tue Nov 3 12:34:06 2015 @@ -21,6 +21,7 @@ package org.apache.wss4j.stax.test; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Calendar; import java.util.GregorianCalendar; @@ -70,7 +71,7 @@ public class TimestampTest extends Abstr securityProperties.setActions(actions); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -147,7 +148,7 @@ public class TimestampTest extends Abstr securityProperties.setTimestampTTL(3600); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close(); @@ -670,7 +671,7 @@ public class TimestampTest extends Abstr WSSSecurityProperties securityProperties = ConfigurationConverter.convert(config); OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties); - XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>()); + XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>()); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml")); XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter); xmlStreamWriter.close();
