Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/5.1' into feature/merge-rel-5.1-develop
Manually Resolved conflicts for files cdap-app-fabric/src/test/java/co/cask/cdap/internal/app/services/http/AppFabricTestBase.java cdap-app-fabric/src/test/java/co/cask/cdap/internal/app/services/http/handlers/ArtifactHttpHandlerTest.java pom.xml
- Loading branch information
Showing
79 changed files
with
2,549 additions
and
489 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
58 changes: 58 additions & 0 deletions
58
cdap-api/src/test/java/co/cask/cdap/api/plugin/PluginClassTest.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,58 @@ | ||
/* | ||
* Copyright © 2018 Cask Data, Inc. | ||
* | ||
* Licensed 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 co.cask.cdap.api.plugin; | ||
|
||
|
||
import com.google.gson.Gson; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import java.util.Collections; | ||
|
||
/** | ||
* Test for {@link PluginClass} | ||
*/ | ||
public class PluginClassTest { | ||
private static final Gson GSON = new Gson(); | ||
|
||
@Test | ||
public void testOldFormat() { | ||
// test that old json representation which does not have a requirements field can be be converted to Plugin class | ||
// by normal GSON without any custom deserializer (CDAP-14515) | ||
PluginClass pluginClass = new PluginClass("sparkprogram", "wordcount", "desc", "className", "config", | ||
Collections.emptyMap(), Collections.emptySet(), null); | ||
PluginClass deserializedPluginClass = GSON.fromJson(GSON.toJson(pluginClass), PluginClass.class); | ||
Assert.assertEquals("wordcount", deserializedPluginClass.getName()); | ||
Assert.assertEquals("sparkprogram", deserializedPluginClass.getType()); | ||
Assert.assertEquals("desc", deserializedPluginClass.getDescription()); | ||
Assert.assertEquals("className", deserializedPluginClass.getClassName()); | ||
Assert.assertTrue(deserializedPluginClass.getRequirements().isEmpty()); | ||
} | ||
|
||
@Test | ||
public void testValidate() { | ||
PluginClass invalidPluginClass = new PluginClass(); | ||
String pluginClassJSON = GSON.toJson(invalidPluginClass); | ||
try { | ||
PluginClass pluginClass = GSON.fromJson(pluginClassJSON, PluginClass.class); | ||
pluginClass.validate(); | ||
Assert.fail("Should have failed to convert an invalid json"); | ||
} catch (IllegalArgumentException e) { | ||
// expected | ||
} | ||
} | ||
} |
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
Oops, something went wrong.