/** * {@inheritDoc} * * @see org.modeshape.graph.property.ValueFactory#create(org.modeshape.graph.property.DateTime) */ public String create( DateTime value ) throws ValueFormatException { if (value == null) return null; return value.getString(); // ISO representation }
@Test public void shouldCreateDateFromInputStreamContainingUtf8EncodingOfStringWithWellFormedDate() throws Exception { assertThat(factory.create(new ByteArrayInputStream(TODAY.getString().getBytes("UTF-8"))), is(TODAY)); assertThat(factory.create(new ByteArrayInputStream(LAST_YEAR.getString().getBytes("UTF-8"))), is(LAST_YEAR)); }
protected String generateNonExistantWorkspaceName() { String workspaceName = "something bogus" + context.getValueFactories().getDateFactory().create().getString(); workspaceName = workspaceName.replaceAll(":",""); // get rid of colons, so the name is valid on Windows Set<String> workspaces = graph.getWorkspaces(); while (workspaces.contains(workspaceName)) { workspaceName = workspaceName + "1"; // keep appending '1' to the name, until it doesn't match } return workspaceName; }