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


Java DateTimeZone.UTC属性代码示例

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


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

示例1: getTaxCodesValidAt

@Test(groups = "fast")
public void getTaxCodesValidAt() throws IOException, ServletException, SQLException {
    // given
    ByteArrayOutputStream byos = givenDefaultServletCall("GET", "/taxCodes");
    given(req.getParameter(EasyTaxServlet.VALID_DATE)).willReturn("2017-01-01T12:00:00Z");

    List<EasyTaxTaxCode> taxCodes = Arrays
            .asList(new EasyTaxTaxCode(UUID.randomUUID().toString()));
    DateTime at = new DateTime(2017, 1, 1, 12, 0, 0, DateTimeZone.UTC);
    given(dao.getTaxCodes(tenantId, null, null, null, at)).willReturn(taxCodes);

    // when
    servlet.service(req, res);

    // then
    thenDefaultOkJsonResponse();

    assertEquals(byos.toString("UTF-8"),
            "[{\"tax_code\":\"" + taxCodes.get(0).getTaxCode() + "\"}]",
            "Response body content");
}
 
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:21,代码来源:EasyTaxServletTests.java

示例2: testReuters1

@Test
public void testReuters1() throws Exception {
    String html = loadArticle("reuters1");
    String url = "http://www.reuters.com/finance/stocks/TEX/key-developments/article/3414284";
    HttpArticle article = ArticleExtractor.extractArticle(html, url, reutersSource(), null);
    assertEquals("Marcato reports 5.1 pct stake in Terex, to urge spinoff & restructuring- CNBC, citing source", article.getTitle());
    assertTrue(article.getText().contains("Marcato reports 5.1 pct stake in Terex, to urge spinoff & restructuring; Marcato supports Terex CEO - CNBC, citing source"));
    DateTime actualPublished = article.getPublished();
    DateTime expectedPublished = new DateTime(2016, 7, 28, 15, 35, DateTimeZone.UTC);
    assertTrue(actualPublished.toDate().equals(expectedPublished.toDate()));
}
 
开发者ID:tokenmill,项目名称:crawling-framework,代码行数:11,代码来源:ReutersExtractorTest.java

示例3: testUTCIntervalRounding

