forked from vmware-archive/admiral
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added KubernetesDescriptionService & KubernetesDescriptionContentServ…
…ice. KubernetesDescriptionContentService will handle creation of a single yaml file with multiple k8s definitions. Added tests for KubernetesDescriptionContentService and tests for KubernetesDescriptionService Exported isApplicationYamlContent() method in OperationUtils. Added 2 util methods fromJsonToYaml() and fromYamlToJson() which convert strings, added test for them. Added hidden flag "--k8s" for admiral template import command. Currently to be used for easier testing of KubernetesDescriptionService. Change-Id: I145e2e844e8128f972e3e5d4fcc79e6b7c77b7e8 Reviewed-on: http://bellevue-ci.eng.vmware.com:8080/6497 Upgrade-Verified: jenkins <[email protected]> Bellevue-Verified: jenkins <[email protected]> CS-Verified: jenkins <[email protected]> Reviewed-by: Tony Georgiev <[email protected]>
- Loading branch information
1 parent
f18ad50
commit 607ffda
Showing
13 changed files
with
647 additions
and
26 deletions.
There are no files selected for viewing
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
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
51 changes: 51 additions & 0 deletions
51
common/src/test/java/com/vmware/admiral/service/common/util/YamlMapperTest.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,51 @@ | ||
/* | ||
* Copyright (c) 2017 VMware, Inc. All Rights Reserved. | ||
* | ||
* This product is licensed to you under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this product except in compliance with the License. | ||
* | ||
* This product may include a number of subcomponents with separate copyright notices | ||
* and license terms. Your use of these subcomponents is subject to the terms and | ||
* conditions of the subcomponent's license, as noted in the LICENSE file. | ||
*/ | ||
|
||
package com.vmware.admiral.service.common.util; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import java.io.IOException; | ||
|
||
import org.junit.Test; | ||
|
||
import com.vmware.admiral.common.util.YamlMapper; | ||
|
||
public class YamlMapperTest { | ||
|
||
@Test | ||
public void testConvertFromYamlToJson() throws IOException { | ||
String yamlInput = "---\n" | ||
+ "person:\n" | ||
+ " name: test-name\n" | ||
+ " age: 14\n"; | ||
|
||
String expectedJsonOutput = "{\"person\":{\"name\":\"test-name\",\"age\":14}}"; | ||
|
||
String actualJsonOutput = YamlMapper.fromYamlToJson(yamlInput); | ||
|
||
assertEquals(expectedJsonOutput, actualJsonOutput); | ||
} | ||
|
||
@Test | ||
public void testConvertFromJsonToYaml() throws IOException { | ||
String jsonInput = "{\"person\":{\"name\":\"test-name\",\"age\":14}}"; | ||
|
||
String expectedYamlOutput = "---\n" | ||
+ "person:\n" | ||
+ " name: \"test-name\"\n" | ||
+ " age: 14\n"; | ||
|
||
String actualYamlOutput = YamlMapper.fromJsonToYaml(jsonInput); | ||
|
||
assertEquals(expectedYamlOutput, actualYamlOutput); | ||
} | ||
} |
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.