cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [1/5] cayenne git commit: CAY-2373 cayenne-rop-server module - move org.apache.cayenne.remote package to cayenne-rop server module - remove dependencies from cayenne-server pom.xml - update tutorial
Date Tue, 12 Dec 2017 13:05:43 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master eec08b7ef -> 38f37d79a


http://git-wip-us.apache.org/repos/asf/cayenne/blob/38f37d79/cayenne-server/src/test/java/org/apache/cayenne/remote/service/BaseRemoteServiceTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/remote/service/BaseRemoteServiceTest.java
b/cayenne-server/src/test/java/org/apache/cayenne/remote/service/BaseRemoteServiceTest.java
deleted file mode 100644
index 00feca6..0000000
--- a/cayenne-server/src/test/java/org/apache/cayenne/remote/service/BaseRemoteServiceTest.java
+++ /dev/null
@@ -1,142 +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
- *
- *    http://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.remote.service;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.fail;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.DataChannel;
-import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.configuration.Constants;
-import org.apache.cayenne.configuration.ObjectContextFactory;
-import org.apache.cayenne.event.MockEventBridgeFactory;
-import org.apache.cayenne.query.Query;
-import org.apache.cayenne.remote.QueryMessage;
-import org.apache.cayenne.remote.RemoteSession;
-import org.apache.cayenne.util.Util;
-import org.junit.Test;
-
-public class BaseRemoteServiceTest {
-
-	@Test
-	public void testConstructor() throws Exception {
-
-		Map<String, String> map = new HashMap<>();
-		map.put(Constants.SERVER_ROP_EVENT_BRIDGE_FACTORY_PROPERTY, MockEventBridgeFactory.class.getName());
-
-		ObjectContextFactory factory = new ObjectContextFactory() {
-
-			public ObjectContext createContext(DataChannel parent) {
-				return null;
-			}
-
-			public ObjectContext createContext() {
-				return null;
-			}
-		};
-		BaseRemoteService service = new BaseRemoteService(factory, map) {
-
-			@Override
-			protected ServerSession createServerSession() {
-				return null;
-			}
-
-			@Override
-			protected ServerSession createServerSession(String name) {
-				return null;
-			}
-
-			@Override
-			protected ServerSession getServerSession() {
-				return null;
-			}
-		};
-		assertEquals(MockEventBridgeFactory.class.getName(), service.getEventBridgeFactoryName());
-		assertSame(factory, service.contextFactory);
-
-	}
-
-	@Test
-	public void testProcessMessageExceptionSerializability() throws Throwable {
-
-		Map<String, String> map = new HashMap<>();
-		ObjectContextFactory factory = new ObjectContextFactory() {
-
-			public ObjectContext createContext(DataChannel parent) {
-				return null;
-			}
-
-			public ObjectContext createContext() {
-				return null;
-			}
-		};
-		BaseRemoteService service = new BaseRemoteService(factory, map) {
-
-			@Override
-			protected ServerSession createServerSession() {
-				return new ServerSession(new RemoteSession("a"), null);
-			}
-
-			@Override
-			protected ServerSession createServerSession(String name) {
-				return createServerSession();
-			}
-
-			@Override
-			protected ServerSession getServerSession() {
-				return createServerSession();
-			}
-		};
-
-		try {
-			service.processMessage(new QueryMessage(null) {
-
-				@Override
-				public Query getQuery() {
-					// serializable exception thrown
-					throw new CayenneRuntimeException();
-				}
-			});
-
-			fail("Expected to throw");
-		} catch (Exception ex) {
-			Util.cloneViaSerialization(ex);
-		}
-
-		try {
-			service.processMessage(new QueryMessage(null) {
-
-				@Override
-				public Query getQuery() {
-					// non-serializable exception thrown
-					throw new MockUnserializableException();
-				}
-			});
-
-			fail("Expected to throw");
-		} catch (Exception ex) {
-			Util.cloneViaSerialization(ex);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/38f37d79/cayenne-server/src/test/java/org/apache/cayenne/remote/service/DispatchHelperTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/remote/service/DispatchHelperTest.java
b/cayenne-server/src/test/java/org/apache/cayenne/remote/service/DispatchHelperTest.java
deleted file mode 100644
index e4b01fe..0000000
--- a/cayenne-server/src/test/java/org/apache/cayenne/remote/service/DispatchHelperTest.java
+++ /dev/null
@@ -1,54 +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
- *
- *    http://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.remote.service;
-
-import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.MockDataChannel;
-import org.apache.cayenne.map.EntityResolver;
-import org.apache.cayenne.remote.BootstrapMessage;
-import org.apache.cayenne.remote.ClientMessage;
-import org.junit.Test;
-
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-
-public class DispatchHelperTest {
-
-    @Test
-    public void testBootstrapMessage() {
-        EntityResolver resolver = new EntityResolver();
-        MockDataChannel channel = new MockDataChannel(resolver);
-        assertSame(resolver.getClientEntityResolver(), DispatchHelper.dispatch(
-                channel,
-                new BootstrapMessage()));
-    }
-
-    @Test
-    public void testUnknownMessage() {
-        try {
-            DispatchHelper.dispatch(new MockDataChannel(), mock(ClientMessage.class));
-            fail("Unknown message must have failed");
-        }
-        catch (CayenneRuntimeException e) {
-            // expected
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/38f37d79/cayenne-server/src/test/java/org/apache/cayenne/remote/service/MockUnserializableException.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/remote/service/MockUnserializableException.java
b/cayenne-server/src/test/java/org/apache/cayenne/remote/service/MockUnserializableException.java
deleted file mode 100644
index e30435b..0000000
--- a/cayenne-server/src/test/java/org/apache/cayenne/remote/service/MockUnserializableException.java
+++ /dev/null
@@ -1,24 +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
- *
- *    http://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.remote.service;
-
-class MockUnserializableException extends RuntimeException {
-
-    protected Object notSerializableField = new Object();
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/38f37d79/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java
----------------------------------------------------------------------
diff --git a/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java
b/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java
index e2434ce..d70843c 100644
--- a/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java
+++ b/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/Main.java
@@ -32,7 +32,7 @@ public class Main {
     public static void main(String[] args) {
 
         Map<String, String> properties = new HashMap<>();
-        properties.put(ClientConstants.ROP_SERVICE_URL_PROPERTY, "http://localhost:8080/tutorial-rop-server/cayenne-service");
+        properties.put(ClientConstants.ROP_SERVICE_URL_PROPERTY, "http://localhost:8080/cayenne-service");
         properties.put(ClientConstants.ROP_SERVICE_USERNAME_PROPERTY, "cayenne-user");
         properties.put(ClientConstants.ROP_SERVICE_PASSWORD_PROPERTY, "secret");
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/38f37d79/tutorials/tutorial-rop-server/pom.xml
----------------------------------------------------------------------
diff --git a/tutorials/tutorial-rop-server/pom.xml b/tutorials/tutorial-rop-server/pom.xml
index c234bd2..4bde8ec 100644
--- a/tutorials/tutorial-rop-server/pom.xml
+++ b/tutorials/tutorial-rop-server/pom.xml
@@ -28,12 +28,13 @@
 	<dependencies>
 		<dependency>
 			<groupId>org.apache.cayenne</groupId>
-			<artifactId>cayenne-server</artifactId>
+			<artifactId>cayenne-rop-server</artifactId>
 			<version>${project.version}</version>
 		</dependency>
 		<dependency>
 			<groupId>javax.servlet</groupId>
 			<artifactId>servlet-api</artifactId>
+			<scope>compile</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.derby</groupId>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/38f37d79/tutorials/tutorial-rop-server/src/main/resources/cayenne-project.xml
----------------------------------------------------------------------
diff --git a/tutorials/tutorial-rop-server/src/main/resources/cayenne-project.xml b/tutorials/tutorial-rop-server/src/main/resources/cayenne-project.xml
index 1c7f367..27b1c1b 100644
--- a/tutorials/tutorial-rop-server/src/main/resources/cayenne-project.xml
+++ b/tutorials/tutorial-rop-server/src/main/resources/cayenne-project.xml
@@ -1,11 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
-<domain project-version="9">
+<domain xmlns="http://cayenne.apache.org/schema/10/domain"
+	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	 xsi:schemaLocation="http://cayenne.apache.org/schema/10/domain http://cayenne.apache.org/schema/10/domain.xsd"
+	 project-version="10">
 	<map name="datamap"/>
-
 	<node name="datanode"
 		 factory="org.apache.cayenne.configuration.server.XMLPoolingDataSourceFactory"
-		 schema-update-strategy="org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy"
-		>
+		 schema-update-strategy="org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy">
 		<map-ref name="datamap"/>
 		<data-source>
 			<driver value="org.apache.derby.jdbc.EmbeddedDriver"/>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/38f37d79/tutorials/tutorial-rop-server/src/main/resources/datamap.map.xml
----------------------------------------------------------------------
diff --git a/tutorials/tutorial-rop-server/src/main/resources/datamap.map.xml b/tutorials/tutorial-rop-server/src/main/resources/datamap.map.xml
index e0a7e3f..f879288 100644
--- a/tutorials/tutorial-rop-server/src/main/resources/datamap.map.xml
+++ b/tutorials/tutorial-rop-server/src/main/resources/datamap.map.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
-<data-map xmlns="http://cayenne.apache.org/schema/9/modelMap"
+<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/9/modelMap http://cayenne.apache.org/schema/9/modelMap.xsd"
-	 project-version="9">
+	 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.tutorial.persistent"/>
 	<property name="clientSupported" value="true"/>
 	<property name="defaultClientPackage" value="org.apache.cayenne.tutorial.persistent.client"/>
@@ -37,10 +37,10 @@
 	<db-relationship name="paintings" source="GALLERY" target="PAINTING" toMany="true">
 		<db-attribute-pair source="ID" target="GALLERY_ID"/>
 	</db-relationship>
-	<db-relationship name="artist" source="PAINTING" target="ARTIST" toMany="false">
+	<db-relationship name="artist" source="PAINTING" target="ARTIST">
 		<db-attribute-pair source="ARTIST_ID" target="ID"/>
 	</db-relationship>
-	<db-relationship name="gallery" source="PAINTING" target="GALLERY" toMany="false">
+	<db-relationship name="gallery" source="PAINTING" target="GALLERY">
 		<db-attribute-pair source="GALLERY_ID" target="ID"/>
 	</db-relationship>
 	<obj-relationship name="paintings" source="Artist" target="Painting" deleteRule="Cascade"
db-relationship-path="paintings"/>


Mime
View raw message