Example usage for java.util Calendar JULY

List of usage examples for java.util Calendar JULY

Introduction

In this page you can find the example usage for java.util Calendar JULY.

Prototype

int JULY

To view the source code for java.util Calendar JULY.

Click Source Link

Document

Value of the #MONTH field indicating the seventh month of the year in the Gregorian and Julian calendars.

Usage

From source file:models.MilestoneTest.java

@Test
public void findById() throws Exception {
    // Given//w ww .  j a va2s  . c o m
    // When
    Milestone firstMilestone = Milestone.findById(1l);
    // Then
    assertThat(firstMilestone.title).isEqualTo("v.0.1");
    assertThat(firstMilestone.getContents()).isEqualTo("nFORGE  .");

    Calendar expactDueDate = new GregorianCalendar();
    expactDueDate.set(2012, Calendar.JULY, 12, 23, 59, 59); // 2012-07-12

    Calendar dueDate = new GregorianCalendar();
    dueDate.setTime(firstMilestone.dueDate);

    assertThat(expactDueDate.get(Calendar.YEAR)).isEqualTo(dueDate.get(Calendar.YEAR));
    assertThat(expactDueDate.get(Calendar.MONTH)).isEqualTo(dueDate.get(Calendar.MONTH));
    assertThat(expactDueDate.get(Calendar.DAY_OF_MONTH)).isEqualTo(dueDate.get(Calendar.DAY_OF_MONTH));

    assertThat(firstMilestone.getNumClosedIssues()).isEqualTo(2);
    assertThat(firstMilestone.getNumOpenIssues()).isEqualTo(2);
    assertThat(firstMilestone.getNumTotalIssues()).isEqualTo(4);
    assertThat(firstMilestone.project).isEqualTo(Project.find.byId(1l));
    assertThat(firstMilestone.getCompletionRate()).isEqualTo(50);
}

From source file:org.jrimum.bopepo.TestFatorDeVencimento.java

@Test
public final void testToFator() {

    data.set(2000, Calendar.JULY, 3);
    assertEquals(1000, FatorDeVencimento.toFator(data.getTime()));

    data.set(2000, Calendar.JULY, 5);
    assertEquals(1002, FatorDeVencimento.toFator(data.getTime()));

    data.set(2025, Calendar.FEBRUARY, 21);
    assertEquals(9999, FatorDeVencimento.toFator(data.getTime()));
}

From source file:br.com.nordestefomento.jrimum.utilix.TestField.java

@Before
public void setUp() {

    campoString = new Field<String>(StringUtils.EMPTY, 8);
    campoString.setFiller(Filler.WHITE_SPACE_RIGHT);

    campoDate = new Field<Date>(new GregorianCalendar(2007, Calendar.JULY, 22).getTime(), 6,
            DateUtil.FORMAT_DDMMYY);//from   w  w  w  . j  a v a2s.c o m

    campoInteger = new Field<Integer>(0, 6);
    campoInteger.setFiller(Filler.ZERO_LEFT);

    campoLong = new Field<Long>(0L, 6);
    campoLong.setFiller(Filler.ZERO_LEFT);

    campoDecimal = new Field<BigDecimal>(new BigDecimal("875.98"), 11, MonetaryUtil.FORMAT_REAL);
    campoDecimal.setFiller(Filler.ZERO_LEFT);

    campoDecimal_v9 = new Field<BigDecimal>(new BigDecimal("875.9"), 11,
            MonetaryUtil.FORMAT_REAL_UMA_CASA_DECIMAL);
    campoDecimal_v9.setFiller(Filler.ZERO_LEFT);
}

From source file:de.forsthaus.backend.dao.impl.ChartDataDAOImpl.java

