Skip to content

Commit

Permalink
Fix for the TestSamzaSqlApplicationConfig.testConfigInit
Browse files Browse the repository at this point in the history
Currently testConfigInit checks for a hardcoded number for udfs. Whenever a new UDF is added, This test is going to fail if it is not updated. Changed the test to validate the number of udfs based on the config that is passed.

Author: Srinivasulu Punuru <[email protected]>

Reviewers: Prateek Maheshwari <[email protected]>

Closes apache#403 from srinipunuru/testfix.1
  • Loading branch information
srinipunuru authored and prateekm committed Jan 11, 2018
1 parent 9893069 commit 267dfc6
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import junit.framework.Assert;
import org.apache.samza.SamzaException;
import org.apache.samza.config.MapConfig;
import org.apache.samza.sql.impl.ConfigBasedUdfResolver;
import org.apache.samza.sql.interfaces.SqlSystemStreamConfig;
import org.apache.samza.sql.runner.SamzaSqlApplicationConfig;
import org.apache.samza.sql.testutil.SamzaSqlTestConfig;
Expand All @@ -36,9 +37,11 @@ public class TestSamzaSqlApplicationConfig {
public void testConfigInit() {
Map<String, String> config = SamzaSqlTestConfig.fetchStaticConfigsWithFactories(10);
config.put(SamzaSqlApplicationConfig.CFG_SQL_STMT, "Insert into testavro.COMPLEX1 select * from testavro.SIMPLE1");
String configUdfResolverDomain = String.format(SamzaSqlApplicationConfig.CFG_FMT_UDF_RESOLVER_DOMAIN, "config");
int numUdfs = config.get(configUdfResolverDomain + ConfigBasedUdfResolver.CFG_UDF_CLASSES).split(",").length;
SamzaSqlApplicationConfig samzaSqlApplicationConfig = new SamzaSqlApplicationConfig(new MapConfig(config));
Assert.assertEquals(1, samzaSqlApplicationConfig.getQueryInfo().size());
Assert.assertEquals(3, samzaSqlApplicationConfig.getUdfMetadata().size());
Assert.assertEquals(numUdfs, samzaSqlApplicationConfig.getUdfMetadata().size());
Assert.assertEquals(1, samzaSqlApplicationConfig.getInputSystemStreamConfigBySource().size());
Assert.assertEquals(1, samzaSqlApplicationConfig.getOutputSystemStreamConfigsBySource().size());
}
Expand Down

0 comments on commit 267dfc6

Please sign in to comment.