當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。