brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #489: BROOKLYN-409: add test
Date Fri, 16 Dec 2016 15:31:33 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/489#discussion_r92830356
  
    --- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityRebindTest.java
---
    @@ -0,0 +1,91 @@
    +/*
    + * 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.camp.brooklyn.catalog;
    +
    +import static org.testng.Assert.assertEquals;
    +
    +import org.apache.brooklyn.api.entity.Entity;
    +import org.apache.brooklyn.api.policy.Policy;
    +import org.apache.brooklyn.camp.brooklyn.AbstractYamlRebindTest;
    +import org.apache.brooklyn.core.entity.StartableApplication;
    +import org.apache.brooklyn.core.mgmt.osgi.OsgiVersionMoreEntityTest;
    +import org.apache.brooklyn.core.test.entity.TestEntity;
    +import org.apache.brooklyn.entity.stock.BasicApplication;
    +import org.apache.brooklyn.test.support.TestResourceUnavailableException;
    +import org.apache.brooklyn.util.osgi.OsgiTestResources;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +import org.testng.annotations.Test;
    +
    +import com.google.common.base.Joiner;
    +import com.google.common.collect.Iterables;
    +
    +/** Many of the same tests as per {@link OsgiVersionMoreEntityTest} but using YAML for
catalog and entities, so catalog item ID is set automatically */
    +public class CatalogOsgiVersionMoreEntityRebindTest extends AbstractYamlRebindTest {
    +    
    +    @SuppressWarnings("unused")
    +    private static final Logger log = LoggerFactory.getLogger(CatalogOsgiVersionMoreEntityRebindTest.class);
    +
    +    @Override
    +    protected boolean useOsgi() {
    +        return true;
    +    }
    +
    +    // See https://issues.apache.org/jira/browse/BROOKLYN-409
    +    @Test
    +    public void testPolicyInBundleReferencedByStockCatalogItem() throws Exception {
    +        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_COM_EXAMPLE_PATH);
    +        
    +        String policyType = OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_COM_EXAMPLE_POLICY;
    +        
    +        String yaml1 = Joiner.on("\n").join(
    +                "brooklyn.catalog:",
    +                "  id: wrapped-entity",
    +                "  version: 1.0",
    +                "  item:",
    +                "    services:",
    +                "    - type: " + TestEntity.class.getName());
    +        addCatalogItems(yaml1);
    --- End diff --
    
    `addCatalogItems` supports `String... catalogYaml` - no need to join them above.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message