Write a feature xml structure for test dependencies specified as ProvisionOption
in system to the given writer

@param writer where to write the feature xml
@param provisionOptions dependencies
978386
static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) {
        XMLOutputFactory xof =  XMLOutputFactory.newInstance();
        xof.setProperty("javax.xml.stream.isRepairingNamespaces", true);
        XMLStreamWriter sw = null;
        try {
            sw = xof.createXMLStreamWriter(writer);
            sw.writeStartDocument("UTF-8", "1.0");
            sw.setDefaultNamespace(KARAF_FEATURE_NS);
            sw.writeCharacters("\n");
            sw.writeStartElement("features");
            sw.writeAttribute("name", "test-dependencies");
            sw.writeCharacters("\n");
            sw.writeStartElement("feature");
            sw.writeAttribute("name", "test-dependencies");
            sw.writeCharacters("\n");
            for (ProvisionOption<?> provisionOption : provisionOptions) {
                if (provisionOption.getURL().startsWith("link")
                    || provisionOption.getURL().startsWith("scan-features")) {
                    // well those we've already handled at another location...
                    continue;
                }
                sw.writeStartElement("bundle");
                if (provisionOption.getStartLevel() != null) {
                    sw.writeAttribute("start-level", provisionOption.getStartLevel().toString());
                }
                sw.writeCharacters(provisionOption.getURL());
                endElement(sw);
            }
            endElement(sw);
            endElement(sw);
            sw.writeEndDocument();
        }
        catch (XMLStreamException e) {
            throw new RuntimeException("Error writing feature " + e.getMessage(), e);
        } 
        finally {
            close(sw);
        }
    }
264469
@Override
	public void serialize(XMLStreamWriter writer) throws XMLStreamException {
		String prefix = writer.getPrefix(CompressionPolicyBuilder.NAMESPACE);

        if (prefix == null) {
            prefix = "tpa";
            writer.setPrefix(prefix, CompressionPolicyBuilder.NAMESPACE);
        }

        // <tpa:Compression>
        writer.writeStartElement(prefix, CompressionPolicyBuilder.COMPRESSION_NAME, 
        		CompressionPolicyBuilder.NAMESPACE);

        // xmlns:tpa="http://types.talend.com/policy/assertion/1.0"
        writer.writeNamespace(prefix, CompressionPolicyBuilder.NAMESPACE);

        // attributes
        writer.writeAttribute(null, TRESHOLD_ATTRIBUTE_NAME, String.valueOf(threshold));

        // </tpa:Compression>
        writer.writeEndElement();
	}
559074
@Override
    public void writeExternal(PofWriter writer) throws IOException {
        writer.writeString(0, nodeName);
        writer.writeString(1, namespace);
    }
1187327
public static void write(final PrintWriter writer, final UicStats stats) {
		writer.println("<dl>");

		writer.print("<dt>Total root wcomponents found in UIC</dt>");
		writer.println("<dd>" + stats.getRootWCs().size() + "</dd>");

		writer.print("<dt>Size of UIC (by serialization)</dt>");
		writer.println("<dd>" + stats.getOverallSerializedSize() + "</dd>");

		writer.print("<dt>UI</dt>");
		writer.println("<dd>" + stats.getUI().getClass().getName() + "</dd>");

		writer.println("</dl>");

		for (Iterator<WComponent> it = stats.getWCsAnalysed(); it.hasNext();) {
			WComponent comp = it.next();
			Map<WComponent, UicStats.Stat> treeStats = stats.getWCTreeStats(comp);

			writer.println("<br /><strong>Analysed component:</strong> " + comp);
			writer.println("<br /><strong>Number of components in tree:</strong> " + treeStats.size());

			writeHeader(writer);
			writeProfileForTree(writer, treeStats);
			writeFooter(writer);
		}
	}
949569
public Context merge(final Writer writer) {
        return merge(Vars.EMPTY, new WriterOut(writer, engine));
    }
193490
public static WriteOptions buildWriteOptions(boolean sync, boolean disableWAL) {
        WriteOptions writeOptions = new WriteOptions();
        writeOptions.setSync(sync).setDisableWAL(disableWAL);
        return writeOptions;
    }
28432
public void xmlWriteOn(FormattedWriter writer) throws IOException
  {
    writer.newLine();
    writer.taggedValue("streamId", _streamId);
    writer.taggedValue("streamKey", _streamKey);
  }
91451
public static WriteOptions writeOptions(Boolean overwrite, Boolean forceSync){
    WriteOptions wo = new WriteOptions();
    if (overwrite != null)
      wo.setOverwrite(overwrite);
    if (forceSync != null)
      wo.setForcesync(forceSync);
    return wo;
  }
685236
public static void writePropStats(XMLStreamWriter xmlStreamWriter,
      Map<String, Set<HierarchicalProperty>> propStatuses) throws XMLStreamException
   {
      for (Map.Entry<String, Set<HierarchicalProperty>> stat : propStatuses.entrySet())
      {
         xmlStreamWriter.writeStartElement("DAV:", "propstat");

         xmlStreamWriter.writeStartElement("DAV:", "prop");
         for (HierarchicalProperty prop : propStatuses.get(stat.getKey()))
         {
            writeProperty(xmlStreamWriter, prop);
         }
         xmlStreamWriter.writeEndElement();

         xmlStreamWriter.writeStartElement("DAV:", "status");
         xmlStreamWriter.writeCharacters(stat.getKey());
         xmlStreamWriter.writeEndElement();

         // D:propstat
         xmlStreamWriter.writeEndElement();
      }
   }
