This is an automated email from the ASF dual-hosted git repository. ntimofeev pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cayenne.git
commit 2e2e9a0db97e0bb37430747044f03d5dc245c747 Author: Nikita Timofeev <[email protected]> AuthorDate: Thu Jun 30 15:32:11 2022 +0300 CAY-2737 Cayenne 4.3: cleanup deprecated code - delete joda module --- cayenne-joda/pom.xml | 128 --------------------- .../java/org/apache/cayenne/joda/JodaModule.java | 52 --------- .../cayenne/joda/JodaServerModuleProvider.java | 48 -------- .../cayenne/joda/access/types/DateTimeType.java | 81 ------------- .../joda/access/types/LocalDateTimeType.java | 81 ------------- .../cayenne/joda/access/types/LocalDateType.java | 92 --------------- .../cayenne/joda/access/types/LocalTimeType.java | 96 ---------------- ...onfiguration.server.CayenneServerModuleProvider | 20 ---- .../java/org/apache/cayenne/joda/JodaModuleIT.java | 122 -------------------- .../cayenne/joda/JodaModuleProviderTest.java | 31 ----- .../joda/access/types/DateTimeTypeTest.java | 62 ---------- .../cayenne/joda/access/types/JodaTestCase.java | 40 ------- .../joda/access/types/LocalDateTimeTypeTest.java | 64 ----------- .../joda/access/types/LocalDateTypeTest.java | 76 ------------ .../joda/access/types/LocalTimeTypeTest.java | 76 ------------ .../apache/cayenne/joda/db/DateTimeTestEntity.java | 27 ----- .../cayenne/joda/db/LocalDateTestEntity.java | 27 ----- .../cayenne/joda/db/LocalDateTimeTestEntity.java | 27 ----- .../cayenne/joda/db/LocalTimeTestEntity.java | 27 ----- .../cayenne/joda/db/auto/_DateTimeTestEntity.java | 88 -------------- .../cayenne/joda/db/auto/_LocalDateTestEntity.java | 88 -------------- .../joda/db/auto/_LocalDateTimeTestEntity.java | 88 -------------- .../cayenne/joda/db/auto/_LocalTimeTestEntity.java | 88 -------------- cayenne-joda/src/test/resources/cayenne-joda.xml | 16 --- cayenne-joda/src/test/resources/joda.map.xml | 35 ------ 25 files changed, 1580 deletions(-) diff --git a/cayenne-joda/pom.xml b/cayenne-joda/pom.xml deleted file mode 100644 index 4b189912c..000000000 --- a/cayenne-joda/pom.xml +++ /dev/null @@ -1,128 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <artifactId>cayenne-parent</artifactId> - <groupId>org.apache.cayenne</groupId> - <version>4.3.M1-SNAPSHOT</version> - </parent> - <artifactId>cayenne-joda</artifactId> - <name>cayenne-joda: Cayenne Joda Extensions</name> - <packaging>jar</packaging> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>joda-time</groupId> - <artifactId>joda-time</artifactId> - <version>2.9.9</version> - </dependency> - </dependencies> - </dependencyManagement> - - <dependencies> - - <!-- Compile dependencies --> - <dependency> - <groupId>org.apache.cayenne</groupId> - <artifactId>cayenne-server</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>joda-time</groupId> - <artifactId>joda-time</artifactId> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <scope>compile</scope> - </dependency> - - <!-- Test dependencies --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.cayenne.build-tools</groupId> - <artifactId>cayenne-test-utilities</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.cayenne</groupId> - <artifactId>cayenne-server</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.mockrunner</groupId> - <artifactId>mockrunner-jdbc</artifactId> - <scope>test</scope> - <exclusions> - <exclusion> - <!-- this one have old Xerces dependency that clashes with JDK's one --> - <groupId>nekohtml</groupId> - <artifactId>nekohtml</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.hsqldb</groupId> - <artifactId>hsqldb</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - <build> - <plugins> - <!-- This ensures LICENSE and NOTICE inclusion in all jars --> - <plugin> - <artifactId>maven-remote-resources-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>process</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.cayenne.plugins</groupId> - <artifactId>cayenne-maven-plugin</artifactId> - <version>${project.version}</version> - <configuration> - <map>${project.basedir}/src/test/resources/joda.map.xml</map> - <destDir>${project.basedir}/src/test/java</destDir> - <superPkg>org.apache.cayenne.joda.db.auto</superPkg> - </configuration> - </plugin> - </plugins> - </build> -</project> \ No newline at end of file diff --git a/cayenne-joda/src/main/java/org/apache/cayenne/joda/JodaModule.java b/cayenne-joda/src/main/java/org/apache/cayenne/joda/JodaModule.java deleted file mode 100644 index 4963afeb1..000000000 --- a/cayenne-joda/src/main/java/org/apache/cayenne/joda/JodaModule.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cayenne.joda; - -import org.apache.cayenne.configuration.server.ServerModule; -import org.apache.cayenne.di.Binder; -import org.apache.cayenne.di.Module; -import org.apache.cayenne.joda.access.types.DateTimeType; -import org.apache.cayenne.joda.access.types.LocalDateTimeType; -import org.apache.cayenne.joda.access.types.LocalDateType; -import org.apache.cayenne.joda.access.types.LocalTimeType; -import org.slf4j.LoggerFactory; -import org.slf4j.Logger; - - -/** - * Auto-loadable Cayenne module that adds support for Joda {@link org.apache.cayenne.access.types.ExtendedType} types. - * - * @since 4.0 - * @deprecated since 4.1 - */ -@Deprecated -public class JodaModule implements Module { - - private static final Logger logger = LoggerFactory.getLogger(JodaModule.class); - - @Override - public void configure(Binder binder) { - logger.warn("Since 4.1 Cayenne-Joda module was deprecated."); - ServerModule.contributeDefaultTypes(binder) - .add(new DateTimeType()) - .add(new LocalDateType()) - .add(new LocalTimeType()) - .add(new LocalDateTimeType()); - } -} diff --git a/cayenne-joda/src/main/java/org/apache/cayenne/joda/JodaServerModuleProvider.java b/cayenne-joda/src/main/java/org/apache/cayenne/joda/JodaServerModuleProvider.java deleted file mode 100644 index cad683f15..000000000 --- a/cayenne-joda/src/main/java/org/apache/cayenne/joda/JodaServerModuleProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cayenne.joda; - -import org.apache.cayenne.configuration.server.CayenneServerModuleProvider; -import org.apache.cayenne.di.Module; - -import java.util.Collection; -import java.util.Collections; - -/** - * @since 4.0 - * @deprecated since 4.1 - */ -@Deprecated -public class JodaServerModuleProvider implements CayenneServerModuleProvider { - - @Override - public Module module() { - return new JodaModule(); - } - - @Override - public Class<? extends Module> moduleType() { - return JodaModule.class; - } - - @Override - public Collection<Class<? extends Module>> overrides() { - return Collections.emptyList(); - } -} diff --git a/cayenne-joda/src/main/java/org/apache/cayenne/joda/access/types/DateTimeType.java b/cayenne-joda/src/main/java/org/apache/cayenne/joda/access/types/DateTimeType.java deleted file mode 100644 index 4f39933db..000000000 --- a/cayenne-joda/src/main/java/org/apache/cayenne/joda/access/types/DateTimeType.java +++ /dev/null @@ -1,81 +0,0 @@ -/***************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ****************************************************************/ - -package org.apache.cayenne.joda.access.types; - -import org.apache.cayenne.access.types.ExtendedType; -import org.joda.time.DateTime; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Timestamp; - -/** - * Handles <code>org.joda.time.DateTime</code> type mapping. - * - * @since 4.0 - * @deprecated since 4.1 - */ -@Deprecated -public class DateTimeType implements ExtendedType<DateTime> { - - @Override - public String getClassName() { - return DateTime.class.getName(); - } - - @Override - public void setJdbcObject(PreparedStatement statement, DateTime value, int pos, int type, int scale) throws Exception { - if (value == null) { - statement.setNull(pos, type); - } else { - Timestamp ts = new Timestamp(value.getMillis()); - statement.setTimestamp(pos, ts); - } - } - - @Override - public DateTime materializeObject(ResultSet rs, int index, int type) throws Exception { - if (rs.getTimestamp(index) != null) { - return new DateTime(rs.getTimestamp(index).getTime()); - } else { - return null; - } - } - - @Override - public DateTime materializeObject(CallableStatement rs, int index, int type) throws Exception { - if (rs.getTimestamp(index) != null) { - return new DateTime(rs.getTimestamp(index).getTime()); - } else { - return null; - } - } - - @Override - public String toString(DateTime value) { - if (value == null) { - return "NULL"; - } - - return '\'' + value.toString() + '\''; - } - -} diff --git a/cayenne-joda/src/main/java/org/apache/cayenne/joda/access/types/LocalDateTimeType.java b/cayenne-joda/src/main/java/org/apache/cayenne/joda/access/types/LocalDateTimeType.java deleted file mode 100644 index 955e1d9c3..000000000 --- a/cayenne-joda/src/main/java/org/apache/cayenne/joda/access/types/LocalDateTimeType.java +++ /dev/null @@ -1,81 +0,0 @@ -/***************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ****************************************************************/ - -package org.apache.cayenne.joda.access.types; - -import org.apache.cayenne.access.types.ExtendedType; -import org.joda.time.LocalDateTime; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Timestamp; -import java.sql.Types; - -/** - * Handles <code>org.joda.time.LocalDateTime</code> type mapping. - * - * @since 4.0 - * @deprecated since 4.1 - */ -@Deprecated -public class LocalDateTimeType implements ExtendedType<LocalDateTime> { - - @Override - public String getClassName() { - return LocalDateTime.class.getName(); - } - - @Override - public void setJdbcObject(PreparedStatement statement, LocalDateTime value, int pos, int type, int scale) throws Exception { - if (value == null) { - statement.setNull(pos, type); - } else { - Timestamp ts = new Timestamp(value.toDateTime().getMillis()); - statement.setTimestamp(pos, ts); - } - } - - @Override - public LocalDateTime materializeObject(ResultSet rs, int index, int type) throws Exception { - if (rs.getTimestamp(index) != null) { - return new LocalDateTime(rs.getTimestamp(index).getTime()); - } else { - return null; - } - } - - @Override - public LocalDateTime materializeObject(CallableStatement rs, int index, int type) throws Exception { - if (type == Types.TIMESTAMP && rs.getTimestamp(index) != null) { - return new LocalDateTime(rs.getTimestamp(index).getTime()); - } else { - return null; - } - } - - @Override - public String toString(LocalDateTime value) { - if (value == null) { - return "NULL"; - } - - return '\'' + value.toString() + '\''; - } -} diff --git a/cayenne-joda/src/main/java/org/apache/cayenne/joda/access/types/LocalDateType.java b/cayenne-joda/src/main/java/org/apache/cayenne/joda/access/types/LocalDateType.java deleted file mode 100644 index 9be2a806b..000000000 --- a/cayenne-joda/src/main/java/org/apache/cayenne/joda/access/types/LocalDateType.java +++ /dev/null @@ -1,92 +0,0 @@ -/***************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ****************************************************************/ - -package org.apache.cayenne.joda.access.types; - -import org.apache.cayenne.access.types.ExtendedType; -import org.joda.time.LocalDate; - -import java.sql.CallableStatement; -import java.sql.Date; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Timestamp; -import java.sql.Types; - -/** - * Handles <code>org.joda.time.LocalDate</code> type mapping. - * - * @since 4.0 - * @deprecated since 4.1 - */ -@Deprecated -public class LocalDateType implements ExtendedType<LocalDate> { - - @Override - public String getClassName() { - return LocalDate.class.getName(); - } - - @Override - public void setJdbcObject(PreparedStatement statement, LocalDate value, int pos, int type, int scale) throws Exception { - if (value == null) { - statement.setNull(pos, type); - } else { - long time = value.toDate().getTime(); - - if (type == Types.DATE) { - statement.setDate(pos, new Date(time)); - } else { - statement.setTimestamp(pos, new Timestamp(time)); - } - } - } - - @Override - public LocalDate materializeObject(ResultSet rs, int index, int type) throws Exception { - if (type == Types.DATE && rs.getDate(index) != null) { - return new LocalDate(rs.getDate(index).getTime()); - } else if (type == Types.TIMESTAMP && rs.getTimestamp(index) != null) { - return new LocalDate(rs.getTimestamp(index).getTime()); - } else { - return null; - } - } - - @Override - public LocalDate materializeObject(CallableStatement rs, int index, int type) throws Exception { - if (type == Types.DATE && rs.getDate(index) != null) { - return new LocalDate(rs.getDate(index).getTime()); - } else if (type == Types.TIMESTAMP && rs.getTimestamp(index) != null) { - return new LocalDate(rs.getTimestamp(index).getTime()); - } else { - return null; - } - } - - @Override - public String toString(LocalDate value) { - if (value == null) { - return "NULL"; - } - - return '\'' + value.toString() + '\''; - } - -} diff --git a/cayenne-joda/src/main/java/org/apache/cayenne/joda/access/types/LocalTimeType.java b/cayenne-joda/src/main/java/org/apache/cayenne/joda/access/types/LocalTimeType.java deleted file mode 100644 index 8d15def5d..000000000 --- a/cayenne-joda/src/main/java/org/apache/cayenne/joda/access/types/LocalTimeType.java +++ /dev/null @@ -1,96 +0,0 @@ -/***************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ****************************************************************/ - -package org.apache.cayenne.joda.access.types; - -import org.apache.cayenne.access.types.ExtendedType; -import org.joda.time.DateTimeZone; -import org.joda.time.LocalDate; -import org.joda.time.LocalTime; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.Types; - -/** - * Handles <code>org.joda.time.LocalTime</code> type mapping. - * - * @since 4.0 - * @deprecated since 4.1 - */ -@Deprecated -public class LocalTimeType implements ExtendedType<LocalTime> { - - private static final LocalDate EPOCH = new LocalDate(0, DateTimeZone.UTC); - - @Override - public String getClassName() { - return LocalTime.class.getName(); - } - - @Override - public void setJdbcObject(PreparedStatement statement, LocalTime value, int pos, int type, int scale) throws Exception { - - if (value == null) { - statement.setNull(pos, type); - } else { - long millis = EPOCH.toDateTime(value).getMillis(); - - if (type == Types.TIME) { - statement.setTime(pos, new Time(millis)); - } else { - statement.setTimestamp(pos, new Timestamp(millis)); - } - } - } - - @Override - public LocalTime materializeObject(ResultSet rs, int index, int type) throws Exception { - if (type == Types.TIME && rs.getTime(index) != null) { - return new LocalTime(rs.getTime(index).getTime()); - } else if (type == Types.TIMESTAMP && rs.getTimestamp(index) != null) { - return new LocalTime(rs.getTimestamp(index).getTime()); - } else { - return null; - } - } - - @Override - public LocalTime materializeObject(CallableStatement rs, int index, int type) throws Exception { - if (type == Types.TIME && rs.getTime(index) != null) { - return new LocalTime(rs.getTime(index).getTime()); - } else if (type == Types.TIMESTAMP && rs.getTimestamp(index) != null) { - return new LocalTime(rs.getTimestamp(index).getTime()); - } else { - return null; - } - } - - @Override - public String toString(LocalTime value) { - if (value == null) { - return "NULL"; - } - - return '\'' + value.toString() + '\''; - } -} diff --git a/cayenne-joda/src/main/resources/META-INF/services/org.apache.cayenne.configuration.server.CayenneServerModuleProvider b/cayenne-joda/src/main/resources/META-INF/services/org.apache.cayenne.configuration.server.CayenneServerModuleProvider deleted file mode 100644 index cee8a95c7..000000000 --- a/cayenne-joda/src/main/resources/META-INF/services/org.apache.cayenne.configuration.server.CayenneServerModuleProvider +++ /dev/null @@ -1,20 +0,0 @@ -################################################################## -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -################################################################## - -org.apache.cayenne.joda.JodaServerModuleProvider \ No newline at end of file diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/JodaModuleIT.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/JodaModuleIT.java deleted file mode 100644 index af8e37892..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/JodaModuleIT.java +++ /dev/null @@ -1,122 +0,0 @@ -/***************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ****************************************************************/ - -package org.apache.cayenne.joda; - -import org.apache.cayenne.ObjectContext; -import org.apache.cayenne.configuration.server.ServerRuntime; -import org.apache.cayenne.joda.db.DateTimeTestEntity; -import org.apache.cayenne.joda.db.LocalDateTestEntity; -import org.apache.cayenne.joda.db.LocalDateTimeTestEntity; -import org.apache.cayenne.joda.db.LocalTimeTestEntity; -import org.apache.cayenne.query.ObjectSelect; -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.joda.time.LocalDateTime; -import org.joda.time.LocalTime; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -public class JodaModuleIT { - - private ServerRuntime runtime; - - @Before - public void setUp() { - this.runtime = ServerRuntime.builder().addConfig("cayenne-joda.xml").build(); - } - - @Test - public void testJodaDateTime() { - ObjectContext context = runtime.newContext(); - - DateTimeTestEntity dateTimeTestEntity = context.newObject(DateTimeTestEntity.class); - DateTime dateTime = DateTime.now(); - dateTimeTestEntity.setTimestamp(dateTime); - - context.commitChanges(); - - DateTimeTestEntity testRead = ObjectSelect.query(DateTimeTestEntity.class).selectOne(context); - - DateTime timestamp = testRead.getTimestamp(); - assertNotNull(timestamp); - assertEquals(DateTime.class, timestamp.getClass()); - assertEquals(dateTime, timestamp); - } - - @Test - public void testJodaLocalDate() { - ObjectContext context = runtime.newContext(); - - LocalDateTestEntity localDateTestEntity = context.newObject(LocalDateTestEntity.class); - LocalDate localDate = LocalDate.now(); - localDateTestEntity.setDate(localDate); - - context.commitChanges(); - - LocalDateTestEntity testRead = ObjectSelect.query(LocalDateTestEntity.class).selectOne(context); - - LocalDate date = testRead.getDate(); - assertNotNull(date); - assertEquals(LocalDate.class, date.getClass()); - assertEquals(localDate, date); - } - - @Test - public void testJodaLocalTime() { - ObjectContext context = runtime.newContext(); - - LocalTimeTestEntity localTimeTestEntity = context.newObject(LocalTimeTestEntity.class); - LocalTime localTime = LocalTime.now(); - localTimeTestEntity.setTime(localTime); - - context.commitChanges(); - - LocalTimeTestEntity testRead = ObjectSelect.query(LocalTimeTestEntity.class).selectOne(context); - - LocalTime time = testRead.getTime(); - assertNotNull(time); - assertEquals(LocalTime.class, time.getClass()); - assertEquals(localTime.getSecondOfMinute(), time.getSecondOfMinute()); - assertEquals(localTime.getMinuteOfHour(), time.getMinuteOfHour()); - assertEquals(localTime.getHourOfDay(), time.getHourOfDay()); - } - - @Test - public void testJodaLocalDateTime() { - ObjectContext context = runtime.newContext(); - - LocalDateTimeTestEntity localDateTimeTestEntity = context.newObject(LocalDateTimeTestEntity.class); - LocalDateTime localDateTime = LocalDateTime.now(); - localDateTimeTestEntity.setTimestamp(localDateTime); - - context.commitChanges(); - - LocalDateTimeTestEntity testRead = ObjectSelect.query(LocalDateTimeTestEntity.class).selectOne(context); - - LocalDateTime timestamp = testRead.getTimestamp(); - assertNotNull(timestamp); - assertEquals(LocalDateTime.class, timestamp.getClass()); - assertEquals(localDateTime, timestamp); - } - -} diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/JodaModuleProviderTest.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/JodaModuleProviderTest.java deleted file mode 100644 index 7841bc58e..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/JodaModuleProviderTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cayenne.joda; - -import org.apache.cayenne.configuration.server.CayenneServerModuleProvider; -import org.apache.cayenne.unit.util.ModuleProviderChecker; -import org.junit.Test; - -public class JodaModuleProviderTest { - - @Test - public void testProviderPresent() { - ModuleProviderChecker.testProviderPresent(JodaServerModuleProvider.class, CayenneServerModuleProvider.class); - } -} diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/DateTimeTypeTest.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/DateTimeTypeTest.java deleted file mode 100644 index 0e39571d3..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/DateTimeTypeTest.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.apache.cayenne.joda.access.types; - -import com.mockrunner.mock.jdbc.MockConnection; -import com.mockrunner.mock.jdbc.MockPreparedStatement; - -import org.joda.time.DateTime; - -import java.sql.PreparedStatement; -import java.sql.Timestamp; -import java.sql.Types; - -/***************************************************************** -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* https://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -****************************************************************/ - -public class DateTimeTypeTest extends JodaTestCase { - - private DateTimeType type; - - @Override - protected void setUp() throws Exception { - super.setUp(); - type = new DateTimeType(); - } - - public void testMaterializeObjectTimestamp() throws Exception { - Object o = type.materializeObject(resultSet(new Timestamp(0)), 1, Types.TIMESTAMP); - assertEquals(new DateTime(0), o); - } - - public void testSetJdbcObject() throws Exception { - PreparedStatement statement = new MockPreparedStatement(new MockConnection(), "update t set c = ?"); - DateTime date = new DateTime(0); - - type.setJdbcObject(statement, date, 1, Types.TIMESTAMP, 0); - - Object object = ((MockPreparedStatement) statement).getParameter(1); - assertEquals(Timestamp.class, object.getClass()); - assertEquals(date.getMillis(), ((Timestamp) object).getTime()); - - type.setJdbcObject(statement, null, 1, Types.TIMESTAMP, 0); - - object = ((MockPreparedStatement) statement).getParameter(1); - assertNull(object); - } - -} \ No newline at end of file diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/JodaTestCase.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/JodaTestCase.java deleted file mode 100644 index 0d9ee9e8d..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/JodaTestCase.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.apache.cayenne.joda.access.types; - -import com.mockrunner.mock.jdbc.MockResultSet; -import junit.framework.TestCase; - -import java.sql.ResultSet; -import java.sql.SQLException; - -/** - * ************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * https://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * ************************************************************** - */ - -public abstract class JodaTestCase extends TestCase { - - ResultSet resultSet(Object value) throws SQLException { - MockResultSet rs = new MockResultSet("Test"); - rs.addColumn("Col"); - rs.addRow(new Object[]{value}); - rs.next(); - return rs; - } - -} diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/LocalDateTimeTypeTest.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/LocalDateTimeTypeTest.java deleted file mode 100644 index 24c0f5ab7..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/LocalDateTimeTypeTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.apache.cayenne.joda.access.types; - -import com.mockrunner.mock.jdbc.MockConnection; -import com.mockrunner.mock.jdbc.MockPreparedStatement; - -import org.joda.time.LocalDateTime; - -import java.sql.PreparedStatement; -import java.sql.Timestamp; -import java.sql.Types; - -/** - * ************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * https://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * ************************************************************** - */ - -public class LocalDateTimeTypeTest extends JodaTestCase { - - private LocalDateTimeType type; - - @Override - protected void setUp() throws Exception { - super.setUp(); - type = new LocalDateTimeType(); - } - - public void testMaterializeObjectTimestamp() throws Exception { - Object o = type.materializeObject(resultSet(new Timestamp(0)), 1, Types.TIMESTAMP); - assertEquals(new LocalDateTime(0), o); - } - - public void testSetJdbcObject() throws Exception { - PreparedStatement statement = new MockPreparedStatement(new MockConnection(), "update t set c = ?"); - LocalDateTime date = new LocalDateTime(0); - - type.setJdbcObject(statement, date, 1, Types.TIMESTAMP, 0); - - Object object = ((MockPreparedStatement) statement).getParameter(1); - assertEquals(Timestamp.class, object.getClass()); - assertEquals(date.toDate().getTime(), ((Timestamp) object).getTime()); - - type.setJdbcObject(statement, null, 1, Types.TIMESTAMP, 0); - - object = ((MockPreparedStatement) statement).getParameter(1); - assertNull(object); - } - -} diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/LocalDateTypeTest.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/LocalDateTypeTest.java deleted file mode 100644 index dc0fafcfd..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/LocalDateTypeTest.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.apache.cayenne.joda.access.types; - -import com.mockrunner.mock.jdbc.MockConnection; -import com.mockrunner.mock.jdbc.MockPreparedStatement; - -import org.joda.time.LocalDate; - -import java.sql.Date; -import java.sql.PreparedStatement; -import java.sql.Timestamp; -import java.sql.Types; - -/** - * ************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * https://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * ************************************************************** - */ - -public class LocalDateTypeTest extends JodaTestCase { - - private LocalDateType type; - - @Override - protected void setUp() throws Exception { - super.setUp(); - type = new LocalDateType(); - } - - public void testMaterializeObjectTimestamp() throws Exception { - Object o = type.materializeObject(resultSet(new Timestamp(0)), 1, Types.TIMESTAMP); - assertEquals(new LocalDate(0), o); - } - - public void testMaterializeObjectDate() throws Exception { - Object o = type.materializeObject(resultSet(new Date(0)), 1, Types.DATE); - assertEquals(new LocalDate(0), o); - } - - public void testSetJdbcObject() throws Exception { - PreparedStatement statement = new MockPreparedStatement(new MockConnection(), "update t set c = ?"); - LocalDate savedObject = new LocalDate(0); - - type.setJdbcObject(statement, savedObject, 1, Types.DATE, 0); - - Object object = ((MockPreparedStatement) statement).getParameter(1); - assertEquals(Date.class, object.getClass()); - assertEquals(savedObject.toDate().getTime(), ((Date) object).getTime()); - - type.setJdbcObject(statement, savedObject, 1, Types.TIMESTAMP, 0); - - object = ((MockPreparedStatement) statement).getParameter(1); - assertEquals(Timestamp.class, object.getClass()); - assertEquals(savedObject.toDate().getTime(), ((Timestamp) object).getTime()); - - type.setJdbcObject(statement, null, 1, Types.TIMESTAMP, 0); - - object = ((MockPreparedStatement) statement).getParameter(1); - assertNull(object); - } - -} diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/LocalTimeTypeTest.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/LocalTimeTypeTest.java deleted file mode 100644 index 45e445ade..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/access/types/LocalTimeTypeTest.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.apache.cayenne.joda.access.types; - -import com.mockrunner.mock.jdbc.MockConnection; -import com.mockrunner.mock.jdbc.MockPreparedStatement; - -import org.joda.time.DateTimeZone; -import org.joda.time.LocalDate; -import org.joda.time.LocalTime; - -import java.sql.PreparedStatement; -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.Types; - -/***************************************************************** -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* https://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -****************************************************************/ - -public class LocalTimeTypeTest extends JodaTestCase { - - private LocalTimeType type; - - @Override - protected void setUp() throws Exception { - super.setUp(); - type = new LocalTimeType(); - } - - public void testMaterializeObjectTimestamp() throws Exception { - Object o = type.materializeObject(resultSet(new Timestamp(0)), 1, Types.TIMESTAMP); - assertEquals(new LocalTime(0), o); - } - - public void testMaterializeObjectTime() throws Exception { - Object o = type.materializeObject(resultSet(new Time(0)), 1, Types.TIME); - assertEquals(new LocalTime(0), o); - } - - public void testSetJdbcObject() throws Exception { - PreparedStatement statement = new MockPreparedStatement(new MockConnection(), "update t set c = ?"); - LocalTime date = new LocalTime(0); - - type.setJdbcObject(statement, date, 1, Types.TIME, 0); - - Object object = ((MockPreparedStatement) statement).getParameter(1); - assertEquals(Time.class, object.getClass()); - assertEquals(new LocalDate(0, DateTimeZone.UTC).toDateTime(date).getMillis(), ((Time) object).getTime()); - - type.setJdbcObject(statement, date, 1, Types.TIMESTAMP, 0); - - object = ((MockPreparedStatement) statement).getParameter(1); - assertEquals(Timestamp.class, object.getClass()); - assertEquals(new LocalDate(0, DateTimeZone.UTC).toDateTime(date).getMillis(), ((Timestamp) object).getTime()); - - type.setJdbcObject(statement, null, 1, Types.TIMESTAMP, 0); - - object = ((MockPreparedStatement) statement).getParameter(1); - assertNull(object); - } - -} \ No newline at end of file diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/DateTimeTestEntity.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/DateTimeTestEntity.java deleted file mode 100644 index 7c91aafba..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/DateTimeTestEntity.java +++ /dev/null @@ -1,27 +0,0 @@ -/***************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ****************************************************************/ -package org.apache.cayenne.joda.db; - -import org.apache.cayenne.joda.db.auto._DateTimeTestEntity; - -public class DateTimeTestEntity extends _DateTimeTestEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/LocalDateTestEntity.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/LocalDateTestEntity.java deleted file mode 100644 index 9ee9d69f2..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/LocalDateTestEntity.java +++ /dev/null @@ -1,27 +0,0 @@ -/***************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ****************************************************************/ -package org.apache.cayenne.joda.db; - -import org.apache.cayenne.joda.db.auto._LocalDateTestEntity; - -public class LocalDateTestEntity extends _LocalDateTestEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/LocalDateTimeTestEntity.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/LocalDateTimeTestEntity.java deleted file mode 100644 index 59fb6a21d..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/LocalDateTimeTestEntity.java +++ /dev/null @@ -1,27 +0,0 @@ -/***************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ****************************************************************/ -package org.apache.cayenne.joda.db; - -import org.apache.cayenne.joda.db.auto._LocalDateTimeTestEntity; - -public class LocalDateTimeTestEntity extends _LocalDateTimeTestEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/LocalTimeTestEntity.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/LocalTimeTestEntity.java deleted file mode 100644 index 1a9961044..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/LocalTimeTestEntity.java +++ /dev/null @@ -1,27 +0,0 @@ -/***************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ****************************************************************/ -package org.apache.cayenne.joda.db; - -import org.apache.cayenne.joda.db.auto._LocalTimeTestEntity; - -public class LocalTimeTestEntity extends _LocalTimeTestEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_DateTimeTestEntity.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_DateTimeTestEntity.java deleted file mode 100644 index 9138bdcad..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_DateTimeTestEntity.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.apache.cayenne.joda.db.auto; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import org.apache.cayenne.BaseDataObject; -import org.apache.cayenne.exp.property.BaseProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.joda.time.DateTime; - -/** - * Class _DateTimeTestEntity was generated by Cayenne. - * It is probably a good idea to avoid changing this class manually, - * since it may be overwritten next time code is regenerated. - * If you need to make any customizations, please use subclass. - */ -public abstract class _DateTimeTestEntity extends BaseDataObject { - - private static final long serialVersionUID = 1L; - - public static final String ID_PK_COLUMN = "ID"; - - public static final BaseProperty<DateTime> TIMESTAMP = PropertyFactory.createBase("timestamp", DateTime.class); - - protected DateTime timestamp; - - - public void setTimestamp(DateTime timestamp) { - beforePropertyWrite("timestamp", this.timestamp, timestamp); - this.timestamp = timestamp; - } - - public DateTime getTimestamp() { - beforePropertyRead("timestamp"); - return this.timestamp; - } - - @Override - public Object readPropertyDirectly(String propName) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch(propName) { - case "timestamp": - return this.timestamp; - default: - return super.readPropertyDirectly(propName); - } - } - - @Override - public void writePropertyDirectly(String propName, Object val) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch (propName) { - case "timestamp": - this.timestamp = (DateTime)val; - break; - default: - super.writePropertyDirectly(propName, val); - } - } - - private void writeObject(ObjectOutputStream out) throws IOException { - writeSerialized(out); - } - - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - readSerialized(in); - } - - @Override - protected void writeState(ObjectOutputStream out) throws IOException { - super.writeState(out); - out.writeObject(this.timestamp); - } - - @Override - protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException { - super.readState(in); - this.timestamp = (DateTime)in.readObject(); - } - -} diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTestEntity.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTestEntity.java deleted file mode 100644 index 2542bd381..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTestEntity.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.apache.cayenne.joda.db.auto; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import org.apache.cayenne.BaseDataObject; -import org.apache.cayenne.exp.property.BaseProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.joda.time.LocalDate; - -/** - * Class _LocalDateTestEntity was generated by Cayenne. - * It is probably a good idea to avoid changing this class manually, - * since it may be overwritten next time code is regenerated. - * If you need to make any customizations, please use subclass. - */ -public abstract class _LocalDateTestEntity extends BaseDataObject { - - private static final long serialVersionUID = 1L; - - public static final String ID_PK_COLUMN = "ID"; - - public static final BaseProperty<LocalDate> DATE = PropertyFactory.createBase("date", LocalDate.class); - - protected LocalDate date; - - - public void setDate(LocalDate date) { - beforePropertyWrite("date", this.date, date); - this.date = date; - } - - public LocalDate getDate() { - beforePropertyRead("date"); - return this.date; - } - - @Override - public Object readPropertyDirectly(String propName) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch(propName) { - case "date": - return this.date; - default: - return super.readPropertyDirectly(propName); - } - } - - @Override - public void writePropertyDirectly(String propName, Object val) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch (propName) { - case "date": - this.date = (LocalDate)val; - break; - default: - super.writePropertyDirectly(propName, val); - } - } - - private void writeObject(ObjectOutputStream out) throws IOException { - writeSerialized(out); - } - - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - readSerialized(in); - } - - @Override - protected void writeState(ObjectOutputStream out) throws IOException { - super.writeState(out); - out.writeObject(this.date); - } - - @Override - protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException { - super.readState(in); - this.date = (LocalDate)in.readObject(); - } - -} diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTimeTestEntity.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTimeTestEntity.java deleted file mode 100644 index ee812abe0..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTimeTestEntity.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.apache.cayenne.joda.db.auto; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import org.apache.cayenne.BaseDataObject; -import org.apache.cayenne.exp.property.BaseProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.joda.time.LocalDateTime; - -/** - * Class _LocalDateTimeTestEntity was generated by Cayenne. - * It is probably a good idea to avoid changing this class manually, - * since it may be overwritten next time code is regenerated. - * If you need to make any customizations, please use subclass. - */ -public abstract class _LocalDateTimeTestEntity extends BaseDataObject { - - private static final long serialVersionUID = 1L; - - public static final String ID_PK_COLUMN = "ID"; - - public static final BaseProperty<LocalDateTime> TIMESTAMP = PropertyFactory.createBase("timestamp", LocalDateTime.class); - - protected LocalDateTime timestamp; - - - public void setTimestamp(LocalDateTime timestamp) { - beforePropertyWrite("timestamp", this.timestamp, timestamp); - this.timestamp = timestamp; - } - - public LocalDateTime getTimestamp() { - beforePropertyRead("timestamp"); - return this.timestamp; - } - - @Override - public Object readPropertyDirectly(String propName) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch(propName) { - case "timestamp": - return this.timestamp; - default: - return super.readPropertyDirectly(propName); - } - } - - @Override - public void writePropertyDirectly(String propName, Object val) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch (propName) { - case "timestamp": - this.timestamp = (LocalDateTime)val; - break; - default: - super.writePropertyDirectly(propName, val); - } - } - - private void writeObject(ObjectOutputStream out) throws IOException { - writeSerialized(out); - } - - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - readSerialized(in); - } - - @Override - protected void writeState(ObjectOutputStream out) throws IOException { - super.writeState(out); - out.writeObject(this.timestamp); - } - - @Override - protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException { - super.readState(in); - this.timestamp = (LocalDateTime)in.readObject(); - } - -} diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalTimeTestEntity.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalTimeTestEntity.java deleted file mode 100644 index 903f24437..000000000 --- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalTimeTestEntity.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.apache.cayenne.joda.db.auto; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import org.apache.cayenne.BaseDataObject; -import org.apache.cayenne.exp.property.BaseProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.joda.time.LocalTime; - -/** - * Class _LocalTimeTestEntity was generated by Cayenne. - * It is probably a good idea to avoid changing this class manually, - * since it may be overwritten next time code is regenerated. - * If you need to make any customizations, please use subclass. - */ -public abstract class _LocalTimeTestEntity extends BaseDataObject { - - private static final long serialVersionUID = 1L; - - public static final String ID_PK_COLUMN = "ID"; - - public static final BaseProperty<LocalTime> TIME = PropertyFactory.createBase("time", LocalTime.class); - - protected LocalTime time; - - - public void setTime(LocalTime time) { - beforePropertyWrite("time", this.time, time); - this.time = time; - } - - public LocalTime getTime() { - beforePropertyRead("time"); - return this.time; - } - - @Override - public Object readPropertyDirectly(String propName) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch(propName) { - case "time": - return this.time; - default: - return super.readPropertyDirectly(propName); - } - } - - @Override - public void writePropertyDirectly(String propName, Object val) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch (propName) { - case "time": - this.time = (LocalTime)val; - break; - default: - super.writePropertyDirectly(propName, val); - } - } - - private void writeObject(ObjectOutputStream out) throws IOException { - writeSerialized(out); - } - - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - readSerialized(in); - } - - @Override - protected void writeState(ObjectOutputStream out) throws IOException { - super.writeState(out); - out.writeObject(this.time); - } - - @Override - protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException { - super.readState(in); - this.time = (LocalTime)in.readObject(); - } - -} diff --git a/cayenne-joda/src/test/resources/cayenne-joda.xml b/cayenne-joda/src/test/resources/cayenne-joda.xml deleted file mode 100644 index 7474d44dc..000000000 --- a/cayenne-joda/src/test/resources/cayenne-joda.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<domain xmlns="http://cayenne.apache.org/schema/10/domain" - project-version="10"> - <map name="joda"/> - <node name="datanode" - factory="org.apache.cayenne.configuration.server.XMLPoolingDataSourceFactory" - schema-update-strategy="org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy"> - <map-ref name="joda"/> - <data-source> - <driver value="org.hsqldb.jdbcDriver"/> - <url value="jdbc:hsqldb:mem:joda"/> - <connectionPool min="1" max="1"/> - <login userName="sa"/> - </data-source> - </node> -</domain> diff --git a/cayenne-joda/src/test/resources/joda.map.xml b/cayenne-joda/src/test/resources/joda.map.xml deleted file mode 100644 index 9fd6c9b60..000000000 --- a/cayenne-joda/src/test/resources/joda.map.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<data-map xmlns="http://cayenne.apache.org/schema/10/modelMap" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://cayenne.apache.org/schema/10/modelMap http://cayenne.apache.org/schema/10/modelMap.xsd" - project-version="10"> - <property name="defaultPackage" value="org.apache.cayenne.joda.db"/> - <db-entity name="DATE_TIME_TEST"> - <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/> - <db-attribute name="Timestamp" type="TIMESTAMP"/> - </db-entity> - <db-entity name="LOCAL_DATE_TEST"> - <db-attribute name="Date" type="DATE"/> - <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/> - </db-entity> - <db-entity name="LOCAL_DATE_TIME_TEST"> - <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/> - <db-attribute name="Timestamp" type="TIMESTAMP"/> - </db-entity> - <db-entity name="LOCAL_TIME_TEST"> - <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/> - <db-attribute name="Time" type="TIME"/> - </db-entity> - <obj-entity name="DateTimeTest" className="org.apache.cayenne.joda.db.DateTimeTestEntity" dbEntityName="DATE_TIME_TEST"> - <obj-attribute name="timestamp" type="org.joda.time.DateTime" db-attribute-path="Timestamp"/> - </obj-entity> - <obj-entity name="LocalDateTest" className="org.apache.cayenne.joda.db.LocalDateTestEntity" dbEntityName="LOCAL_DATE_TEST"> - <obj-attribute name="date" type="org.joda.time.LocalDate" db-attribute-path="Date"/> - </obj-entity> - <obj-entity name="LocalDateTimeTest" className="org.apache.cayenne.joda.db.LocalDateTimeTestEntity" dbEntityName="LOCAL_DATE_TIME_TEST"> - <obj-attribute name="timestamp" type="org.joda.time.LocalDateTime" db-attribute-path="Timestamp"/> - </obj-entity> - <obj-entity name="LocalTimeTest" className="org.apache.cayenne.joda.db.LocalTimeTestEntity" dbEntityName="LOCAL_TIME_TEST"> - <obj-attribute name="time" type="org.joda.time.LocalTime" db-attribute-path="Time"/> - </obj-entity> -</data-map>
