Example usage for java.util Calendar FEBRUARY

List of usage examples for java.util Calendar FEBRUARY

Introduction

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

Prototype

int FEBRUARY

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

Click Source Link

Document

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

Usage

From source file:org.openmrs.web.patient.PatientDashboardGraphControllerTest.java

/**
 * Test getting a concept by name and by partial name.
 * /* ww  w. j  a  va  2s  .  c o m*/
 * @see PatientDashboardGraphController#showGraphData(Integer, Integer, ModelMap)
 */
@Test
@Verifies(value = "return json data with observation details and critical values for the concept", method = "showGraphData(Integer, Integer, ModelMap)")
public void shouldReturnJSONWithPatientObservationDetails() throws Exception {
    executeDataSet("org/openmrs/api/include/ObsServiceTest-initial.xml");
    PatientDashboardGraphController controller = new PatientDashboardGraphController();

    long firstObsDate = new GregorianCalendar(2006, Calendar.FEBRUARY, 9).getTimeInMillis();
    long secondObsDate = new GregorianCalendar(2006, Calendar.FEBRUARY, 10).getTimeInMillis();

    ModelMap map = new ModelMap();
    controller.showGraphData(2, 1, map);
    PatientGraphData graph = (PatientGraphData) map.get("graph");

    String expectedData = String.format(
            "{\"absolute\":{\"high\":50.0,\"low\":2.0},\"critical\":{\"high\":null,\"low\":null},\"name\":\"Some concept name\",\"normal\":{\"high\":null,\"low\":null},\"data\":[[%d,null],[%d,1.0]],\"units\":\"\"}",
            secondObsDate, firstObsDate);

    ObjectMapper mapper = new ObjectMapper();
    JsonNode expectedJson = mapper.readTree(expectedData);
    JsonNode actualJson = mapper.readTree(graph.toString());

    Assert.assertEquals(expectedJson.size(), actualJson.size());
    for (Iterator<String> fieldNames = expectedJson.getFieldNames(); fieldNames.hasNext();) {
        String field = fieldNames.next();
        Assert.assertEquals(expectedJson.get(field), actualJson.get(field));
    }
}

From source file:com.cemeterylistingswebtest.test.services.LoginServiceTest.java

@Test
public void AuthenticateTest() {
    loginServ = ctx.getBean(LoginService.class);
    repo = ctx.getBean(SubscriberRepository.class);

    //create subscribers
    userRepo = ctx.getBean(UserRoleRepository.class);

    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.YEAR, 2008);
    calendar.set(Calendar.MONTH, Calendar.FEBRUARY);
    calendar.set(Calendar.DATE, 4);

    java.sql.Date javaSqlDate = new java.sql.Date(calendar.getTime().getTime());

    UserRole user = new UserRole.Builder().setLevel(1).build();

    //userRepo.save(user);
    //userRoleID = user.getUserRoleID();

    Subscriber newSub = new Subscriber.Builder().setEmail("manfredOsulivan@horseRaddish.com")
            .setFirstName("Manfred").setSurname("Osulivan").setPwd("jesus").setUsername("ManiFredOssy")
            .setSubscriptionDate(javaSqlDate).setUserRoleID(user).build();

    repo.save(newSub);/* www .jav  a  2s  . com*/
    id = newSub.getSubscriberID();

    Assert.assertTrue(loginServ.authenticate(newSub.getUsername(), newSub.getPwd()), "Login successful");
    Assert.assertFalse(loginServ.authenticate(newSub.getUsername(), ""), "Login Failed; no password");
    Assert.assertFalse(loginServ.authenticate("", newSub.getPwd()), "Login Failed ; no username");
    Assert.assertFalse(loginServ.authenticate("", ""), "Login Failed no username or password");
}

From source file:com.example.geomesa.transformations.QueryTutorial.java

/**
 * Creates a base filter that will return a small subset of our results. This can be tweaked to
 * return different results if desired. Currently it should return 16 results.
 *
 * @return//from  w ww .ja v a 2  s  .com
 *
 * @throws CQLException
 * @throws IOException
 */
