mirror of https://github.com/apache/nifi.git
NIFI-4092: This closes #2365.
- Removing direct dependency on jaxb. Signed-off-by: joewitt <joewitt@apache.org>
This commit is contained in:
parent
6ee6b5e57c
commit
a2a8fcb31c
|
@ -183,8 +183,6 @@ The following binary components are provided under the Common Development and Di
|
||||||
(CDDL 1.1) (GPL2 w/ CPE) asm-all-repackaged (org.glassfish.hk2.external:asm-all-repackaged:jar:2.5.0-b42 - https://javaee.github.io/glassfish/)
|
(CDDL 1.1) (GPL2 w/ CPE) asm-all-repackaged (org.glassfish.hk2.external:asm-all-repackaged:jar:2.5.0-b42 - https://javaee.github.io/glassfish/)
|
||||||
(CDDL 1.1) (GPL2 w/ CPE) aopalliance-repackaged (org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b42 - https://javaee.github.io/glassfish/)
|
(CDDL 1.1) (GPL2 w/ CPE) aopalliance-repackaged (org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b42 - https://javaee.github.io/glassfish/)
|
||||||
(CDDL 1.1) (GPL2 w/ CPE) javax.inject:1 as OSGi bundle (org.glassfish.hk2.external:javax.inject:jar:2.4.0-b25 - https://hk2.java.net/external/javax.inject)
|
(CDDL 1.1) (GPL2 w/ CPE) javax.inject:1 as OSGi bundle (org.glassfish.hk2.external:javax.inject:jar:2.4.0-b25 - https://hk2.java.net/external/javax.inject)
|
||||||
(CDDL 1.1) (GPL2 w/ CPE) Old JAXB Runtime (com.sun.xml.bind:jaxb-impl:jar:2.2.3-1 - http://jaxb.java.net/)
|
|
||||||
(CDDL 1.1) (GPL2 w/ CPE) Java Architecture For XML Binding (javax.xml.bind:jaxb-api:jar:2.2.2 - https://jaxb.dev.java.net/)
|
|
||||||
(CDDL 1.1) (GPL2 w/ CPE) MIME Streaming Extension (org.jvnet.mimepull:mimepull:jar:1.9.3 - http://mimepull.java.net)
|
(CDDL 1.1) (GPL2 w/ CPE) MIME Streaming Extension (org.jvnet.mimepull:mimepull:jar:1.9.3 - http://mimepull.java.net)
|
||||||
(CDDL 1.1) (GPL2 w/ CPE) JavaMail API (compat) (javax.mail:mail:jar:1.4.7 - http://kenai.com/projects/javamail/mail)
|
(CDDL 1.1) (GPL2 w/ CPE) JavaMail API (compat) (javax.mail:mail:jar:1.4.7 - http://kenai.com/projects/javamail/mail)
|
||||||
(CDDL 1.1) (GPL2 w/ CPE) javax.ws.rs-api (javax.ws.rs:javax.ws.rs-api:jar:2.1 - http://jax-rs-spec.java.net)
|
(CDDL 1.1) (GPL2 w/ CPE) javax.ws.rs-api (javax.ws.rs:javax.ws.rs-api:jar:2.1 - http://jax-rs-spec.java.net)
|
||||||
|
|
|
@ -103,11 +103,6 @@
|
||||||
<groupId>org.bouncycastle</groupId>
|
<groupId>org.bouncycastle</groupId>
|
||||||
<artifactId>bcprov-jdk15on</artifactId>
|
<artifactId>bcprov-jdk15on</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.sun.xml.bind</groupId>
|
|
||||||
<artifactId>jaxb-impl</artifactId>
|
|
||||||
<version>2.2.3-1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.core</groupId>
|
<groupId>org.glassfish.jersey.core</groupId>
|
||||||
<artifactId>jersey-client</artifactId>
|
<artifactId>jersey-client</artifactId>
|
||||||
|
|
|
@ -25,11 +25,6 @@ import javax.xml.bind.Marshaller;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.xml.stream.XMLOutputFactory;
|
|
||||||
import javax.xml.stream.XMLStreamException;
|
|
||||||
import javax.xml.stream.XMLStreamWriter;
|
|
||||||
|
|
||||||
import com.sun.xml.txw2.output.IndentingXMLStreamWriter;
|
|
||||||
|
|
||||||
public final class TemplateSerializer {
|
public final class TemplateSerializer {
|
||||||
|
|
||||||
|
@ -46,13 +41,12 @@ public final class TemplateSerializer {
|
||||||
|
|
||||||
JAXBContext context = JAXBContext.newInstance(TemplateDTO.class);
|
JAXBContext context = JAXBContext.newInstance(TemplateDTO.class);
|
||||||
Marshaller marshaller = context.createMarshaller();
|
Marshaller marshaller = context.createMarshaller();
|
||||||
XMLOutputFactory xmlof = XMLOutputFactory.newInstance();
|
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
|
||||||
XMLStreamWriter writer = new IndentingXMLStreamWriter(xmlof.createXMLStreamWriter(bos));
|
marshaller.marshal(dto, bos);
|
||||||
marshaller.marshal(dto, writer);
|
|
||||||
|
|
||||||
bos.flush();
|
bos.flush();
|
||||||
return baos.toByteArray(); //Note: For really large templates this could use a lot of heap space
|
return baos.toByteArray(); //Note: For really large templates this could use a lot of heap space
|
||||||
} catch (final IOException | JAXBException | XMLStreamException e) {
|
} catch (final IOException | JAXBException e) {
|
||||||
throw new FlowSerializationException(e);
|
throw new FlowSerializationException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,21 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.nifi.persistence;
|
package org.apache.nifi.persistence;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import javax.xml.bind.JAXBContext;
|
|
||||||
import javax.xml.bind.JAXBElement;
|
|
||||||
import javax.xml.bind.Unmarshaller;
|
|
||||||
import javax.xml.stream.XMLStreamReader;
|
|
||||||
import org.apache.nifi.security.xml.XmlUtils;
|
import org.apache.nifi.security.xml.XmlUtils;
|
||||||
import org.apache.nifi.util.ComponentIdGenerator;
|
import org.apache.nifi.util.ComponentIdGenerator;
|
||||||
import org.apache.nifi.web.api.dto.FlowSnippetDTO;
|
import org.apache.nifi.web.api.dto.FlowSnippetDTO;
|
||||||
|
@ -43,6 +28,22 @@ import org.eclipse.jgit.diff.RawText;
|
||||||
import org.eclipse.jgit.diff.RawTextComparator;
|
import org.eclipse.jgit.diff.RawTextComparator;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import javax.xml.bind.JAXBContext;
|
||||||
|
import javax.xml.bind.JAXBElement;
|
||||||
|
import javax.xml.bind.Unmarshaller;
|
||||||
|
import javax.xml.stream.XMLStreamReader;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class TemplateSerializerTest {
|
public class TemplateSerializerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -106,11 +107,11 @@ public class TemplateSerializerTest {
|
||||||
List<String> changes = reader.lines().peek(System.out::println)
|
List<String> changes = reader.lines().peek(System.out::println)
|
||||||
.filter(line -> line.startsWith("+") || line.startsWith("-")).collect(Collectors.toList());
|
.filter(line -> line.startsWith("+") || line.startsWith("-")).collect(Collectors.toList());
|
||||||
|
|
||||||
assertEquals("+ <name>Hello-0</name>", changes.get(0));
|
assertEquals("+ <name>Hello-0</name>", changes.get(0));
|
||||||
assertEquals("+ <name>Hello-2</name>", changes.get(1));
|
assertEquals("+ <name>Hello-2</name>", changes.get(1));
|
||||||
assertEquals("+ <processors>", changes.get(2));
|
assertEquals("+ <processors>", changes.get(2));
|
||||||
assertEquals("+ <type>ProcessorNew.class</type>", changes.get(4));
|
assertEquals("+ <type>ProcessorNew.class</type>", changes.get(4));
|
||||||
assertEquals("+ </processors>", changes.get(5));
|
assertEquals("+ </processors>", changes.get(5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue