ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: ignite-471-2: merge from ignite-sprint-6
Date Tue, 09 Jun 2015 13:04:44 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-471-2 384c3adbc -> 19f2b865f


ignite-471-2: merge from ignite-sprint-6


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/19f2b865
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/19f2b865
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/19f2b865

Branch: refs/heads/ignite-471-2
Commit: 19f2b865fb58cda493f2e9ed8c8251e9ac1d9ad9
Parents: 384c3ad
Author: Denis Magda <dmagda@gridgain.com>
Authored: Tue Jun 9 16:04:32 2015 +0300
Committer: Denis Magda <dmagda@gridgain.com>
Committed: Tue Jun 9 16:04:32 2015 +0300

----------------------------------------------------------------------
 DEVNOTES.txt                                    |  7 +++
 .../cloud/TcpDiscoveryCloudIpFinder.java        | 25 +++++++---
 .../TcpDiscoveryCloudIpFinderSelfTest.java      |  3 +-
 .../internal/interop/InteropIgnition.java       | 52 +++++++++++++++++++-
 .../internal/interop/InteropProcessor.java      |  8 +++
 5 files changed, 83 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/19f2b865/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/DEVNOTES.txt b/DEVNOTES.txt
index 1562dc4..8f1730c 100644
--- a/DEVNOTES.txt
+++ b/DEVNOTES.txt
@@ -69,6 +69,13 @@ To test compliance with JCache TCK use:
 
 mvn test -P-release,jcache-tck -pl :ignite-core -am
 
+Run tests
+==========
+To run tests locally use:
+
+mvn clean test -U -Plgpl,examples,-clean-libs,-release -Dmaven.test.failure.ignore=true -DfailIfNoTests=false
-Dtest=%TEST_PATTERN%
+
+For example, %TEST_PATTERN% can be 'org.apache.ignite.testsuites.IgniteBasicTestSuite' or
'GridCacheLocalAtomicFullApiSelfTest#testGet'
 
 Apache RAT Instructions
 =======================

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/19f2b865/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java
b/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java
index 2637742..7555b16 100644
--- a/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java
+++ b/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java
@@ -30,6 +30,7 @@ import org.jclouds.*;
 import org.jclouds.compute.*;
 import org.jclouds.compute.domain.*;
 import org.jclouds.domain.*;
+import org.jclouds.googlecloud.*;
 import org.jclouds.location.reference.*;
 
 import java.io.*;
@@ -97,7 +98,7 @@ import java.util.concurrent.atomic.*;
  *                     &lt;bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.cloud.TcpDiscoveryCloudIpFinder"/&gt;
  *                         &lt;property name="provider" value="google-compute-engine"/&gt;
  *                         &lt;property name="identity" value="your_service_account_email"/&gt;
- *                         &lt;property name="credentialPath" value="path_to_pem_file"/&gt;
+ *                         &lt;property name="credentialPath" value="path_to_json_key"/&gt;
  *                         &lt;property name="zones"&gt;
  *                             &lt;list&gt;
  *                                 &lt;value>us-central1-a&lt/value&gt;
