Repository: incubator-brooklyn Updated Branches: refs/heads/master ab81a2fbe -> d85719b4d
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4de9f731/utils/test-bundles/more-entities-v2-evil-twin/pom.xml ---------------------------------------------------------------------- diff --git a/utils/test-bundles/more-entities-v2-evil-twin/pom.xml b/utils/test-bundles/more-entities-v2-evil-twin/pom.xml new file mode 100644 index 0000000..5db9c8b --- /dev/null +++ b/utils/test-bundles/more-entities-v2-evil-twin/pom.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <packaging>jar</packaging> + + <groupId>org.apache.brooklyn.test.resources.osgi.evil_twin</groupId> + <artifactId>brooklyn-test-osgi-more-entities</artifactId> + <version>0.2.0</version> + + <name>OSGi bundled test entities</name> + + <description> + Simple entities for testing the OSGi functionality + </description> + + <parent> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-parent</artifactId> + <version>0.8.0-SNAPSHOT</version><!-- BROOKLYN_VERSION --> + <relativePath>../../../parent/pom.xml</relativePath> + </parent> + <dependencies> + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-core</artifactId> + <version>${brooklyn.version}</version> + </dependency> + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-api</artifactId> + <version>${brooklyn.version}</version> + </dependency> + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-utils-common</artifactId> + <version>${brooklyn.version}</version> + </dependency> + <dependency> + <groupId>org.apache.brooklyn.test.resources.osgi</groupId> + <artifactId>brooklyn-test-osgi-entities</artifactId> + <version>0.1.0</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>2.5.3</version> + <configuration> + <instructions> + <Bundle-SymbolicName>org.apache.brooklyn.test.resources.osgi.brooklyn-test-osgi-more-entities</Bundle-SymbolicName> + <Bundle-Version>${project.version}</Bundle-Version> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4de9f731/utils/test-bundles/more-entities-v2-evil-twin/src/main/java/brooklyn/osgi/tests/more/MoreEntity.java ---------------------------------------------------------------------- diff --git a/utils/test-bundles/more-entities-v2-evil-twin/src/main/java/brooklyn/osgi/tests/more/MoreEntity.java b/utils/test-bundles/more-entities-v2-evil-twin/src/main/java/brooklyn/osgi/tests/more/MoreEntity.java new file mode 100644 index 0000000..553cbc5 --- /dev/null +++ b/utils/test-bundles/more-entities-v2-evil-twin/src/main/java/brooklyn/osgi/tests/more/MoreEntity.java @@ -0,0 +1,38 @@ +/* + * 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 brooklyn.osgi.tests.more; + + +import brooklyn.entity.Effector; +import brooklyn.entity.Entity; +import brooklyn.entity.effector.Effectors; +import brooklyn.entity.proxying.ImplementedBy; + +@ImplementedBy(MoreEntityImpl.class) +public interface MoreEntity extends Entity { + + public static final Effector<String> SAY_HI = Effectors.effector(String.class, "sayHI") + .description("says HO to an uppercased name") + .parameter(String.class, "name") + .buildAbstract(); + + /** Makes a string saying HO to the given name, in contrast to v1 and v2. */ + String sayHI(String name); + +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4de9f731/utils/test-bundles/more-entities-v2-evil-twin/src/main/java/brooklyn/osgi/tests/more/MoreEntityImpl.java ---------------------------------------------------------------------- diff --git a/utils/test-bundles/more-entities-v2-evil-twin/src/main/java/brooklyn/osgi/tests/more/MoreEntityImpl.java b/utils/test-bundles/more-entities-v2-evil-twin/src/main/java/brooklyn/osgi/tests/more/MoreEntityImpl.java new file mode 100644 index 0000000..6200787 --- /dev/null +++ b/utils/test-bundles/more-entities-v2-evil-twin/src/main/java/brooklyn/osgi/tests/more/MoreEntityImpl.java @@ -0,0 +1,47 @@ +/* + * 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 brooklyn.osgi.tests.more; + +import brooklyn.entity.basic.AbstractEntity; +import brooklyn.entity.effector.EffectorBody; +import brooklyn.policy.PolicySpec; +import brooklyn.util.config.ConfigBag; + + +public class MoreEntityImpl extends AbstractEntity implements MoreEntity { + + /** Unlike v1, this declares an explicit dependency on SimplePolicy */ + @Override + public void init() { + super.init(); + getMutableEntityType().addEffector(SAY_HI, new EffectorBody<String>() { + @Override + public String call(ConfigBag parameters) { + return sayHI((String)parameters.getStringKey("name")); + } + }); + addPolicy(PolicySpec.create(brooklyn.osgi.tests.SimplePolicy.class)); + } + + /** Returns HO instead of HI (like v2 non-evil twin) or Hi (like v1) */ + public String sayHI(String name) { + return "HO "+name.toUpperCase()+" FROM V2 EVIL TWIN"; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4de9f731/utils/test-bundles/more-entities-v2/pom.xml ---------------------------------------------------------------------- diff --git a/utils/test-bundles/more-entities-v2/pom.xml b/utils/test-bundles/more-entities-v2/pom.xml new file mode 100644 index 0000000..d066557 --- /dev/null +++ b/utils/test-bundles/more-entities-v2/pom.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <packaging>jar</packaging> + + <groupId>org.apache.brooklyn.test.resources.osgi</groupId> + <artifactId>brooklyn-test-osgi-more-entities</artifactId> + <version>0.2.0</version> + + <name>OSGi bundled test entities</name> + + <description> + Simple entities for testing the OSGi functionality + </description> + + <parent> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-parent</artifactId> + <version>0.8.0-SNAPSHOT</version><!-- BROOKLYN_VERSION --> + <relativePath>../../../parent/pom.xml</relativePath> + </parent> + <dependencies> + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-core</artifactId> + <version>${brooklyn.version}</version> + </dependency> + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-api</artifactId> + <version>${brooklyn.version}</version> + </dependency> + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-utils-common</artifactId> + <version>${brooklyn.version}</version> + </dependency> + <dependency> + <groupId>org.apache.brooklyn.test.resources.osgi</groupId> + <artifactId>brooklyn-test-osgi-entities</artifactId> + <version>0.1.0</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>2.5.3</version> + <configuration> + <instructions> + <Bundle-Version>${project.version}</Bundle-Version> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4de9f731/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreEntity.java ---------------------------------------------------------------------- diff --git a/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreEntity.java b/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreEntity.java new file mode 100644 index 0000000..837d6a4 --- /dev/null +++ b/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreEntity.java @@ -0,0 +1,41 @@ +/* + * 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 brooklyn.osgi.tests.more; + + +import org.apache.brooklyn.catalog.Catalog; +import brooklyn.entity.Effector; +import brooklyn.entity.Entity; +import brooklyn.entity.effector.Effectors; +import brooklyn.entity.proxying.ImplementedBy; + +@Catalog(name="More Entity v2") +@ImplementedBy(MoreEntityImpl.class) +public interface MoreEntity extends Entity { + + public static final Effector<String> SAY_HI = Effectors.effector(String.class, "sayHI") + .description("says HI to an uppercased name") + .parameter(String.class, "name") + .buildAbstract(); + + /** Makes a string saying hi to the given name, in uppercase, for testing. + * In contrast to v1, impl here returns HI not Hi. */ + String sayHI(String name); + +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4de9f731/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreEntityImpl.java ---------------------------------------------------------------------- diff --git a/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreEntityImpl.java b/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreEntityImpl.java new file mode 100644 index 0000000..a3952cf --- /dev/null +++ b/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreEntityImpl.java @@ -0,0 +1,47 @@ +/* + * 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 brooklyn.osgi.tests.more; + +import brooklyn.entity.basic.AbstractEntity; +import brooklyn.entity.effector.EffectorBody; +import brooklyn.policy.PolicySpec; +import brooklyn.util.config.ConfigBag; + + +public class MoreEntityImpl extends AbstractEntity implements MoreEntity { + + /** Unlike v1, this declares an explicit dependency on SimplePolicy */ + @Override + public void init() { + super.init(); + getMutableEntityType().addEffector(SAY_HI, new EffectorBody<String>() { + @Override + public String call(ConfigBag parameters) { + return sayHI((String)parameters.getStringKey("name")); + } + }); + addPolicy(PolicySpec.create(brooklyn.osgi.tests.SimplePolicy.class)); + } + + /** Unlike v1, this returns "HI " rather than "Hi " */ + public String sayHI(String name) { + return "HI "+name.toUpperCase()+" FROM V2"; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4de9f731/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreLocation.java ---------------------------------------------------------------------- diff --git a/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreLocation.java b/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreLocation.java new file mode 100644 index 0000000..5edaac0 --- /dev/null +++ b/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreLocation.java @@ -0,0 +1,27 @@ +/* + * 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 brooklyn.osgi.tests.more; + + +import org.apache.brooklyn.catalog.Catalog; +import brooklyn.location.basic.AbstractLocation; + +@Catalog(name="More Location", description="Cataliog item OSGi test location") +public class MoreLocation extends AbstractLocation { +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4de9f731/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MorePolicy.java ---------------------------------------------------------------------- diff --git a/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MorePolicy.java b/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MorePolicy.java new file mode 100644 index 0000000..b6b852b --- /dev/null +++ b/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MorePolicy.java @@ -0,0 +1,30 @@ +/* + * 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 brooklyn.osgi.tests.more; + + +import org.apache.brooklyn.catalog.Catalog; +import brooklyn.policy.basic.AbstractPolicy; + +@Catalog(name="More Policy", description="Cataliog item OSGi test policy") +public class MorePolicy extends AbstractPolicy { + public String sayHI(String name) { + return "HI "+name.toUpperCase()+" FROM V2"; + } +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4de9f731/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreTemplate.java ---------------------------------------------------------------------- diff --git a/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreTemplate.java b/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreTemplate.java new file mode 100644 index 0000000..c2244aa --- /dev/null +++ b/utils/test-bundles/more-entities-v2/src/main/java/brooklyn/osgi/tests/more/MoreTemplate.java @@ -0,0 +1,32 @@ +/* + * 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 brooklyn.osgi.tests.more; + + +import org.apache.brooklyn.catalog.Catalog; +import brooklyn.entity.Application; +import brooklyn.entity.Effector; +import brooklyn.entity.Entity; +import brooklyn.entity.basic.AbstractApplication; +import brooklyn.entity.effector.Effectors; +import brooklyn.entity.proxying.ImplementedBy; + +@Catalog(name="More Template", description="Cataliog item OSGi test template") +public class MoreTemplate extends AbstractApplication { +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4de9f731/utils/test-bundles/pom.xml ---------------------------------------------------------------------- diff --git a/utils/test-bundles/pom.xml b/utils/test-bundles/pom.xml new file mode 100644 index 0000000..d21ce93 --- /dev/null +++ b/utils/test-bundles/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn</artifactId> + <version>0.8.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION --> + <relativePath>../../pom.xml</relativePath> + </parent> + + <groupId>org.apache.brooklyn.test</groupId> + <artifactId>brooklyn-test-bundles</artifactId> + <packaging>pom</packaging> + + <name>Brooklyn Test Bundles</name> + <description> + OSGi bundles used for testing. + </description> + + <modules> + <module>entities</module> + <module>more-entities-v1</module> + <module>more-entities-v2</module> + <module>more-entities-v2-evil-twin</module> + </modules> +</project>
