当前位置: 首页>>代码示例>>Java>>正文


Java Instant.EPOCH属性代码示例

本文整理汇总了Java中java.time.Instant.EPOCH属性的典型用法代码示例。如果您正苦于以下问题:Java Instant.EPOCH属性的具体用法?Java Instant.EPOCH怎么用?Java Instant.EPOCH使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.time.Instant的用法示例。


在下文中一共展示了Instant.EPOCH属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLepResourceDescriptor

private LepResourceDescriptor getLepResourceDescriptor(LepResourceKey resourceKey,
                                                       Resource scriptResource) {
    // get script modification time
    Instant modificationTime;
    try {
        modificationTime = Instant.ofEpochMilli(scriptResource.lastModified());
    } catch (IOException e) {
        throw new IllegalStateException(
            "Error while getting script resource modification time: "
                + e.getMessage(),
            e);
    }

    // build descriptor
    return new DefaultLepResourceDescriptor(getResourceType(resourceKey), resourceKey,
                                            Instant.EPOCH, modificationTime);
}
 
开发者ID:xm-online,项目名称:xm-commons,代码行数:17,代码来源:XmLepResourceService.java

示例2: getLepResourceDescriptor

private LepResourceDescriptor getLepResourceDescriptor(
    LepResourceKey resourceKey,
    Resource scriptResource) {
    // get script modification time
    Instant modificationTime;
    try {
        modificationTime = Instant.ofEpochMilli(scriptResource.lastModified());
    } catch (IOException e) {
        throw new IllegalStateException(
            "Error while getting script resource modification time: "
                + e.getMessage(),
            e);
    }

    // build descriptor
    return new DefaultLepResourceDescriptor(getResourceType(resourceKey), resourceKey,
                                            Instant.EPOCH, modificationTime);
}
 
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:18,代码来源:XmClasspathLepResourceService.java

示例3: data_adjustInto