@Override
public List<ChartData> getChartDataForCustomer(long kunId) {

    List<ChartData> result = new ArrayList<ChartData>();

    if (kunId == 20) {
        Calendar calendar = new GregorianCalendar();
        calendar.set(2009, Calendar.JANUARY, 2, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30)));
        calendar.set(2009, Calendar.FEBRUARY, 2, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(450.30)));
        calendar.set(2009, Calendar.MARCH, 15, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(820.10)));
        calendar.set(2009, Calendar.APRIL, 20, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(654.00)));
        calendar.set(2009, Calendar.MAY, 2, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30)));
        calendar.set(2009, Calendar.JUNE, 2, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(520.30)));
        calendar.set(2009, Calendar.JULY, 22, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30)));
        calendar.set(2009, Calendar.AUGUST, 13, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(20.30)));
        calendar.set(2009, Calendar.SEPTEMBER, 6, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(480.30)));
        calendar.set(2009, Calendar.OCTOBER, 26, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(520.30)));
        calendar.set(2009, Calendar.NOVEMBER, 26, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.70)));
        calendar.set(2009, Calendar.DECEMBER, 26, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(1220.90)));
    } else if (kunId == 21) {
        Calendar calendar = new GregorianCalendar();
        calendar.set(2009, Calendar.JANUARY, 2, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30)));
        calendar.set(2009, Calendar.FEBRUARY, 2, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(450.30)));
        calendar.set(2009, Calendar.MARCH, 15, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.10)));
        calendar.set(2009, Calendar.APRIL, 20, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(154.00)));
        calendar.set(2009, Calendar.MAY, 2, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30)));
        calendar.set(2009, Calendar.JUNE, 2, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.30)));
        calendar.set(2009, Calendar.JULY, 22, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(920.30)));
        calendar.set(2009, Calendar.AUGUST, 13, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30)));
        calendar.set(2009, Calendar.SEPTEMBER, 6, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(680.30)));
        calendar.set(2009, Calendar.OCTOBER, 26, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(580.30)));
        calendar.set(2009, Calendar.NOVEMBER, 26, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(820.70)));
        calendar.set(2009, Calendar.DECEMBER, 26, 0, 0, 0);
        result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(220.90)));
    }//from   w  w  w . j  a v a 2 s  . c  o m

    return result;

}

From source file:one.GanttDemo1.java

/**
 * Creates a sample dataset for a Gantt chart.
 *
 * @return The dataset.//  w  w w  . j av a2s.  c  o m
 */
