ayushtkn commented on code in PR #408:
URL: https://github.com/apache/tez/pull/408#discussion_r2306937921
##########
tez-common/src/test/java/org/apache/tez/common/TestTezUtils.java:
##########
@@ -291,4 +301,30 @@ public void testPopulateConfProtoFromEntries() {
assertEquals(confBuilder.getConfKeyValuesList().size(), 1);
}
+ @Test(timeout = 5000)
+ public void testReadTezConfigurationXmlFromClasspath() throws IOException {
+ InputStream is =
ClassLoader.getSystemResourceAsStream(TezConfiguration.TEZ_SITE_XML);
+ Configuration conf = TezUtilsInternal.readTezConfigurationXml(is);
+ assertEquals(conf.get("tez.lib.uris"), "tez.tar.gz");
+ }
+
+ @Test(timeout = 5000)
+ public void testPluginsDescriptorFromJSON() throws IOException {
+ InputStream is =
ClassLoader.getSystemResourceAsStream(TezConstants.SERVICE_PLUGINS_DESCRIPTOR_JSON);
+ ServicePluginsDescriptor spd =
TezClientUtils.createPluginsDescriptorFromJSON(is);
+ TaskSchedulerDescriptor tsd = spd.getTaskSchedulerDescriptors()[0];
+ ContainerLauncherDescriptor cld = spd.getContainerLauncherDescriptors()[0];
+ TaskCommunicatorDescriptor tcd = spd.getTaskCommunicatorDescriptors()[0];
+
+ assertFalse(spd.areContainersEnabled());
+ assertTrue(spd.isUberEnabled());
+ assertEquals(tsd.getClassName(), "testScheduler0_class");
+ assertEquals(tsd.getEntityName(), "testScheduler0");
+ assertEquals(cld.getClassName(), "testLauncher0_class");
+ assertEquals(cld.getEntityName(), "testLauncher0");
+ assertEquals(tcd.getClassName(), "testComm0_class");
+ assertEquals(tcd.getEntityName(), "testComm0");
+ assertEquals(tcd.getUserPayload().getVersion(), 1);
+ assertArrayEquals(tcd.getUserPayload().deepCopyAsArray(), new byte[] {0,
0, 0, 1});
Review Comment:
can you check the order of arguments in assertEquals, the expected in first
argument actual is second, I think it is opposite here
##########
tez-common/src/main/java/org/apache/tez/common/TezUtilsInternal.java:
##########
@@ -74,14 +78,36 @@ public final class TezUtilsInternal {
private TezUtilsInternal() {}
- public static ConfigurationProto readUserSpecifiedTezConfiguration(String
baseDir) throws
- IOException {
+ public static ConfigurationProto readUserSpecifiedTezConfiguration(String
baseDir) throws IOException {
File confPBFile = new File(baseDir, TezConstants.TEZ_PB_BINARY_CONF_NAME);
try (FileInputStream fis = new FileInputStream(confPBFile)) {
return ConfigurationProto.parseFrom(fis);
}
}
+ public static Configuration readTezConfigurationXml(InputStream is) throws
IOException {
Review Comment:
this doesn't throw IOE
##########
tez-common/src/main/java/org/apache/tez/common/TezUtilsInternal.java:
##########
@@ -74,14 +78,36 @@ public final class TezUtilsInternal {
private TezUtilsInternal() {}
- public static ConfigurationProto readUserSpecifiedTezConfiguration(String
baseDir) throws
- IOException {
+ public static ConfigurationProto readUserSpecifiedTezConfiguration(String
baseDir) throws IOException {
File confPBFile = new File(baseDir, TezConstants.TEZ_PB_BINARY_CONF_NAME);
try (FileInputStream fis = new FileInputStream(confPBFile)) {
return ConfigurationProto.parseFrom(fis);
}
}
+ public static Configuration readTezConfigurationXml(InputStream is) throws
IOException {
+ Configuration configuration = new Configuration();
+ if (is != null) {
+ configuration.addResource(is);
+ }
+ return configuration;
+ }
+
+ public static ConfigurationProto loadConfProtoFromText() throws IOException {
Review Comment:
which method call this? this shows as unused. Removing it doesn't make any
test fail either
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]