You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/06/07 08:33:35 UTC

[3/3] camel git commit: CAMEL-11382 - Creating IgniteComponent from Ignite Instance throws IllegalStateException

CAMEL-11382 - Creating IgniteComponent from Ignite Instance throws IllegalStateException


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1dde32f0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1dde32f0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1dde32f0

Branch: refs/heads/master
Commit: 1dde32f0e835a5ec8f30329049b96c8fe17e691e
Parents: e4503e3
Author: Gary Hodgson <co...@garyhodgson.com>
Authored: Tue Jun 6 22:43:47 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jun 7 10:32:28 2017 +0200

----------------------------------------------------------------------
 .../ignite/AbstractIgniteComponent.java         | 14 +-----
 .../component/ignite/IgniteCreationTest.java    | 47 ++++++++++++++++++++
 2 files changed, 48 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1dde32f0/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/AbstractIgniteComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/AbstractIgniteComponent.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/AbstractIgniteComponent.java
index eaf6583..e9efc79 100644
--- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/AbstractIgniteComponent.java
+++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/AbstractIgniteComponent.java
@@ -17,22 +17,9 @@
 package org.apache.camel.component.ignite;
 
 import java.io.InputStream;
-import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
-import java.util.Map;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.component.ignite.cache.IgniteCacheEndpoint;
-import org.apache.camel.component.ignite.compute.IgniteComputeEndpoint;
-import org.apache.camel.component.ignite.events.IgniteEventsEndpoint;
-import org.apache.camel.component.ignite.idgen.IgniteIdGenEndpoint;
-import org.apache.camel.component.ignite.messaging.IgniteMessagingEndpoint;
-import org.apache.camel.component.ignite.queue.IgniteQueueEndpoint;
-import org.apache.camel.component.ignite.set.IgniteSetEndpoint;
 import org.apache.camel.impl.DefaultComponent;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.URISupport;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.configuration.IgniteConfiguration;
@@ -121,6 +108,7 @@ public abstract class AbstractIgniteComponent extends DefaultComponent {
      */
     public void setIgnite(Ignite ignite) {
         this.ignite = ignite;
+        lifecycleMode = IgniteLifecycleMode.USER_MANAGED;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/camel/blob/1dde32f0/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCreationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCreationTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCreationTest.java
new file mode 100644
index 0000000..1da4e1c
--- /dev/null
+++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCreationTest.java
@@ -0,0 +1,47 @@
+/**
+ * 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.camel.component.ignite;
+
+import org.apache.camel.component.ignite.cache.IgniteCacheComponent;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.Ignition;
+import org.junit.Test;
+
+public class IgniteCreationTest extends AbstractIgniteTest {
+
+    @Override
+    protected String getScheme() {
+        return "ignite-cache";
+    }
+
+    @Override
+    protected AbstractIgniteComponent createComponent() {
+        Ignite ignite = Ignition.start(createConfiguration());
+        return IgniteCacheComponent.fromIgnite(ignite);
+    }
+
+    @Test
+    public void testCAMEL_11382() {
+       assertNotNull(ignite());
+    }
+
+    @Override
+    public boolean isCreateCamelContextPerClass() {
+        return true;
+    }
+
+}