本文整理汇总了Java中org.jdom.output.Format.getCompactFormat方法的典型用法代码示例。如果您正苦于以下问题:Java Format.getCompactFormat方法的具体用法?Java Format.getCompactFormat怎么用?Java Format.getCompactFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdom.output.Format
的用法示例。
在下文中一共展示了Format.getCompactFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: repeatedWriteShouldNotChangeElement
import org.jdom.output.Format; //导入方法依赖的package包/类
@Test
public void repeatedWriteShouldNotChangeElement() throws WriteExternalException {
final XMLOutputter xmlOutputter = new XMLOutputter(Format.getCompactFormat());
BlazeAndroidRunConfigurationCommonState commonState = state.getCommonState();
commonState.getBlazeFlagsState().setRawFlags(ImmutableList.of("--flag1", "--flag2"));
commonState.setNativeDebuggingEnabled(true);
state.setActivityClass("com.example.TestActivity");
state.setMode(BlazeAndroidBinaryRunConfigurationState.LAUNCH_SPECIFIC_ACTIVITY);
state.setLaunchMethod(AndroidBinaryLaunchMethod.MOBILE_INSTALL);
state.setUseSplitApksIfPossible(false);
state.setUseWorkProfileIfPresent(true);
state.setUserId(2);
state.setDeepLink("http://deeplink");
Element firstWrite = new Element("test");
state.writeExternal(firstWrite);
Element secondWrite = firstWrite.clone();
state.writeExternal(secondWrite);
assertThat(xmlOutputter.outputString(secondWrite))
.isEqualTo(xmlOutputter.outputString(firstWrite));
}
示例2: repeatedWriteShouldNotChangeElement
import org.jdom.output.Format; //导入方法依赖的package包/类
@Test
public void repeatedWriteShouldNotChangeElement() throws WriteExternalException {
final XMLOutputter xmlOutputter = new XMLOutputter(Format.getCompactFormat());
BlazeAndroidRunConfigurationCommonState commonState = state.getCommonState();
commonState.getBlazeFlagsState().setRawFlags(ImmutableList.of("--flag1", "--flag2"));
commonState.setNativeDebuggingEnabled(true);
state.setTestingType(BlazeAndroidTestRunConfigurationState.TEST_METHOD);
state.setInstrumentationRunnerClass("com.example.TestRunner");
state.setMethodName("fooMethod");
state.setClassName("BarClass");
state.setPackageName("com.test.package.name");
state.setLaunchMethod(AndroidTestLaunchMethod.MOBILE_INSTALL);
state.setExtraOptions("--option");
Element firstWrite = new Element("test");
state.writeExternal(firstWrite);
Element secondWrite = firstWrite.clone();
state.writeExternal(secondWrite);
assertThat(xmlOutputter.outputString(secondWrite))
.isEqualTo(xmlOutputter.outputString(firstWrite));
}
示例3: repeatedWriteShouldNotChangeElement
import org.jdom.output.Format; //导入方法依赖的package包/类
@Test
public void repeatedWriteShouldNotChangeElement() throws WriteExternalException {
final XMLOutputter xmlOutputter = new XMLOutputter(Format.getCompactFormat());
state.getBlazeFlagsState().setRawFlags(ImmutableList.of("--flag1", "--flag2"));
state.getExeFlagsState().setRawFlags(ImmutableList.of("--exe1", "--exe2"));
state.setNativeDebuggingEnabled(true);
Element firstWrite = new Element("test");
state.writeExternal(firstWrite);
Element secondWrite = firstWrite.clone();
state.writeExternal(secondWrite);
assertThat(xmlOutputter.outputString(secondWrite))
.isEqualTo(xmlOutputter.outputString(firstWrite));
}
示例4: writeConfiguration
import org.jdom.output.Format; //导入方法依赖的package包/类
private static void writeConfiguration(RunConfiguration configuration, File outputFile) {
try (FileOutputStream writer = new FileOutputStream(outputFile, false)) {
XMLOutputter xmlOutputter = new XMLOutputter(Format.getCompactFormat());
xmlOutputter.output(RunConfigurationSerializer.writeToXml(configuration), writer);
} catch (IOException e) {
throw new RuntimeException("Error exporting run configuration to file: " + outputFile);
}
}
示例5: repeatedWriteShouldNotChangeElement
import org.jdom.output.Format; //导入方法依赖的package包/类
@Test
public void repeatedWriteShouldNotChangeElement() throws Exception {
final XMLOutputter xmlOutputter = new XMLOutputter(Format.getCompactFormat());
state.getCommandState().setCommand(COMMAND);
state.getBlazeFlagsState().setRawFlags(ImmutableList.of("--flag1", "--flag2"));
state.getExeFlagsState().setRawFlags(ImmutableList.of("--exeFlag1"));
state.getBlazeBinaryState().setBlazeBinary("/usr/bin/blaze");
Element firstWrite = new Element("test");
state.writeExternal(firstWrite);
Element secondWrite = firstWrite.clone();
state.writeExternal(secondWrite);
assertThat(xmlOutputter.outputString(secondWrite))
.isEqualTo(xmlOutputter.outputString(firstWrite));
}
示例6: loadStateAndGetStateElementShouldMatchAfterChangeAndRevert
import org.jdom.output.Format; //导入方法依赖的package包/类
@Test
public void loadStateAndGetStateElementShouldMatchAfterChangeAndRevert() {
final XMLOutputter xmlOutputter = new XMLOutputter(Format.getCompactFormat());
final Label label = Label.create("//package:rule");
configuration.setTarget(label);
final Element initialElement = runManager.getState();
runManager.loadState(initialElement);
final BlazeCommandRunConfiguration modifiedConfiguration =
(BlazeCommandRunConfiguration) runManager.getAllConfigurations()[0];
modifiedConfiguration.setTarget(Label.create("//new:label"));
final Element modifiedElement = runManager.getState();
assertThat(xmlOutputter.outputString(modifiedElement))
.isNotEqualTo(xmlOutputter.outputString(initialElement));
runManager.loadState(modifiedElement);
final BlazeCommandRunConfiguration revertedConfiguration =
(BlazeCommandRunConfiguration) runManager.getAllConfigurations()[0];
revertedConfiguration.setTarget(label);
final Element revertedElement = runManager.getState();
assertThat(xmlOutputter.outputString(revertedElement))
.isEqualTo(xmlOutputter.outputString(initialElement));
}
示例7: getStateElementShouldMatchAfterEditorApplyToAndResetFrom
import org.jdom.output.Format; //导入方法依赖的package包/类
@Test
public void getStateElementShouldMatchAfterEditorApplyToAndResetFrom()
throws ConfigurationException {
final XMLOutputter xmlOutputter = new XMLOutputter(Format.getCompactFormat());
final BlazeCommandRunConfigurationSettingsEditor editor =
new BlazeCommandRunConfigurationSettingsEditor(configuration);
configuration.setTarget(Label.create("//package:rule"));
final Element initialElement = runManager.getState();
editor.resetFrom(configuration);
editor.applyEditorTo(configuration);
final Element newElement = runManager.getState();
assertThat(xmlOutputter.outputString(newElement))
.isEqualTo(xmlOutputter.outputString(initialElement));
Disposer.dispose(editor);
}
示例8: testRunConfigurationUnalteredBySerializationRoundTrip
import org.jdom.output.Format; //导入方法依赖的package包/类
@Test
public void testRunConfigurationUnalteredBySerializationRoundTrip() throws InvalidDataException {
configuration.setTarget(Label.create("//package:rule"));
configuration.setKeepInSync(true);
final Element initialElement = runManager.getState();
Element element = RunConfigurationSerializer.writeToXml(configuration);
assertThat(RunConfigurationSerializer.findExisting(getProject(), element)).isNotNull();
clearRunManager(); // remove configuration from project
RunConfigurationSerializer.loadFromXmlElementIgnoreExisting(getProject(), element);
final Element newElement = runManager.getState();
final XMLOutputter xmlOutputter = new XMLOutputter(Format.getCompactFormat());
assertThat(xmlOutputter.outputString(newElement))
.isEqualTo(xmlOutputter.outputString(initialElement));
}
示例9: ingestWcsCoverageDescription
import org.jdom.output.Format; //导入方法依赖的package包/类
/**
* Ingest individual coverage description element into the WCS catalog.
* @param cde - coverage description element.
* @param lastModified - last modified time of the RDF document.
* @return WCS CoverageDescription.
*/
private CoverageDescription ingestWcsCoverageDescription(Element cde, long lastModified) throws InterruptedException {
CoverageDescription cd = null;
try {
cd = new CoverageDescription(cde, lastModified);
coverages.put(cd.getIdentifier(), cd);
//log.info("Ingested CoverageDescription: " + cd.getCoverageId());
} catch (WcsException e) {
XMLOutputter xmlo = new XMLOutputter(Format.getCompactFormat());
String wcseElem = xmlo.outputString(e.getExceptionElement());
String cvgDesc = xmlo.outputString(cde);
log.error("ingestWcsCoverageDescription(): Failed to ingest CoverageDescription!");
log.error("ingestWcsCoverageDescription(): WcsException: " + wcseElem + "");
log.error("ingestWcsCoverageDescription(): Here is the XML element that failed to ingest: " + cvgDesc);
}
return cd;
}
示例10: toCompactString
import org.jdom.output.Format; //导入方法依赖的package包/类
public String toCompactString() {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
String xml = toString(format);
xml = xml.replaceAll("\\r","");
xml = xml.replaceAll("\\n","");
return xml;
}
示例11: toCompactString
import org.jdom.output.Format; //导入方法依赖的package包/类
public String toCompactString() {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
String xml = toString(format);
xml = xml.replaceAll("\\r","");
xml = xml.replaceAll("\\n","");
return "<?xml version=\"1.0\"?>"+xml;
}
示例12: toEncodedURLString
import org.jdom.output.Format; //导入方法依赖的package包/类
public String toEncodedURLString() throws UnsupportedEncodingException {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
String xml = toString(format);
xml = xml.replaceAll("\\r\\n","");
xml = xml.replaceAll("\\r","");
xml = xml.replaceAll("\\n","");
return URLEncoder.encode("<?xml version=\"1.0\"?>"+xml, "UTF-8");
}
示例13: toEncodedJavaScriptSafeURLString
import org.jdom.output.Format; //导入方法依赖的package包/类
public String toEncodedJavaScriptSafeURLString() throws UnsupportedEncodingException {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
String xml = toString(format);
//xml = xml.replaceAll("\"","\\\\\"");
xml = xml.replaceAll("'","\\\\'");;
xml = xml.replaceAll("\\r\\n","");
xml = xml.replaceAll("\\r","");
xml = xml.replaceAll("\\n","");
return URLEncoder.encode("<?xml version=\"1.0\"?>"+xml, "UTF-8");
}
示例14: toJavaScriptSafeString
import org.jdom.output.Format; //导入方法依赖的package包/类
public String toJavaScriptSafeString() {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
String xml = toString(format);
xml="<?xml version=\"1.0\"?>"+xml;
xml = xml.replaceAll("'","\\\\'");
xml = xml.replaceAll("\"","\\\\\"");
xml = xml.replaceAll("\\r\\n","");
xml = xml.replaceAll("\\r","");
xml = xml.replaceAll("\\n","");
return xml;
}
示例15: toEncodedURLString
import org.jdom.output.Format; //导入方法依赖的package包/类
/**
* Returns the document encoded by the URLEncoder class after striping carriage returns and line feeds.
* @return the encoded string
* @throws UnsupportedEncodingException
*/
public String toEncodedURLString() throws UnsupportedEncodingException {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
String xml = toString(format);
xml = xml.replaceAll("\\r\\n","");
xml = xml.replaceAll("\\r","");
xml = xml.replaceAll("\\n","");
return URLEncoder.encode("<?xml version=\"1.0\"?>"+xml, "UTF-8");
}