Project

General

Profile

« Previous | Next » 

Revision f1a25720

Added by Katja Luther over 6 years ago

  • ID f1a25720755daa96e8838a617a660dfced7b9f31
  • Parent 23e50194

first implementation for change from joda time to java8 time

View differences:

cdmlib-remote/src/test/java/eu/etaxonomy/cdm/remote/dto/assembler/lsid/AssemblerTest.java
9 9
import java.lang.reflect.Field;
10 10
import java.lang.reflect.Method;
11 11
import java.net.URI;
12
import java.time.Year;
13
import java.time.ZoneId;
14
import java.time.ZonedDateTime;
12 15
import java.util.ArrayList;
13 16
import java.util.Arrays;
14 17
import java.util.Collection;
......
26 29
import org.hibernate.engine.spi.SessionImplementor;
27 30
import org.hibernate.proxy.HibernateProxy;
28 31
import org.hibernate.proxy.LazyInitializer;
29
import org.joda.time.DateTime;
30
import org.joda.time.DateTimeFieldType;
31
import org.joda.time.Partial;
32 32
import org.junit.Before;
33 33
import org.junit.BeforeClass;
34 34
import org.junit.Ignore;
......
118 118
        sec.setLsid(new LSID("urn:lsid:example.org:references:1"));
119 119

  
120 120
        taxon = Taxon.NewInstance(name, (Reference)sec);
121
        taxon.setCreated(new DateTime(2004, 12, 25, 12, 0, 0, 0));
122
        taxon.setUpdated(new DateTime(2005, 12, 25, 12, 0, 0, 0));
121
        taxon.setCreated(ZonedDateTime.of(20014, 12, 25, 12, 0, 0, 0, ZoneId.systemDefault()));
122
        taxon.setUpdated(ZonedDateTime.of(20014, 12, 25, 12, 0, 0, 0, ZoneId.systemDefault()));
123 123
        taxon.setTitleCache("titleCache", true);
124 124
        taxon.setLsid(lsid);
125 125

  
......
155 155
        book = ReferenceFactory.newBook();
156 156
        book.setTitle("Book.title");
157 157
        book.setAuthorship(authorship);
158
        book.setCreated(new DateTime(2004, 12, 25, 12, 0, 0, 0));
159
        book.setDatePublished(new TimePeriod(new Partial(DateTimeFieldType.year(), 1800)));
158
        book.setCreated(ZonedDateTime.of(20014, 12, 25, 12, 0, 0, 0, ZoneId.systemDefault()));
159
        book.setDatePublished(new TimePeriod(Year.of(1800)));
160 160
        book.setEdition("1st Edition");
161 161
        book.setEditor("Editor");
162 162
        book.setIsbn("isbn");
......
173 173
        bookSection.setPages("999 ff.");
174 174
        bookSection.setTitle("BookSection.title");
175 175
        bookSection.setAuthorship(authorship);
176
        bookSection.setCreated(new DateTime(2004, 12, 25, 12, 0, 0, 0));
177
        bookSection.setDatePublished(new TimePeriod(new Partial(DateTimeFieldType.year(), 1800)));
176
        bookSection.setCreated(ZonedDateTime.of(20014, 12, 25, 12, 0, 0, 0, ZoneId.systemDefault()));
177
        bookSection.setDatePublished(new TimePeriod(Year.of(1800)));
178 178
        bookSection.setReferenceAbstract("referenceAbstract");
179 179
        bookSection.setUri(new URI("http://persitent.books.foo/myBookSection"));
180 180
        bookSection.setUuid(UUID.randomUUID());
......
204 204
        assertEquals("IdentifiableEntity.titleCache should be copied into BaseThing.title",taxon.getTitleCache(),taxonConcept.getTitle());
205 205
        assertEquals("IdentifiableEntity.lsid should be copied into BaseThing.identifier",taxon.getLsid().toString(),taxonConcept.getIdentifier().toString());
206 206
        assertEquals("BaseThing.sameAs should refer to the proxy version of the lsid","http://lsid.example.org/" + taxon.getLsid().toString(),taxonConcept.getSameAs());
207
        assertEquals("CdmBase.created should be copied into BaseThing.created",new DateTime(2004, 12, 25, 12, 0, 0, 0),taxonConcept.getCreated());
207
        assertEquals("CdmBase.created should be copied into BaseThing.created",ZonedDateTime.of(2004, 12, 25, 12, 0, 0, 0, ZoneId.systemDefault()),taxonConcept.getCreated());
208 208
        assertNotNull("TaxonBase.sec should be mapped into BaseThing.publishedInCitation",taxonConcept.getPublishedInCitation());
209 209
        assertEquals("TaxonBase.sec.titleCache should be mapped into BaseThing.publishedInCitation.title",sec.getTitleCache(),taxonConcept.getPublishedInCitation().getTitle());
210 210
        assertNotNull("TaxonBase.sec.authorship should be mapped into TaxonConcept.accordingTo",taxonConcept.getAccordingTo());
......
448 448

  
449 449
		@Override
450 450
		public Object getImplementation(
451
				org.hibernate.engine.spi.SessionImplementor session)
451
				org.hibernate.engine.spi.SharedSessionContractImplementor session)
452 452
				throws HibernateException {
453 453
			// TODO Auto-generated method stub
454 454
			return null;
......
474 474

  
475 475
		@Override
476 476
		public void setSession(
477
				org.hibernate.engine.spi.SessionImplementor session)
477
				org.hibernate.engine.spi.SharedSessionContractImplementor session)
478 478
				throws HibernateException {
479 479
			// TODO Auto-generated method stub
480 480

  

Also available in: Unified diff