Return-Path: X-Original-To: apmail-brooklyn-commits-archive@minotaur.apache.org Delivered-To: apmail-brooklyn-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 1982B184EC for ; Tue, 27 Oct 2015 14:48:48 +0000 (UTC) Received: (qmail 53589 invoked by uid 500); 27 Oct 2015 14:48:26 -0000 Delivered-To: apmail-brooklyn-commits-archive@brooklyn.apache.org Received: (qmail 53566 invoked by uid 500); 27 Oct 2015 14:48:25 -0000 Mailing-List: contact commits-help@brooklyn.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.incubator.apache.org Delivered-To: mailing list commits@brooklyn.incubator.apache.org Received: (qmail 53557 invoked by uid 99); 27 Oct 2015 14:48:25 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Oct 2015 14:48:25 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 7F6C4C0E4D for ; Tue, 27 Oct 2015 14:48:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.77 X-Spam-Level: * X-Spam-Status: No, score=1.77 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id K73VD-AkGZTm for ; Tue, 27 Oct 2015 14:48:24 +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 2D15920F43 for ; Tue, 27 Oct 2015 14:48:24 +0000 (UTC) Received: (qmail 53536 invoked by uid 99); 27 Oct 2015 14:48:24 -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; Tue, 27 Oct 2015 14:48:24 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DCC59DFCE0; Tue, 27 Oct 2015 14:48:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: svet@apache.org To: commits@brooklyn.incubator.apache.org Date: Tue, 27 Oct 2015 14:48:23 -0000 Message-Id: <858a685f611c4fb1b476bbe8423bf1ce@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/8] incubator-brooklyn git commit: Introduce relationships between brooklyn objects Repository: incubator-brooklyn Updated Branches: refs/heads/master c6273b891 -> 52241ae61 http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/772e707f/core/src/test/java/org/apache/brooklyn/core/relations/RelationshipTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/relations/RelationshipTest.java b/core/src/test/java/org/apache/brooklyn/core/relations/RelationshipTest.java new file mode 100644 index 0000000..ba114dd --- /dev/null +++ b/core/src/test/java/org/apache/brooklyn/core/relations/RelationshipTest.java @@ -0,0 +1,58 @@ +/* + * 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.brooklyn.core.relations; + +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.core.test.entity.TestEntity; +import org.testng.Assert; +import org.testng.annotations.Test; + +import brooklyn.basic.relations.Relationship; + +@Test +public class RelationshipTest { + + static Relationship AUNTIE_OF = Relationships.newRelationshipPair( + "auntie", "aunties", Entity.class, "auntie_of_nephew", + "nephew", "nephews", TestEntity.class, "nephew_of_auntie"); + + static Relationship NEPHEW_OF = AUNTIE_OF.getInverseRelationship(); + + public void testFields() { + Assert.assertEquals(AUNTIE_OF.getRelationshipTypeName(), "auntie_of_nephew"); + Assert.assertEquals(AUNTIE_OF.getSourceType(), Entity.class); + Assert.assertEquals(AUNTIE_OF.getTargetType(), TestEntity.class); + Assert.assertEquals(AUNTIE_OF.getSourceName(), "auntie"); + Assert.assertEquals(AUNTIE_OF.getTargetName(), "nephew"); + Assert.assertEquals(AUNTIE_OF.getSourceNamePlural(), "aunties"); + Assert.assertEquals(AUNTIE_OF.getTargetNamePlural(), "nephews"); + + Assert.assertEquals(NEPHEW_OF.getRelationshipTypeName(), "nephew_of_auntie"); + Assert.assertEquals(NEPHEW_OF.getSourceType(), TestEntity.class); + Assert.assertEquals(NEPHEW_OF.getTargetType(), Entity.class); + Assert.assertEquals(NEPHEW_OF.getSourceName(), "nephew"); + Assert.assertEquals(NEPHEW_OF.getTargetName(), "auntie"); + Assert.assertEquals(NEPHEW_OF.getSourceNamePlural(), "nephews"); + Assert.assertEquals(NEPHEW_OF.getTargetNamePlural(), "aunties"); + + Assert.assertEquals(NEPHEW_OF.getInverseRelationship(), AUNTIE_OF); + Assert.assertEquals(AUNTIE_OF.getInverseRelationship(), NEPHEW_OF); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/772e707f/core/src/test/java/org/apache/brooklyn/util/core/internal/FlagUtilsTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/util/core/internal/FlagUtilsTest.java b/core/src/test/java/org/apache/brooklyn/util/core/internal/FlagUtilsTest.java index 81c760e..a75db17 100644 --- a/core/src/test/java/org/apache/brooklyn/util/core/internal/FlagUtilsTest.java +++ b/core/src/test/java/org/apache/brooklyn/util/core/internal/FlagUtilsTest.java @@ -272,6 +272,11 @@ public class FlagUtilsTest { return configSupport; } + @Override + public T getConfig(ConfigKey key) { + return config().get(key); + } + public T setConfig(ConfigKey key, T val) { return config().set(key, val); } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/772e707f/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java ---------------------------------------------------------------------- diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java index b278f02..e16d825 100644 --- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java +++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ObjectsYamlTest.java @@ -97,6 +97,11 @@ public class ObjectsYamlTest extends AbstractYamlTest { public void setDouble(Double value) { this.value = value; } @Override + public T getConfig(ConfigKey key) { + return config().get(key); + } + + @Override public T setConfig(ConfigKey key, T value) { return config().set(key, value); }