@DataProvider(name="adjustInto")
Object[][] data_adjustInto() {
    return new Object[][]{
            {Instant.ofEpochSecond(10, 200), Instant.ofEpochSecond(20), Instant.ofEpochSecond(10, 200), null},
            {Instant.ofEpochSecond(10, -200), Instant.now(), Instant.ofEpochSecond(10, -200), null},
            {Instant.ofEpochSecond(-10), Instant.EPOCH, Instant.ofEpochSecond(-10), null},
            {Instant.ofEpochSecond(10), Instant.MIN, Instant.ofEpochSecond(10), null},
            {Instant.ofEpochSecond(10), Instant.MAX, Instant.ofEpochSecond(10), null},

            {Instant.ofEpochSecond(10, 200), LocalDateTime.of(1970, 1, 1, 0, 0, 20).toInstant(ZoneOffset.UTC), Instant.ofEpochSecond(10, 200), null},
            {Instant.ofEpochSecond(10, 200), OffsetDateTime.of(1970, 1, 1, 0, 0, 20, 10, ZoneOffset.UTC), OffsetDateTime.of(1970, 1, 1, 0, 0, 10, 200, ZoneOffset.UTC), null},
            {Instant.ofEpochSecond(10, 200), OffsetDateTime.of(1970, 1, 1, 0, 0, 20, 10, OFFSET_PTWO), OffsetDateTime.of(1970, 1, 1, 2, 0, 10, 200, OFFSET_PTWO), null},
            {Instant.ofEpochSecond(10, 200), ZonedDateTime.of(1970, 1, 1, 0, 0, 20, 10, ZONE_PARIS), ZonedDateTime.of(1970, 1, 1, 1, 0, 10, 200, ZONE_PARIS), null},

            {Instant.ofEpochSecond(10, 200), LocalDateTime.of(1970, 1, 1, 0, 0, 20), null, DateTimeException.class},
            {Instant.ofEpochSecond(10, 200), null, null, NullPointerException.class},

    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:TCKInstant.java

示例4: data_with

@DataProvider(name="with")
Object[][] data_with() {
    return new Object[][]{
            {Instant.ofEpochSecond(10, 200), Instant.ofEpochSecond(20), Instant.ofEpochSecond(20), null},
            {Instant.ofEpochSecond(10), Instant.ofEpochSecond(20, -100), Instant.ofEpochSecond(20, -100), null},
            {Instant.ofEpochSecond(-10), Instant.EPOCH, Instant.ofEpochSecond(0), null},
            {Instant.ofEpochSecond(10), Instant.MIN, Instant.MIN, null},
            {Instant.ofEpochSecond(10), Instant.MAX, Instant.MAX, null},

            {Instant.ofEpochSecond(10, 200), LocalDateTime.of(1970, 1, 1, 0, 0, 20).toInstant(ZoneOffset.UTC), Instant.ofEpochSecond(20), null},

            {Instant.ofEpochSecond(10, 200), LocalDateTime.of(1970, 1, 1, 0, 0, 20), null, DateTimeException.class},
            {Instant.ofEpochSecond(10, 200), null, null, NullPointerException.class},

    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:TCKInstant.java

示例5: testStringDatedResultNode

@Test
public void testStringDatedResultNode() {
    final TreeNode treeNode =
            NodeSupplier.createDatedResultTreeNode(createStringDriver("TestInput"),
                    NodeSupplier.ROOT_NODE_LEVEL, getRule()).get();
    final ResultNode resultNode = (ResultNode) treeNode;
    final BaseTreeNode baseTreeNode = (BaseTreeNode) treeNode;

    assertEquals(new UUID(0, 1L), resultNode.getRuleIdentifier());
    assertEquals(14L, resultNode.getWeight());

    assertTrue(resultNode.evaluate("TestInput"));
    assertFalse(resultNode.evaluate("TestInputs"));

    assertTrue(resultNode.getDriverType() == InputValueType.STRING);
    // a result node never equals another
    assertFalse(resultNode.equals(resultNode));

    final InputDriver driverValue = baseTreeNode.getDriver();
    assertTrue(driverValue.getValue().equals("TestInput"));

    final Range<Instant> range = new Range<>(Instant.EPOCH, DecisionTreeRule.MAX);
    assertEquals(range, treeNode.getDateRange());
}
 
开发者ID:jpmorganchase,项目名称:swblocks-decisiontree,代码行数:24,代码来源:ResultNodeTest.java

示例6: shouldBeEqualToOtherDatedCandleSticksWithSameValue

/**
 * A {@link DatedCandleStick} {@link Object#equals(Object)} only other {@link DatedCandleStick} that have the same
 * value.
 * 
 * <p>
 * A {@link DatedCandleStick} can also be equal to instances of sub-class of {@link DatedCandleStick}.
 * </p>
 */
@Test
public void shouldBeEqualToOtherDatedCandleSticksWithSameValue() {
    final Instant someTime = Instant.EPOCH;
    final Instant otherTime = Instant.EPOCH.plus(1, MINUTES);

    assertThat(new DatedCandleStick<>(someTime, 1.0, 2.0, 3.0, 4.0)).isEqualTo(
            new DatedCandleStick<>(someTime, new Price(1.0), new Price(2.0), new Price(3.0), new Price(4.0)));
    assertThat(new DatedCandleStick<>(someTime, 1.0, 2.0, 3.0, 4.0)).isEqualTo(
            new ExemplaryDatedCandleStickSubClass(someTime, 1.0, 2.0, 3.0, 4.0, 42));
    assertThat(new DatedCandleStick<>(someTime, 1.0, 2.592, 1.12345, 5.12345)).isEqualTo(
            new DatedCandleStick<>(someTime, 1.0, 2.592, 1.123449, 5.12345018));

    assertThat(new DatedCandleStick<>(someTime, 1.0, 2.0, 3.0, 4.0)).isNotEqualTo(
            new DatedCandleStick<>(otherTime, 1.0, 2.0, 3.0, 4.0));
    assertThat(new DatedCandleStick<>(someTime, 1.0, 2.592, 1.12345, 5.12345)).isNotEqualTo(
            new DatedCandleStick<>(someTime, 1.0, 2.592, 1.12346, 5.12343));
    assertThat(new DatedCandleStick<>(someTime, 1.0, 2.0, 3.0, 4.0)).isNotEqualTo("not a candle stick");
    assertThat(new DatedCandleStick<>(someTime, 1.0, 2.0, 3.0, 4.02)).isNotEqualTo(null);
}
 
开发者ID:rbi,项目名称:trading4j,代码行数:27,代码来源:DatedCandleStickTest.java

示例7: shouldBeEqualToOtherFatCandleSticksWithSameValue

/**
 * A {@link FullMarketData} {@link Object#equals(Object)} only other {@link FullMarketData} that have the same
 * value.
 * 
 * <p>
 * A {@link FullMarketData} can also be equal to instances of sub-class of {@link FullMarketData}.
 * </p>
 */
@Test
public void shouldBeEqualToOtherFatCandleSticksWithSameValue() {
    final Instant someTime = Instant.EPOCH;
    final Instant otherTime = Instant.EPOCH.plus(1, MINUTES);

    assertThat(
            new FullMarketData<>(someTime, new Price(1.0), new Price(2.0), new Price(3.0), new Price(4.0),
                    new Price(5.0), new Volume(5, VolumeUnit.LOT), 50)).isEqualTo(
            new FullMarketData<>(someTime, new Price(1.0), new Price(2.0), new Price(3.0), new Price(4.0),
                    new Price(5.0), new Volume(50, VolumeUnit.MINI_LOT), 50));
    assertThat(
            new FullMarketData<>(someTime, new Price(1.0), new Price(2.0), new Price(3.0), new Price(4.0),
                    new Price(5.0), new Volume(5, VolumeUnit.LOT), 50)).isEqualTo(
            new ExemplaryFatCandleStickSubClass(someTime, new Price(1.0), new Price(2.0), new Price(3.0),
                    new Price(4.0), new Price(5.0), new Volume(5, VolumeUnit.LOT), 50, 42));

    assertThat(
            new FullMarketData<>(someTime, new Price(1.0), new Price(2.0), new Price(3.0), new Price(4.0),
                    new Price(5.0), new Volume(5, VolumeUnit.LOT), 50)).isNotEqualTo(
            new FullMarketData<>(otherTime, new Price(1.0), new Price(2.0), new Price(3.0), new Price(4.0),
                    new Price(5.0), new Volume(5, VolumeUnit.LOT), 32));
    assertThat(
            new FullMarketData<>(someTime, new Price(1.0), new Price(2.0), new Price(3.0), new Price(4.0),
                    new Price(5.0), new Volume(5, VolumeUnit.LOT), 5432)).isNotEqualTo(
            new FullMarketData<>(someTime, new Price(1.0), new Price(2.0), new Price(3.0), new Price(4.0),
                    new Price(5.0), new Volume(5, VolumeUnit.LOT), 50));
    assertThat(
            new FullMarketData<>(someTime, new Price(1.0), new Price(2.0), new Price(3.0), new Price(4.0),
                    new Price(5.0), new Volume(5, VolumeUnit.LOT), 50)).isNotEqualTo("not a candle stick");
    assertThat(
            new FullMarketData<>(someTime, new Price(1.0), new Price(2.0), new Price(3.0), new Price(4.0),
                    new Price(5.0), new Volume(5, VolumeUnit.LOT), 50)).isNotEqualTo(null);
}
 
开发者ID:rbi,项目名称:trading4j,代码行数:41,代码来源:FullMarketDataTest.java

示例8: granted_tnt_license_at

@Override
public @Nullable Instant granted_tnt_license_at() {
    return Instant.EPOCH;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:LocalUserDocument.java

示例9: BackdatingEventReader

public BackdatingEventReader(EventReader underlying, Instant liveCutoverInclusive) {
    this(underlying, liveCutoverInclusive, Instant.EPOCH);
}
 
开发者ID:tim-group,项目名称:tg-eventstore,代码行数:3,代码来源:BackdatingEventReader.java

示例10: minimumProcessFundsMigrationValue

@Test
public void minimumProcessFundsMigrationValue() throws IOException, BlockStoreException {
    BridgeConstants bridgeConstants = BridgeRegTestConstants.getInstance();
    Federation oldFederation = bridgeConstants.getGenesisFederation();
    Federation newFederation = new Federation(
            Collections.singletonList(new BtcECKey(new SecureRandom())),
            Instant.EPOCH,
            5L,
            bridgeConstants.getBtcParams()
    );

    BridgeStorageProvider provider = mock(BridgeStorageProvider.class);
    when(provider.getFeePerKb())
            .thenReturn(Coin.MILLICOIN);
    when(provider.getReleaseRequestQueue())
            .thenReturn(new ReleaseRequestQueue(Collections.emptyList()));
    when(provider.getReleaseTransactionSet())
            .thenReturn(new ReleaseTransactionSet(Collections.emptySet()));
    when(provider.getOldFederation())
            .thenReturn(oldFederation);
    when(provider.getNewFederation())
            .thenReturn(newFederation);

    BlockGenerator blockGenerator = new BlockGenerator();
    // Old federation will be in migration age at block 35
    org.ethereum.core.Block rskCurrentBlock = blockGenerator.createBlock(35, 1);
    Transaction tx = Transaction.create(ConfigHelper.CONFIG, TO_ADDRESS, DUST_AMOUNT, NONCE, GAS_PRICE, GAS_LIMIT, DATA);

    Repository repository = new RepositoryImpl(ConfigHelper.CONFIG);
    Repository track = repository.startTracking();
    BridgeSupport bridgeSupport = new BridgeSupport(ConfigHelper.CONFIG, track, mock(BridgeEventLogger.class), provider, rskCurrentBlock);

    // One MICROCOIN is less than half the fee per kb, which is the minimum funds to migrate,
    // and so it won't be removed from the old federation UTXOs list for migration.
    List<UTXO> unsufficientUTXOsForMigration1 = new ArrayList<>();
    unsufficientUTXOsForMigration1.add(createUTXO(Coin.MICROCOIN, oldFederation.getAddress()));
    when(provider.getOldFederationBtcUTXOs())
            .thenReturn(unsufficientUTXOsForMigration1);
    bridgeSupport.updateCollections(tx);
    assertThat(unsufficientUTXOsForMigration1.size(), is(1));

    // MILLICOIN is greater than half the fee per kb,
    // and it will be removed from the old federation UTXOs list for migration.
    List<UTXO> sufficientUTXOsForMigration1 = new ArrayList<>();
    sufficientUTXOsForMigration1.add(createUTXO(Coin.MILLICOIN, oldFederation.getAddress()));
    when(provider.getOldFederationBtcUTXOs())
            .thenReturn(sufficientUTXOsForMigration1);

    bridgeSupport.updateCollections(tx);
    assertThat(sufficientUTXOsForMigration1.size(), is(0));

    // 2 smaller coins should work exactly like 1 MILLICOIN
    List<UTXO> sufficientUTXOsForMigration2 = new ArrayList<>();
    sufficientUTXOsForMigration2.add(createUTXO(Coin.MILLICOIN.divide(2), oldFederation.getAddress()));
    sufficientUTXOsForMigration2.add(createUTXO(Coin.MILLICOIN.divide(2), oldFederation.getAddress()));
    when(provider.getOldFederationBtcUTXOs())
            .thenReturn(sufficientUTXOsForMigration2);

    bridgeSupport.updateCollections(tx);
    assertThat(sufficientUTXOsForMigration2.size(), is(0));

    // higher fee per kb prevents funds migration
    List<UTXO> unsufficientUTXOsForMigration2 = new ArrayList<>();
    unsufficientUTXOsForMigration2.add(createUTXO(Coin.MILLICOIN, oldFederation.getAddress()));
    when(provider.getOldFederationBtcUTXOs())
            .thenReturn(unsufficientUTXOsForMigration2);
    when(provider.getFeePerKb())
            .thenReturn(Coin.COIN);

    bridgeSupport.updateCollections(tx);
    assertThat(unsufficientUTXOsForMigration2.size(), is(1));
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:72,代码来源:BridgeSupportTest.java

示例11: main

public static void main(String[] args) throws Exception {
    //ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.ADVANCED);

    try {

        String propertiesFile = System.getProperty(GE_EXPORT_DATABASE_PROPERTIES_KEY, "db-info.properties");
        LOGGER.info("Validating connection to the target database from configuration file: {}", propertiesFile);
        Properties dbProps = PropertiesUtils.getPropertiesFromClasspath(propertiesFile);
        try {
            Yank.setupDefaultConnectionPool(dbProps);
            SqlHelper.loadSqlQueries();
        } catch (Throwable t) {
            LOGGER.error("Unable to connect to the target database.  Please validate your configuration settings.");
            throw new RuntimeException("Failed to establish connection to target database.", t);
        }

        LOGGER.info("Validating connection to Gradle Enterprise");
        // This ignores authentication
        performHealthCheck();
        // This does NOT ignore authentication
        performAuthenticationCheck();

        if (System.getProperty("createDb") != null) {
            CreateDB.run();
        }

        String hoursStr = System.getProperty("hours", "24");
        Instant since;
        if (hoursStr.equals("all")) {
            since = Instant.EPOCH;
            LOGGER.info("Calculating for all stored build scans");
        } else {
            since = now().minus(Duration.ofHours(Integer.parseInt(hoursStr)));
        }

        buildIdStream(since)
                .flatMap(buildId -> buildEventStream(buildId)
                                .reduce(new EventProcessor(buildId), EventProcessor::process),
                        NUM_OF_STREAMS
                )
                .toBlocking()
                .subscribe(
                        EventProcessor::persist
                );

        Yank.releaseDefaultConnectionPool();
    } catch (Exception e) {
        LOGGER.error("Export failed ", e);
        System.exit(1);
    }
}
 
开发者ID:gradle,项目名称:ge-export,代码行数:51,代码来源:Application.java

示例12: samples

@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {TEST_12345_123456789, Instant.MIN, Instant.MAX, Instant.EPOCH};
    return Arrays.asList(array);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:5,代码来源:TCKInstant.java

示例13: getRule

private DecisionTreeRule getRule() {
    return new DecisionTreeRule(new UUID(0, 1), UUID.randomUUID(),
            getInputDriverArray("*", "CME", "S&P", "US", "*"),
            Collections.emptyMap(), Instant.EPOCH, DecisionTreeRule.MAX);
}
 
开发者ID:jpmorganchase,项目名称:swblocks-decisiontree,代码行数:5,代码来源:ResultNodeTest.java


注:本文中的java.time.Instant.EPOCH属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。