public static IntervalCategoryDataset createDataset() {

    final TaskSeries s1 = new TaskSeries("Scheduled");
    s1.add(new Task("Write Proposal",
            new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001))));
    s1.add(new Task("Obtain Approval",
            new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001))));
    s1.add(new Task("Requirements Analysis",
            new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(5, Calendar.MAY, 2001))));
    s1.add(new Task("Design Phase",
            new SimpleTimePeriod(date(6, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001))));
    s1.add(new Task("Design Signoff",
            new SimpleTimePeriod(date(2, Calendar.JUNE, 2001), date(2, Calendar.JUNE, 2001))));
    s1.add(new Task("Alpha Implementation",
            new SimpleTimePeriod(date(3, Calendar.JUNE, 2001), date(31, Calendar.JULY, 2001))));
    s1.add(new Task("Design Review",
            new SimpleTimePeriod(date(1, Calendar.AUGUST, 2001), date(8, Calendar.AUGUST, 2001))));
    s1.add(new Task("Revised Design Signoff",
            new SimpleTimePeriod(date(10, Calendar.AUGUST, 2001), date(10, Calendar.AUGUST, 2001))));
    s1.add(new Task("Beta Implementation",
            new SimpleTimePeriod(date(12, Calendar.AUGUST, 2001), date(12, Calendar.SEPTEMBER, 2001))));
    s1.add(new Task("Testing",
            new SimpleTimePeriod(date(13, Calendar.SEPTEMBER, 2001), date(31, Calendar.OCTOBER, 2001))));
    s1.add(new Task("Final Implementation",
            new SimpleTimePeriod(date(1, Calendar.NOVEMBER, 2001), date(15, Calendar.NOVEMBER, 2001))));
    s1.add(new Task("Signoff",
            new SimpleTimePeriod(date(28, Calendar.NOVEMBER, 2001), date(30, Calendar.NOVEMBER, 2001))));
    s1.add(new Task("Database set up",
            new SimpleTimePeriod(date(15, Calendar.OCTOBER, 2001), date(30, Calendar.OCTOBER, 2001))));

    final TaskSeries s2 = new TaskSeries("Actual");
    s2.add(new Task("Write Proposal",
            new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001))));
    s2.add(new Task("Obtain Approval",
            new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001))));
    s2.add(new Task("Requirements Analysis",
            new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(15, Calendar.MAY, 2001))));
    s2.add(new Task("Design Phase",
            new SimpleTimePeriod(date(15, Calendar.MAY, 2001), date(17, Calendar.JUNE, 2001))));
    s2.add(new Task("Design Signoff",
            new SimpleTimePeriod(date(30, Calendar.JUNE, 2001), date(30, Calendar.JUNE, 2001))));
    s2.add(new Task("Alpha Implementation",
            new SimpleTimePeriod(date(1, Calendar.JULY, 2001), date(12, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Design Review",
            new SimpleTimePeriod(date(12, Calendar.SEPTEMBER, 2001), date(22, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Revised Design Signoff",
            new SimpleTimePeriod(date(25, Calendar.SEPTEMBER, 2001), date(27, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Beta Implementation",
            new SimpleTimePeriod(date(27, Calendar.SEPTEMBER, 2001), date(30, Calendar.OCTOBER, 2001))));
    s2.add(new Task("Testing",
            new SimpleTimePeriod(date(31, Calendar.OCTOBER, 2001), date(17, Calendar.NOVEMBER, 2001))));
    s2.add(new Task("Final Implementation",
            new SimpleTimePeriod(date(18, Calendar.NOVEMBER, 2001), date(5, Calendar.DECEMBER, 2001))));
    s2.add(new Task("Signoff",
            new SimpleTimePeriod(date(10, Calendar.DECEMBER, 2001), date(11, Calendar.DECEMBER, 2001))));

    final TaskSeriesCollection collection = new TaskSeriesCollection();
    collection.add(s1);
    collection.add(s2);

    return collection;
}

From source file:com.boozallen.cognition.ingest.storm.bolt.enrich.SetDateBoltTest.java

@Test
public void testEnrichGnip(@Mocked final LogRecord record) throws Exception {
    final Calendar calendar = Calendar.getInstance();
    calendar.clear();//from w w w  .j a  v  a2 s  . co  m
    calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
    calendar.set(2015, Calendar.JULY, 12, 0, 0, 52);

    bolt.dateFields = Arrays.asList("postedTime");
    bolt.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSX";

    new Expectations() {
        {
            record.getValue(bolt.dateFields.get(0));
            result = "2015-07-12T00:00:52.000Z";
            record.setDate(calendar.getTime());
        }
    };
    bolt.process(record);
}

From source file:org.jrimum.utilix.text.TestField.java

@Before
public void setUp() {

    campoString = new Field<String>(StringUtils.EMPTY, 8);
    campoString.setFiller(Filler.WHITE_SPACE_RIGHT);

    campoDate = new Field<Date>(new GregorianCalendar(2007, Calendar.JULY, 22).getTime(), 6, FORMAT_DDMMYY);

    campoInteger = new Field<Integer>(0, 6);
    campoInteger.setFiller(Filler.ZERO_LEFT);

    campoLong = new Field<Long>(0L, 6);
    campoLong.setFiller(Filler.ZERO_LEFT);

    campoDecimal = new Field<BigDecimal>(new BigDecimal("875.98"), 11, DecimalFormat.MONEY_DD_BR.copy());
    campoDecimal.setFiller(Filler.ZERO_LEFT);

    campoDecimal_v9 = new Field<BigDecimal>(new BigDecimal("875.9"), 11, DecimalFormat.MONEY_D_BR.copy());
    campoDecimal_v9.setFiller(Filler.ZERO_LEFT);
}

From source file:util.MyUtils.java

public static String getMonthString(int month) {
    switch (month - 1) {
    case Calendar.JANUARY:
        return "Jan";
    case Calendar.FEBRUARY:
        return "Feb";
    case Calendar.MARCH:
        return "Mar";
    case Calendar.APRIL:
        return "Apr";
    case Calendar.MAY:
        return "May";
    case Calendar.JUNE:
        return "Jun";
    case Calendar.JULY:
        return "Jul";
    case Calendar.AUGUST:
        return "Aug";
    case Calendar.SEPTEMBER:
        return "Sep";
    case Calendar.OCTOBER:
        return "Oct";
    case Calendar.NOVEMBER:
        return "Nov";
    case Calendar.DECEMBER:
        return "Dec";
    }//from  ww w .  ja v a 2s .  com
    return "";
}

From source file:com.netflix.genie.server.metrics.impl.TestJobCountManagerImpl.java

/**
 * Test getting number of running jobs on one instance.
 *
 * @throws GenieException if there is any error during this test
 *///from   w  w  w .  j av  a  2s.  c om
@Test
@DatabaseSetup("testNumInstanceJobs.xml")
public void testNumInstanceJobs() throws GenieException {
    //Force the hostname of the jobs to be the machine running the build
    final String hostName = NetUtil.getHostName();
    for (final Job job : this.jobRepo.findAll()) {
        job.setHostName(hostName);
    }
    this.jobRepo.flush();

    final Calendar one = Calendar.getInstance();
    one.clear();
    one.set(2014, Calendar.JULY, 1, 16, 27, 38);

    final Calendar two = Calendar.getInstance();
    two.clear();
    two.set(2014, Calendar.JULY, 1, 16, 27, 39);

    final Calendar three = Calendar.getInstance();
    three.clear();
    three.set(2014, Calendar.JULY, 1, 16, 27, 40);

    Assert.assertEquals(2, this.manager.getNumInstanceJobs());
    Assert.assertEquals(2, this.manager.getNumInstanceJobs(0L, System.currentTimeMillis()));
    Assert.assertEquals(1, this.manager.getNumInstanceJobs(one.getTimeInMillis(), two.getTimeInMillis()));
    Assert.assertEquals(1,
            this.manager.getNumInstanceJobs(hostName, two.getTimeInMillis(), three.getTimeInMillis()));
    Assert.assertEquals(0, this.manager.getNumInstanceJobs(0L, 0L));
}

From source file:biz.c24.io.spring.integration.samples.fpml.FpmlGenerator.java

private static TradeConfirmed randomizeFpML(TradeConfirmed tradeConfirmed) throws CloneNotSupportedException {
    ISO8601DateTime creationDate = new ISO8601DateTime(new Date());
    ISO8601Date tradeDate = new ISO8601Date(new GregorianCalendar(2011, Calendar.JULY, 5).getTime());
    ISO8601Date expiryDate = new ISO8601Date(new GregorianCalendar(2012, Calendar.JANUARY, 5).getTime());
    ISO8601Date settlementDate = new ISO8601Date(new GregorianCalendar(2011, Calendar.JULY, 7).getTime());
    ISO8601Date valueDate = new ISO8601Date(new GregorianCalendar(2012, Calendar.JANUARY, 9).getTime());

    Random random = new Random();

    BigDecimal putAmount = new BigDecimal((1 + random.nextInt(999)) * 100000.);
    BigDecimal callAmount = new BigDecimal((1 + random.nextInt(999)) * 100000.);
    BigDecimal fxRate = callAmount.divide(putAmount, 8, RoundingMode.HALF_EVEN).setScale(5,
            BigDecimal.ROUND_HALF_UP);
    BigDecimal premiumValue = new BigDecimal(0.001).setScale(5, BigDecimal.ROUND_HALF_UP);
    BigDecimal premiumAmount = callAmount.multiply(premiumValue).setScale(2, BigDecimal.ROUND_HALF_UP);

    String sendTo = "SendTo" + random.nextInt(999999);
    String sentBy = "SentBy" + random.nextInt(999999);
    String msgId = "Msg" + random.nextInt(999999);
    String conversationId = "Conv" + random.nextInt(999999);
    String tradeId1 = "ID1:" + random.nextInt(999999);
    String tradeId2 = "ID2:" + random.nextInt(999999);

    // Set the header
    NotificationMessageHeader header = tradeConfirmed.getHeader();
    header.getMessageHeadermodel().setCreationTimestamp(creationDate);
    header.getConversationId().setValue(conversationId);
    header.getMessageId().setValue(msgId);
    header.getMessageHeadermodel().getSentBy().setValue(sentBy);
    header.getMessageHeadermodel().getSendTo()[0].setValue(sendTo);

    // Set the TradeHeader
    TradeHeader tradeHeader = tradeConfirmed.getTrade().getTradeHeader();
    tradeHeader.getPartyTradeIdentifier()[0].getTradeIdentifierSG1()[0].getTradeId().setValue(tradeId1);
    tradeHeader.getPartyTradeIdentifier()[1].getTradeIdentifierSG1()[0].getTradeId().setValue(tradeId2);
    tradeHeader.getTradeDate().setValue(tradeDate);

    FxOptionLeg fxOptionLeg = (FxOptionLeg) tradeConfirmed.getTrade().getProduct();
    fxOptionLeg.getExpiryDateTime().setExpiryDate(expiryDate);

    FxOptionPremium optionPremium = fxOptionLeg.getFxOptionPremium()[0];
    optionPremium.getPremiumAmount().setAmount(premiumAmount);
    optionPremium.setPremiumSettlementDate(settlementDate);
    SettlementInstruction settlementInstruction = optionPremium.getSettlementInformation()
            .getSettlementInstruction();
    settlementInstruction.getCorrespondentInformation().getRoutingIdentificationmodel().getRoutingIds()
            .getRoutingId()[0].setValue(sendTo);
    settlementInstruction.getBeneficiary().getRoutingIdentificationmodel().getRoutingIds().getRoutingId()[0]
            .setValue(sentBy);/*from   www . j a  va 2  s  .co  m*/
    optionPremium.getPremiumQuote().setPremiumValue(premiumValue);
    fxOptionLeg.setValueDate(valueDate);

    fxOptionLeg.getPutCurrencyAmount().getCurrency().setValue("AUD");
    fxOptionLeg.getPutCurrencyAmount().setAmount(putAmount);

    fxOptionLeg.getPutCurrencyAmount().getCurrency().setValue("USD");
    fxOptionLeg.getCallCurrencyAmount().setAmount(callAmount);

    fxOptionLeg.getFxStrikePrice().setRate(fxRate);

    fxOptionLeg.getQuotedAs().getOptionOnCurrency().setValue("AUD");
    fxOptionLeg.getQuotedAs().getFaceOnCurrency().setValue("USD");
    fxOptionLeg.getQuotedAs().getQuotedTenor().setPeriod("M");
    fxOptionLeg.getQuotedAs().getQuotedTenor().setPeriodMultiplier(new BigInteger("6"));

    tradeConfirmed.getParty()[0].getPartyId()[0].setValue(sendTo);
    tradeConfirmed.getParty()[1].getPartyId()[0].setValue(sentBy);

    return (TradeConfirmed) tradeConfirmed.cloneDeep();
}