Java Code Examples for java.time.OffsetDateTime#toString()

The following examples show how to use java.time.OffsetDateTime#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TCKOffsetDateTime.java    From j2objc with Apache License 2.0 5 votes vote down vote up
@Test()
@UseDataProvider("provider_sampleToString")
public void test_toString(int y, int o, int d, int h, int m, int s, int n, String offsetId, String expected) {
    OffsetDateTime t = OffsetDateTime.of(y, o, d, h, m, s, n, ZoneOffset.of(offsetId));
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 2
Source File: TCKOffsetDateTime.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int y, int o, int d, int h, int m, int s, int n, String offsetId, String expected) {
    OffsetDateTime t = OffsetDateTime.of(y, o, d, h, m, s, n, ZoneOffset.of(offsetId));
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 3
Source File: SimpleCatalogManager.java    From mobi with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public Commit createCommit(@Nonnull InProgressCommit inProgressCommit, @Nonnull String message, Commit baseCommit,
                           Commit auxCommit) {
    if (auxCommit != null && baseCommit == null) {
        throw new IllegalArgumentException("Commit must have a base commit in order to have an auxiliary commit");
    }
    IRI associatedWith = vf.createIRI(Activity.wasAssociatedWith_IRI);
    IRI generatedIRI = vf.createIRI(Activity.generated_IRI);
    OffsetDateTime now = OffsetDateTime.now();
    Resource revisionIRI = (Resource) inProgressCommit.getProperty(generatedIRI).get();
    Value user = inProgressCommit.getProperty(associatedWith).get();
    StringBuilder metadata = new StringBuilder(now.toString() + user.stringValue());

    Set<Value> generatedParents = new HashSet<>();
    if (baseCommit != null) {
        metadata.append(baseCommit.getResource().stringValue());
        generatedParents.add(baseCommit.getProperty(generatedIRI).get());
    }
    if (auxCommit != null) {
        metadata.append(auxCommit.getResource().stringValue());
        generatedParents.add(auxCommit.getProperty(generatedIRI).get());
    }
    Commit commit = commitFactory.createNew(vf.createIRI(Catalogs.COMMIT_NAMESPACE
            + DigestUtils.sha1Hex(metadata.toString())));
    commit.setProperty(revisionIRI, generatedIRI);
    commit.setProperty(vf.createLiteral(now), vf.createIRI(PROV_AT_TIME));
    commit.setProperty(vf.createLiteral(message), vf.createIRI(_Thing.title_IRI));
    commit.setProperty(user, associatedWith);

    if (baseCommit != null) {
        commit.setBaseCommit(baseCommit);
    }
    if (auxCommit != null) {
        commit.setAuxiliaryCommit(auxCommit);
    }

    Model revisionModel = mf.createModel(inProgressCommit.getModel());
    revisionModel.remove(inProgressCommit.getResource(), null, null);
    revisionFactory.getExisting(revisionIRI, revisionModel).ifPresent(revision -> {
        if (generatedParents.size() > 0) {
            revision.setProperties(generatedParents, vf.createIRI(Entity.wasDerivedFrom_IRI));
        }
    });

    commit.getModel().addAll(revisionModel);
    return commit;
}
 
Example 4
Source File: TCKOffsetDateTime.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int y, int o, int d, int h, int m, int s, int n, String offsetId, String expected) {
    OffsetDateTime t = OffsetDateTime.of(y, o, d, h, m, s, n, ZoneOffset.of(offsetId));
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 5
Source File: OffsetDateTimeType.java    From agrest with Apache License 2.0 4 votes vote down vote up
@Override
public String toString(OffsetDateTime value) {
	return (null != value) ? ('\'' + value.toString() + '\''): "NULL";
}
 
Example 6
Source File: TimestampColumnOffsetDateTimeMapper.java    From jadira with Apache License 2.0 4 votes vote down vote up
@Override
public String toNonNullString(OffsetDateTime value) {
    return value.toString();
}
 
Example 7
Source File: UserApiHeader.java    From vertx-swagger with Apache License 2.0 4 votes vote down vote up
public static UserApiHeader UserApi_loginUser_200_createXExpiresAfter(OffsetDateTime xExpiresAfter) {
    return new UserApiHeader("X-Expires-After", xExpiresAfter.toString());
}
 
Example 8
Source File: LastPublishedItemImpl.java    From robozonky with Apache License 2.0 4 votes vote down vote up
public void setDatePublished(final OffsetDateTime datePublished) {
    this.datePublished = datePublished.toString();
}
 
Example 9
Source File: LastPublishedItemImpl.java    From robozonky with Apache License 2.0 4 votes vote down vote up
public LastPublishedItemImpl(final long id, final OffsetDateTime datePublished) {
    this.id = id;
    this.datePublished = datePublished.toString();
}
 
Example 10
Source File: BaseLoanImpl.java    From robozonky with Apache License 2.0 4 votes vote down vote up
public void setDatePublished(final OffsetDateTime datePublished) {
    this.datePublished = datePublished.toString();
}
 
Example 11
Source File: TCKOffsetDateTime.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int y, int o, int d, int h, int m, int s, int n, String offsetId, String expected) {
    OffsetDateTime t = OffsetDateTime.of(y, o, d, h, m, s, n, ZoneOffset.of(offsetId));
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 12
Source File: TCKOffsetDateTime.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int y, int o, int d, int h, int m, int s, int n, String offsetId, String expected) {
    OffsetDateTime t = OffsetDateTime.of(y, o, d, h, m, s, n, ZoneOffset.of(offsetId));
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 13
Source File: Clients.java    From java-json-benchmark with MIT License 4 votes vote down vote up
public String convertToString(OffsetDateTime object) {
    return object.toString();
}
 
Example 14
Source File: TimestampValueValidatorTest.java    From ditto with Eclipse Public License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() {
    final OffsetDateTime timestamp = OffsetDateTime.now();
    validTimestampString = timestamp.toString();
}
 
Example 15
Source File: TCKOffsetDateTime.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int y, int o, int d, int h, int m, int s, int n, String offsetId, String expected) {
    OffsetDateTime t = OffsetDateTime.of(y, o, d, h, m, s, n, ZoneOffset.of(offsetId));
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 16
Source File: TCKOffsetDateTime.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int y, int o, int d, int h, int m, int s, int n, String offsetId, String expected) {
    OffsetDateTime t = OffsetDateTime.of(y, o, d, h, m, s, n, ZoneOffset.of(offsetId));
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 17
Source File: TCKOffsetDateTime.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int y, int o, int d, int h, int m, int s, int n, String offsetId, String expected) {
    OffsetDateTime t = OffsetDateTime.of(y, o, d, h, m, s, n, ZoneOffset.of(offsetId));
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 18
Source File: TCKOffsetDateTime.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int y, int o, int d, int h, int m, int s, int n, String offsetId, String expected) {
    OffsetDateTime t = OffsetDateTime.of(y, o, d, h, m, s, n, ZoneOffset.of(offsetId));
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 19
Source File: TCKOffsetDateTime.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int y, int o, int d, int h, int m, int s, int n, String offsetId, String expected) {
    OffsetDateTime t = OffsetDateTime.of(y, o, d, h, m, s, n, ZoneOffset.of(offsetId));
    String str = t.toString();
    assertEquals(str, expected);
}
 
Example 20
Source File: TCKOffsetDateTime.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="sampleToString")
public void test_toString(int y, int o, int d, int h, int m, int s, int n, String offsetId, String expected) {
    OffsetDateTime t = OffsetDateTime.of(y, o, d, h, m, s, n, ZoneOffset.of(offsetId));
    String str = t.toString();
    assertEquals(str, expected);
}