655926
public static <T> Writer<TrialMeter<T>> writer(final Writer<? super T> writer) {
		return elem(
			"measurement",
			attr("name").map(TrialMeter::getName),
			attr("description").map(tm -> tm.getDescription().orElse("")),
			Env.WRITER.map(TrialMeter::getEnv),
			Params.<T>writer(writer).map(TrialMeter::getParams),
			DataSet.WRITER.map(TrialMeter::getDataSet)
		);
	}
1019573
public void writeRequestLine(Writer writer) throws IOException
    {
        writer.write(_method);
        writer.write(' ');
        writer.write(_uri != null ? _uri.toString() : "null");
        writer.write(' ');
        writer.write(_version);
    }
253159
@Override
    public void writeContent(XMLExtendedStreamWriter writer, ModuleConfig value) throws XMLStreamException {

        writer.writeStartDocument();
        writer.writeStartElement(MODULE);
        writer.writeDefaultNamespace(MODULE_NS);

        if(moduleName == null) {
            throw new XMLStreamException("Module name is missing.");
        }
        writer.writeAttribute(NAME, moduleName);

        if (slotName != null) {
            writer.writeAttribute(SLOT, slotName);
        }

        if(properties != null) {
            writeNewLine(writer);
            writer.writeStartElement(PROPERTIES);
            for(Map.Entry<String, String> entry: properties.entrySet()) {
                writer.writeStartElement(PROPERTY);
                writer.writeAttribute(NAME, entry.getKey());
                writer.writeAttribute(VALUE, entry.getValue());
                writer.writeEndElement();
            }
            writer.writeEndElement();
        }

        if(mainClass != null) {
            writeNewLine(writer);
            writer.writeStartElement(MAIN_CLASS);
            writer.writeAttribute(NAME, mainClass);
            writer.writeEndElement();
        }

        if(resources != null) {
            writeNewLine(writer);
            writer.writeStartElement(RESOURCES);
            for(Resource res : resources) {
                res.writeContent(writer, res);
            }
            writer.writeEndElement();
        }

        if(dependencies != null) {
            writeNewLine(writer);
            writer.writeStartElement(DEPENDENCIES);
            for(Dependency dep : dependencies) {
                dep.writeContent(writer, dep);
            }
            writer.writeEndElement();
        }

        writeNewLine(writer);
        writer.writeEndElement();
        writer.writeEndDocument();
    }
871238
public void writeConfiguration(final YarnClusterSubmissionFromCS yarnClusterSubmissionFromCS,
                                 final JobFolder jobFolderOnDFS) throws IOException {
    final File yarnAppParametersFile = new File(yarnClusterSubmissionFromCS.getDriverFolder(),
        fileNames.getYarnBootstrapAppParamFilePath());

    final File yarnJobParametersFile = new File(yarnClusterSubmissionFromCS.getDriverFolder(),
        fileNames.getYarnBootstrapJobParamFilePath());

    try (final FileOutputStream appFileOutputStream = new FileOutputStream(yarnAppParametersFile)) {
      try (final FileOutputStream jobFileOutputStream = new FileOutputStream(yarnJobParametersFile)) {
        // this is mainly a test hook.
        writeAvroYarnAppSubmissionParametersToOutputStream(yarnClusterSubmissionFromCS, appFileOutputStream);
        writeAvroYarnJobSubmissionParametersToOutputStream(
            yarnClusterSubmissionFromCS, jobFolderOnDFS.getPath().toString(), jobFileOutputStream);
      }
    }
  }
651230
public static void toWriter(Node node, Writer writer, Map<String, String> outputProperties) throws TransformerException {
		try {
			Transformer transformer = TransformerFactory.newInstance().newTransformer();
			for (Map.Entry<String, String> property : outputProperties.entrySet()) {
				try {
					transformer.setOutputProperty(property.getKey(), property.getValue());
				} catch (IllegalArgumentException e) {
					//ignore invalid output properties
				}
			}

			DOMSource source = new DOMSource(node);
			StreamResult result = new StreamResult(writer);
			transformer.transform(source, result);
		} catch (TransformerConfigurationException e) {
			//no complex configurations
		} catch (TransformerFactoryConfigurationError e) {
			//no complex configurations
		}
	}
1209829
public void write(XMLStreamWriter writer, String xmlElementName) throws XMLStreamException {
      if (isModified()) {
         writer.writeStartElement(xmlElementName);
         write(writer);
         writer.writeEndElement();
      }
   }
464919
public final void xmlRequestWriteOn(FormattedWriter writer) throws IOException, NotInMessageStore
    {
        Membership membership = _getMembership();
        if (null == membership)
        {
            throw new NotInMessageStore();
        }
        if (null != membership)
        {
            membership.requestXmlWriteOn(writer);
            writer.flush();
        }
    }
1139730
public void write(Workspace workspace, Writer writer) {
        workspace.getViews().getSystemContextViews().forEach(v -> write(v, null, writer));
        workspace.getViews().getContainerViews().forEach(v -> write(v, v.getSoftwareSystem(), writer));
        workspace.getViews().getComponentViews().forEach(v -> write(v, v.getContainer(), writer));
    }