MetaElement implements OdsElement { public static MetaElementBuilder builder() { return new MetaElementBuilder(); } MetaElement(final String creator, final String dateTime, final String description,
                       final String language, final String subject, final String title,
                       final String editingCycles, final String editingDuration,
                       final String initialCreator, final List<String> keyWords,
                       final List<UserDefined> userDefineds); static MetaElementBuilder builder(); static MetaElement create(); @Override void write(final XMLUtil util, final ZipUTF8Writer writer); static final String GENERATOR; static final String OFFICE_VERSION; static final Map<String, String> META_NAMESPACE_BY_PREFIX; }
@Test public void testEmpty() throws IOException { final MetaElement element = MetaElement.builder().creator("creator").date("date") .language(Locale.US.getLanguage()).build(); final String string = this.getString(element); DomTester.assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<office:document-meta " + "xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\" " + "xmlns:xlink=\"http: "xmlns:dc=\"http: "xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\" " + "xmlns:ooo=\"http: "office:version=\"1.2\"><office:meta>" + "<dc:creator>creator</dc:creator>" + "<dc:date>date</dc:date>" + "<dc:language>en</dc:language>" + "<meta:generator>FastOds/0.7.3</meta:generator>" + "<meta:editing-cycles>1</meta:editing-cycles>" + "<meta:editing-duration>PT1M00S</meta:editing-duration>" + "</office:meta></office:document-meta>", string); }
@Test public void testFull() throws IOException { final MetaElement element = MetaElement.builder().creator("creator").date("date").description("description") .language("l").editingCycles("10").editingDuration("duration") .initialCreator("init").keyWord("kw1", "kw3").keyWord("kw2") .subject("subject").title("title").userDefinedBoolean("b", false) .userDefinedDate("d", new Date(0)).userDefinedFloat("f", 10) .userDefinedString("s1", "s1").userDefinedString("s2", "s2") .userDefinedTime("t", new Date(0)).build(); final String string = this.getString(element); DomTester.assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<office:document-meta " + "xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\" " + "xmlns:xlink=\"http: "xmlns:dc=\"http: "xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\" " + "xmlns:ooo=\"http: "office:version=\"1.2\">" + "<office:meta>" + "<dc:creator>creator</dc:creator><dc:date>date</dc:date>" + "<dc:description>description</dc:description>" + "<dc:language>l</dc:language><dc:subject>subject</dc:subject>" + "<dc:title>title</dc:title>" + "<meta:generator>FastOds/0.7.3</meta:generator>" + "<meta:editing-cycles>10</meta:editing-cycles>" + "<meta:editing-duration>duration</meta:editing-duration>" + "<meta:initial-creator>init</meta:initial-creator>" + "<meta:keyword>kw1</meta:keyword><meta:keyword>kw3</meta:keyword>" + "<meta:keyword>kw2</meta:keyword>" + "<meta:user-defined meta:name=\"b\" meta:type=\"boolean\">" + "false</meta:user-defined>" + "<meta:user-defined meta:name=\"d\" meta:type=\"date\">" + "1970-01-01</meta:user-defined>" + "<meta:user-defined meta:name=\"f\" meta:type=\"float\">" + "10</meta:user-defined>" + "<meta:user-defined meta:name=\"s1\" meta:type=\"string\">" + "s1</meta:user-defined>" + "<meta:user-defined meta:name=\"s2\" meta:type=\"string\">" + "s2</meta:user-defined>" + "<meta:user-defined meta:name=\"t\" meta:type=\"time\">" + "00:00:00</meta:user-defined>" + "</office:meta></office:document-meta>", string); }