static Filter createBaseFilter() throws CQLException, IOException {

    // Get a FilterFactory2 to build up our query
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();

    // We are going to query for events in Ukraine during the
    // civil unrest.

    // We'll start by looking at a particular day in February of 2014
    Calendar calendar = Calendar.getInstance();
    calendar.clear();
    calendar.set(Calendar.YEAR, 2014);
    calendar.set(Calendar.MONTH, Calendar.FEBRUARY);
    calendar.set(Calendar.DAY_OF_MONTH, 2);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    Date start = calendar.getTime();

    calendar.set(Calendar.HOUR_OF_DAY, 23);
    Date end = calendar.getTime();

    Filter timeFilter = ff.between(ff.property(GdeltFeature.Attributes.SQLDATE.getName()), ff.literal(start),
            ff.literal(end));

    // We'll bound our query spatially to Ukraine
    Filter spatialFilter = ff.bbox(GdeltFeature.Attributes.geom.getName(), 22.1371589, 44.386463, 40.228581,
            52.379581, "EPSG:4326");

    // we'll also restrict our query to only articles about the US, UK or UN
    Filter attributeFilter = ff.like(ff.property(GdeltFeature.Attributes.Actor1Name.getName()), "UNITED%");

    // Now we can combine our filters using a boolean AND operator
    Filter conjunction = ff.and(Arrays.asList(timeFilter, spatialFilter, attributeFilter));

    return conjunction;
}

From source file:com.cemeterylistingswebtest.test.domain.SubscriberTest.java

@Test
public void create() {
    System.out.println("Subscriber Test");

    repo = ctx.getBean(SubscriberRepository.class);
    userRepo = ctx.getBean(UserRoleRepository.class);

    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.YEAR, 2008);
    calendar.set(Calendar.MONTH, Calendar.FEBRUARY);
    calendar.set(Calendar.DATE, 4);

    java.sql.Date javaSqlDate = new java.sql.Date(calendar.getTime().getTime());

    UserRole user = new UserRole.Builder().setLevel(1).build();

    //userRepo.save(user);
    //userRoleID = user.getUserRoleID();

    Subscriber newSub = new Subscriber.Builder().setEmail("manfredOsulivan@horseRaddish.com")
            .setFirstName("Manfred").setSurname("Osulivan").setPwd("jesus").setUsername("ManiFredOssy")
            .setSubscriptionDate(javaSqlDate).setUserRoleID(user).build();

    repo.save(newSub);/*from ww w .  java  2s .c  o m*/
    id = newSub.getSubscriberID();
}

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  ww w . j  ava  2  s. c  om*/

    return result;

}

From source file:com.cemeterylistingswebtest.test.services.SubscriptionServiceTest.java

@Test
public void createSub() {
    repo = ctx.getBean(SubscriberRepository.class);
    adserv = ctx.getBean(AdminRegisterSubscriberService.class);

    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.YEAR, 2014);
    calendar.set(Calendar.MONTH, Calendar.FEBRUARY);
    calendar.set(Calendar.DATE, 9);

    java.sql.Date javaSqlDate = new java.sql.Date(calendar.getTime().getTime());

    UserRole user = new UserRole.Builder().setLevel(2).build();

    //userRepo.save(user);
    //userRoleID = user.getUserRoleID();

    Subscriber newSub = new Subscriber.Builder().setEmail("bull@horse.com").setFirstName("red")
            .setSurname("bull").setPwd("wings").setUsername("redBull").setSubscriptionDate(javaSqlDate)
            .setUserRoleID(user).build();

    repo.save(newSub);//  w  ww .  j a  v  a2 s . co m
    id = newSub.getSubscriberID();

    Assert.assertFalse(repo.findAll().isEmpty());

}

From source file:com.cemeterylistingswebtest.test.services.RetrieveAllSubscriberDetailsTest.java

