Example usage for java.sql Date Date

List of usage examples for java.sql Date Date

Introduction

In this page you can find the example usage for java.sql Date Date.

Prototype

public Date(long date) 

Source Link

Document

Allocates a Date object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.

Usage

From source file:gov.nih.nci.integration.invoker.CaTissueParticipantStrategyTest.java

/**
 * Tests registerParticipant using the ServiceInvocationStrategy class for the success scenario
 * //from  ww w . j  av  a  2  s  .  c o  m
 * @throws IntegrationException - IntegrationException
 * @throws JAXBException - JAXBException
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void registerParticipant() throws IntegrationException, JAXBException {
    final Date stTime = new Date(new java.util.Date().getTime()); // NOPMD

    xsltTransformer.transform(null, null, null);
    EasyMock.expectLastCall().andAnswer(new IAnswer() {

        public Object answer() {
            return getSpecimenXMLStr();
        }
    }).anyTimes();

    final ServiceInvocationResult clientResult = new ServiceInvocationResult();
    EasyMock.expect(caTissueParticipantClient.registerParticipant((String) EasyMock.anyObject()))
            .andReturn(clientResult);
    EasyMock.replay(caTissueParticipantClient);
    final ServiceInvocationMessage serviceInvocationMessage = prepareServiceInvocationMessage(REFMSGID,
            getSpecimenXMLStr(), stTime, caTissueRegistrationStrategy.getStrategyIdentifier());
    final ServiceInvocationResult strategyResult = caTissueRegistrationStrategy
            .invoke(serviceInvocationMessage);
    Assert.assertNotNull(strategyResult);
}

From source file:gov.nih.nci.integration.dao.IHubMessagesDaoTest.java

private IHubMessage createIHubMessage() {
    final IHubMessage iHubMessage = new IHubMessage();
    iHubMessage.setRequest("request string");
    iHubMessage.setStartTime(new Date(new java.util.Date().getTime()));
    iHubMessage.setStatus(Status.PROCESS);
    iHubMessage.setReferenceMessageId(12345L);

    return iHubMessage;
}

From source file:com.brsanthu.dataexporter.DataExporterTestBase.java

protected void addDataBeans() {
    List<SampleBean> beans = new ArrayList<SampleBean>();
    beans.add(new SampleBean(new Date(dateReference - 2397984), new Integer(1), "Laptop", new Boolean(false),
            new Integer(1), new Double(799.78)));
    beans.add(new SampleBean(new Date(dateReference - 232042098), new Integer(2), "Mouse", new Boolean(true),
            new Integer(2), new Double(49.30)));
    beans.add(new SampleBean(new Date(dateReference - 234084277), new Integer(3), "Keyboard",
            new Boolean(false), new Integer(5), new Double(75)));

    exporter.addBeanRows(beans);/*w  w w.ja va2  s . c  o m*/
}

From source file:com.impetus.kundera.property.accessor.SQLDateAccessor.java

@Override
public Date getCopy(Object object) {
    Date d = (Date) object;
    return d != null ? new Date(d.getTime()) : null;
}

From source file:gov.nih.nci.integration.caaers.CaAERSAdverseEventStrategyTest.java

/**
 * Tests createAdverseEvent using the ServiceInvocationStrategy class for the success scenario
 * //  ww w  .  ja  v a 2 s.  com
 * @throws IntegrationException - IntegrationException
 * @throws JAXBException - JAXBException
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void createAdverseEventSuccess() throws IntegrationException, JAXBException {
    final Date stTime = new Date(new java.util.Date().getTime());

    xsltTransformer.transform(null, null, null);
    EasyMock.expectLastCall().andAnswer(new IAnswer() {

        public Object answer() {
            // return the value to be returned by the method (null for void)
            return getAEXMLString();
        }
    }).anyTimes();

    final CreateProvisionalAdverseEventsResponse caaersresponse = getWSResponse(SUCCESS);
    EasyMock.expect(wsClient.createProvisionalAdverseEvents((String) EasyMock.anyObject()))
            .andReturn(caaersresponse);
    EasyMock.replay(wsClient);

    final ServiceInvocationMessage serviceInvocationMessage = prepareServiceInvocationMessage(REFMSGID,
            getAEInterimMessage(), stTime, caAERSAdverseEventServiceInvocationStrategy.getStrategyIdentifier());

    final ServiceInvocationResult result = caAERSAdverseEventServiceInvocationStrategy
            .invoke(serviceInvocationMessage);

    Assert.assertNotNull(result);
}

From source file:org.beangle.ems.security.service.UserServiceImpl.java

public void saveOrUpdate(User user) {
    user.setUpdatedAt(new Date(System.currentTimeMillis()));
    if (!user.isPersisted()) {
        user.setCreatedAt(new Date(System.currentTimeMillis()));
    }//w  w  w . jav  a  2s .co  m
    entityDao.saveOrUpdate(user);
    try {
        publish(new UserAlterationEvent(Collections.singletonList(user)));
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
    }
}

From source file:su90.mybatisdemo.dao.Job_HistoryMapperTest.java

@Test(groups = { "find" })
public void testFindById03() {
    try {/*from w ww  .  j  a va  2 s.  c o m*/
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
        java.util.Date start_util_date = formatter.parse("20020701");
        Employee thesearchEmp = new Employee();
        thesearchEmp.setId(200L);
        Job_History result = job_HistoryMapper
                .findById(new Job_History.Key(thesearchEmp, new Date(start_util_date.getTime())));
        assertNotNull(result);
    } catch (ParseException ex) {
        assertTrue(false);
    }
}

From source file:com.impetus.kundera.property.accessor.SQLDateAccessor.java

public Date getInstance(Class<?> clazz) {
    return new Date(Integer.MAX_VALUE);
}

From source file:org.kuali.kra.common.committee.meeting.MeetingServiceImplBase.java

protected Date getAgendaGenerationDate(Long scheduleId) {
    List<ScheduleAgendaBase> scheduleAgendas = getAgenda(scheduleId);
    if (scheduleAgendas.isEmpty()) {
        return null;
    } else {//from   ww w. ja  v a2s.c o  m
        return new Date(scheduleAgendas.get(scheduleAgendas.size() - 1).getCreateTimestamp().getTime());
    }
}

From source file:fr.xebia.demo.ws.employee.EmployeeServiceIntegrationTest.java

@Test(expected = SOAPFaultException.class)
public void testPutEmployeeFirstNameMissing() throws Exception {
    int id = random.nextInt();

    Employee employee = new Employee();
    employee.setId(id);/*w  ww.  j  av a2  s .  c  om*/
    employee.setLastName("Doe-" + id);
    employee.setFirstName(null);
    employee.setGender(Gender.MALE);
    employee.setBirthdate(new Date(new GregorianCalendar(1976, 01, 05).getTimeInMillis()));

    try {
        employeeService.putEmployee(new Holder<Employee>(employee));
    } catch (SOAPFaultException e) {
        e.printStackTrace();
        throw e;
    }
    /*
     * throws javax.xml.ws.soap.SOAPFaultException: Marshalling Error: cvc-complex-type.2.4.b: The content of element 'employee' is not
     * complete. One of '{"http://demo.xebia.fr/xml/employee":firstName}' is expected.
     */

}