-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle new terraform resources (KeyPair,SecurityGroup,SecurityGroupRule)
- Loading branch information
Showing
37 changed files
with
1,694 additions
and
1,064 deletions.
There are no files selected for viewing
28 changes: 14 additions & 14 deletions
28
...api/src/test/java/org/eclipse/xpanse/api/config/MonitorResourceTypeEnumConverterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
package org.eclipse.xpanse.api.config; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
import org.eclipse.xpanse.modules.models.common.exceptions.UnsupportedEnumValueException; | ||
import org.eclipse.xpanse.modules.models.monitor.enums.MonitorResourceType; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class MonitorResourceTypeEnumConverterTest { | ||
|
||
private MonitorResourceTypeEnumConverter monitorResourceTypeEnumConverterUnderTest; | ||
private final MonitorResourceTypeEnumConverter converterTest = | ||
new MonitorResourceTypeEnumConverter(); | ||
|
||
@BeforeEach | ||
void setUp() { | ||
monitorResourceTypeEnumConverterUnderTest = new MonitorResourceTypeEnumConverter(); | ||
} | ||
|
||
@Test | ||
void testConvert() { | ||
assertThat( | ||
monitorResourceTypeEnumConverterUnderTest.convert("CPU")) | ||
.isEqualTo(MonitorResourceType.CPU); | ||
assertThrows(UnsupportedEnumValueException.class, () -> | ||
monitorResourceTypeEnumConverterUnderTest.convert("monitorResourceType")); | ||
|
||
Assertions.assertEquals(MonitorResourceType.CPU, | ||
converterTest.convert("cpu")); | ||
Assertions.assertEquals(MonitorResourceType.MEM, | ||
converterTest.convert("mem")); | ||
Assertions.assertEquals(MonitorResourceType.VM_NETWORK_INCOMING, | ||
converterTest.convert("vm_network_incoming")); | ||
Assertions.assertEquals(MonitorResourceType.VM_NETWORK_OUTGOING, | ||
converterTest.convert("vm_network_outgoing")); | ||
Assertions.assertThrows(UnsupportedEnumValueException.class, | ||
() -> converterTest.convert("error_value")); | ||
} | ||
} |
52 changes: 0 additions & 52 deletions
52
modules/api/src/test/java/org/eclipse/xpanse/api/config/ResponseValidatorTest.java
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
.../api/src/test/java/org/eclipse/xpanse/api/config/ServiceHostingTypeEnumConverterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.eclipse.xpanse.api.config; | ||
|
||
import org.eclipse.xpanse.modules.models.common.exceptions.UnsupportedEnumValueException; | ||
import org.eclipse.xpanse.modules.models.servicetemplate.enums.ServiceHostingType; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class ServiceHostingTypeEnumConverterTest { | ||
|
||
private final ServiceHostingTypeEnumConverter converterTest = | ||
new ServiceHostingTypeEnumConverter(); | ||
|
||
@Test | ||
void testConvert() { | ||
Assertions.assertEquals(ServiceHostingType.SELF, | ||
converterTest.convert("self")); | ||
Assertions.assertEquals(ServiceHostingType.SERVICE_VENDOR, | ||
converterTest.convert("service-vendor")); | ||
Assertions.assertThrows(UnsupportedEnumValueException.class, | ||
() -> converterTest.convert("error_value")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
.../main/java/org/eclipse/xpanse/modules/models/service/deploy/DeployResourceProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* SPDX-FileCopyrightText: Huawei Inc. | ||
* | ||
*/ | ||
|
||
package org.eclipse.xpanse.modules.models.service.deploy; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import org.eclipse.xpanse.modules.models.service.deploy.enums.DeployResourceKind; | ||
|
||
|
||
/** | ||
* Defines methods to get kind and properties for deploy resources. | ||
*/ | ||
public class DeployResourceProperties { | ||
|
||
/** | ||
* Get kind of deployed resource. | ||
* | ||
* @return DeployResourceKind. | ||
*/ | ||
public DeployResourceKind getResourceKind() { | ||
return DeployResourceKind.UNKNOWN; | ||
} | ||
|
||
/** | ||
* Get properties map of resource. | ||
* | ||
* @return properties map. | ||
*/ | ||
public Map<String, String> getResourceProperties() { | ||
return new HashMap<>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...t/java/org/eclipse/xpanse/modules/models/service/deploy/DeployResourcePropertiesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.eclipse.xpanse.modules.models.service.deploy; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import org.eclipse.xpanse.modules.models.service.deploy.enums.DeployResourceKind; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class DeployResourcePropertiesTest { | ||
|
||
private DeployResourceProperties deployResourcePropertiesUnderTest; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
deployResourcePropertiesUnderTest = new DeployResourceProperties() { | ||
}; | ||
} | ||
|
||
@Test | ||
void testGetResourceKind() { | ||
assertThat(deployResourcePropertiesUnderTest.getResourceKind()) | ||
.isEqualTo(DeployResourceKind.UNKNOWN); | ||
} | ||
|
||
@Test | ||
void testGetResourceProperties() { | ||
// Setup | ||
final Map<String, String> expectedResult = new HashMap<>(); | ||
|
||
// Run the test | ||
final Map<String, String> result = | ||
deployResourcePropertiesUnderTest.getResourceProperties(); | ||
|
||
// Verify the results | ||
assertThat(result).isEqualTo(expectedResult); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.