@Test
public void hello() {
    subServ = ctx.getBean(RetrieveAllSubscriberDetails.class);
    repo = ctx.getBean(SubscriberRepository.class);

    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.YEAR, 2008);
    calendar.set(Calendar.MONTH, Calendar.FEBRUARY);
    calendar.set(Calendar.DATE, 4);

    java.sql.Date javaSqlDate = new java.sql.Date(calendar.getTime().getTime());

    UserRole user = new UserRole.Builder().setLevel(2).build();

    //userRepo.save(user);
    userRoleID = user.getUserRoleID();/*w ww . j av  a  2s.co m*/

    Subscriber newSub = new Subscriber.Builder().setEmail("manfredOsulivan@horseRaddish.com")
            .setFirstName("willie").setSurname("Wonker").setPwd("charlie").setUsername("wwonker")
            .setSubscriptionDate(javaSqlDate).setUserRoleID(user).build();

    repo.save(newSub);
    id = newSub.getSubscriberID();

    Subscriber sub = subServ.getSubscriberByUsername("wwonker");
    Assert.assertEquals(sub.getUsername(), "wwonker");

    repo.delete(id);

}

From source file:net.sf.sze.service.impl.common.SchulKalenderServiceImpl.java

/**
 * {@inheritDoc}/* w w  w  .java2 s .com*/
 */
@Override
public Calendar getLeavedSchoolDate(final Calendar currentDate) {
    final Calendar result = Calendar.getInstance();
    if (currentDate.get(Calendar.MONTH) >= Calendar.APRIL
            && currentDate.get(Calendar.MONTH) < Calendar.OCTOBER) {
        result.set(currentDate.get(Calendar.YEAR), Calendar.FEBRUARY, 1, 0, 0, 0);
    } else if (currentDate.get(Calendar.MONTH) < Calendar.APRIL) {
        result.set(currentDate.get(Calendar.YEAR) - 1, Calendar.AUGUST, 1, 0, 0, 0);
    } else {
        result.set(currentDate.get(Calendar.YEAR), Calendar.AUGUST, 1, 0, 0, 0);
    }
    result.set(Calendar.MILLISECOND, 0);
    return result;
}

From source file:com.cemeterylistingswebtest.test.domain.PublishedDeceasedListingTest.java

@Test
public void create() {
    repoList = ctx.getBean(PublishedDeceasedListingRepository.class);

    System.out.println("Published Deceased Listings Test");
    repoList = ctx.getBean(PublishedDeceasedListingRepository.class);
    subRepo = ctx.getBean(SubscriberRepository.class);
    userRepo = ctx.getBean(UserRoleRepository.class);

    //Initialise date
    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.YEAR, 2008);
    calendar.set(Calendar.MONTH, Calendar.FEBRUARY);
    calendar.set(Calendar.DATE, 4);

    java.sql.Date javaSqlDate = new java.sql.Date(calendar.getTime().getTime());

    //Initialise user role                
    UserRole userRole = new UserRole.Builder().setLevel(1).build();
    //userRepo.save(userRole);
    //userRoleID = userRole.getUserRoleID();

    //Initialise subscriber
    Subscriber newSub = new Subscriber.Builder().setEmail("manfredOsulivan@horseRaddish.com")
            .setFirstName("Manfred").setSurname("Osulivan").setPwd("jesus").setUsername("ManiFredOssy")
            .setSubscriptionDate(javaSqlDate).setUserRoleID(userRole).build();
    subRepo.save(newSub);//from   w ww .j a  va 2s  . c  o m
    subID = newSub.getSubscriberID();

    PublishedDeceasedListing newListing = new PublishedDeceasedListing.Builder().setFirstName("Hendrika")
            .setSurname("Fourie").setMaidenName("Gerber").setGender("Female").setDateOfBirth("08/06/1969")
            .setDateOfDeath("14/02/2005").setGraveInscription("Hippiest person eva").setGraveNumber("2456")
            .setImageOfBurialSite("/images/001.jpg").setLastKnownContactName("Berry")
            .setLastKnownContactNumber("0725576482").setSubscriberSubmitID(subID).build();

    repoList.save(newListing);
    id = newListing.getPublishedListingID();
}

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

@Test(expected = IllegalArgumentException.class)
public void testToFatorComDataMaiorQueDataLimite() {

    data.set(2025, Calendar.FEBRUARY, 22);

    FatorDeVencimento.toFator(data.getTime());
}