Repository: cayenne
Updated Branches:
  refs/heads/master 2bc717d28 -> f6a58d687


CAY-2166 Auto-loading of Cayenne modules

* auto-loading DbSyncModule


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/4e90ad4e
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/4e90ad4e
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/4e90ad4e

Branch: refs/heads/master
Commit: 4e90ad4e8b0bc6fd8b2184e5390b00688e6c9a37
Parents: 2bc717d
Author: Andrus Adamchik <and...@objectstyle.com>
Authored: Sun Dec 11 17:05:33 2016 +0300
Committer: Andrus Adamchik <and...@objectstyle.com>
Committed: Sun Dec 11 21:04:51 2016 +0300

----------------------------------------------------------------------
 .../cayenne/dbsync/DbSyncModuleProvider.java    | 48 ++++++++++++++++++++
 .../org.apache.cayenne.di.spi.ModuleProvider    |  1 +
 .../dbsync/DbSyncModuleProviderTest.java        | 29 ++++++++++++
 3 files changed, 78 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/4e90ad4e/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/DbSyncModuleProvider.java
----------------------------------------------------------------------
diff --git 
a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/DbSyncModuleProvider.java
 
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/DbSyncModuleProvider.java
new file mode 100644
index 0000000..fb0cb8d
--- /dev/null
+++ 
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/DbSyncModuleProvider.java
@@ -0,0 +1,48 @@
+/*
+ *    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.dbsync;
+
+import org.apache.cayenne.di.Module;
+import org.apache.cayenne.di.spi.ModuleProvider;
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * Auto-loading provider for {@link DbSyncModule}.
+ *
+ * @since 4.0
+ */
+public class DbSyncModuleProvider implements ModuleProvider {
+
+    @Override
+    public Module module() {
+        return new DbSyncModule();
+    }
+
+    @Override
+    public Class<? extends Module> moduleType() {
+        return DbSyncModule.class;
+    }
+
+    @Override
+    public Collection<Class<? extends Module>> overrides() {
+        return Collections.emptyList();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/4e90ad4e/cayenne-dbsync/src/main/resources/META-INF/services/org.apache.cayenne.di.spi.ModuleProvider
----------------------------------------------------------------------
diff --git 
a/cayenne-dbsync/src/main/resources/META-INF/services/org.apache.cayenne.di.spi.ModuleProvider
 
b/cayenne-dbsync/src/main/resources/META-INF/services/org.apache.cayenne.di.spi.ModuleProvider
new file mode 100644
index 0000000..7784c87
--- /dev/null
+++ 
b/cayenne-dbsync/src/main/resources/META-INF/services/org.apache.cayenne.di.spi.ModuleProvider
@@ -0,0 +1 @@
+org.apache.cayenne.dbsync.DbSyncModuleProvider
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/4e90ad4e/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/DbSyncModuleProviderTest.java
----------------------------------------------------------------------
diff --git 
a/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/DbSyncModuleProviderTest.java
 
b/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/DbSyncModuleProviderTest.java
new file mode 100644
index 0000000..bc7cd19
--- /dev/null
+++ 
b/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/DbSyncModuleProviderTest.java
@@ -0,0 +1,29 @@
+/*
+ *    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.dbsync;
+
+import org.apache.cayenne.unit.util.ModuleProviderChecker;
+import org.junit.Test;
+
+public class DbSyncModuleProviderTest {
+    @Test
+    public void testProviderPresent() {
+        ModuleProviderChecker.testProviderPresent(DbSyncModuleProvider.class);
+    }
+}

Reply via email to