public void testUTCIntervalRounding() {
    Rounding tzRounding = Rounding.builder(TimeValue.timeValueHours(12)).build();
    DateTimeZone tz = DateTimeZone.UTC;
    assertThat(tzRounding.round(time("2009-02-03T01:01:01")), isDate(time("2009-02-03T00:00:00.000Z"), tz));
    assertThat(tzRounding.nextRoundingValue(time("2009-02-03T00:00:00.000Z")), isDate(time("2009-02-03T12:00:00.000Z"), tz));
    assertThat(tzRounding.round(time("2009-02-03T13:01:01")), isDate(time("2009-02-03T12:00:00.000Z"), tz));
    assertThat(tzRounding.nextRoundingValue(time("2009-02-03T12:00:00.000Z")), isDate(time("2009-02-04T00:00:00.000Z"), tz));

    tzRounding = Rounding.builder(TimeValue.timeValueHours(48)).build();
    assertThat(tzRounding.round(time("2009-02-03T01:01:01")), isDate(time("2009-02-03T00:00:00.000Z"), tz));
    assertThat(tzRounding.nextRoundingValue(time("2009-02-03T00:00:00.000Z")), isDate(time("2009-02-05T00:00:00.000Z"), tz));
    assertThat(tzRounding.round(time("2009-02-05T13:01:01")), isDate(time("2009-02-05T00:00:00.000Z"), tz));
    assertThat(tzRounding.nextRoundingValue(time("2009-02-05T00:00:00.000Z")), isDate(time("2009-02-07T00:00:00.000Z"), tz));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:TimeZoneRoundingTests.java

示例4: returnDateIsMandatoryForClosedLoans

@Test
@Ignore("Should conditional field validation be done in a storage module?")
public void returnDateIsMandatoryForClosedLoans()
  throws InterruptedException,
  MalformedURLException,
  TimeoutException,
  ExecutionException {

  DateTime loanDate = new DateTime(2017, 3, 1, 13, 25, 46, 232, DateTimeZone.UTC);

  IndividualResource loan = createLoan(new LoanRequestBuilder()
    .withLoanDate(loanDate)
    .withdueDate(loanDate.plus(Period.days(14)))
    .create());

  JsonObject returnedLoan = loan.copyJson();

  returnedLoan
    .put("status", new JsonObject().put("name", "Closed"));

  CompletableFuture<TextResponse> putCompleted = new CompletableFuture();

  client.put(loanStorageUrl(String.format("/%s", loan.getId())), returnedLoan,
    StorageTestSuite.TENANT_ID, ResponseHandler.text(putCompleted));

  TextResponse response = putCompleted.get(5, TimeUnit.SECONDS);

  assertThat(String.format("Should have failed to update loan: %s", response.getBody()),
    response.getStatusCode(), is(HttpURLConnection.HTTP_BAD_REQUEST));

  assertThat(response.getBody(),
    containsString("return date is mandatory to close a loan"));
}
 
开发者ID:folio-org,项目名称:mod-circulation-storage,代码行数:33,代码来源:LoansApiTest.java

示例5: formatToZulu

/**
 * Normalise isoDate time to Zulu(UTC0) time-zone, removing any UTC offset.
 * @param isoDate
 * @return the ISO Zulu timezone formatted string 
 *             e.g 2011-02-04T17:13:14.000+01:00 -> 2011-02-04T16:13:14.000Z
 */
public static String formatToZulu(String isoDate)
{
    try 
    {
        DateTime dt = new DateTime(isoDate, DateTimeZone.UTC);
        return dt.toString();
    } catch (IllegalArgumentException e) 
    {
        throw new AlfrescoRuntimeException("Failed to parse date " + isoDate, e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-core,代码行数:17,代码来源:ISO8601DateFormat.java

示例6: setup

@BeforeMethod
public void setup() {
    now = new DateTime(DateTimeZone.UTC);
    tenantId = UUID.randomUUID();
    tenant = mock(Tenant.class);
    clock = mock(Clock.class);
    dao = mock(EasyTaxDao.class);
    securityApi = mock(SecurityApi.class);
    servlet = new EasyTaxServlet(dao, clock, securityApi);
    req = mock(HttpServletRequest.class);
    res = mock(HttpServletResponse.class);
}
 
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:12,代码来源:EasyTaxServletTests.java

示例7: testUnixMs

public void testUnixMs() {
    DateProcessor dateProcessor = new DateProcessor(randomAsciiOfLength(10), DateTimeZone.UTC, randomLocale(random()),
            "date_as_string", Collections.singletonList("UNIX_MS"), "date_as_date");
    Map<String, Object> document = new HashMap<>();
    document.put("date_as_string", "1000500");
    IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
    dateProcessor.execute(ingestDocument);
    assertThat(ingestDocument.getFieldValue("date_as_date", String.class), equalTo("1970-01-01T00:16:40.500Z"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:DateProcessorTests.java

示例8: RequestRequestBuilder

public RequestRequestBuilder() {
  this(UUID.randomUUID(),
    "Hold",
    new DateTime(2017, 7, 15, 9, 35, 27, DateTimeZone.UTC),
    UUID.randomUUID(),
    UUID.randomUUID(),
    "Hold Shelf",
    null,
    null,
    null,
    null,
    null);
}
 
开发者ID:folio-org,项目名称:mod-circulation-storage,代码行数:13,代码来源:RequestRequestBuilder.java

示例9: DateTime

public DateTime(String format, DateTimeZone timezone) {
    this.formatter = Joda.forPattern(format);
    this.timeZone = timezone != null ? timezone : DateTimeZone.UTC;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:4,代码来源:ValueFormatter.java

示例10: getUtcMinDateTime

@Test
public void getUtcMinDateTime() throws Exception {
    DateTime result = client.datetimes().getUtcMinDateTime();
    DateTime expected = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC);
    Assert.assertEquals(expected, result);
}
 
开发者ID:Azure,项目名称:autorest.java,代码行数:6,代码来源:DatetimeOperationsTests.java

示例11: canCreateARequestWithOnlyRequiredProperties

@Test
public void canCreateARequestWithOnlyRequiredProperties()
  throws InterruptedException,
  MalformedURLException,
  TimeoutException,
  ExecutionException,
  UnsupportedEncodingException {

  CompletableFuture<JsonResponse> createCompleted = new CompletableFuture<>();

  UUID id = UUID.randomUUID();
  UUID itemId = UUID.randomUUID();
  UUID requesterId = UUID.randomUUID();
  DateTime requestDate = new DateTime(2017, 7, 22, 10, 22, 54, DateTimeZone.UTC);

  JsonObject requestRequest = new RequestRequestBuilder()
    .recall()
    .withId(id)
    .withRequestDate(requestDate)
    .withItemId(itemId)
    .withRequesterId(requesterId)
    .toHoldShelf()
    .create();

  client.post(requestStorageUrl(),
    requestRequest, StorageTestSuite.TENANT_ID,
    ResponseHandler.json(createCompleted));

  JsonResponse response = createCompleted.get(5, TimeUnit.SECONDS);

  assertThat(String.format("Failed to create request: %s", response.getBody()),
    response.getStatusCode(), is(HttpURLConnection.HTTP_CREATED));

  JsonObject representation = response.getJson();

  assertThat(representation.getString("id"), is(id.toString()));
  assertThat(representation.getString("requestType"), is("Recall"));
  assertThat(representation.getString("requestDate"), is(equivalentTo(requestDate)));
  assertThat(representation.getString("itemId"), is(itemId.toString()));
  assertThat(representation.getString("requesterId"), is(requesterId.toString()));
  assertThat(representation.getString("fulfilmentPreference"), is("Hold Shelf"));
  assertThat(representation.containsKey("requestExpirationDate"), is(false));
  assertThat(representation.containsKey("holdShelfExpirationDate"), is(false));
  assertThat(representation.containsKey("item"), is(false));
  assertThat(representation.containsKey("requester"), is(false));
}
 
开发者ID:folio-org,项目名称:mod-circulation-storage,代码行数:46,代码来源:RequestsApiTest.java

示例12: canCreateARequest

@Test
public void canCreateARequest()
  throws InterruptedException,
  MalformedURLException,
  TimeoutException,
  ExecutionException,
  UnsupportedEncodingException {

  CompletableFuture<JsonResponse> createCompleted = new CompletableFuture<>();

  UUID id = UUID.randomUUID();
  UUID itemId = UUID.randomUUID();
  UUID requesterId = UUID.randomUUID();
  DateTime requestDate = new DateTime(2017, 7, 22, 10, 22, 54, DateTimeZone.UTC);

  JsonObject requestRequest = new RequestRequestBuilder()
    .recall()
    .toHoldShelf()
    .withId(id)
    .withRequestDate(requestDate)
    .withItemId(itemId)
    .withRequesterId(requesterId)
    .withRequestExpiration(new LocalDate(2017, 7, 30))
    .withHoldShelfExpiration(new LocalDate(2017, 8, 31))
    .withItem("Nod", "565578437802")
    .withRequester("Jones", "Stuart", "Anthony", "6837502674015")
    .create();

  client.post(requestStorageUrl(),
    requestRequest, StorageTestSuite.TENANT_ID,
    ResponseHandler.json(createCompleted));

  JsonResponse response = createCompleted.get(5, TimeUnit.SECONDS);

  assertThat(String.format("Failed to create request: %s", response.getBody()),
    response.getStatusCode(), is(HttpURLConnection.HTTP_CREATED));

  JsonObject representation = response.getJson();

  assertThat(representation.getString("id"), is(id.toString()));
  assertThat(representation.getString("requestType"), is("Recall"));
  assertThat(representation.getString("requestDate"), is(equivalentTo(requestDate)));
  assertThat(representation.getString("itemId"), is(itemId.toString()));
  assertThat(representation.getString("requesterId"), is(requesterId.toString()));
  assertThat(representation.getString("fulfilmentPreference"), is("Hold Shelf"));
  assertThat(representation.getString("requestExpirationDate"), is("2017-07-30"));
  assertThat(representation.getString("holdShelfExpirationDate"), is("2017-08-31"));

  assertThat(representation.containsKey("item"), is(true));
  assertThat(representation.getJsonObject("item").getString("title"), is("Nod"));
  assertThat(representation.getJsonObject("item").getString("barcode"), is("565578437802"));

  assertThat(representation.containsKey("requester"), is(true));
  assertThat(representation.getJsonObject("requester").getString("lastName"), is("Jones"));
  assertThat(representation.getJsonObject("requester").getString("firstName"), is("Stuart"));
  assertThat(representation.getJsonObject("requester").getString("middleName"), is("Anthony"));
  assertThat(representation.getJsonObject("requester").getString("barcode"), is("6837502674015"));
}
 
开发者ID:folio-org,项目名称:mod-circulation-storage,代码行数:58,代码来源:RequestsApiTest.java

示例13: date

private DateTime date(int month, int day) {
    return new DateTime(2012, month, day, 0, 0, DateTimeZone.UTC);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:3,代码来源:DateDerivativeIT.java

示例14: getUtcLowercaseMaxDateTime

@Test
public void getUtcLowercaseMaxDateTime() throws Exception {
    DateTime result = client.datetimes().getUtcLowercaseMaxDateTime();
    DateTime expected = new DateTime(9999, 12, 31, 23, 59, 59, 999, DateTimeZone.UTC);
    Assert.assertEquals(expected, result);
}
 
开发者ID:Azure,项目名称:autorest.java,代码行数:6,代码来源:DatetimeOperationsTests.java

示例15: getTo

@Override
public Object getTo() {
    return Double.isInfinite(((Number) to).doubleValue()) ? null : new DateTime(((Number) to).longValue(), DateTimeZone.UTC);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:4,代码来源:InternalDateRange.java


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