@@ -253,8 +254,7 @@ public class TcpDiscoveryCloudIpFinder extends TcpDiscoveryIpFinderAdapter
{
     /**
      * Sets the path to a credential that is used during authentication on the cloud.
      *
-     * This method should be used when an access key or private key is stored in a plain
or PEM file without
-     * a passphrase.
+     * This method should be used when an access key or private key is stored in a file.
      * Content of the file, referred by @{code credentialPath}, is fully read and used as
a access key or private key
      * during authentication.
      *
@@ -322,7 +322,7 @@ public class TcpDiscoveryCloudIpFinder extends TcpDiscoveryIpFinderAdapter
{
                     throw new IgniteSpiException("Both credential and credentialPath are
set. Use only one method.");
 
                 if (credentialPath != null)
-                    credential = getPrivateKeyFromFile();
+                    credential = getCredentialFromFile();
 
                 try {
                     ContextBuilder ctxBuilder = ContextBuilder.newBuilder(provider);
@@ -398,13 +398,22 @@ public class TcpDiscoveryCloudIpFinder extends TcpDiscoveryIpFinderAdapter
{
     }
 
     /**
-     * Retrieves a private key from the secrets file.
+     * Reads credential info from {@link #credentialPath} and returns in a string format.
      *
-     * @return Private key
+     * @return Credential in {@code String} representation.
+     * @throws IgniteSpiException In case of error.
      */
-    private String getPrivateKeyFromFile() throws IgniteSpiException {
+    private String getCredentialFromFile() throws IgniteSpiException {
         try {
-            return Files.toString(new File(credentialPath), Charsets.UTF_8);
+            String fileContents = Files.toString(new File(credentialPath), Charsets.UTF_8);
+
+            if (provider.equals("google-compute-engine")) {
+                Supplier<Credentials> credentialSupplier = new GoogleCredentialsFromJson(fileContents);
+
+                return credentialSupplier.get().credential;
+            }
+
+            return fileContents;
         }
         catch (IOException e) {
             throw new IgniteSpiException("Failed to retrieve the private key from the file:
" + credentialPath, e);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/19f2b865/modules/cloud/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/cloud/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinderSelfTest.java
b/modules/cloud/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinderSelfTest.java
index aba0760..d1d945f 100644
--- a/modules/cloud/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinderSelfTest.java
+++ b/modules/cloud/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinderSelfTest.java
@@ -101,9 +101,8 @@ public class TcpDiscoveryCloudIpFinderSelfTest extends
 
         if (provider.equals("google-compute-engine"))
             ipFinder.setCredentialPath(IgniteCloudTestSuite.getSecretKey(provider));
-        else {
+        else
             ipFinder.setCredential(IgniteCloudTestSuite.getSecretKey(provider));
-        }
 
         Collection<InetSocketAddress> addresses = ipFinder.getRegisteredAddresses();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/19f2b865/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
index 3ccd361..d8cc276 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
@@ -35,6 +35,9 @@ import java.util.*;
  */
 @SuppressWarnings("UnusedDeclaration")
 public class InteropIgnition {
+    /** Map with active instances. */
+    private static final HashMap<String, InteropProcessor> instances = new HashMap<>();
+
     /**
      * Start Ignite node in interop mode.
      *
@@ -44,8 +47,8 @@ public class InteropIgnition {
      * @param envPtr Environment pointer.
      * @return Ignite instance.
      */
-    public static InteropProcessor start(@Nullable String springCfgPath, @Nullable String
gridName, int factoryId,
-        long envPtr) {
+    public static synchronized InteropProcessor start(@Nullable String springCfgPath, @Nullable
String gridName,
+        int factoryId, long envPtr) {
         IgniteConfiguration cfg = configuration(springCfgPath);
 
         if (gridName != null)
@@ -57,10 +60,55 @@ public class InteropIgnition {
 
         trackFinalization(proc);
 
+        InteropProcessor old = instances.put(gridName, proc);
+
+        assert old == null;
+
         return proc;
     }
 
     /**
+     * Get instance by environment pointer.
+     *
+     * @param gridName Grid name.
+     * @return Instance or {@code null} if it doesn't exists (never started or stopped).
+     */
+    @Nullable public static synchronized InteropProcessor instance(@Nullable String gridName)
{
+        return instances.get(gridName);
+    }
+
+    /**
+     * Stop single instance.
+     *
+     * @param gridName Grid name,
+     * @param cancel Cancel flag.
+     * @return {@code True} if instance was found and stopped.
+     */
+    public static synchronized boolean stop(@Nullable String gridName, boolean cancel) {
+        if (Ignition.stop(gridName, cancel)) {
+            InteropProcessor old = instances.remove(gridName);
+
+            assert old != null;
+
+            return true;
+        }
+        else
+            return false;
+    }
+
+    /**
+     * Stop all instances.
+     *
+     * @param cancel Cancel flag.
+     */
+    public static synchronized void stopAll(boolean cancel) {
+        for (InteropProcessor proc : instances.values())
+            Ignition.stop(proc.ignite().name(), cancel);
+
+        instances.clear();
+    }
+
+    /**
      * Create configuration.
      *
      * @param springCfgPath Path to Spring XML.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/19f2b865/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
index aa4f877..325a464 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.interop;
 
+import org.apache.ignite.*;
 import org.jetbrains.annotations.*;
 
 /**
@@ -24,6 +25,13 @@ import org.jetbrains.annotations.*;
  */
 public interface InteropProcessor {
     /**
+     * Get owning Ignite instance.
+     *
+     * @return Ignite instance.
+     */
+    public Ignite ignite();
+
+    /**
      * Get stop runnable to perform cleanup when interop is not longer used.
      * <p/>
      * <b>NOTE!</b> This runnable is called when current instance of interop
processor is eligible for garbage


Mime
View raw message