http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-management/management-core/src/test/java/org/jclouds/management/ComputeMBeanFactory.java ---------------------------------------------------------------------- diff --git a/jclouds-management/management-core/src/test/java/org/jclouds/management/ComputeMBeanFactory.java b/jclouds-management/management-core/src/test/java/org/jclouds/management/ComputeMBeanFactory.java deleted file mode 100644 index c657efe..0000000 --- a/jclouds-management/management-core/src/test/java/org/jclouds/management/ComputeMBeanFactory.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.jclouds.management; - -import com.google.common.reflect.TypeToken; -import org.jclouds.apis.Compute; - -public class ComputeMBeanFactory implements ViewMBeanFactory<Compute> { - - /** - * Creates a {@link ManagedBean} for the Context. - * - * @param view - * @return - */ - @Override - public ViewMBean<Compute> create(Compute view) { - return new ComputeManagement(); - } - - /** - * Returns the {@link com.google.common.reflect.TypeToken} of the {@link org.jclouds.View}. - * - * @return - */ - @Override - public TypeToken getViewType() { - return TypeToken.of(Compute.class); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - return true; - } -}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-management/management-core/src/test/java/org/jclouds/management/ComputeManagement.java ---------------------------------------------------------------------- diff --git a/jclouds-management/management-core/src/test/java/org/jclouds/management/ComputeManagement.java b/jclouds-management/management-core/src/test/java/org/jclouds/management/ComputeManagement.java deleted file mode 100644 index c738aae..0000000 --- a/jclouds-management/management-core/src/test/java/org/jclouds/management/ComputeManagement.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.jclouds.management; - - -import org.jclouds.apis.Compute; - -public class ComputeManagement implements ComputeManagementMBean, ViewMBean<Compute> { - - - /** - * Returns the type of the MBean. - * - * @return - */ - @Override - public String getType() { - return "test"; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-management/management-core/src/test/java/org/jclouds/management/ComputeManagementMBean.java ---------------------------------------------------------------------- diff --git a/jclouds-management/management-core/src/test/java/org/jclouds/management/ComputeManagementMBean.java b/jclouds-management/management-core/src/test/java/org/jclouds/management/ComputeManagementMBean.java deleted file mode 100644 index b259cc6..0000000 --- a/jclouds-management/management-core/src/test/java/org/jclouds/management/ComputeManagementMBean.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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.jclouds.management; - -public interface ComputeManagementMBean { -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-management/management-core/src/test/java/org/jclouds/management/StorageMBeanFactory.java ---------------------------------------------------------------------- diff --git a/jclouds-management/management-core/src/test/java/org/jclouds/management/StorageMBeanFactory.java b/jclouds-management/management-core/src/test/java/org/jclouds/management/StorageMBeanFactory.java deleted file mode 100644 index e9d2a0c..0000000 --- a/jclouds-management/management-core/src/test/java/org/jclouds/management/StorageMBeanFactory.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.jclouds.management; - -import com.google.common.reflect.TypeToken; -import org.jclouds.apis.Storage; - -public class StorageMBeanFactory implements ViewMBeanFactory<Storage> { - - /** - * Creates a {@link org.jclouds.management.ManagedBean} for the Context. - * - * @param view - * @return - */ - @Override - public ViewMBean<Storage> create(Storage view) { - return new StorageManagement(); - } - - /** - * Returns the {@link com.google.common.reflect.TypeToken} of the {@link org.jclouds.View}. - * - * @return - */ - @Override - public TypeToken getViewType() { - return TypeToken.of(Storage.class); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - return true; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-management/management-core/src/test/java/org/jclouds/management/StorageManagement.java ---------------------------------------------------------------------- diff --git a/jclouds-management/management-core/src/test/java/org/jclouds/management/StorageManagement.java b/jclouds-management/management-core/src/test/java/org/jclouds/management/StorageManagement.java deleted file mode 100644 index f731a4a..0000000 --- a/jclouds-management/management-core/src/test/java/org/jclouds/management/StorageManagement.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.jclouds.management; - -import org.jclouds.apis.Storage; - -public class StorageManagement implements StorageManagementMBean, ViewMBean<Storage> { - - - /** - * Returns the type of the MBean. - * - * @return - */ - @Override - public String getType() { - return "test"; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-management/management-core/src/test/java/org/jclouds/management/StorageManagementMBean.java ---------------------------------------------------------------------- diff --git a/jclouds-management/management-core/src/test/java/org/jclouds/management/StorageManagementMBean.java b/jclouds-management/management-core/src/test/java/org/jclouds/management/StorageManagementMBean.java deleted file mode 100644 index 525101f..0000000 --- a/jclouds-management/management-core/src/test/java/org/jclouds/management/StorageManagementMBean.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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.jclouds.management; - -public interface StorageManagementMBean { -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-management/management-core/src/test/java/org/jclouds/management/ViewMBeanFactoriesTest.java ---------------------------------------------------------------------- diff --git a/jclouds-management/management-core/src/test/java/org/jclouds/management/ViewMBeanFactoriesTest.java b/jclouds-management/management-core/src/test/java/org/jclouds/management/ViewMBeanFactoriesTest.java deleted file mode 100644 index e00e91d..0000000 --- a/jclouds-management/management-core/src/test/java/org/jclouds/management/ViewMBeanFactoriesTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.jclouds.management; - -import com.google.common.reflect.TypeToken; -import org.jclouds.apis.Compute; -import org.jclouds.apis.Storage; -import org.testng.annotations.Test; - -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -@Test(groups = "unit", testName = "ViewManagementFactoriesTest") -public class ViewMBeanFactoriesTest { - - private final ViewMBeanFactory storageFactory = new StorageMBeanFactory(); - private final ViewMBeanFactory computeTestFactory = new ComputeMBeanFactory(); - - @Test - void testAll() { - Iterable<ViewMBeanFactory> factories = ViewMBeanFactories.all(); - assertTrue(contains(factories, storageFactory)); - assertTrue(contains(factories, computeTestFactory)); - } - - @Test - void testManagesView() { - Iterable<ViewMBeanFactory> storageFactories = ViewMBeanFactories.forType(TypeToken.of(Storage.class)); - Iterable<ViewMBeanFactory> otherTestViewfactories = ViewMBeanFactories.forType(TypeToken.of(Compute.class)); - - assertTrue(contains(storageFactories, storageFactory)); - assertFalse(contains(storageFactories, computeTestFactory)); - - assertFalse(contains(otherTestViewfactories, storageFactory)); - assertTrue(contains(otherTestViewfactories, computeTestFactory)); - } - - - private static boolean contains(Iterable<ViewMBeanFactory> factories, ViewMBeanFactory f) { - for (ViewMBeanFactory factory : factories) { - if (f.equals(factory)) { - return true; - } - } - return false; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-management/management-core/src/test/java/org/jclouds/management/config/ManagementLifecycleTest.java ---------------------------------------------------------------------- diff --git a/jclouds-management/management-core/src/test/java/org/jclouds/management/config/ManagementLifecycleTest.java b/jclouds-management/management-core/src/test/java/org/jclouds/management/config/ManagementLifecycleTest.java deleted file mode 100644 index 1fb7656..0000000 --- a/jclouds-management/management-core/src/test/java/org/jclouds/management/config/ManagementLifecycleTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.jclouds.management.config; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; -import org.jclouds.ContextBuilder; -import org.jclouds.apis.Compute; -import org.jclouds.management.ComputeManagement; -import org.jclouds.management.ManagementContext; -import org.jclouds.providers.JcloudsTestComputeProviderMetadata; -import org.testng.annotations.Test; - -import static org.easymock.EasyMock.anyObject; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.eq; -import static org.easymock.EasyMock.expectLastCall; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -@Test(groups = "unit", testName = "ManagementLifecycleTest") -public class ManagementLifecycleTest { - - - @Test - void testManagementLifecycle() { - //Test that the ManagementLifeCycle module properly listens for view creation events and context destruction. - ManagementContext managementContext = createMock(ManagementContext.class); - - managementContext.register(anyObject(Compute.class)); - expectLastCall().once(); - managementContext.manage(anyObject(ComputeManagement.class), eq("testname")); - expectLastCall().once(); - managementContext.unmanage(anyObject(ComputeManagement.class), eq("testname")); - expectLastCall().once(); - managementContext.unregister(anyObject(Compute.class)); - expectLastCall().once(); - replay(managementContext); - - Compute compute = ContextBuilder.newBuilder(new JcloudsTestComputeProviderMetadata()).name("testname") - .credentials("user", "password") - .modules(ImmutableSet.<Module>builder().add(new ManagementLifecycle(managementContext)).build()).build(Compute.class); - compute.unwrap().close(); - verify(managementContext); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-management/management-core/src/test/java/org/jclouds/management/internal/ManagementUtilsTest.java ---------------------------------------------------------------------- diff --git a/jclouds-management/management-core/src/test/java/org/jclouds/management/internal/ManagementUtilsTest.java b/jclouds-management/management-core/src/test/java/org/jclouds/management/internal/ManagementUtilsTest.java deleted file mode 100644 index 9953832..0000000 --- a/jclouds-management/management-core/src/test/java/org/jclouds/management/internal/ManagementUtilsTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.jclouds.management.internal; - - -import org.testng.annotations.Test; - -import javax.management.MBeanServer; -import javax.management.ObjectInstance; -import javax.management.ObjectName; - -import static org.easymock.EasyMock.anyObject; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.eq; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.expectLastCall; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - - -@Test(groups = "unit", testName = "ManagementUtilsTest") -public class ManagementUtilsTest { - - @Test - public void testRegister() throws Exception { - MBeanServer mBeanServer = createMock(MBeanServer.class); - - ObjectName firstObjectName = ManagementUtils.objectNameFor("test", "first"); - ObjectName secondObjectName = ManagementUtils.objectNameFor("test", "second"); - ObjectInstance firstInstance = new ObjectInstance(firstObjectName, "FirstClass"); - ObjectInstance secondInstance = new ObjectInstance(firstObjectName, "FirstClass"); - - expect(mBeanServer.isRegistered(firstObjectName)).andReturn(false).once(); - expect(mBeanServer.isRegistered(firstObjectName)).andReturn(true).atLeastOnce(); - expect(mBeanServer.isRegistered(secondObjectName)).andReturn(false).once(); - expect(mBeanServer.isRegistered(secondObjectName)).andReturn(true).atLeastOnce(); - - expect(mBeanServer.registerMBean(anyObject(), eq(firstObjectName))).andReturn(firstInstance).once(); - expect(mBeanServer.registerMBean(anyObject(), eq(secondObjectName))).andReturn(secondInstance).once(); - replay(mBeanServer); - - for (int i = 0; i < 5; i++) { - ManagementUtils.register(mBeanServer, new Object(), "test", "first"); - } - - for (int i = 0; i < 5; i++) { - ManagementUtils.register(mBeanServer, new Object(), "test", "second"); - } - verify(mBeanServer); - } - - @Test - public void testUnregister() throws Exception { - MBeanServer mBeanServer = createMock(MBeanServer.class); - - ObjectName firstObjectName = ManagementUtils.objectNameFor("test", "first"); - ObjectName secondObjectName = ManagementUtils.objectNameFor("test", "second"); - - expect(mBeanServer.isRegistered(firstObjectName)).andReturn(true).once(); - expect(mBeanServer.isRegistered(firstObjectName)).andReturn(false).atLeastOnce(); - expect(mBeanServer.isRegistered(secondObjectName)).andReturn(true).once(); - expect(mBeanServer.isRegistered(secondObjectName)).andReturn(false).atLeastOnce(); - - - mBeanServer.unregisterMBean(firstObjectName); - expectLastCall().once(); - mBeanServer.unregisterMBean(secondObjectName); - expectLastCall().once(); - replay(mBeanServer); - - for (int i = 0; i < 5; i++) { - ManagementUtils.unregister(mBeanServer, "test", "first"); - } - - for (int i = 0; i < 5; i++) { - ManagementUtils.unregister(mBeanServer, "test", "second"); - } - verify(mBeanServer); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-management/management-core/src/test/resources/META-INF/services/org.jclouds.management.ViewMBeanFactory ---------------------------------------------------------------------- diff --git a/jclouds-management/management-core/src/test/resources/META-INF/services/org.jclouds.management.ViewMBeanFactory b/jclouds-management/management-core/src/test/resources/META-INF/services/org.jclouds.management.ViewMBeanFactory deleted file mode 100644 index 88a32cd..0000000 --- a/jclouds-management/management-core/src/test/resources/META-INF/services/org.jclouds.management.ViewMBeanFactory +++ /dev/null @@ -1,2 +0,0 @@ -org.jclouds.management.StorageMBeanFactory -org.jclouds.management.ComputeMBeanFactory \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-management/pom.xml ---------------------------------------------------------------------- diff --git a/jclouds-management/pom.xml b/jclouds-management/pom.xml deleted file mode 100644 index 3dd8b8c..0000000 --- a/jclouds-management/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?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"> - <parent> - <artifactId>jclouds-labs</artifactId> - <groupId>org.apache.jclouds.labs</groupId> - <version>2.0.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.jclouds.labs</groupId> - <artifactId>jclouds-management</artifactId> - <packaging>pom</packaging> - <name>jclouds :: management</name> - - <modules> - <module>management-core</module> - <module>management-compute</module> - <module>management-blobstore</module> - </modules> - - -</project> http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/README.md ---------------------------------------------------------------------- diff --git a/jclouds-representations/README.md b/jclouds-representations/README.md deleted file mode 100644 index 18ffe17..0000000 --- a/jclouds-representations/README.md +++ /dev/null @@ -1,27 +0,0 @@ -jclouds representations -======================= - -This project provides representations for the jclouds domain objects. -The representation object have no dependency in the acutal jclouds modules and can be used as a "thin client" from -other software that wants to integrate with jclouds. - -The original intention was to be used for JMX integration but can also be used for REST etc. - -The project contains two submodules: - -* representations-core -* represtations-codec - -representations-core --------------------- - -Contains representation objects for core, compute & blobstore modules of jclouds. - - -representations-codec ---------------------- - -Contains convertion functions for the actual jclouds domain objects to their representations. -It also includes a ComputeService and BlobStore interface which use the representation instead of the domain objects. - -**Note:** This module does depend from jclouds. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/pom.xml ---------------------------------------------------------------------- diff --git a/jclouds-representations/pom.xml b/jclouds-representations/pom.xml deleted file mode 100644 index 12ce20b..0000000 --- a/jclouds-representations/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?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"> - <parent> - <artifactId>jclouds-labs</artifactId> - <groupId>org.apache.jclouds.labs</groupId> - <version>2.0.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.jclouds.labs</groupId> - <artifactId>jclouds-representations</artifactId> - <packaging>pom</packaging> - <name>jclouds :: representations</name> - <description>Representations objects for jclouds domain objects</description> - - <modules> - <module>representations-core</module> - <module>representations-codec</module> - </modules> - -</project> http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/pom.xml ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/pom.xml b/jclouds-representations/representations-codec/pom.xml deleted file mode 100644 index dd280c9..0000000 --- a/jclouds-representations/representations-codec/pom.xml +++ /dev/null @@ -1,83 +0,0 @@ -<!-- - - 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"> - <parent> - <groupId>org.apache.jclouds.labs</groupId> - <artifactId>jclouds-representations</artifactId> - <version>2.0.0-SNAPSHOT</version> - <relativePath>..</relativePath> - </parent> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.jclouds.labs.representations</groupId> - <artifactId>representations-codec</artifactId> - <packaging>bundle</packaging> - <name>jclouds :: representations :: codec</name> - - <properties> - <jclouds.osgi.import> - org.jclouds.blobstore*;version="${project.version}";resolution:=optional, - org.jclouds.compute*;version="${project.version}";resolution:=optional, - * - </jclouds.osgi.import> - <jclouds.osgi.export> - org.jclouds.codec*;version=${project.version};-noimport:=true, - org.jclouds.compute.codec*;version=${project.version};-noimport:=true, - org.jclouds.blobstore.codec*;version=${project.version};-noimport:=true - </jclouds.osgi.export> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.jclouds.labs.representations</groupId> - <artifactId>representations-core</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.jclouds</groupId> - <artifactId>jclouds-core</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.jclouds</groupId> - <artifactId>jclouds-compute</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.jclouds</groupId> - <artifactId>jclouds-blobstore</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.jclouds</groupId> - <artifactId>jclouds-core</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - - </dependencies> - -</project> http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToBlob.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToBlob.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToBlob.java deleted file mode 100644 index 62ea858..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToBlob.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.jclouds.blobstore.codec; - -import com.google.common.base.Function; -import org.jclouds.blobstore.representations.Blob; -import org.jclouds.javax.annotation.Nullable; - - -public enum ToBlob implements Function<org.jclouds.blobstore.domain.Blob, Blob> { - - INSTANCE; - - @Override - public Blob apply(@Nullable org.jclouds.blobstore.domain.Blob input) { - if (input == null) { - return null; - } - return Blob.builder().allHeaders(input.getAllHeaders().asMap()) - .blobMetadata(ToBlobMetadata.INSTANCE.apply(input.getMetadata())).build(); - } - - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToBlobMetadata.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToBlobMetadata.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToBlobMetadata.java deleted file mode 100644 index b47f6b8..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToBlobMetadata.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.jclouds.blobstore.codec; - -import com.google.common.base.Function; -import org.jclouds.blobstore.representations.BlobMetadata; -import org.jclouds.javax.annotation.Nullable; - -public enum ToBlobMetadata implements Function<org.jclouds.blobstore.domain.BlobMetadata, BlobMetadata> { - - INSTANCE; - - @Override - public BlobMetadata apply(@Nullable org.jclouds.blobstore.domain.BlobMetadata input) { - if (input == null) { - return null; - } - return BlobMetadata.builder() - .publicUri(input.getPublicUri()).type(input.getType().name()).providerId(input.getProviderId()) - .name(input.getName()).uri(input.getUri()).userMetadata(input.getUserMetadata()) - .eTag(input.getETag()).creationDate(input.getCreationDate()).lastModifiedDate(input.getLastModified()) - .content(ToContentContentMetadata.INSTANCE.apply(input.getContentMetadata())) - .build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToContentContentMetadata.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToContentContentMetadata.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToContentContentMetadata.java deleted file mode 100644 index 8fe660f..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToContentContentMetadata.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.jclouds.blobstore.codec; - -import com.google.common.base.Function; -import org.jclouds.blobstore.representations.ContentMetadata; -import org.jclouds.javax.annotation.Nullable; - -public enum ToContentContentMetadata implements Function<org.jclouds.io.ContentMetadata, ContentMetadata> { - - INSTANCE; - - @Override - public ContentMetadata apply(@Nullable org.jclouds.io.ContentMetadata input) { - if (input == null) { - return null; - } - return ContentMetadata.builder().type(input.getContentType()).disposition(input.getContentDisposition()) - .encoding(input.getContentEncoding()).length(input.getContentLength()) - .expires(input.getExpires()) - .build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToStorageMetadata.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToStorageMetadata.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToStorageMetadata.java deleted file mode 100644 index 631a786..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/blobstore/codec/ToStorageMetadata.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.jclouds.blobstore.codec; - -import com.google.common.base.Function; -import org.jclouds.blobstore.representations.StorageMetadata; -import org.jclouds.javax.annotation.Nullable; - -public enum ToStorageMetadata implements Function<org.jclouds.blobstore.domain.StorageMetadata, StorageMetadata> { - - INSTANCE; - - @Override - public StorageMetadata apply(@Nullable org.jclouds.blobstore.domain.StorageMetadata input) { - if (input == null) { - return null; - } - return StorageMetadata.builder().type(input.getType().name()).providerId(input.getProviderId()) - .name(input.getName()).uri(input.getUri()).userMetadata(input.getUserMetadata()) - .eTag(input.getETag()).creationDate(input.getCreationDate()).lastModifiedDate(input.getLastModified()) - .build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToApiMetadata.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToApiMetadata.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToApiMetadata.java deleted file mode 100644 index b1e1f52..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToApiMetadata.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.jclouds.codec; - -import com.google.common.base.Function; -import com.google.common.collect.ImmutableSet; -import com.google.common.reflect.TypeToken; -import com.google.inject.Module; -import org.jclouds.View; -import org.jclouds.representations.ApiMetadata; -import org.jclouds.javax.annotation.Nullable; - -import static com.google.common.collect.Iterables.transform; - -public enum ToApiMetadata implements Function<org.jclouds.apis.ApiMetadata, ApiMetadata> { - - INSTANCE; - - @Override - public ApiMetadata apply(@Nullable org.jclouds.apis.ApiMetadata input) { - if (input == null) { - return null; - } - return ApiMetadata.builder().id(input.getId()).name(input.getName()).endpointName(input.getEndpointName()) - .identityName(input.getIdentityName()).credentialName(input.getCredentialName().orNull()) - .version(input.getVersion()) - .defaultEndpoint(input.getDefaultEndpoint().orNull()) - .defaultIdentity(input.getDefaultIdentity().orNull()) - .defaultCredential(input.getDefaultCredential().orNull()) - .defaultProperties(input.getDefaultProperties()) - .documentation(input.getDocumentation()) - .context(input.getContext().getType().toString()) - - .defaultModules(ImmutableSet.<String>builder().addAll(transform(input.getDefaultModules(), new Function<Class<? extends Module>, String>() { - @Override - public String apply(@Nullable Class<? extends Module> input) { - return input.getName(); - } - })).build()) - - .views(ImmutableSet.<String>builder().addAll(transform(input.getViews(), new Function<TypeToken<? extends View>, String>() { - @Override - public String apply(@Nullable TypeToken<? extends View> input) { - return input.getRawType().getName(); - } - })).build()) - - .build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToContext.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToContext.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToContext.java deleted file mode 100644 index 0558f58..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToContext.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.jclouds.codec; - -import com.google.common.base.Function; -import org.jclouds.representations.Context; -import org.jclouds.javax.annotation.Nullable; - -public enum ToContext implements Function<org.jclouds.Context, Context> { - - INSTANCE; - - @Override - public Context apply(@Nullable org.jclouds.Context input) { - if (input == null) { - return null; - } - return Context.builder().name(input.getName()).identity(input.getIdentity()) - .providerId(input.getProviderMetadata() != null ? input.getProviderMetadata().getId() : null).build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToLocation.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToLocation.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToLocation.java deleted file mode 100644 index afb7658..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToLocation.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.jclouds.codec; - -import com.google.common.base.Function; -import org.jclouds.representations.Location; -import org.jclouds.javax.annotation.Nullable; - -public enum ToLocation implements Function<org.jclouds.domain.Location, Location> { - - INSTANCE; - - @Override - public Location apply(@Nullable org.jclouds.domain.Location input) { - if (input == null) { - return null; - } - return Location.builder().id(input.getId()).scope(input.getScope().name()) - .parentId(input.getParent() != null ? input.getParent().getId() : null) - .description(input.getDescription()) - .iso3166Codes(input.getIso3166Codes()).build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToProvider.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToProvider.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToProvider.java deleted file mode 100644 index d0f2c5b..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/codec/ToProvider.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.jclouds.codec; - -import com.google.common.base.Function; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.google.common.reflect.TypeToken; -import com.google.inject.Module; -import org.jclouds.View; -import org.jclouds.representations.ProviderMetadata; -import org.jclouds.javax.annotation.Nullable; - -import java.util.Map; -import java.util.Properties; - -import static com.google.common.collect.Iterables.transform; - -public enum ToProvider implements Function<org.jclouds.providers.ProviderMetadata, ProviderMetadata> { - - INSTANCE; - - public ProviderMetadata apply(@Nullable org.jclouds.providers.ProviderMetadata input) { - if (input == null) { - return null; - } - - - - - return ProviderMetadata.builder().id(input.getId()).name(input.getName()) - .endpoint(input.getEndpoint()) - .console(input.getConsole().orNull()).homePage(input.getHomepage().orNull()) - .linkedServices(input.getLinkedServices()).iso3166Codes(input.getIso3166Codes()) - .identityName(input.getApiMetadata().getIdentityName()) - .credentialName(input.getApiMetadata().getCredentialName().orNull()) - .endpointName(input.getApiMetadata().getEndpointName()) - .documentation(input.getApiMetadata().getDocumentation().toString()) - .defaultProperties(fromProperties(input.getApiMetadata().getDefaultProperties(), input.getDefaultProperties())) - - .defaultModules(ImmutableSet.<String>builder().addAll(transform(input.getApiMetadata().getDefaultModules(), new Function<Class<? extends Module>, String>() { - @Override - public String apply(@Nullable Class<? extends Module> input) { - return input.getName(); - } - })).build()) - - .views(ImmutableSet.<String>builder().addAll(transform(input.getApiMetadata().getViews(), new Function<TypeToken<? extends View>, String>() { - @Override - public String apply(@Nullable TypeToken<? extends View> input) { - return input.getRawType().getName(); - } - })).build()) - - .build(); - } - - /** - * Merges multiple {@link Properties} into a {@link Map}. - * In case of duplicate keys, the latest value will be kept. - * This utility is mostly needed because the map builder can't handle duplicates. - * @param properties - * @return - */ - private static Map<String, String> fromProperties(Properties ... properties) { - Map<String, String> map = Maps.newHashMap(); - for (Properties p : properties) { - map.putAll(Maps.fromProperties(p)); - } - return map; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToExecResponse.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToExecResponse.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToExecResponse.java deleted file mode 100644 index 3e02f8a..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToExecResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.jclouds.compute.codec; - -import com.google.common.base.Function; -import org.jclouds.compute.representations.ExecResponse; -import org.jclouds.javax.annotation.Nullable; - -public enum ToExecResponse implements Function<org.jclouds.compute.domain.ExecResponse, ExecResponse> { - - INSTANCE; - - @Override - public ExecResponse apply(@Nullable org.jclouds.compute.domain.ExecResponse input) { - if (input == null) { - return null; - } - return ExecResponse.builder().output(input.getOutput()).error(input.getError()).exitStatus(input.getExitStatus()) - .build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToHardware.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToHardware.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToHardware.java deleted file mode 100644 index d85545f..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToHardware.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.jclouds.compute.codec; - -import com.google.common.base.Function; -import com.google.common.collect.ImmutableList; -import org.jclouds.compute.representations.Hardware; -import org.jclouds.compute.representations.Processor; -import org.jclouds.compute.representations.Volume; -import org.jclouds.javax.annotation.Nullable; - -import static com.google.common.collect.Iterables.transform; - -public enum ToHardware implements Function<org.jclouds.compute.domain.Hardware, Hardware> { - - INSTANCE; - - @Override - public Hardware apply(@Nullable org.jclouds.compute.domain.Hardware input) { - if (input == null) { - return null; - } - return Hardware.builder().id(input.getId()).name(input.getName()).hypervisor(input.getHypervisor()) - .ram(input.getRam()) - //Transformation is lazy and doesn't serialize well, so let's wrap the processor list - .processors(ImmutableList.<Processor>builder().addAll(transform(input.getProcessors(), ToProcessor.INSTANCE)).build()) - - //Transformation is lazy and doesn't serialize well, so let's wrap the volume list - .volumes(ImmutableList.<Volume>builder().addAll(transform(input.getVolumes(), ToVolume.INSTANCE)).build()) - .build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToImage.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToImage.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToImage.java deleted file mode 100644 index b3634f7..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToImage.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.jclouds.compute.codec; - -import com.google.common.base.Function; -import org.jclouds.compute.representations.Image; -import org.jclouds.javax.annotation.Nullable; - -public enum ToImage implements Function<org.jclouds.compute.domain.Image, Image> { - - INSTANCE; - - @Override - public Image apply(@Nullable org.jclouds.compute.domain.Image input) { - if (input == null) { - return null; - } - return Image.builder().id(input.getId()).name(input.getName()).status(input.getStatus().name()) - .tags(input.getTags()).version(input.getVersion()).description(input.getDescription()) - .operatingSystem(ToOperatingSystem.INSTANCE.apply(input.getOperatingSystem())) - .defaultCredentials(ToLoginCredentials.INSTANCE.apply(input.getDefaultCredentials())).build(); - - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToLoginCredentials.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToLoginCredentials.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToLoginCredentials.java deleted file mode 100644 index 7a6fee6..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToLoginCredentials.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.jclouds.compute.codec; - -import com.google.common.base.Function; -import org.jclouds.compute.representations.LoginCredentials; -import org.jclouds.javax.annotation.Nullable; - -public enum ToLoginCredentials implements Function<org.jclouds.domain.LoginCredentials, LoginCredentials> { - - INSTANCE; - - @Override - public LoginCredentials apply(@Nullable org.jclouds.domain.LoginCredentials input) { - if (input == null) { - return null; - } - return LoginCredentials.builder().username(input.getUser()).password(input.getPassword()) - .privateKey(input.getPrivateKey()).authenticateSudo(input.shouldAuthenticateSudo()) - .build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToNodeMetadata.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToNodeMetadata.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToNodeMetadata.java deleted file mode 100644 index 09c2026..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToNodeMetadata.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.jclouds.compute.codec; - -import com.google.common.base.Function; -import org.jclouds.compute.representations.NodeMetadata; -import org.jclouds.javax.annotation.Nullable; - -public enum ToNodeMetadata implements Function<org.jclouds.compute.domain.NodeMetadata, NodeMetadata> { - - INSTANCE; - - @Override - public NodeMetadata apply(@Nullable org.jclouds.compute.domain.NodeMetadata input) { - if (input == null) { - return null; - } - return NodeMetadata.builder().id(input.getId()).name(input.getName()).status(input.getStatus().name()) - .hostname(input.getHostname()) - .loginPort(input.getLoginPort()).group(input.getGroup()) - .tags(input.getTags()).metadata(input.getUserMetadata()) - .locationId(input.getLocation() != null ? input.getLocation().getId() : null) - .imageId(input.getImageId()) - .defaultCredentials(ToLoginCredentials.INSTANCE.apply(input.getCredentials())).build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToOperatingSystem.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToOperatingSystem.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToOperatingSystem.java deleted file mode 100644 index 74de141..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToOperatingSystem.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.jclouds.compute.codec; - -import com.google.common.base.Function; -import org.jclouds.compute.representations.OperatingSystem; -import org.jclouds.javax.annotation.Nullable; - -public enum ToOperatingSystem implements Function<org.jclouds.compute.domain.OperatingSystem, OperatingSystem> { - - INSTANCE; - - @Override - public OperatingSystem apply(@Nullable org.jclouds.compute.domain.OperatingSystem input) { - if (input == null) { - return null; - } - return OperatingSystem.builder().family(input.getFamily().name()).version(input.getVersion()).name(input.getName()) - .arch(input.getArch()).is64Bit(input.is64Bit()).build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToProcessor.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToProcessor.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToProcessor.java deleted file mode 100644 index e0e412f..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToProcessor.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.jclouds.compute.codec; - -import com.google.common.base.Function; -import org.jclouds.compute.representations.Processor; -import org.jclouds.javax.annotation.Nullable; - -public enum ToProcessor implements Function<org.jclouds.compute.domain.Processor, Processor> { - - INSTANCE; - - @Override - public Processor apply(@Nullable org.jclouds.compute.domain.Processor input) { - if (input == null) { - return null; - } - return Processor.builder().cores(input.getCores()).speed(input.getSpeed()).build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToVolume.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToVolume.java b/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToVolume.java deleted file mode 100644 index 6509888..0000000 --- a/jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToVolume.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.jclouds.compute.codec; - -import com.google.common.base.Function; -import org.jclouds.compute.representations.Volume; -import org.jclouds.javax.annotation.Nullable; - -public enum ToVolume implements Function<org.jclouds.compute.domain.Volume, Volume> { - - INSTANCE; - - @Override - public Volume apply(@Nullable org.jclouds.compute.domain.Volume input) { - if (input == null) { - return null; - } - return Volume.builder().id(input.getId()).size(input.getSize()).type(input.getType().name()).device(input.getDevice()) - .durable(input.isDurable()).bootDevice(input.isBootDevice()).build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/test/java/org/jclouds/blobstore/codec/BlobStoreConversionsTest.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/test/java/org/jclouds/blobstore/codec/BlobStoreConversionsTest.java b/jclouds-representations/representations-codec/src/test/java/org/jclouds/blobstore/codec/BlobStoreConversionsTest.java deleted file mode 100644 index 60148b4..0000000 --- a/jclouds-representations/representations-codec/src/test/java/org/jclouds/blobstore/codec/BlobStoreConversionsTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.jclouds.blobstore.codec; - -import com.google.common.collect.ImmutableSet; -import com.google.common.io.ByteSource; - -import org.jclouds.ContextBuilder; -import org.jclouds.blobstore.BlobStore; -import org.jclouds.blobstore.BlobStoreContext; -import org.jclouds.blobstore.representations.Blob; -import org.jclouds.blobstore.representations.StorageMetadata; -import org.testng.annotations.Test; - -import java.util.Set; - -import static com.google.common.collect.Iterables.transform; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; - -@Test -public class BlobStoreConversionsTest { - - private BlobStore getBlobStore() { - BlobStoreContext context = ContextBuilder.newBuilder("transient").name("test-transient").credentials("user", "pass").build(BlobStoreContext.class); - return context.getBlobStore(); - } - - @Test - void testToStorageMetadata() { - assertNull(ToStorageMetadata.INSTANCE.apply(null)); - BlobStore blobStore = getBlobStore(); - blobStore.createContainerInLocation(null, "test"); - blobStore.createDirectory("test", "one"); - Set<StorageMetadata> storageMetadataSet = ImmutableSet.<StorageMetadata>builder() - .addAll(transform(blobStore.list(), ToStorageMetadata.INSTANCE)) - .build(); - assertFalse(storageMetadataSet.isEmpty()); - StorageMetadata representation = storageMetadataSet.iterator().next(); - assertEquals("test", representation.getName()); - } - - @Test - void testToBlob() { - assertNull(ToBlob.INSTANCE.apply(null)); - BlobStore blobStore = getBlobStore(); - blobStore.createContainerInLocation(null, "container"); - blobStore.createDirectory("container", "one"); - - blobStore.putBlob("container", blobStore.blobBuilder("myblob").payload(ByteSource.wrap("testcontent".getBytes())).build()); - Blob representation = ToBlob.INSTANCE.apply(blobStore.getBlob("container", "myblob")); - assertNotNull(representation); - assertNotNull(representation.getBlobMetadata()); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/test/java/org/jclouds/codec/ToApiMetadataTest.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/test/java/org/jclouds/codec/ToApiMetadataTest.java b/jclouds-representations/representations-codec/src/test/java/org/jclouds/codec/ToApiMetadataTest.java deleted file mode 100644 index aa23d2e..0000000 --- a/jclouds-representations/representations-codec/src/test/java/org/jclouds/codec/ToApiMetadataTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.jclouds.codec; - -import com.google.common.collect.ImmutableSet; -import org.jclouds.apis.Apis; -import org.jclouds.representations.ApiMetadata; -import org.testng.annotations.Test; - -import java.util.Set; - -import static com.google.common.collect.Iterables.transform; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; - -@Test -public class ToApiMetadataTest { - - @Test - void testConversion() { - assertNull(ToApiMetadata.INSTANCE.apply(null)); - org.jclouds.apis.ApiMetadata stub = Apis.withId("stub"); - assertNotNull(stub); - ApiMetadata dto = ToApiMetadata.INSTANCE.apply(stub); - assertNotNull(dto); - assertEquals("stub", dto.getId()); - } - - @Test - void testIterableTransformation() { - Set<ApiMetadata> representations = ImmutableSet.<ApiMetadata>builder() - .addAll(transform(Apis.all(), ToApiMetadata.INSTANCE)) - .build(); - assertFalse(representations.isEmpty()); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/test/java/org/jclouds/codec/ToContextTest.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/test/java/org/jclouds/codec/ToContextTest.java b/jclouds-representations/representations-codec/src/test/java/org/jclouds/codec/ToContextTest.java deleted file mode 100644 index c3c321c..0000000 --- a/jclouds-representations/representations-codec/src/test/java/org/jclouds/codec/ToContextTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.jclouds.codec; - -import org.jclouds.ContextBuilder; -import org.jclouds.representations.Context; -import org.testng.annotations.Test; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; - -@Test -public class ToContextTest { - - @Test - void testConversion() { - assertNull(ToContext.INSTANCE.apply(null)); - org.jclouds.Context context = ContextBuilder.newBuilder("stub").name("test-stub").credentials("user", "pass").build(); - Context representation = ToContext.INSTANCE.apply(context); - assertNotNull(representation); - assertEquals("test-stub", representation.getName()); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-codec/src/test/java/org/jclouds/compute/codec/ComputeConversionsTest.java ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-codec/src/test/java/org/jclouds/compute/codec/ComputeConversionsTest.java b/jclouds-representations/representations-codec/src/test/java/org/jclouds/compute/codec/ComputeConversionsTest.java deleted file mode 100644 index d100681..0000000 --- a/jclouds-representations/representations-codec/src/test/java/org/jclouds/compute/codec/ComputeConversionsTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.jclouds.compute.codec; - -import com.google.common.collect.ImmutableSet; -import org.jclouds.ContextBuilder; -import org.jclouds.codec.ToLocation; -import org.jclouds.compute.ComputeService; -import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.compute.representations.Hardware; -import org.jclouds.compute.representations.Image; -import org.jclouds.representations.Location; -import org.testng.annotations.Test; - -import java.util.Set; - -import static com.google.common.collect.Iterables.transform; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.assertTrue; - - -@Test -public class ComputeConversionsTest { - - private ComputeService getCompute() { - ComputeServiceContext context = ContextBuilder.newBuilder("stub").name("test-stub").credentials("user", "pass").build(ComputeServiceContext.class); - return context.getComputeService(); - } - - @Test - void testToHardware() { - assertNull(ToHardware.INSTANCE.apply(null)); - ComputeService compute = getCompute(); - Set<Hardware> hardwareSet = ImmutableSet.<Hardware>builder() - .addAll(transform(compute.listHardwareProfiles(), ToHardware.INSTANCE)) - .build(); - assertFalse(hardwareSet.isEmpty()); - for (Hardware representation : hardwareSet) { - assertTrue(representation.getRam() > 0); - } - } - - @Test - void testToImage() { - assertNull(ToImage.INSTANCE.apply(null)); - ComputeService compute = getCompute(); - Set<Image> imageSet = ImmutableSet.<Image>builder() - .addAll(transform(compute.listImages(), ToImage.INSTANCE)) - .build(); - - assertFalse(imageSet.isEmpty()); - for (Image representation : imageSet) { - assertNotNull(representation.getId()); - assertNotNull(representation.getOperatingSystem()); - } - } - - @Test - void testToLocation() { - assertNull(ToLocation.INSTANCE.apply(null)); - ComputeService compute = getCompute(); - Set<Location> locationSet = ImmutableSet.<Location>builder() - .addAll(transform(compute.listAssignableLocations(), ToLocation.INSTANCE)) - .build(); - assertFalse(locationSet.isEmpty()); - - for (Location representation : locationSet) { - assertNotNull(representation.getId()); - assertNotNull(representation.getScope()); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/db7a37ce/jclouds-representations/representations-core/pom.xml ---------------------------------------------------------------------- diff --git a/jclouds-representations/representations-core/pom.xml b/jclouds-representations/representations-core/pom.xml deleted file mode 100644 index 68f67d8..0000000 --- a/jclouds-representations/representations-core/pom.xml +++ /dev/null @@ -1,63 +0,0 @@ -<?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"> - <parent> - <groupId>org.apache.jclouds.labs</groupId> - <artifactId>jclouds-representations</artifactId> - <version>2.0.0-SNAPSHOT</version> - <relativePath>..</relativePath> - </parent> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.jclouds.labs.representations</groupId> - <artifactId>representations-core</artifactId> - <name>jclouds :: representations :: core</name> - <packaging>bundle</packaging> - - <properties> - <jclouds.osgi.import>*</jclouds.osgi.import> - <jclouds.osgi.export> - org.jclouds*;version=${project.version};-noimport:=true - </jclouds.osgi.export> - </properties> - - <dependencies> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>${guava.version}</version> - </dependency> - <dependency> - <groupId>org.apache.jclouds</groupId> - <artifactId>jclouds-core</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - -</project>
