Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0A15F1888E for ; Fri, 31 Jul 2015 06:11:06 +0000 (UTC) Received: (qmail 30080 invoked by uid 500); 31 Jul 2015 06:11:05 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 30039 invoked by uid 500); 31 Jul 2015 06:11:05 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 29945 invoked by uid 99); 31 Jul 2015 06:11:05 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Jul 2015 06:11:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id CEF33D91BA for ; Fri, 31 Jul 2015 06:11:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.373 X-Spam-Level: X-Spam-Status: No, score=0.373 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-1.428, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id EDt44qxCqZ8Z for ; Fri, 31 Jul 2015 06:10:50 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 3976530660 for ; Fri, 31 Jul 2015 06:10:38 +0000 (UTC) Received: (qmail 26731 invoked by uid 99); 31 Jul 2015 06:10:37 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Jul 2015 06:10:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B44F4DFDC7; Fri, 31 Jul 2015 06:10:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anovikov@apache.org To: commits@ignite.incubator.apache.org Date: Fri, 31 Jul 2015 06:10:55 -0000 Message-Id: In-Reply-To: <15a4ae0dcd5d4fadb73d4015e6eee03b@git.apache.org> References: <15a4ae0dcd5d4fadb73d4015e6eee03b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [19/50] [abbrv] incubator-ignite git commit: removing Google Compute Engine buckets on test finish removing Google Compute Engine buckets on test finish Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f22de3ea Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f22de3ea Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f22de3ea Branch: refs/heads/ignite-843 Commit: f22de3ea35b1506c8bcf4d2f7bb6d423a0b3225d Parents: 9bfc184 Author: Denis Magda Authored: Mon Jul 27 11:06:30 2015 +0300 Committer: Denis Magda Committed: Mon Jul 27 11:06:30 2015 +0300 ---------------------------------------------------------------------- .../TcpDiscoveryIpFinderAbstractSelfTest.java | 2 +- .../gce/TcpDiscoveryGoogleStorageIpFinder.java | 18 ++++++++++++ ...pDiscoveryGoogleStorageIpFinderSelfTest.java | 29 +++++++++++++++++++- 3 files changed, 47 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f22de3ea/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java index b5b8c63..ba660b8 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java @@ -31,7 +31,7 @@ import java.util.*; public abstract class TcpDiscoveryIpFinderAbstractSelfTest extends GridCommonAbstractTest { /** */ - private T finder; + protected T finder; /** * Constructor. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f22de3ea/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java ---------------------------------------------------------------------- diff --git a/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java b/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java index 48991e8..c2b1a91 100644 --- a/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java +++ b/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java @@ -380,4 +380,22 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt return new InetSocketAddress(res[0], port); } + + /** + * Used by TEST SUITES only. Called through reflection. + * + * @param bucketName Bucket to delete. + */ + private void removeBucket(String bucketName) { + init(); + + try { + Storage.Buckets.Delete deleteBucket = storage.buckets().delete(bucketName); + + deleteBucket.execute(); + } + catch (Exception e) { + throw new IgniteSpiException("Failed to remove the bucket: " + bucketName, e); + } + } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f22de3ea/modules/gce/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinderSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/gce/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinderSelfTest.java b/modules/gce/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinderSelfTest.java index 2fa0d43..f8929cc 100644 --- a/modules/gce/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinderSelfTest.java +++ b/modules/gce/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinderSelfTest.java @@ -21,6 +21,7 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.testsuites.*; +import java.lang.reflect.*; import java.net.InetAddress; import java.net.InetSocketAddress; import java.util.Collection; @@ -30,6 +31,9 @@ import java.util.Collection; */ public class TcpDiscoveryGoogleStorageIpFinderSelfTest extends TcpDiscoveryIpFinderAbstractSelfTest { + /** Bucket name. */ + private static String bucketName; + /** * Constructor. * @@ -40,6 +44,29 @@ public class TcpDiscoveryGoogleStorageIpFinderSelfTest } /** {@inheritDoc} */ + @Override protected void beforeTestsStarted() throws Exception { + bucketName = "ip-finder-test-bucket-" + InetAddress.getLocalHost().getAddress()[3]; + + super.beforeTestsStarted(); + } + + /** {@inheritDoc} */ + @Override protected void afterTestsStopped() throws Exception { + try { + Method method = TcpDiscoveryGoogleStorageIpFinder.class.getDeclaredMethod("removeBucket", String.class); + + method.setAccessible(true); + + method.invoke(finder, bucketName); + } + catch (Exception e) { + log.warning("Failed to remove bucket on GCE [bucketName=" + bucketName + ", mes=" + e.getMessage() + ']'); + } + + super.afterTestsStopped(); + } + + /** {@inheritDoc} */ @Override protected TcpDiscoveryGoogleStorageIpFinder ipFinder() throws Exception { TcpDiscoveryGoogleStorageIpFinder finder = new TcpDiscoveryGoogleStorageIpFinder(); @@ -52,7 +79,7 @@ public class TcpDiscoveryGoogleStorageIpFinderSelfTest finder.setProjectName(IgniteGCETestSuite.getProjectName()); // Bucket name must be unique across the whole GCE platform. - finder.setBucketName("ip-finder-test-bucket-" + InetAddress.getLocalHost().getAddress()[3]); + finder.setBucketName(bucketName); for (int i = 0; i < 5; i++) { Collection addrs = finder.getRegisteredAddresses();