From notifications-return-6867-archive-asf-public=cust-asf.ponee.io@ignite.apache.org Mon Sep 16 15:10:45 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 85A49180638 for ; Mon, 16 Sep 2019 17:10:45 +0200 (CEST) Received: (qmail 26970 invoked by uid 500); 16 Sep 2019 15:10:45 -0000 Mailing-List: contact notifications-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list notifications@ignite.apache.org Received: (qmail 26961 invoked by uid 99); 16 Sep 2019 15:10:44 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Sep 2019 15:10:44 +0000 From: GitBox To: notifications@ignite.apache.org Subject: [GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine. Message-ID: <156864664486.20309.15678806952865569270.gitbox@gitbox.apache.org> Date: Mon, 16 Sep 2019 15:10:44 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine. URL: https://github.com/apache/ignite/pull/6845#discussion_r324730783 ########## File path: modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java ########## @@ -0,0 +1,144 @@ +/* + * 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.ignite.internal.metric; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.CountDownLatch; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.spi.metric.view.SystemView; +import org.apache.ignite.spi.metric.view.CacheGroupView; +import org.apache.ignite.spi.metric.view.CacheView; +import org.apache.ignite.spi.metric.view.ComputeTaskView; +import org.apache.ignite.spi.metric.view.ServiceView; +import org.apache.ignite.internal.processors.service.DummyService; +import org.apache.ignite.internal.util.typedef.F; +import org.apache.ignite.services.ServiceConfiguration; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; + +import static org.apache.ignite.internal.processors.cache.ClusterCachesInfo.CACHES_VIEW; +import static org.apache.ignite.internal.processors.cache.ClusterCachesInfo.CACHE_GRPS_VIEW; +import static org.apache.ignite.internal.processors.service.IgniteServiceProcessor.SVCS_VIEW; +import static org.apache.ignite.internal.processors.task.GridTaskProcessor.TASKS_VIEW; + +/** */ +public class SystemViewSelfTest extends GridCommonAbstractTest { + /** */ + private static CountDownLatch latch; + + /** */ + @Test + public void testCachesView() throws Exception { + try (IgniteEx g = startGrid()) { + Set cacheNames = new HashSet<>(Arrays.asList("cache-1", "cache-2")); + + for (String name : cacheNames) + g.createCache(name); + + SystemView caches = g.context().metric().view(CACHES_VIEW); + + assertEquals(g.context().cache().cacheDescriptors().size(), F.size(caches.iterator())); + + for (CacheView row : caches) + cacheNames.remove(row.cacheName()); + + assertTrue(cacheNames.toString(), cacheNames.isEmpty()); + } + } + + /** */ + @Test + public void testCacheGroupsView() throws Exception { + try(IgniteEx g = startGrid()) { + Set grpNames = new HashSet<>(Arrays.asList("grp-1", "grp-2")); + + for (String grpName : grpNames) + g.createCache(new CacheConfiguration<>("cache-" + grpName).setGroupName(grpName)); + + SystemView grps = g.context().metric().view(CACHE_GRPS_VIEW); + + assertEquals(g.context().cache().cacheGroupDescriptors().size(), F.size(grps.iterator())); + + for (CacheGroupView row : grps) + grpNames.remove(row.cacheGroupName()); + + assertTrue(grpNames.toString(), grpNames.isEmpty()); + } + } + + /** */ + @Test + public void testServices() throws Exception { + try(IgniteEx g = startGrid()) { + ServiceConfiguration srvcCfg = new ServiceConfiguration(); + + srvcCfg.setName("service"); + srvcCfg.setMaxPerNodeCount(1); + srvcCfg.setService(new DummyService()); + + g.services().deploy(srvcCfg); + + SystemView srvs = g.context().metric().view(SVCS_VIEW); + + assertEquals(g.context().service().serviceDescriptors().size(), F.size(srvs.iterator())); + + ServiceView sview = srvs.iterator().next(); + + assertEquals(srvcCfg.getName(), sview.name()); + assertEquals(srvcCfg.getMaxPerNodeCount(), sview.maxPerNodeCount()); + assertEquals(DummyService.class, sview.serviceClass()); + } + } + + /** */ + @Test + public void testComputeBroadcast() throws Exception { + latch = new CountDownLatch(1); + + try(IgniteEx g1 = startGrid(0)) { Review comment: Space missed ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services