target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testNullParams() { try { UnorderedPartitionedKVEdgeConfigurer.newBuilder(null, "VALUE", "PARTITIONER", null); fail("Expecting a null parameter list to fail"); } catch (NullPointerException npe) { assertTrue(npe.getMessage().contains("cannot be null")); } try { UnorderedPartitionedKVEdgeConfigurer.newB... | public static Builder newBuilder(String keyClassName, String valueClassName, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClassName, valueClassName, partitionerClassName, partitionerConf); } | UnorderedPartitionedKVEdgeConfigurer extends HadoopKeyValuesBasedBaseConf { public static Builder newBuilder(String keyClassName, String valueClassName, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClassName, valueClassName, partitionerClassName, partitionerConf); } } | UnorderedPartitionedKVEdgeConfigurer extends HadoopKeyValuesBasedBaseConf { public static Builder newBuilder(String keyClassName, String valueClassName, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClassName, valueClassName, partitionerClassName, partitionerConf); } private Unord... | UnorderedPartitionedKVEdgeConfigurer extends HadoopKeyValuesBasedBaseConf { public static Builder newBuilder(String keyClassName, String valueClassName, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClassName, valueClassName, partitionerClassName, partitionerConf); } private Unord... | UnorderedPartitionedKVEdgeConfigurer extends HadoopKeyValuesBasedBaseConf { public static Builder newBuilder(String keyClassName, String valueClassName, String partitionerClassName, Configuration partitionerConf) { return new Builder(keyClassName, valueClassName, partitionerClassName, partitionerConf); } private Unord... |
@Test public void testNullParams() { try { ShuffledUnorderedKVInputConfiguration.newBuilder(null, "VALUE"); fail("Expecting a null parameter list to fail"); } catch (NullPointerException npe) { assertTrue(npe.getMessage().contains("cannot be null")); } try { ShuffledUnorderedKVInputConfiguration.newBuilder("KEY", null)... | public static Builder newBuilder(String keyClass, String valueClass) { return new Builder(keyClass, valueClass); } | ShuffledUnorderedKVInputConfiguration { public static Builder newBuilder(String keyClass, String valueClass) { return new Builder(keyClass, valueClass); } } | ShuffledUnorderedKVInputConfiguration { public static Builder newBuilder(String keyClass, String valueClass) { return new Builder(keyClass, valueClass); } @InterfaceAudience.Private @VisibleForTesting ShuffledUnorderedKVInputConfiguration(); private ShuffledUnorderedKVInputConfiguration(Configuration conf); } | ShuffledUnorderedKVInputConfiguration { public static Builder newBuilder(String keyClass, String valueClass) { return new Builder(keyClass, valueClass); } @InterfaceAudience.Private @VisibleForTesting ShuffledUnorderedKVInputConfiguration(); private ShuffledUnorderedKVInputConfiguration(Configuration conf); byte[] to... | ShuffledUnorderedKVInputConfiguration { public static Builder newBuilder(String keyClass, String valueClass) { return new Builder(keyClass, valueClass); } @InterfaceAudience.Private @VisibleForTesting ShuffledUnorderedKVInputConfiguration(); private ShuffledUnorderedKVInputConfiguration(Configuration conf); byte[] to... |
@Test public void testSimple() throws Exception { SortedGroupedMergedInput input = new SortedGroupedMergedInput(); SortedTestKeyValuesReader kvsReader1 = new SortedTestKeyValuesReader(new int[] { 1, 2, 3 }, new int[][] { { 1, 1 }, { 2, 2 }, { 3, 3 } }); SortedTestKeyValuesReader kvsReader2 = new SortedTestKeyValuesRead... | @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } @Override KeyValuesReader getReader(); @Override void setConstituentInputIsReady(Input input); } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } @Override KeyValuesReader getReader(); @Override void setConstituentInputIsReady(Input input); } |
@Test public void testSkippedKey() throws Exception { SortedGroupedMergedInput input = new SortedGroupedMergedInput(); SortedTestKeyValuesReader kvsReader1 = new SortedTestKeyValuesReader(new int[] { 1, 2, 3 }, new int[][] { { 1, 1 }, { 2, 2 }, { 3, 3 } }); SortedTestKeyValuesReader kvsReader2 = new SortedTestKeyValues... | @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } @Override KeyValuesReader getReader(); @Override void setConstituentInputIsReady(Input input); } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } @Override KeyValuesReader getReader(); @Override void setConstituentInputIsReady(Input input); } |
@Test public void testPartialValuesSkip() throws Exception { SortedGroupedMergedInput input = new SortedGroupedMergedInput(); SortedTestKeyValuesReader kvsReader1 = new SortedTestKeyValuesReader(new int[] { 1, 2, 3 }, new int[][] { { 1, 1 }, { 2, 2 }, { 3, 3 } }); SortedTestKeyValuesReader kvsReader2 = new SortedTestKe... | @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } @Override KeyValuesReader getReader(); @Override void setConstituentInputIsReady(Input input); } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } @Override KeyValuesReader getReader(); @Override void setConstituentInputIsReady(Input input); } |
@Test public void testOrdering() throws Exception { SortedGroupedMergedInput input = new SortedGroupedMergedInput(); SortedTestKeyValuesReader kvsReader1 = new SortedTestKeyValuesReader(new int[] { 2, 4 }, new int[][] { { 2, 2 }, { 4, 4 } }); SortedTestKeyValuesReader kvsReader2 = new SortedTestKeyValuesReader(new int[... | @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } @Override KeyValuesReader getReader(); @Override void setConstituentInputIsReady(Input input); } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } @Override KeyValuesReader getReader(); @Override void setConstituentInputIsReady(Input input); } |
@Test public void testSkippedKey2() throws Exception { SortedGroupedMergedInput input = new SortedGroupedMergedInput(); SortedTestKeyValuesReader kvsReader1 = new SortedTestKeyValuesReader(new int[] { 2, 4 }, new int[][] { { 2, 2 }, { 4, 4 } }); SortedTestKeyValuesReader kvsReader2 = new SortedTestKeyValuesReader(new i... | @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } @Override KeyValuesReader getReader(); @Override void setConstituentInputIsReady(Input input); } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } @Override KeyValuesReader getReader(); @Override void setConstituentInputIsReady(Input input); } |
@Test public void testNewSplitsGen() throws Exception { InputSplitInfo info = generateNewSplits(newSplitsDir); Assert.assertEquals(new Path(newSplitsDir, MRHelpers.JOB_SPLIT_RESOURCE_NAME), info.getSplitsFile()); Assert.assertEquals(new Path(newSplitsDir, MRHelpers.JOB_SPLIT_METAINFO_RESOURCE_NAME), info.getSplitsMetaI... | @SuppressWarnings({ "rawtypes", "unchecked" }) @Private public static org.apache.hadoop.mapreduce.InputSplit[] generateNewSplits( JobContext jobContext, String inputFormatName, int numTasks) throws ClassNotFoundException, IOException, InterruptedException { Configuration conf = jobContext.getConfiguration(); InputForma... | MRHelpers { @SuppressWarnings({ "rawtypes", "unchecked" }) @Private public static org.apache.hadoop.mapreduce.InputSplit[] generateNewSplits( JobContext jobContext, String inputFormatName, int numTasks) throws ClassNotFoundException, IOException, InterruptedException { Configuration conf = jobContext.getConfiguration()... | MRHelpers { @SuppressWarnings({ "rawtypes", "unchecked" }) @Private public static org.apache.hadoop.mapreduce.InputSplit[] generateNewSplits( JobContext jobContext, String inputFormatName, int numTasks) throws ClassNotFoundException, IOException, InterruptedException { Configuration conf = jobContext.getConfiguration()... | MRHelpers { @SuppressWarnings({ "rawtypes", "unchecked" }) @Private public static org.apache.hadoop.mapreduce.InputSplit[] generateNewSplits( JobContext jobContext, String inputFormatName, int numTasks) throws ClassNotFoundException, IOException, InterruptedException { Configuration conf = jobContext.getConfiguration()... | MRHelpers { @SuppressWarnings({ "rawtypes", "unchecked" }) @Private public static org.apache.hadoop.mapreduce.InputSplit[] generateNewSplits( JobContext jobContext, String inputFormatName, int numTasks) throws ClassNotFoundException, IOException, InterruptedException { Configuration conf = jobContext.getConfiguration()... |
@Test public void testSkippedKey3() throws Exception { SortedGroupedMergedInput input = new SortedGroupedMergedInput(); SortedTestKeyValuesReader kvsReader1 = new SortedTestKeyValuesReader(new int[] { 1, 2, 3, 4 }, new int[][] { { 1, 1 }, { 2, 2 }, { 3, 3 }, {4, 4} }); SortedTestKeyValuesReader kvsReader2 = new SortedT... | @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } @Override KeyValuesReader getReader(); @Override void setConstituentInputIsReady(Input input); } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } @Override KeyValuesReader getReader(); @Override void setConstituentInputIsReady(Input input); } |
@Test public void testEmptySources() throws Exception { SortedGroupedMergedInput input = new SortedGroupedMergedInput(); SortedTestKeyValuesReader kvsReader1 = new SortedTestKeyValuesReader(new int[] {}, new int[][] {}); SortedTestKeyValuesReader kvsReader2 = new SortedTestKeyValuesReader(new int[] {}, new int[][] {});... | @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } @Override KeyValuesReader getReader(); @Override void setConstituentInputIsReady(Input input); } | SortedGroupedMergedInput extends MergedLogicalInput { @Override public KeyValuesReader getReader() throws Exception { return new SortedGroupedMergedKeyValuesReader(getInputs()); } @Override KeyValuesReader getReader(); @Override void setConstituentInputIsReady(Input input); } |
@Test public void testCleanVertexName() { String testString = "special characters & spaces and longer than " + TezUtils.MAX_VERTEX_NAME_LENGTH + " characters"; Assert.assertTrue(testString.length() > TezUtils.MAX_VERTEX_NAME_LENGTH); String cleaned = TezUtils.cleanVertexName(testString); Assert.assertTrue(cleaned.lengt... | @Private public static String cleanVertexName(String vertexName) { return sanitizeString(vertexName).substring(0, vertexName.length() > MAX_VERTEX_NAME_LENGTH ? MAX_VERTEX_NAME_LENGTH : vertexName.length()); } | TezUtils { @Private public static String cleanVertexName(String vertexName) { return sanitizeString(vertexName).substring(0, vertexName.length() > MAX_VERTEX_NAME_LENGTH ? MAX_VERTEX_NAME_LENGTH : vertexName.length()); } } | TezUtils { @Private public static String cleanVertexName(String vertexName) { return sanitizeString(vertexName).substring(0, vertexName.length() > MAX_VERTEX_NAME_LENGTH ? MAX_VERTEX_NAME_LENGTH : vertexName.length()); } } | TezUtils { @Private public static String cleanVertexName(String vertexName) { return sanitizeString(vertexName).substring(0, vertexName.length() > MAX_VERTEX_NAME_LENGTH ? MAX_VERTEX_NAME_LENGTH : vertexName.length()); } static void addUserSpecifiedTezConfiguration(Configuration conf); static ByteString createByteStri... | TezUtils { @Private public static String cleanVertexName(String vertexName) { return sanitizeString(vertexName).substring(0, vertexName.length() > MAX_VERTEX_NAME_LENGTH ? MAX_VERTEX_NAME_LENGTH : vertexName.length()); } static void addUserSpecifiedTezConfiguration(Configuration conf); static ByteString createByteStri... |
@Test public void testBitSetToByteArray() { BitSet bitSet = createBitSet(0); byte[] bytes = TezUtils.toByteArray(bitSet); Assert.assertTrue(bytes.length == ((bitSet.length() / 8) + 1)); bitSet = createBitSet(1000); bytes = TezUtils.toByteArray(bitSet); Assert.assertTrue(bytes.length == ((bitSet.length() / 8) + 1)); } | public static byte[] toByteArray(BitSet bits) { if (bits == null) { return null; } byte[] bytes = new byte[bits.length() / 8 + 1]; for (int i = 0; i < bits.length(); i++) { if (bits.get(i)) { bytes[(bytes.length) - (i / 8) - 1] |= 1 << (i % 8); } } return bytes; } | TezUtils { public static byte[] toByteArray(BitSet bits) { if (bits == null) { return null; } byte[] bytes = new byte[bits.length() / 8 + 1]; for (int i = 0; i < bits.length(); i++) { if (bits.get(i)) { bytes[(bytes.length) - (i / 8) - 1] |= 1 << (i % 8); } } return bytes; } } | TezUtils { public static byte[] toByteArray(BitSet bits) { if (bits == null) { return null; } byte[] bytes = new byte[bits.length() / 8 + 1]; for (int i = 0; i < bits.length(); i++) { if (bits.get(i)) { bytes[(bytes.length) - (i / 8) - 1] |= 1 << (i % 8); } } return bytes; } } | TezUtils { public static byte[] toByteArray(BitSet bits) { if (bits == null) { return null; } byte[] bytes = new byte[bits.length() / 8 + 1]; for (int i = 0; i < bits.length(); i++) { if (bits.get(i)) { bytes[(bytes.length) - (i / 8) - 1] |= 1 << (i % 8); } } return bytes; } static void addUserSpecifiedTezConfiguratio... | TezUtils { public static byte[] toByteArray(BitSet bits) { if (bits == null) { return null; } byte[] bytes = new byte[bits.length() / 8 + 1]; for (int i = 0; i < bits.length(); i++) { if (bits.get(i)) { bytes[(bytes.length) - (i / 8) - 1] |= 1 << (i % 8); } } return bytes; } static void addUserSpecifiedTezConfiguratio... |
@Test @SuppressWarnings("deprecation") public void testBinaryCredentials() throws Exception { String binaryTokenFile = null; try { Path TEST_ROOT_DIR = new Path("target"); binaryTokenFile = FileSystem.getLocal(conf).makeQualified( new Path(TEST_ROOT_DIR, "tokenFile")).toUri().getPath(); MockFileSystem fs1 = createFileS... | @InterfaceAudience.Private public static void mergeBinaryTokens(Credentials creds, Configuration conf, String tokenFilePath) throws IOException { if (tokenFilePath == null || tokenFilePath.isEmpty()) { throw new RuntimeException("Invalid file path provided" + ", tokenFilePath=" + tokenFilePath); } LOG.info("Merging add... | TokenCache { @InterfaceAudience.Private public static void mergeBinaryTokens(Credentials creds, Configuration conf, String tokenFilePath) throws IOException { if (tokenFilePath == null || tokenFilePath.isEmpty()) { throw new RuntimeException("Invalid file path provided" + ", tokenFilePath=" + tokenFilePath); } LOG.info... | TokenCache { @InterfaceAudience.Private public static void mergeBinaryTokens(Credentials creds, Configuration conf, String tokenFilePath) throws IOException { if (tokenFilePath == null || tokenFilePath.isEmpty()) { throw new RuntimeException("Invalid file path provided" + ", tokenFilePath=" + tokenFilePath); } LOG.info... | TokenCache { @InterfaceAudience.Private public static void mergeBinaryTokens(Credentials creds, Configuration conf, String tokenFilePath) throws IOException { if (tokenFilePath == null || tokenFilePath.isEmpty()) { throw new RuntimeException("Invalid file path provided" + ", tokenFilePath=" + tokenFilePath); } LOG.info... | TokenCache { @InterfaceAudience.Private public static void mergeBinaryTokens(Credentials creds, Configuration conf, String tokenFilePath) throws IOException { if (tokenFilePath == null || tokenFilePath.isEmpty()) { throw new RuntimeException("Invalid file path provided" + ", tokenFilePath=" + tokenFilePath); } LOG.info... |
@Test public void testKeySet() throws IllegalAccessException { Class<?> c = TezJobConfig.class; Set<String> expectedKeys = new HashSet<String>(); for (Field f : c.getFields()) { if (!f.getName().endsWith("DEFAULT") && f.getType() == String.class) { expectedKeys.add((String) f.get(null)); } } Set<String> actualKeySet = ... | @Private public static Set<String> getRuntimeConfigKeySet() { return umnodifiableTezRuntimeKeySet; } | TezJobConfig { @Private public static Set<String> getRuntimeConfigKeySet() { return umnodifiableTezRuntimeKeySet; } } | TezJobConfig { @Private public static Set<String> getRuntimeConfigKeySet() { return umnodifiableTezRuntimeKeySet; } } | TezJobConfig { @Private public static Set<String> getRuntimeConfigKeySet() { return umnodifiableTezRuntimeKeySet; } @Private static Set<String> getRuntimeConfigKeySet(); @Private static Set<String> getRuntimeAdditionalConfigKeySet(); @Private static List<String> getAllowedPrefixes(); @Private static Map<String, String... | TezJobConfig { @Private public static Set<String> getRuntimeConfigKeySet() { return umnodifiableTezRuntimeKeySet; } @Private static Set<String> getRuntimeConfigKeySet(); @Private static Set<String> getRuntimeAdditionalConfigKeySet(); @Private static List<String> getAllowedPrefixes(); @Private static Map<String, String... |
@Test public void testTezBaseStagingPath() throws Exception { Configuration localConf = new Configuration(); localConf.unset(TezConfiguration.TEZ_AM_STAGING_DIR); localConf.set("fs.defaultFS", "file: Path stageDir = TezCommonUtils.getTezBaseStagingPath(localConf); Assert.assertEquals(stageDir.toString(), "file:" + TezC... | public static Path getTezBaseStagingPath(Configuration conf) { String stagingDirStr = conf.get(TezConfiguration.TEZ_AM_STAGING_DIR, TezConfiguration.TEZ_AM_STAGING_DIR_DEFAULT); Path baseStagingDir; try { Path p = new Path(stagingDirStr); FileSystem fs = p.getFileSystem(conf); if (!fs.exists(p)) { mkDirForAM(fs, p); LO... | TezCommonUtils { public static Path getTezBaseStagingPath(Configuration conf) { String stagingDirStr = conf.get(TezConfiguration.TEZ_AM_STAGING_DIR, TezConfiguration.TEZ_AM_STAGING_DIR_DEFAULT); Path baseStagingDir; try { Path p = new Path(stagingDirStr); FileSystem fs = p.getFileSystem(conf); if (!fs.exists(p)) { mkDi... | TezCommonUtils { public static Path getTezBaseStagingPath(Configuration conf) { String stagingDirStr = conf.get(TezConfiguration.TEZ_AM_STAGING_DIR, TezConfiguration.TEZ_AM_STAGING_DIR_DEFAULT); Path baseStagingDir; try { Path p = new Path(stagingDirStr); FileSystem fs = p.getFileSystem(conf); if (!fs.exists(p)) { mkDi... | TezCommonUtils { public static Path getTezBaseStagingPath(Configuration conf) { String stagingDirStr = conf.get(TezConfiguration.TEZ_AM_STAGING_DIR, TezConfiguration.TEZ_AM_STAGING_DIR_DEFAULT); Path baseStagingDir; try { Path p = new Path(stagingDirStr); FileSystem fs = p.getFileSystem(conf); if (!fs.exists(p)) { mkDi... | TezCommonUtils { public static Path getTezBaseStagingPath(Configuration conf) { String stagingDirStr = conf.get(TezConfiguration.TEZ_AM_STAGING_DIR, TezConfiguration.TEZ_AM_STAGING_DIR_DEFAULT); Path baseStagingDir; try { Path p = new Path(stagingDirStr); FileSystem fs = p.getFileSystem(conf); if (!fs.exists(p)) { mkDi... |
@Test public void testCreateTezSysStagingPath() throws Exception { String strAppId = "testAppId"; String expectedStageDir = RESOLVED_STAGE_DIR + File.separatorChar + TezCommonUtils.TEZ_SYSTEM_SUB_DIR + File.separatorChar + strAppId; String unResolvedStageDir = STAGE_DIR + File.separatorChar + TezCommonUtils.TEZ_SYSTEM_... | @Private public static Path createTezSystemStagingPath(Configuration conf, String strAppId) { Path baseStagingPath = getTezBaseStagingPath(conf); Path tezStagingDir; try { tezStagingDir = new Path(baseStagingPath, TEZ_SYSTEM_SUB_DIR); FileSystem fs = tezStagingDir.getFileSystem(conf); tezStagingDir = new Path(tezStagin... | TezCommonUtils { @Private public static Path createTezSystemStagingPath(Configuration conf, String strAppId) { Path baseStagingPath = getTezBaseStagingPath(conf); Path tezStagingDir; try { tezStagingDir = new Path(baseStagingPath, TEZ_SYSTEM_SUB_DIR); FileSystem fs = tezStagingDir.getFileSystem(conf); tezStagingDir = n... | TezCommonUtils { @Private public static Path createTezSystemStagingPath(Configuration conf, String strAppId) { Path baseStagingPath = getTezBaseStagingPath(conf); Path tezStagingDir; try { tezStagingDir = new Path(baseStagingPath, TEZ_SYSTEM_SUB_DIR); FileSystem fs = tezStagingDir.getFileSystem(conf); tezStagingDir = n... | TezCommonUtils { @Private public static Path createTezSystemStagingPath(Configuration conf, String strAppId) { Path baseStagingPath = getTezBaseStagingPath(conf); Path tezStagingDir; try { tezStagingDir = new Path(baseStagingPath, TEZ_SYSTEM_SUB_DIR); FileSystem fs = tezStagingDir.getFileSystem(conf); tezStagingDir = n... | TezCommonUtils { @Private public static Path createTezSystemStagingPath(Configuration conf, String strAppId) { Path baseStagingPath = getTezBaseStagingPath(conf); Path tezStagingDir; try { tezStagingDir = new Path(baseStagingPath, TEZ_SYSTEM_SUB_DIR); FileSystem fs = tezStagingDir.getFileSystem(conf); tezStagingDir = n... |
@Test public void testTezSysStagingPath() throws Exception { String strAppId = "testAppId"; Path stageDir = TezCommonUtils.getTezSystemStagingPath(conf, strAppId); String expectedStageDir = RESOLVED_STAGE_DIR + File.separatorChar + TezCommonUtils.TEZ_SYSTEM_SUB_DIR + File.separatorChar + strAppId; Assert.assertEquals(s... | @Private public static Path getTezSystemStagingPath(Configuration conf, String strAppId) { Path baseStagingPath = getTezBaseStagingPath(conf); Path tezStagingDir; tezStagingDir = new Path(baseStagingPath, TEZ_SYSTEM_SUB_DIR); tezStagingDir = new Path(tezStagingDir, strAppId); return tezStagingDir; } | TezCommonUtils { @Private public static Path getTezSystemStagingPath(Configuration conf, String strAppId) { Path baseStagingPath = getTezBaseStagingPath(conf); Path tezStagingDir; tezStagingDir = new Path(baseStagingPath, TEZ_SYSTEM_SUB_DIR); tezStagingDir = new Path(tezStagingDir, strAppId); return tezStagingDir; } } | TezCommonUtils { @Private public static Path getTezSystemStagingPath(Configuration conf, String strAppId) { Path baseStagingPath = getTezBaseStagingPath(conf); Path tezStagingDir; tezStagingDir = new Path(baseStagingPath, TEZ_SYSTEM_SUB_DIR); tezStagingDir = new Path(tezStagingDir, strAppId); return tezStagingDir; } } | TezCommonUtils { @Private public static Path getTezSystemStagingPath(Configuration conf, String strAppId) { Path baseStagingPath = getTezBaseStagingPath(conf); Path tezStagingDir; tezStagingDir = new Path(baseStagingPath, TEZ_SYSTEM_SUB_DIR); tezStagingDir = new Path(tezStagingDir, strAppId); return tezStagingDir; } s... | TezCommonUtils { @Private public static Path getTezSystemStagingPath(Configuration conf, String strAppId) { Path baseStagingPath = getTezBaseStagingPath(conf); Path tezStagingDir; tezStagingDir = new Path(baseStagingPath, TEZ_SYSTEM_SUB_DIR); tezStagingDir = new Path(tezStagingDir, strAppId); return tezStagingDir; } s... |
@Test (timeout=5000) public void validateSetTezJarLocalResourcesNotDefined() throws Exception { TezConfiguration conf = new TezConfiguration(); Credentials credentials = new Credentials(); try { TezClientUtils.setupTezJarsLocalResources(conf, credentials); Assert.fail("Expected TezUncheckedException"); } catch (TezUnch... | static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource>(); if (conf.get... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... |
@Test public void testOldSplitsGen() throws Exception { InputSplitInfo info = generateOldSplits(oldSplitsDir); Assert.assertEquals(new Path(oldSplitsDir, MRHelpers.JOB_SPLIT_RESOURCE_NAME), info.getSplitsFile()); Assert.assertEquals(new Path(oldSplitsDir, MRHelpers.JOB_SPLIT_METAINFO_RESOURCE_NAME), info.getSplitsMetaI... | @SuppressWarnings({ "rawtypes", "unchecked" }) @Private public static org.apache.hadoop.mapred.InputSplit[] generateOldSplits( JobConf jobConf, String inputFormatName, int numTasks) throws IOException { org.apache.hadoop.mapred.InputFormat inputFormat = jobConf.getInputFormat(); org.apache.hadoop.mapred.InputFormat fin... | MRHelpers { @SuppressWarnings({ "rawtypes", "unchecked" }) @Private public static org.apache.hadoop.mapred.InputSplit[] generateOldSplits( JobConf jobConf, String inputFormatName, int numTasks) throws IOException { org.apache.hadoop.mapred.InputFormat inputFormat = jobConf.getInputFormat(); org.apache.hadoop.mapred.Inp... | MRHelpers { @SuppressWarnings({ "rawtypes", "unchecked" }) @Private public static org.apache.hadoop.mapred.InputSplit[] generateOldSplits( JobConf jobConf, String inputFormatName, int numTasks) throws IOException { org.apache.hadoop.mapred.InputFormat inputFormat = jobConf.getInputFormat(); org.apache.hadoop.mapred.Inp... | MRHelpers { @SuppressWarnings({ "rawtypes", "unchecked" }) @Private public static org.apache.hadoop.mapred.InputSplit[] generateOldSplits( JobConf jobConf, String inputFormatName, int numTasks) throws IOException { org.apache.hadoop.mapred.InputFormat inputFormat = jobConf.getInputFormat(); org.apache.hadoop.mapred.Inp... | MRHelpers { @SuppressWarnings({ "rawtypes", "unchecked" }) @Private public static org.apache.hadoop.mapred.InputSplit[] generateOldSplits( JobConf jobConf, String inputFormatName, int numTasks) throws IOException { org.apache.hadoop.mapred.InputFormat inputFormat = jobConf.getInputFormat(); org.apache.hadoop.mapred.Inp... |
@Test (timeout=5000) public void validateSetTezJarLocalResourcesDefinedButEmpty() throws Exception { File emptyDir = new File(TEST_ROOT_DIR, "emptyDir"); emptyDir.deleteOnExit(); Assert.assertTrue(emptyDir.mkdirs()); Path emptyDirPath = new Path(emptyDir.getAbsolutePath()); TezConfiguration conf = new TezConfiguration(... | static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource>(); if (conf.get... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... |
@Test(expected=FileNotFoundException.class, timeout=5000) public void validateSetTezJarLocalResourcesDefinedNonExistingDirectory() throws Exception { TezConfiguration conf = new TezConfiguration(); conf.set(TezConfiguration.TEZ_LIB_URIS, "file: Credentials credentials = new Credentials(); TezClientUtils.setupTezJarsLoc... | static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource>(); if (conf.get... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... |
@Test (timeout=5000) public void validateSetTezJarLocalResourcesDefinedExistingDirectory() throws Exception { URL[] cp = ((URLClassLoader)ClassLoader.getSystemClassLoader()).getURLs(); StringBuffer buffer = new StringBuffer(); for (URL url : cp) { buffer.append(url.toExternalForm()); buffer.append(","); } TezConfigurat... | static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource>(); if (conf.get... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... |
@Test (timeout=5000) public void validateSetTezJarLocalResourcesDefinedExistingDirectoryIgnored() throws Exception { URL[] cp = ((URLClassLoader)ClassLoader.getSystemClassLoader()).getURLs(); StringBuffer buffer = new StringBuffer(); for (URL url : cp) { buffer.append(url.toExternalForm()); buffer.append(","); } TezCon... | static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource>(); if (conf.get... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... |
@Test (timeout=5000) public void validateSetTezJarLocalResourcesDefinedExistingDirectoryIgnoredSetToFalse() throws Exception { URL[] cp = ((URLClassLoader)ClassLoader.getSystemClassLoader()).getURLs(); StringBuffer buffer = new StringBuffer(); for (URL url : cp) { buffer.append(url.toExternalForm()); buffer.append(",")... | static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource>(); if (conf.get... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... | TezClientUtils { static Map<String, LocalResource> setupTezJarsLocalResources( TezConfiguration conf, Credentials credentials) throws IOException { Preconditions.checkNotNull(credentials, "A non-null credentials object should be specified"); Map<String, LocalResource> tezJarResources = new HashMap<String, LocalResource... |
@Test (timeout=5000) public void testDefaultMemoryJavaOpts() { final double factor = 0.8; String origJavaOpts = "-Xmx"; String javaOpts = TezClientUtils.maybeAddDefaultMemoryJavaOpts(origJavaOpts, Resource.newInstance(1000, 1), factor); Assert.assertEquals(origJavaOpts, javaOpts); origJavaOpts = ""; javaOpts = TezClien... | public static String maybeAddDefaultMemoryJavaOpts(String javaOpts, Resource resource, double maxHeapFactor) { if ((javaOpts != null && !javaOpts.isEmpty() && (javaOpts.contains("-Xmx") || javaOpts.contains("-Xms"))) || (resource.getMemory() <= 0)) { return javaOpts; } if (maxHeapFactor <= 0 || maxHeapFactor >= 1) { re... | TezClientUtils { public static String maybeAddDefaultMemoryJavaOpts(String javaOpts, Resource resource, double maxHeapFactor) { if ((javaOpts != null && !javaOpts.isEmpty() && (javaOpts.contains("-Xmx") || javaOpts.contains("-Xms"))) || (resource.getMemory() <= 0)) { return javaOpts; } if (maxHeapFactor <= 0 || maxHeap... | TezClientUtils { public static String maybeAddDefaultMemoryJavaOpts(String javaOpts, Resource resource, double maxHeapFactor) { if ((javaOpts != null && !javaOpts.isEmpty() && (javaOpts.contains("-Xmx") || javaOpts.contains("-Xms"))) || (resource.getMemory() <= 0)) { return javaOpts; } if (maxHeapFactor <= 0 || maxHeap... | TezClientUtils { public static String maybeAddDefaultMemoryJavaOpts(String javaOpts, Resource resource, double maxHeapFactor) { if ((javaOpts != null && !javaOpts.isEmpty() && (javaOpts.contains("-Xmx") || javaOpts.contains("-Xms"))) || (resource.getMemory() <= 0)) { return javaOpts; } if (maxHeapFactor <= 0 || maxHeap... | TezClientUtils { public static String maybeAddDefaultMemoryJavaOpts(String javaOpts, Resource resource, double maxHeapFactor) { if ((javaOpts != null && !javaOpts.isEmpty() && (javaOpts.contains("-Xmx") || javaOpts.contains("-Xms"))) || (resource.getMemory() <= 0)) { return javaOpts; } if (maxHeapFactor <= 0 || maxHeap... |
@Test (timeout=5000) public void testDefaultLoggingJavaOpts() { String origJavaOpts = null; String javaOpts = TezClientUtils.maybeAddDefaultLoggingJavaOpts("FOOBAR", origJavaOpts); Assert.assertNotNull(javaOpts); Assert.assertTrue(javaOpts.contains("-D" + TezConfiguration.TEZ_ROOT_LOGGER_NAME + "=FOOBAR") && javaOpts.c... | static void maybeAddDefaultLoggingJavaOpts(String logLevel, List<String> vargs) { if (vargs != null && !vargs.isEmpty()) { for (String arg : vargs) { if (arg.contains(TezConfiguration.TEZ_ROOT_LOGGER_NAME)) { return ; } } } TezClientUtils.addLog4jSystemProperties(logLevel, vargs); } | TezClientUtils { static void maybeAddDefaultLoggingJavaOpts(String logLevel, List<String> vargs) { if (vargs != null && !vargs.isEmpty()) { for (String arg : vargs) { if (arg.contains(TezConfiguration.TEZ_ROOT_LOGGER_NAME)) { return ; } } } TezClientUtils.addLog4jSystemProperties(logLevel, vargs); } } | TezClientUtils { static void maybeAddDefaultLoggingJavaOpts(String logLevel, List<String> vargs) { if (vargs != null && !vargs.isEmpty()) { for (String arg : vargs) { if (arg.contains(TezConfiguration.TEZ_ROOT_LOGGER_NAME)) { return ; } } } TezClientUtils.addLog4jSystemProperties(logLevel, vargs); } } | TezClientUtils { static void maybeAddDefaultLoggingJavaOpts(String logLevel, List<String> vargs) { if (vargs != null && !vargs.isEmpty()) { for (String arg : vargs) { if (arg.contains(TezConfiguration.TEZ_ROOT_LOGGER_NAME)) { return ; } } } TezClientUtils.addLog4jSystemProperties(logLevel, vargs); } static FileSystem ... | TezClientUtils { static void maybeAddDefaultLoggingJavaOpts(String logLevel, List<String> vargs) { if (vargs != null && !vargs.isEmpty()) { for (String arg : vargs) { if (arg.contains(TezConfiguration.TEZ_ROOT_LOGGER_NAME)) { return ; } } } TezClientUtils.addLog4jSystemProperties(logLevel, vargs); } static FileSystem ... |
@Test(timeout = 5000) public void testWithoutGrouping2() throws InterruptedException { InputReadyTracker inputReadyTracker = new InputReadyTracker(); ControlledReadyInputForTest input1 = new ControlledReadyInputForTest(inputReadyTracker); ControlledReadyInputForTest input2 = new ControlledReadyInputForTest(inputReadyTr... | public Input waitForAnyInputReady(Collection<Input> inputs) throws InterruptedException { Preconditions.checkArgument(inputs != null && inputs.size() > 0, "At least one input should be specified"); InputReadyMonitor inputReadyMonitor = new InputReadyMonitor(inputs, true); return inputReadyMonitor.awaitCondition(); } | InputReadyTracker implements InputReadyCallback { public Input waitForAnyInputReady(Collection<Input> inputs) throws InterruptedException { Preconditions.checkArgument(inputs != null && inputs.size() > 0, "At least one input should be specified"); InputReadyMonitor inputReadyMonitor = new InputReadyMonitor(inputs, true... | InputReadyTracker implements InputReadyCallback { public Input waitForAnyInputReady(Collection<Input> inputs) throws InterruptedException { Preconditions.checkArgument(inputs != null && inputs.size() > 0, "At least one input should be specified"); InputReadyMonitor inputReadyMonitor = new InputReadyMonitor(inputs, true... | InputReadyTracker implements InputReadyCallback { public Input waitForAnyInputReady(Collection<Input> inputs) throws InterruptedException { Preconditions.checkArgument(inputs != null && inputs.size() > 0, "At least one input should be specified"); InputReadyMonitor inputReadyMonitor = new InputReadyMonitor(inputs, true... | InputReadyTracker implements InputReadyCallback { public Input waitForAnyInputReady(Collection<Input> inputs) throws InterruptedException { Preconditions.checkArgument(inputs != null && inputs.size() > 0, "At least one input should be specified"); InputReadyMonitor inputReadyMonitor = new InputReadyMonitor(inputs, true... |
@Test public void testHandlerExists() throws JSONException { for (HistoryEventType eventType : HistoryEventType.values()) { HistoryEvent event = null; switch (eventType) { case AM_LAUNCHED: event = new AMLaunchedEvent(applicationAttemptId, random.nextInt(), random.nextInt(), user); break; case AM_STARTED: event = new A... | public static JSONObject convertToJson(HistoryEvent historyEvent) throws JSONException { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } JSONObject jsonObject = null; switch (historyEvent.getEventT... | HistoryEventJsonConversion { public static JSONObject convertToJson(HistoryEvent historyEvent) throws JSONException { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } JSONObject jsonObject = null; s... | HistoryEventJsonConversion { public static JSONObject convertToJson(HistoryEvent historyEvent) throws JSONException { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } JSONObject jsonObject = null; s... | HistoryEventJsonConversion { public static JSONObject convertToJson(HistoryEvent historyEvent) throws JSONException { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } JSONObject jsonObject = null; s... | HistoryEventJsonConversion { public static JSONObject convertToJson(HistoryEvent historyEvent) throws JSONException { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } JSONObject jsonObject = null; s... |
@Test public void testConvertDAGPlanToATSMap() throws IOException, JSONException { DAGPlan dagPlan = createDAG(); Map<String, Object> atsMap = DAGUtils.convertDAGPlanToATSMap(dagPlan); Assert.assertTrue(atsMap.containsKey(DAGUtils.DAG_NAME_KEY)); Assert.assertEquals(dagPlan.getName(), atsMap.get(DAGUtils.DAG_NAME_KEY))... | public static Map<String,Object> convertDAGPlanToATSMap( DAGProtos.DAGPlan dagPlan) throws IOException { final String VERSION_KEY = "version"; final int version = 1; Map<String,Object> dagMap = new LinkedHashMap<String, Object>(); dagMap.put(DAG_NAME_KEY, dagPlan.getName()); dagMap.put(VERSION_KEY, version); ArrayList<... | DAGUtils { public static Map<String,Object> convertDAGPlanToATSMap( DAGProtos.DAGPlan dagPlan) throws IOException { final String VERSION_KEY = "version"; final int version = 1; Map<String,Object> dagMap = new LinkedHashMap<String, Object>(); dagMap.put(DAG_NAME_KEY, dagPlan.getName()); dagMap.put(VERSION_KEY, version);... | DAGUtils { public static Map<String,Object> convertDAGPlanToATSMap( DAGProtos.DAGPlan dagPlan) throws IOException { final String VERSION_KEY = "version"; final int version = 1; Map<String,Object> dagMap = new LinkedHashMap<String, Object>(); dagMap.put(DAG_NAME_KEY, dagPlan.getName()); dagMap.put(VERSION_KEY, version);... | DAGUtils { public static Map<String,Object> convertDAGPlanToATSMap( DAGProtos.DAGPlan dagPlan) throws IOException { final String VERSION_KEY = "version"; final int version = 1; Map<String,Object> dagMap = new LinkedHashMap<String, Object>(); dagMap.put(DAG_NAME_KEY, dagPlan.getName()); dagMap.put(VERSION_KEY, version);... | DAGUtils { public static Map<String,Object> convertDAGPlanToATSMap( DAGProtos.DAGPlan dagPlan) throws IOException { final String VERSION_KEY = "version"; final int version = 1; Map<String,Object> dagMap = new LinkedHashMap<String, Object>(); dagMap.put(DAG_NAME_KEY, dagPlan.getName()); dagMap.put(VERSION_KEY, version);... |
@Test public void testMapJavaOptions() { Configuration conf = createConfForJavaOptsTest(); String opts = MRHelpers.getMapJavaOpts(conf); Assert.assertTrue(opts.contains("fooMapAdminOpts")); Assert.assertTrue(opts.contains(" fooMapJavaOpts ")); Assert.assertFalse(opts.contains("fooReduceAdminOpts ")); Assert.assertFalse... | @SuppressWarnings("deprecation") public static String getMapJavaOpts(Configuration conf) { String adminOpts = conf.get( MRJobConfig.MAPRED_MAP_ADMIN_JAVA_OPTS, MRJobConfig.DEFAULT_MAPRED_ADMIN_JAVA_OPTS); String userOpts = conf.get( MRJobConfig.MAP_JAVA_OPTS, conf.get( JobConf.MAPRED_TASK_JAVA_OPTS, JobConf.DEFAULT_MAP... | MRHelpers { @SuppressWarnings("deprecation") public static String getMapJavaOpts(Configuration conf) { String adminOpts = conf.get( MRJobConfig.MAPRED_MAP_ADMIN_JAVA_OPTS, MRJobConfig.DEFAULT_MAPRED_ADMIN_JAVA_OPTS); String userOpts = conf.get( MRJobConfig.MAP_JAVA_OPTS, conf.get( JobConf.MAPRED_TASK_JAVA_OPTS, JobConf... | MRHelpers { @SuppressWarnings("deprecation") public static String getMapJavaOpts(Configuration conf) { String adminOpts = conf.get( MRJobConfig.MAPRED_MAP_ADMIN_JAVA_OPTS, MRJobConfig.DEFAULT_MAPRED_ADMIN_JAVA_OPTS); String userOpts = conf.get( MRJobConfig.MAP_JAVA_OPTS, conf.get( JobConf.MAPRED_TASK_JAVA_OPTS, JobConf... | MRHelpers { @SuppressWarnings("deprecation") public static String getMapJavaOpts(Configuration conf) { String adminOpts = conf.get( MRJobConfig.MAPRED_MAP_ADMIN_JAVA_OPTS, MRJobConfig.DEFAULT_MAPRED_ADMIN_JAVA_OPTS); String userOpts = conf.get( MRJobConfig.MAP_JAVA_OPTS, conf.get( JobConf.MAPRED_TASK_JAVA_OPTS, JobConf... | MRHelpers { @SuppressWarnings("deprecation") public static String getMapJavaOpts(Configuration conf) { String adminOpts = conf.get( MRJobConfig.MAPRED_MAP_ADMIN_JAVA_OPTS, MRJobConfig.DEFAULT_MAPRED_ADMIN_JAVA_OPTS); String userOpts = conf.get( MRJobConfig.MAP_JAVA_OPTS, conf.get( JobConf.MAPRED_TASK_JAVA_OPTS, JobConf... |
@Test (timeout = 5000) public void testContainerPreempted() throws IOException { Configuration conf = new Configuration(false); schedulerHandler.init(conf); schedulerHandler.start(); String diagnostics = "Container preempted by RM."; TaskAttemptImpl mockTask = mock(TaskAttemptImpl.class); ContainerStatus mockStatus = m... | @Override public synchronized void containerCompleted(Object task, ContainerStatus containerStatus) { AMContainer amContainer = appContext.getAllContainers().get(containerStatus.getContainerId()); if (amContainer != null) { String message = null; int exitStatus = containerStatus.getExitStatus(); if (exitStatus == Conta... | TaskSchedulerEventHandler extends AbstractService implements TaskSchedulerAppCallback,
EventHandler<AMSchedulerEvent> { @Override public synchronized void containerCompleted(Object task, ContainerStatus containerStatus) { AMContainer amContainer = appContext.getAllContaine... | TaskSchedulerEventHandler extends AbstractService implements TaskSchedulerAppCallback,
EventHandler<AMSchedulerEvent> { @Override public synchronized void containerCompleted(Object task, ContainerStatus containerStatus) { AMContainer amContainer = appContext.getAllContaine... | TaskSchedulerEventHandler extends AbstractService implements TaskSchedulerAppCallback,
EventHandler<AMSchedulerEvent> { @Override public synchronized void containerCompleted(Object task, ContainerStatus containerStatus) { AMContainer amContainer = appContext.getAllContaine... | TaskSchedulerEventHandler extends AbstractService implements TaskSchedulerAppCallback,
EventHandler<AMSchedulerEvent> { @Override public synchronized void containerCompleted(Object task, ContainerStatus containerStatus) { AMContainer amContainer = appContext.getAllContaine... |
@Test (timeout = 5000) public void testContainerDiskFailed() throws IOException { Configuration conf = new Configuration(false); schedulerHandler.init(conf); schedulerHandler.start(); String diagnostics = "NM disk failed."; TaskAttemptImpl mockTask = mock(TaskAttemptImpl.class); ContainerStatus mockStatus = mock(Contai... | @Override public synchronized void containerCompleted(Object task, ContainerStatus containerStatus) { AMContainer amContainer = appContext.getAllContainers().get(containerStatus.getContainerId()); if (amContainer != null) { String message = null; int exitStatus = containerStatus.getExitStatus(); if (exitStatus == Conta... | TaskSchedulerEventHandler extends AbstractService implements TaskSchedulerAppCallback,
EventHandler<AMSchedulerEvent> { @Override public synchronized void containerCompleted(Object task, ContainerStatus containerStatus) { AMContainer amContainer = appContext.getAllContaine... | TaskSchedulerEventHandler extends AbstractService implements TaskSchedulerAppCallback,
EventHandler<AMSchedulerEvent> { @Override public synchronized void containerCompleted(Object task, ContainerStatus containerStatus) { AMContainer amContainer = appContext.getAllContaine... | TaskSchedulerEventHandler extends AbstractService implements TaskSchedulerAppCallback,
EventHandler<AMSchedulerEvent> { @Override public synchronized void containerCompleted(Object task, ContainerStatus containerStatus) { AMContainer amContainer = appContext.getAllContaine... | TaskSchedulerEventHandler extends AbstractService implements TaskSchedulerAppCallback,
EventHandler<AMSchedulerEvent> { @Override public synchronized void containerCompleted(Object task, ContainerStatus containerStatus) { AMContainer amContainer = appContext.getAllContaine... |
@Test(timeout=5000) public void testHealthUpdateUnknownNode() { AppContext appContext = mock(AppContext.class); AMNodeMap amNodeMap = new AMNodeMap(eventHandler, appContext); amNodeMap.init(new Configuration(false)); amNodeMap.start(); NodeId nodeId = NodeId.newInstance("unknownhost", 2342); NodeReport nodeReport = gen... | public void handle(AMNodeEvent rEvent) { NodeId nodeId = rEvent.getNodeId(); switch (rEvent.getType()) { case N_NODE_WAS_BLACKLISTED: addToBlackList(nodeId); computeIgnoreBlacklisting(); break; case N_NODE_COUNT_UPDATED: AMNodeEventNodeCountUpdated event = (AMNodeEventNodeCountUpdated) rEvent; numClusterNodes = event.g... | AMNodeMap extends AbstractService implements
EventHandler<AMNodeEvent> { public void handle(AMNodeEvent rEvent) { NodeId nodeId = rEvent.getNodeId(); switch (rEvent.getType()) { case N_NODE_WAS_BLACKLISTED: addToBlackList(nodeId); computeIgnoreBlacklisting(); break; case N_NODE_COUNT_UPDATED: AMNodeEventNodeCountUp... | AMNodeMap extends AbstractService implements
EventHandler<AMNodeEvent> { public void handle(AMNodeEvent rEvent) { NodeId nodeId = rEvent.getNodeId(); switch (rEvent.getType()) { case N_NODE_WAS_BLACKLISTED: addToBlackList(nodeId); computeIgnoreBlacklisting(); break; case N_NODE_COUNT_UPDATED: AMNodeEventNodeCountUp... | AMNodeMap extends AbstractService implements
EventHandler<AMNodeEvent> { public void handle(AMNodeEvent rEvent) { NodeId nodeId = rEvent.getNodeId(); switch (rEvent.getType()) { case N_NODE_WAS_BLACKLISTED: addToBlackList(nodeId); computeIgnoreBlacklisting(); break; case N_NODE_COUNT_UPDATED: AMNodeEventNodeCountUp... | AMNodeMap extends AbstractService implements
EventHandler<AMNodeEvent> { public void handle(AMNodeEvent rEvent) { NodeId nodeId = rEvent.getNodeId(); switch (rEvent.getType()) { case N_NODE_WAS_BLACKLISTED: addToBlackList(nodeId); computeIgnoreBlacklisting(); break; case N_NODE_COUNT_UPDATED: AMNodeEventNodeCountUp... |
@Test(timeout = 5000) public void testVertexStart() { initAllVertices(VertexState.INITED); VertexImpl v = vertices.get("vertex2"); startVertex(v); } | private VertexState startVertex() { Preconditions.checkState(getState() == VertexState.INITED, "Vertex must be inited " + logIdentifier); startedTime = clock.getTime(); vertexManager.onVertexStarted(pendingReportedSrcCompletions); pendingReportedSrcCompletions.clear(); logJobHistoryVertexStartedEvent(); if (targetVerti... | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { private VertexState startVertex() { Preconditions.checkState(getState() == VertexState.INITED, "Vertex must be inited " + logIdentifier); startedTime = clock.getTime(); vertexManager.onVertexStarted(pendingReportedSrcCompletions); pe... | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { private VertexState startVertex() { Preconditions.checkState(getState() == VertexState.INITED, "Vertex must be inited " + logIdentifier); startedTime = clock.getTime(); vertexManager.onVertexStarted(pendingReportedSrcCompletions); pe... | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { private VertexState startVertex() { Preconditions.checkState(getState() == VertexState.INITED, "Vertex must be inited " + logIdentifier); startedTime = clock.getTime(); vertexManager.onVertexStarted(pendingReportedSrcCompletions); pe... | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { private VertexState startVertex() { Preconditions.checkState(getState() == VertexState.INITED, "Vertex must be inited " + logIdentifier); startedTime = clock.getTime(); vertexManager.onVertexStarted(pendingReportedSrcCompletions); pe... |
@Test(timeout = 5000) public void testVertexKillDiagnosticsInInit() { initAllVertices(VertexState.INITED); VertexImpl v2 = vertices.get("vertex4"); killVertex(v2); String diagnostics = StringUtils.join(",", v2.getDiagnostics()).toLowerCase(); LOG.info("diagnostics v2: " + diagnostics); Assert.assertTrue(diagnostics.con... | @Override public List<String> getDiagnostics() { readLock.lock(); try { return diagnostics; } finally { readLock.unlock(); } } | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @Override public List<String> getDiagnostics() { readLock.lock(); try { return diagnostics; } finally { readLock.unlock(); } } } | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @Override public List<String> getDiagnostics() { readLock.lock(); try { return diagnostics; } finally { readLock.unlock(); } } VertexImpl(TezVertexID vertexId, VertexPlan vertexPlan,
String vertexName, Configuration conf, Event... | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @Override public List<String> getDiagnostics() { readLock.lock(); try { return diagnostics; } finally { readLock.unlock(); } } VertexImpl(TezVertexID vertexId, VertexPlan vertexPlan,
String vertexName, Configuration conf, Event... | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @Override public List<String> getDiagnostics() { readLock.lock(); try { return diagnostics; } finally { readLock.unlock(); } } VertexImpl(TezVertexID vertexId, VertexPlan vertexPlan,
String vertexName, Configuration conf, Event... |
@Test(timeout = 5000) public void testVertexCommitterInit() { initAllVertices(VertexState.INITED); VertexImpl v2 = vertices.get("vertex2"); Assert.assertNull(v2.getOutputCommitter("output")); VertexImpl v6 = vertices.get("vertex6"); Assert.assertTrue(v6.getOutputCommitter("outputx") instanceof CountingOutputCommitter);... | @Nullable @Private @VisibleForTesting public OutputCommitter getOutputCommitter(String outputName) { if (this.outputCommitters != null) { return outputCommitters.get(outputName); } return null; } | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @Nullable @Private @VisibleForTesting public OutputCommitter getOutputCommitter(String outputName) { if (this.outputCommitters != null) { return outputCommitters.get(outputName); } return null; } } | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @Nullable @Private @VisibleForTesting public OutputCommitter getOutputCommitter(String outputName) { if (this.outputCommitters != null) { return outputCommitters.get(outputName); } return null; } VertexImpl(TezVertexID vertexId, Vert... | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @Nullable @Private @VisibleForTesting public OutputCommitter getOutputCommitter(String outputName) { if (this.outputCommitters != null) { return outputCommitters.get(outputName); } return null; } VertexImpl(TezVertexID vertexId, Vert... | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @Nullable @Private @VisibleForTesting public OutputCommitter getOutputCommitter(String outputName) { if (this.outputCommitters != null) { return outputCommitters.get(outputName); } return null; } VertexImpl(TezVertexID vertexId, Vert... |
@Test(timeout = 5000) public void testVertexManagerInit() { initAllVertices(VertexState.INITED); VertexImpl v2 = vertices.get("vertex2"); Assert.assertTrue(v2.getVertexManager().getPlugin() instanceof ImmediateStartVertexManager); VertexImpl v6 = vertices.get("vertex6"); Assert.assertTrue(v6.getVertexManager().getPlugi... | @VisibleForTesting VertexManager getVertexManager() { return this.vertexManager; } | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @VisibleForTesting VertexManager getVertexManager() { return this.vertexManager; } } | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @VisibleForTesting VertexManager getVertexManager() { return this.vertexManager; } VertexImpl(TezVertexID vertexId, VertexPlan vertexPlan,
String vertexName, Configuration conf, EventHandler eventHandler,
TaskAttemptListe... | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @VisibleForTesting VertexManager getVertexManager() { return this.vertexManager; } VertexImpl(TezVertexID vertexId, VertexPlan vertexPlan,
String vertexName, Configuration conf, EventHandler eventHandler,
TaskAttemptListe... | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @VisibleForTesting VertexManager getVertexManager() { return this.vertexManager; } VertexImpl(TezVertexID vertexId, VertexPlan vertexPlan,
String vertexName, Configuration conf, EventHandler eventHandler,
TaskAttemptListe... |
@Test(timeout = 5000) public void testVertexManagerHeuristic() { setupPreDagCreation(); dagPlan = createDAGPlanWithMixedEdges(); setupPostDagCreation(); initAllVertices(VertexState.INITED); Assert.assertEquals(ImmediateStartVertexManager.class, vertices.get("vertex1").getVertexManager().getPlugin().getClass()); Assert.... | @VisibleForTesting VertexManager getVertexManager() { return this.vertexManager; } | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @VisibleForTesting VertexManager getVertexManager() { return this.vertexManager; } } | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @VisibleForTesting VertexManager getVertexManager() { return this.vertexManager; } VertexImpl(TezVertexID vertexId, VertexPlan vertexPlan,
String vertexName, Configuration conf, EventHandler eventHandler,
TaskAttemptListe... | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @VisibleForTesting VertexManager getVertexManager() { return this.vertexManager; } VertexImpl(TezVertexID vertexId, VertexPlan vertexPlan,
String vertexName, Configuration conf, EventHandler eventHandler,
TaskAttemptListe... | VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
EventHandler<VertexEvent> { @VisibleForTesting VertexManager getVertexManager() { return this.vertexManager; } VertexImpl(TezVertexID vertexId, VertexPlan vertexPlan,
String vertexName, Configuration conf, EventHandler eventHandler,
TaskAttemptListe... |
@Test public void testFetchedEventsModifyUnderlyingList() { List<TezEvent> fetchedList; TezTaskID taskId = getNewTaskID(); scheduleTaskAttempt(taskId); sendTezEventsToTask(taskId, 2); TezTaskAttemptID attemptID = mockTask.getAttemptList().iterator().next() .getID(); fetchedList = mockTask.getTaskAttemptTezEvents(attemp... | @Override public List<TezEvent> getTaskAttemptTezEvents(TezTaskAttemptID attemptID, int fromEventId, int maxEvents) { List<TezEvent> events = EMPTY_TASK_ATTEMPT_TEZ_EVENTS; readLock.lock(); if (!attempts.containsKey(attemptID)) { throw new TezUncheckedException("Unknown TA: " + attemptID + " asking for events from task... | TaskImpl implements Task, EventHandler<TaskEvent> { @Override public List<TezEvent> getTaskAttemptTezEvents(TezTaskAttemptID attemptID, int fromEventId, int maxEvents) { List<TezEvent> events = EMPTY_TASK_ATTEMPT_TEZ_EVENTS; readLock.lock(); if (!attempts.containsKey(attemptID)) { throw new TezUncheckedException("Unkno... | TaskImpl implements Task, EventHandler<TaskEvent> { @Override public List<TezEvent> getTaskAttemptTezEvents(TezTaskAttemptID attemptID, int fromEventId, int maxEvents) { List<TezEvent> events = EMPTY_TASK_ATTEMPT_TEZ_EVENTS; readLock.lock(); if (!attempts.containsKey(attemptID)) { throw new TezUncheckedException("Unkno... | TaskImpl implements Task, EventHandler<TaskEvent> { @Override public List<TezEvent> getTaskAttemptTezEvents(TezTaskAttemptID attemptID, int fromEventId, int maxEvents) { List<TezEvent> events = EMPTY_TASK_ATTEMPT_TEZ_EVENTS; readLock.lock(); if (!attempts.containsKey(attemptID)) { throw new TezUncheckedException("Unkno... | TaskImpl implements Task, EventHandler<TaskEvent> { @Override public List<TezEvent> getTaskAttemptTezEvents(TezTaskAttemptID attemptID, int fromEventId, int maxEvents) { List<TezEvent> events = EMPTY_TASK_ATTEMPT_TEZ_EVENTS; readLock.lock(); if (!attempts.containsKey(attemptID)) { throw new TezUncheckedException("Unkno... |
@Test public void testTaskProgress() { LOG.info("--- START: testTaskProgress ---"); TezTaskID taskId = getNewTaskID(); scheduleTaskAttempt(taskId); float progress = 0f; assert (mockTask.getProgress() == progress); launchTaskAttempt(mockTask.getLastAttempt().getID()); progress = 50f; updateAttemptProgress(mockTask.getLa... | @Override public float getProgress() { readLock.lock(); try { TaskAttempt bestAttempt = selectBestAttempt(); if (bestAttempt == null) { return 0f; } return bestAttempt.getProgress(); } finally { readLock.unlock(); } } | TaskImpl implements Task, EventHandler<TaskEvent> { @Override public float getProgress() { readLock.lock(); try { TaskAttempt bestAttempt = selectBestAttempt(); if (bestAttempt == null) { return 0f; } return bestAttempt.getProgress(); } finally { readLock.unlock(); } } } | TaskImpl implements Task, EventHandler<TaskEvent> { @Override public float getProgress() { readLock.lock(); try { TaskAttempt bestAttempt = selectBestAttempt(); if (bestAttempt == null) { return 0f; } return bestAttempt.getProgress(); } finally { readLock.unlock(); } } TaskImpl(TezVertexID vertexId, int taskIndex,
... | TaskImpl implements Task, EventHandler<TaskEvent> { @Override public float getProgress() { readLock.lock(); try { TaskAttempt bestAttempt = selectBestAttempt(); if (bestAttempt == null) { return 0f; } return bestAttempt.getProgress(); } finally { readLock.unlock(); } } TaskImpl(TezVertexID vertexId, int taskIndex,
... | TaskImpl implements Task, EventHandler<TaskEvent> { @Override public float getProgress() { readLock.lock(); try { TaskAttempt bestAttempt = selectBestAttempt(); if (bestAttempt == null) { return 0f; } return bestAttempt.getProgress(); } finally { readLock.unlock(); } } TaskImpl(TezVertexID vertexId, int taskIndex,
... |
@Test public void testReduceJavaOptions() { Configuration conf = createConfForJavaOptsTest(); String opts = MRHelpers.getReduceJavaOpts(conf); Assert.assertFalse(opts.contains("fooMapAdminOpts")); Assert.assertFalse(opts.contains(" fooMapJavaOpts ")); Assert.assertTrue(opts.contains("fooReduceAdminOpts")); Assert.asser... | @SuppressWarnings("deprecation") public static String getReduceJavaOpts(Configuration conf) { String adminOpts = conf.get( MRJobConfig.MAPRED_REDUCE_ADMIN_JAVA_OPTS, MRJobConfig.DEFAULT_MAPRED_ADMIN_JAVA_OPTS); String userOpts = conf.get( MRJobConfig.REDUCE_JAVA_OPTS, conf.get( JobConf.MAPRED_TASK_JAVA_OPTS, JobConf.DE... | MRHelpers { @SuppressWarnings("deprecation") public static String getReduceJavaOpts(Configuration conf) { String adminOpts = conf.get( MRJobConfig.MAPRED_REDUCE_ADMIN_JAVA_OPTS, MRJobConfig.DEFAULT_MAPRED_ADMIN_JAVA_OPTS); String userOpts = conf.get( MRJobConfig.REDUCE_JAVA_OPTS, conf.get( JobConf.MAPRED_TASK_JAVA_OPTS... | MRHelpers { @SuppressWarnings("deprecation") public static String getReduceJavaOpts(Configuration conf) { String adminOpts = conf.get( MRJobConfig.MAPRED_REDUCE_ADMIN_JAVA_OPTS, MRJobConfig.DEFAULT_MAPRED_ADMIN_JAVA_OPTS); String userOpts = conf.get( MRJobConfig.REDUCE_JAVA_OPTS, conf.get( JobConf.MAPRED_TASK_JAVA_OPTS... | MRHelpers { @SuppressWarnings("deprecation") public static String getReduceJavaOpts(Configuration conf) { String adminOpts = conf.get( MRJobConfig.MAPRED_REDUCE_ADMIN_JAVA_OPTS, MRJobConfig.DEFAULT_MAPRED_ADMIN_JAVA_OPTS); String userOpts = conf.get( MRJobConfig.REDUCE_JAVA_OPTS, conf.get( JobConf.MAPRED_TASK_JAVA_OPTS... | MRHelpers { @SuppressWarnings("deprecation") public static String getReduceJavaOpts(Configuration conf) { String adminOpts = conf.get( MRJobConfig.MAPRED_REDUCE_ADMIN_JAVA_OPTS, MRJobConfig.DEFAULT_MAPRED_ADMIN_JAVA_OPTS); String userOpts = conf.get( MRJobConfig.REDUCE_JAVA_OPTS, conf.get( JobConf.MAPRED_TASK_JAVA_OPTS... |
@SuppressWarnings("rawtypes") @Test public void testTaskSucceedAndRetroActiveFailure() { TezTaskID taskId = getNewTaskID(); scheduleTaskAttempt(taskId); launchTaskAttempt(mockTask.getLastAttempt().getID()); updateAttemptState(mockTask.getLastAttempt(), TaskAttemptState.RUNNING); mockTask.handle(new TaskEventTAUpdate(mo... | @Override public void handle(TaskEvent event) { if (LOG.isDebugEnabled()) { LOG.debug("Processing TaskEvent " + event.getTaskID() + " of type " + event.getType() + " while in state " + getInternalState() + ". Event: " + event); } try { writeLock.lock(); TaskStateInternal oldState = getInternalState(); try { stateMachin... | TaskImpl implements Task, EventHandler<TaskEvent> { @Override public void handle(TaskEvent event) { if (LOG.isDebugEnabled()) { LOG.debug("Processing TaskEvent " + event.getTaskID() + " of type " + event.getType() + " while in state " + getInternalState() + ". Event: " + event); } try { writeLock.lock(); TaskStateInter... | TaskImpl implements Task, EventHandler<TaskEvent> { @Override public void handle(TaskEvent event) { if (LOG.isDebugEnabled()) { LOG.debug("Processing TaskEvent " + event.getTaskID() + " of type " + event.getType() + " while in state " + getInternalState() + ". Event: " + event); } try { writeLock.lock(); TaskStateInter... | TaskImpl implements Task, EventHandler<TaskEvent> { @Override public void handle(TaskEvent event) { if (LOG.isDebugEnabled()) { LOG.debug("Processing TaskEvent " + event.getTaskID() + " of type " + event.getType() + " while in state " + getInternalState() + ". Event: " + event); } try { writeLock.lock(); TaskStateInter... | TaskImpl implements Task, EventHandler<TaskEvent> { @Override public void handle(TaskEvent event) { if (LOG.isDebugEnabled()) { LOG.debug("Processing TaskEvent " + event.getTaskID() + " of type " + event.getType() + " while in state " + getInternalState() + ". Event: " + event); } try { writeLock.lock(); TaskStateInter... |
@Test(timeout = 5000) public void testDAGInit() { initDAG(dag); Assert.assertEquals(6, dag.getTotalVertices()); } | @Override public int getTotalVertices() { readLock.lock(); try { return numVertices; } finally { readLock.unlock(); } } | DAGImpl implements org.apache.tez.dag.app.dag.DAG,
EventHandler<DAGEvent> { @Override public int getTotalVertices() { readLock.lock(); try { return numVertices; } finally { readLock.unlock(); } } } | DAGImpl implements org.apache.tez.dag.app.dag.DAG,
EventHandler<DAGEvent> { @Override public int getTotalVertices() { readLock.lock(); try { return numVertices; } finally { readLock.unlock(); } } DAGImpl(TezDAGID dagId,
Configuration conf,
DAGPlan jobPlan,
EventHandler eventHandler,
TaskAttemp... | DAGImpl implements org.apache.tez.dag.app.dag.DAG,
EventHandler<DAGEvent> { @Override public int getTotalVertices() { readLock.lock(); try { return numVertices; } finally { readLock.unlock(); } } DAGImpl(TezDAGID dagId,
Configuration conf,
DAGPlan jobPlan,
EventHandler eventHandler,
TaskAttemp... | DAGImpl implements org.apache.tez.dag.app.dag.DAG,
EventHandler<DAGEvent> { @Override public int getTotalVertices() { readLock.lock(); try { return numVertices; } finally { readLock.unlock(); } } DAGImpl(TezDAGID dagId,
Configuration conf,
DAGPlan jobPlan,
EventHandler eventHandler,
TaskAttemp... |
@SuppressWarnings("unchecked") @Test(timeout=5000) public void testVertexReRunning() { initDAG(dag); dag.dagScheduler = mock(DAGScheduler.class); startDAG(dag); dispatcher.await(); TezVertexID vId = TezVertexID.getInstance(dagId, 1); Vertex v = dag.getVertex(vId); dispatcher.getEventHandler().handle(new VertexEventTask... | private boolean vertexReRunning(Vertex vertex) { reRunningVertices.add(vertex.getVertexId()); numSuccessfulVertices--; addDiagnostic("Vertex re-running" + ", vertexName=" + vertex.getName() + ", vertexId=" + vertex.getVertexId()); if (!commitAllOutputsOnSuccess) { List<VertexGroupInfo> groupList = vertexGroupInfo.get(v... | DAGImpl implements org.apache.tez.dag.app.dag.DAG,
EventHandler<DAGEvent> { private boolean vertexReRunning(Vertex vertex) { reRunningVertices.add(vertex.getVertexId()); numSuccessfulVertices--; addDiagnostic("Vertex re-running" + ", vertexName=" + vertex.getName() + ", vertexId=" + vertex.getVertexId()); if (!commit... | DAGImpl implements org.apache.tez.dag.app.dag.DAG,
EventHandler<DAGEvent> { private boolean vertexReRunning(Vertex vertex) { reRunningVertices.add(vertex.getVertexId()); numSuccessfulVertices--; addDiagnostic("Vertex re-running" + ", vertexName=" + vertex.getName() + ", vertexId=" + vertex.getVertexId()); if (!commit... | DAGImpl implements org.apache.tez.dag.app.dag.DAG,
EventHandler<DAGEvent> { private boolean vertexReRunning(Vertex vertex) { reRunningVertices.add(vertex.getVertexId()); numSuccessfulVertices--; addDiagnostic("Vertex re-running" + ", vertexName=" + vertex.getName() + ", vertexId=" + vertex.getVertexId()); if (!commit... | DAGImpl implements org.apache.tez.dag.app.dag.DAG,
EventHandler<DAGEvent> { private boolean vertexReRunning(Vertex vertex) { reRunningVertices.add(vertex.getVertexId()); numSuccessfulVertices--; addDiagnostic("Vertex re-running" + ", vertexName=" + vertex.getName() + ", vertexId=" + vertex.getVertexId()); if (!commit... |
@Test(timeout = 1000) @SuppressWarnings("unchecked") public void testDAGClientHandler() throws TezException { TezDAGID mockTezDAGId = mock(TezDAGID.class); when(mockTezDAGId.getId()).thenReturn(1); when(mockTezDAGId.toString()).thenReturn("dag_9999_0001_1"); DAG mockDAG = mock(DAG.class); when(mockDAG.getID()).thenRetu... | public DAGClientHandler(DAGAppMaster dagAppMaster) { this.dagAppMaster = dagAppMaster; } | DAGClientHandler { public DAGClientHandler(DAGAppMaster dagAppMaster) { this.dagAppMaster = dagAppMaster; } } | DAGClientHandler { public DAGClientHandler(DAGAppMaster dagAppMaster) { this.dagAppMaster = dagAppMaster; } DAGClientHandler(DAGAppMaster dagAppMaster); } | DAGClientHandler { public DAGClientHandler(DAGAppMaster dagAppMaster) { this.dagAppMaster = dagAppMaster; } DAGClientHandler(DAGAppMaster dagAppMaster); List<String> getAllDAGs(); DAGStatus getDAGStatus(String dagIdStr,
Set<StatusGetOpts> statusOptions); VertexStatus getVertexStatus(String dagIdStr, String vertex... | DAGClientHandler { public DAGClientHandler(DAGAppMaster dagAppMaster) { this.dagAppMaster = dagAppMaster; } DAGClientHandler(DAGAppMaster dagAppMaster); List<String> getAllDAGs(); DAGStatus getDAGStatus(String dagIdStr,
Set<StatusGetOpts> statusOptions); VertexStatus getVertexStatus(String dagIdStr, String vertex... |
@Test public void testVertexStateConversion() { for (VertexState state : VertexState.values()) { DAGProtos.VertexStatusStateProto stateProto = VertexStatusBuilder.getProtoState(state); VertexStatus.State clientState = VertexStatus.getState(stateProto); if (state.equals(VertexState.RECOVERING)) { Assert.assertEquals(cli... | @VisibleForTesting static VertexStatusStateProto getProtoState(VertexState state) { switch(state) { case NEW: return VertexStatusStateProto.VERTEX_NEW; case INITIALIZING: return VertexStatusStateProto.VERTEX_INITIALIZING; case RECOVERING: return VertexStatusStateProto.VERTEX_NEW; case INITED: return VertexStatusStatePr... | VertexStatusBuilder extends VertexStatus { @VisibleForTesting static VertexStatusStateProto getProtoState(VertexState state) { switch(state) { case NEW: return VertexStatusStateProto.VERTEX_NEW; case INITIALIZING: return VertexStatusStateProto.VERTEX_INITIALIZING; case RECOVERING: return VertexStatusStateProto.VERTEX_N... | VertexStatusBuilder extends VertexStatus { @VisibleForTesting static VertexStatusStateProto getProtoState(VertexState state) { switch(state) { case NEW: return VertexStatusStateProto.VERTEX_NEW; case INITIALIZING: return VertexStatusStateProto.VERTEX_INITIALIZING; case RECOVERING: return VertexStatusStateProto.VERTEX_N... | VertexStatusBuilder extends VertexStatus { @VisibleForTesting static VertexStatusStateProto getProtoState(VertexState state) { switch(state) { case NEW: return VertexStatusStateProto.VERTEX_NEW; case INITIALIZING: return VertexStatusStateProto.VERTEX_INITIALIZING; case RECOVERING: return VertexStatusStateProto.VERTEX_N... | VertexStatusBuilder extends VertexStatus { @VisibleForTesting static VertexStatusStateProto getProtoState(VertexState state) { switch(state) { case NEW: return VertexStatusStateProto.VERTEX_NEW; case INITIALIZING: return VertexStatusStateProto.VERTEX_INITIALIZING; case RECOVERING: return VertexStatusStateProto.VERTEX_N... |
@Test public void testTasksToBeProfiled() { Random rnd = new Random(); Configuration conf = new Configuration(); JavaProfilerOptions profilerOptions = getOptions(conf, ""); assertFalse(profilerOptions.shouldProfileJVM("v", 0)); profilerOptions = getOptions(conf, "v[0,1,2]"); assertTrue(profilerOptions.shouldProfileJVM(... | public boolean shouldProfileJVM(String vertexName, int taskId) { if (tasksToProfileMap == null || taskId < 0) { return false; } BitSet taskSet = tasksToProfileMap.get(vertexName); return (taskSet == null) ? false : ((taskSet.isEmpty()) ? true : taskSet.get(taskId)); } | JavaProfilerOptions { public boolean shouldProfileJVM(String vertexName, int taskId) { if (tasksToProfileMap == null || taskId < 0) { return false; } BitSet taskSet = tasksToProfileMap.get(vertexName); return (taskSet == null) ? false : ((taskSet.isEmpty()) ? true : taskSet.get(taskId)); } } | JavaProfilerOptions { public boolean shouldProfileJVM(String vertexName, int taskId) { if (tasksToProfileMap == null || taskId < 0) { return false; } BitSet taskSet = tasksToProfileMap.get(vertexName); return (taskSet == null) ? false : ((taskSet.isEmpty()) ? true : taskSet.get(taskId)); } JavaProfilerOptions(Configura... | JavaProfilerOptions { public boolean shouldProfileJVM(String vertexName, int taskId) { if (tasksToProfileMap == null || taskId < 0) { return false; } BitSet taskSet = tasksToProfileMap.get(vertexName); return (taskSet == null) ? false : ((taskSet.isEmpty()) ? true : taskSet.get(taskId)); } JavaProfilerOptions(Configura... | JavaProfilerOptions { public boolean shouldProfileJVM(String vertexName, int taskId) { if (tasksToProfileMap == null || taskId < 0) { return false; } BitSet taskSet = tasksToProfileMap.get(vertexName); return (taskSet == null) ? false : ((taskSet.isEmpty()) ? true : taskSet.get(taskId)); } JavaProfilerOptions(Configura... |
@Test public void testProfilingJVMOpts() { Configuration conf = new Configuration(); JavaProfilerOptions profilerOptions = getOptions(conf, "", ""); String jvmOpts = profilerOptions.getProfilerOptions("", "", 0); assertTrue(jvmOpts.trim().equals("")); profilerOptions = getOptions(conf, "", "dir=__VERTEX_NAME__"); jvmOp... | public String getProfilerOptions(String jvmOpts, String vertexName, int taskIdx) { jvmOpts = (jvmOpts == null) ? "" : jvmOpts; vertexName = vertexName.replaceAll(" ", ""); String result = jvmProfilingOpts.replaceAll("__VERTEX_NAME__", vertexName) .replaceAll("__TASK_INDEX__", Integer.toString(taskIdx)); result = (jvmOp... | JavaProfilerOptions { public String getProfilerOptions(String jvmOpts, String vertexName, int taskIdx) { jvmOpts = (jvmOpts == null) ? "" : jvmOpts; vertexName = vertexName.replaceAll(" ", ""); String result = jvmProfilingOpts.replaceAll("__VERTEX_NAME__", vertexName) .replaceAll("__TASK_INDEX__", Integer.toString(task... | JavaProfilerOptions { public String getProfilerOptions(String jvmOpts, String vertexName, int taskIdx) { jvmOpts = (jvmOpts == null) ? "" : jvmOpts; vertexName = vertexName.replaceAll(" ", ""); String result = jvmProfilingOpts.replaceAll("__VERTEX_NAME__", vertexName) .replaceAll("__TASK_INDEX__", Integer.toString(task... | JavaProfilerOptions { public String getProfilerOptions(String jvmOpts, String vertexName, int taskIdx) { jvmOpts = (jvmOpts == null) ? "" : jvmOpts; vertexName = vertexName.replaceAll(" ", ""); String result = jvmProfilingOpts.replaceAll("__VERTEX_NAME__", vertexName) .replaceAll("__TASK_INDEX__", Integer.toString(task... | JavaProfilerOptions { public String getProfilerOptions(String jvmOpts, String vertexName, int taskIdx) { jvmOpts = (jvmOpts == null) ? "" : jvmOpts; vertexName = vertexName.replaceAll(" ", ""); String result = jvmProfilingOpts.replaceAll("__VERTEX_NAME__", vertexName) .replaceAll("__TASK_INDEX__", Integer.toString(task... |
@Test public void testMultipleUpdateEnvironment() { EnvironmentUpdateUtils.put("test.environment1", "test.value1"); EnvironmentUpdateUtils.put("test.environment2", "test.value2"); assertEquals("Environment was not set propertly", "test.value1", System.getenv("test.environment1")); assertEquals("Environment was not set ... | public static void put(String key, String value){ Map<String, String> environment = new HashMap<String, String>(System.getenv()); environment.put(key, value); updateEnvironment(environment); } | EnvironmentUpdateUtils { public static void put(String key, String value){ Map<String, String> environment = new HashMap<String, String>(System.getenv()); environment.put(key, value); updateEnvironment(environment); } } | EnvironmentUpdateUtils { public static void put(String key, String value){ Map<String, String> environment = new HashMap<String, String>(System.getenv()); environment.put(key, value); updateEnvironment(environment); } } | EnvironmentUpdateUtils { public static void put(String key, String value){ Map<String, String> environment = new HashMap<String, String>(System.getenv()); environment.put(key, value); updateEnvironment(environment); } static void put(String key, String value); static void putAll(Map<String, String> additionalEnvironme... | EnvironmentUpdateUtils { public static void put(String key, String value){ Map<String, String> environment = new HashMap<String, String>(System.getenv()); environment.put(key, value); updateEnvironment(environment); } static void put(String key, String value); static void putAll(Map<String, String> additionalEnvironme... |
@Test(timeout=20000) public void testATSHistoryLoggingServiceShutdown() { TezDAGID tezDAGID = TezDAGID.getInstance( ApplicationId.newInstance(100l, 1), 1); DAGHistoryEvent historyEvent = new DAGHistoryEvent(tezDAGID, new DAGStartedEvent(tezDAGID, 1001l, "user1", "dagName1")); for (int i = 0; i < 20; ++i) { atsHistoryLo... | public void handle(DAGHistoryEvent event) { eventQueue.add(event); } | ATSHistoryLoggingService extends HistoryLoggingService { public void handle(DAGHistoryEvent event) { eventQueue.add(event); } } | ATSHistoryLoggingService extends HistoryLoggingService { public void handle(DAGHistoryEvent event) { eventQueue.add(event); } ATSHistoryLoggingService(); } | ATSHistoryLoggingService extends HistoryLoggingService { public void handle(DAGHistoryEvent event) { eventQueue.add(event); } ATSHistoryLoggingService(); @Override void serviceInit(Configuration conf); @Override void serviceStart(); @Override void serviceStop(); void handle(DAGHistoryEvent event); } | ATSHistoryLoggingService extends HistoryLoggingService { public void handle(DAGHistoryEvent event) { eventQueue.add(event); } ATSHistoryLoggingService(); @Override void serviceInit(Configuration conf); @Override void serviceStart(); @Override void serviceStop(); void handle(DAGHistoryEvent event); } |
@Test public void testHandlerExists() throws JSONException { for (HistoryEventType eventType : HistoryEventType.values()) { HistoryEvent event = null; switch (eventType) { case AM_LAUNCHED: event = new AMLaunchedEvent(applicationAttemptId, random.nextInt(), random.nextInt(), user); break; case AM_STARTED: event = new A... | public static TimelineEntity convertToTimelineEntity(HistoryEvent historyEvent) { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } TimelineEntity timelineEntity = null; switch (historyEvent.getEvent... | HistoryEventTimelineConversion { public static TimelineEntity convertToTimelineEntity(HistoryEvent historyEvent) { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } TimelineEntity timelineEntity = nu... | HistoryEventTimelineConversion { public static TimelineEntity convertToTimelineEntity(HistoryEvent historyEvent) { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } TimelineEntity timelineEntity = nu... | HistoryEventTimelineConversion { public static TimelineEntity convertToTimelineEntity(HistoryEvent historyEvent) { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } TimelineEntity timelineEntity = nu... | HistoryEventTimelineConversion { public static TimelineEntity convertToTimelineEntity(HistoryEvent historyEvent) { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } TimelineEntity timelineEntity = nu... |
@Test public void testMREnvSetupForMap() { Configuration conf = setupConfigForMREnvTest(); Map<String, String> env = new HashMap<String, String>(); MRHelpers.updateEnvironmentForMRTasks(conf, env, true); testCommonEnvSettingsForMRTasks(env); Assert.assertEquals("map1", env.get("foo")); Assert.assertEquals("map2", env.g... | public static void updateEnvironmentForMRTasks(Configuration conf, Map<String, String> environment, boolean isMap) { environment.put(Environment.SHELL.name(), conf.get( MRJobConfig.MAPRED_ADMIN_USER_SHELL, MRJobConfig.DEFAULT_SHELL)); TezYARNUtils.addToEnvironment(environment, Environment.LD_LIBRARY_PATH.name(), Enviro... | MRHelpers { public static void updateEnvironmentForMRTasks(Configuration conf, Map<String, String> environment, boolean isMap) { environment.put(Environment.SHELL.name(), conf.get( MRJobConfig.MAPRED_ADMIN_USER_SHELL, MRJobConfig.DEFAULT_SHELL)); TezYARNUtils.addToEnvironment(environment, Environment.LD_LIBRARY_PATH.na... | MRHelpers { public static void updateEnvironmentForMRTasks(Configuration conf, Map<String, String> environment, boolean isMap) { environment.put(Environment.SHELL.name(), conf.get( MRJobConfig.MAPRED_ADMIN_USER_SHELL, MRJobConfig.DEFAULT_SHELL)); TezYARNUtils.addToEnvironment(environment, Environment.LD_LIBRARY_PATH.na... | MRHelpers { public static void updateEnvironmentForMRTasks(Configuration conf, Map<String, String> environment, boolean isMap) { environment.put(Environment.SHELL.name(), conf.get( MRJobConfig.MAPRED_ADMIN_USER_SHELL, MRJobConfig.DEFAULT_SHELL)); TezYARNUtils.addToEnvironment(environment, Environment.LD_LIBRARY_PATH.na... | MRHelpers { public static void updateEnvironmentForMRTasks(Configuration conf, Map<String, String> environment, boolean isMap) { environment.put(Environment.SHELL.name(), conf.get( MRJobConfig.MAPRED_ADMIN_USER_SHELL, MRJobConfig.DEFAULT_SHELL)); TezYARNUtils.addToEnvironment(environment, Environment.LD_LIBRARY_PATH.na... |
@Test public void testMREnvSetupForReduce() { Configuration conf = setupConfigForMREnvTest(); Map<String, String> env = new HashMap<String, String>(); MRHelpers.updateEnvironmentForMRTasks(conf, env, false); testCommonEnvSettingsForMRTasks(env); Assert.assertEquals("red1", env.get("foo")); Assert.assertEquals("red2", e... | public static void updateEnvironmentForMRTasks(Configuration conf, Map<String, String> environment, boolean isMap) { environment.put(Environment.SHELL.name(), conf.get( MRJobConfig.MAPRED_ADMIN_USER_SHELL, MRJobConfig.DEFAULT_SHELL)); TezYARNUtils.addToEnvironment(environment, Environment.LD_LIBRARY_PATH.name(), Enviro... | MRHelpers { public static void updateEnvironmentForMRTasks(Configuration conf, Map<String, String> environment, boolean isMap) { environment.put(Environment.SHELL.name(), conf.get( MRJobConfig.MAPRED_ADMIN_USER_SHELL, MRJobConfig.DEFAULT_SHELL)); TezYARNUtils.addToEnvironment(environment, Environment.LD_LIBRARY_PATH.na... | MRHelpers { public static void updateEnvironmentForMRTasks(Configuration conf, Map<String, String> environment, boolean isMap) { environment.put(Environment.SHELL.name(), conf.get( MRJobConfig.MAPRED_ADMIN_USER_SHELL, MRJobConfig.DEFAULT_SHELL)); TezYARNUtils.addToEnvironment(environment, Environment.LD_LIBRARY_PATH.na... | MRHelpers { public static void updateEnvironmentForMRTasks(Configuration conf, Map<String, String> environment, boolean isMap) { environment.put(Environment.SHELL.name(), conf.get( MRJobConfig.MAPRED_ADMIN_USER_SHELL, MRJobConfig.DEFAULT_SHELL)); TezYARNUtils.addToEnvironment(environment, Environment.LD_LIBRARY_PATH.na... | MRHelpers { public static void updateEnvironmentForMRTasks(Configuration conf, Map<String, String> environment, boolean isMap) { environment.put(Environment.SHELL.name(), conf.get( MRJobConfig.MAPRED_ADMIN_USER_SHELL, MRJobConfig.DEFAULT_SHELL)); TezYARNUtils.addToEnvironment(environment, Environment.LD_LIBRARY_PATH.na... |
@Test public void testGetBaseMRConf() { Configuration conf = MRHelpers.getBaseMRConfiguration(); Assert.assertNotNull(conf); conf = MRHelpers.getBaseMRConfiguration(new YarnConfiguration()); Assert.assertNotNull(conf); } | public static Configuration getBaseMRConfiguration(Configuration conf) { return getBaseJobConf(conf); } | MRHelpers { public static Configuration getBaseMRConfiguration(Configuration conf) { return getBaseJobConf(conf); } } | MRHelpers { public static Configuration getBaseMRConfiguration(Configuration conf) { return getBaseJobConf(conf); } } | MRHelpers { public static Configuration getBaseMRConfiguration(Configuration conf) { return getBaseJobConf(conf); } @LimitedPrivate("Hive, Pig") @Unstable static void translateVertexConfToTez(Configuration conf); @SuppressWarnings({ "rawtypes", "unchecked" }) @Private static org.apache.hadoop.mapreduce.InputSplit[] ge... | MRHelpers { public static Configuration getBaseMRConfiguration(Configuration conf) { return getBaseJobConf(conf); } @LimitedPrivate("Hive, Pig") @Unstable static void translateVertexConfToTez(Configuration conf); @SuppressWarnings({ "rawtypes", "unchecked" }) @Private static org.apache.hadoop.mapreduce.InputSplit[] ge... |
@Test public void testMRAMJavaOpts() { Configuration conf = new Configuration(); conf.set(MRJobConfig.MR_AM_ADMIN_COMMAND_OPTS, " -Dadminfoobar "); conf.set(MRJobConfig.MR_AM_COMMAND_OPTS, " -Duserfoo "); String opts = MRHelpers.getMRAMJavaOpts(conf); Assert.assertEquals("-Dadminfoobar -Duserfoo", opts); } | public static String getMRAMJavaOpts(Configuration conf) { String mrAppMasterAdminOptions = conf.get( MRJobConfig.MR_AM_ADMIN_COMMAND_OPTS, MRJobConfig.DEFAULT_MR_AM_ADMIN_COMMAND_OPTS); String mrAppMasterUserOptions = conf.get(MRJobConfig.MR_AM_COMMAND_OPTS, MRJobConfig.DEFAULT_MR_AM_COMMAND_OPTS); return mrAppMasterA... | MRHelpers { public static String getMRAMJavaOpts(Configuration conf) { String mrAppMasterAdminOptions = conf.get( MRJobConfig.MR_AM_ADMIN_COMMAND_OPTS, MRJobConfig.DEFAULT_MR_AM_ADMIN_COMMAND_OPTS); String mrAppMasterUserOptions = conf.get(MRJobConfig.MR_AM_COMMAND_OPTS, MRJobConfig.DEFAULT_MR_AM_COMMAND_OPTS); return ... | MRHelpers { public static String getMRAMJavaOpts(Configuration conf) { String mrAppMasterAdminOptions = conf.get( MRJobConfig.MR_AM_ADMIN_COMMAND_OPTS, MRJobConfig.DEFAULT_MR_AM_ADMIN_COMMAND_OPTS); String mrAppMasterUserOptions = conf.get(MRJobConfig.MR_AM_COMMAND_OPTS, MRJobConfig.DEFAULT_MR_AM_COMMAND_OPTS); return ... | MRHelpers { public static String getMRAMJavaOpts(Configuration conf) { String mrAppMasterAdminOptions = conf.get( MRJobConfig.MR_AM_ADMIN_COMMAND_OPTS, MRJobConfig.DEFAULT_MR_AM_ADMIN_COMMAND_OPTS); String mrAppMasterUserOptions = conf.get(MRJobConfig.MR_AM_COMMAND_OPTS, MRJobConfig.DEFAULT_MR_AM_COMMAND_OPTS); return ... | MRHelpers { public static String getMRAMJavaOpts(Configuration conf) { String mrAppMasterAdminOptions = conf.get( MRJobConfig.MR_AM_ADMIN_COMMAND_OPTS, MRJobConfig.DEFAULT_MR_AM_ADMIN_COMMAND_OPTS); String mrAppMasterUserOptions = conf.get(MRJobConfig.MR_AM_COMMAND_OPTS, MRJobConfig.DEFAULT_MR_AM_COMMAND_OPTS); return ... |
@Test public void useCommonsLogging() { LoggerFactory.useCommonsLogging(); Logger log = LoggerFactory.getLog(Object.class); logSomething(log); assertThat(log, instanceOf(JakartaCommonsLoggingImpl.class)); } | public synchronized void useCommonsLogging() { setImplementation(JakartaCommonsLoggingImpl.class); } | LoggerFactory { public synchronized void useCommonsLogging() { setImplementation(JakartaCommonsLoggingImpl.class); } } | LoggerFactory { public synchronized void useCommonsLogging() { setImplementation(JakartaCommonsLoggingImpl.class); } } | LoggerFactory { public synchronized void useCommonsLogging() { setImplementation(JakartaCommonsLoggingImpl.class); } Logger getLog(Class<?> aClass); Logger getLog(String logger); synchronized void useCustomLogging(Class<? extends Logger> clazz); synchronized void useSlf4jLogging(); synchronized void useCommonsLogging(... | LoggerFactory { public synchronized void useCommonsLogging() { setImplementation(JakartaCommonsLoggingImpl.class); } Logger getLog(Class<?> aClass); Logger getLog(String logger); synchronized void useCustomLogging(Class<? extends Logger> clazz); synchronized void useSlf4jLogging(); synchronized void useCommonsLogging(... |
@Test public void useJdKLogging() { LoggerFactory.useJdkLogging(); Logger log = LoggerFactory.getLog(Object.class); logSomething(log); assertThat(log, instanceOf(Jdk14LoggingImpl.class)); } | public synchronized void useJdkLogging() { setImplementation(Jdk14LoggingImpl.class); } | LoggerFactory { public synchronized void useJdkLogging() { setImplementation(Jdk14LoggingImpl.class); } } | LoggerFactory { public synchronized void useJdkLogging() { setImplementation(Jdk14LoggingImpl.class); } } | LoggerFactory { public synchronized void useJdkLogging() { setImplementation(Jdk14LoggingImpl.class); } Logger getLog(Class<?> aClass); Logger getLog(String logger); synchronized void useCustomLogging(Class<? extends Logger> clazz); synchronized void useSlf4jLogging(); synchronized void useCommonsLogging(); synchroniz... | LoggerFactory { public synchronized void useJdkLogging() { setImplementation(Jdk14LoggingImpl.class); } Logger getLog(Class<?> aClass); Logger getLog(String logger); synchronized void useCustomLogging(Class<? extends Logger> clazz); synchronized void useSlf4jLogging(); synchronized void useCommonsLogging(); synchroniz... |
@Test public void useNoLogging() { LoggerFactory.useNoLogging(); Logger log = LoggerFactory.getLog(Object.class); logSomething(log); assertThat(log, instanceOf(NoLoggingImpl.class)); } | public synchronized void useNoLogging() { setImplementation(NoLoggingImpl.class); } | LoggerFactory { public synchronized void useNoLogging() { setImplementation(NoLoggingImpl.class); } } | LoggerFactory { public synchronized void useNoLogging() { setImplementation(NoLoggingImpl.class); } } | LoggerFactory { public synchronized void useNoLogging() { setImplementation(NoLoggingImpl.class); } Logger getLog(Class<?> aClass); Logger getLog(String logger); synchronized void useCustomLogging(Class<? extends Logger> clazz); synchronized void useSlf4jLogging(); synchronized void useCommonsLogging(); synchronized v... | LoggerFactory { public synchronized void useNoLogging() { setImplementation(NoLoggingImpl.class); } Logger getLog(Class<?> aClass); Logger getLog(String logger); synchronized void useCustomLogging(Class<? extends Logger> clazz); synchronized void useSlf4jLogging(); synchronized void useCommonsLogging(); synchronized v... |
@Test public void operand_should_auto_unwrap_quote() { StringPrimitiveOperand operand = new StringPrimitiveOperand("\"dsdsdsdsds"); assertThat(operand.getValue(), equalTo("dsdsdsdsds")); StringPrimitiveOperand operand1 = new StringPrimitiveOperand("\"dsdsdsdsds\""); assertThat(operand1.getValue(), equalTo("dsdsdsdsds")... | @Override public String getValue() { return value; } | StringPrimitiveOperand implements PrimitiveOperand { @Override public String getValue() { return value; } } | StringPrimitiveOperand implements PrimitiveOperand { @Override public String getValue() { return value; } StringPrimitiveOperand(@NonNull String value); } | StringPrimitiveOperand implements PrimitiveOperand { @Override public String getValue() { return value; } StringPrimitiveOperand(@NonNull String value); @Override String getValue(); @Override String getType(); } | StringPrimitiveOperand implements PrimitiveOperand { @Override public String getValue() { return value; } StringPrimitiveOperand(@NonNull String value); @Override String getValue(); @Override String getType(); } |
@Test public void get_specified_line_in_multiply_line_str() throws Exception { String text = "aaa\nbbb\nccc\nddd"; assertThat(AntlrUtils.errorLine(text, 1), is("aaa")); assertThat(AntlrUtils.errorLine(text, 2), is("bbb")); assertThat(AntlrUtils.errorLine(text, 3), is("ccc")); assertThat(AntlrUtils.errorLine(text, 4), i... | String errorLine(String errorMessage, int lineNumber) { int startIndex = 0; int endIndex = 0; for (int i = 0; i < lineNumber; i++) { int index = errorMessage.indexOf('\n', endIndex + 1); if (i > 0) { startIndex = endIndex + 1; } if (index >= 0) { endIndex = index; } else { endIndex = errorMessage.length(); } } return e... | AntlrUtils { String errorLine(String errorMessage, int lineNumber) { int startIndex = 0; int endIndex = 0; for (int i = 0; i < lineNumber; i++) { int index = errorMessage.indexOf('\n', endIndex + 1); if (i > 0) { startIndex = endIndex + 1; } if (index >= 0) { endIndex = index; } else { endIndex = errorMessage.length();... | AntlrUtils { String errorLine(String errorMessage, int lineNumber) { int startIndex = 0; int endIndex = 0; for (int i = 0; i < lineNumber; i++) { int index = errorMessage.indexOf('\n', endIndex + 1); if (i > 0) { startIndex = endIndex + 1; } if (index >= 0) { endIndex = index; } else { endIndex = errorMessage.length();... | AntlrUtils { String errorLine(String errorMessage, int lineNumber) { int startIndex = 0; int endIndex = 0; for (int i = 0; i < lineNumber; i++) { int index = errorMessage.indexOf('\n', endIndex + 1); if (i > 0) { startIndex = endIndex + 1; } if (index >= 0) { endIndex = index; } else { endIndex = errorMessage.length();... | AntlrUtils { String errorLine(String errorMessage, int lineNumber) { int startIndex = 0; int endIndex = 0; for (int i = 0; i < lineNumber; i++) { int index = errorMessage.indexOf('\n', endIndex + 1); if (i > 0) { startIndex = endIndex + 1; } if (index >= 0) { endIndex = index; } else { endIndex = errorMessage.length();... |
@Test public void applySystemPropertiesShouldConvertOptsToSystemProps() { System.setProperty("c", ""); Map<String, String> opts = new HashMap<>(); opts.put("a", "1"); opts.put("-Dc", "2"); CoffeeHouseApp.applySystemProperties(opts); assertThat(System.getProperty("c")).isEqualTo("2"); } | static void applySystemProperties(final Map<String, String> opts) { opts.forEach((key, value) -> { if (key.startsWith("-D")) System.setProperty(key.substring(2), value); }); } | CoffeeHouseApp implements Terminal { static void applySystemProperties(final Map<String, String> opts) { opts.forEach((key, value) -> { if (key.startsWith("-D")) System.setProperty(key.substring(2), value); }); } } | CoffeeHouseApp implements Terminal { static void applySystemProperties(final Map<String, String> opts) { opts.forEach((key, value) -> { if (key.startsWith("-D")) System.setProperty(key.substring(2), value); }); } CoffeeHouseApp(final ActorSystem system); } | CoffeeHouseApp implements Terminal { static void applySystemProperties(final Map<String, String> opts) { opts.forEach((key, value) -> { if (key.startsWith("-D")) System.setProperty(key.substring(2), value); }); } CoffeeHouseApp(final ActorSystem system); static void main(final String[] args); } | CoffeeHouseApp implements Terminal { static void applySystemProperties(final Map<String, String> opts) { opts.forEach((key, value) -> { if (key.startsWith("-D")) System.setProperty(key.substring(2), value); }); } CoffeeHouseApp(final ActorSystem system); static void main(final String[] args); } |
@Test public void sendingPrepareCoffeeShouldResultInCoffeePreparedResponse() { new JavaTestKit(system) {{ ActorRef barista = system.actorOf(Barista.props(duration("100 milliseconds"))); new Within(duration("50 milliseconds"), duration("1000 milliseconds")) { @Override protected void run() { barista.tell(new Barista.Pre... | public static Props props(FiniteDuration prepareCoffeeDuration) { return Props.create(Barista.class, () -> new Barista(prepareCoffeeDuration)); } | Barista extends AbstractLoggingActor { public static Props props(FiniteDuration prepareCoffeeDuration) { return Props.create(Barista.class, () -> new Barista(prepareCoffeeDuration)); } } | Barista extends AbstractLoggingActor { public static Props props(FiniteDuration prepareCoffeeDuration) { return Props.create(Barista.class, () -> new Barista(prepareCoffeeDuration)); } private Barista(FiniteDuration prepareCoffeeDuration); } | Barista extends AbstractLoggingActor { public static Props props(FiniteDuration prepareCoffeeDuration) { return Props.create(Barista.class, () -> new Barista(prepareCoffeeDuration)); } private Barista(FiniteDuration prepareCoffeeDuration); @Override Receive createReceive(); static Props props(FiniteDuration prepareCof... | Barista extends AbstractLoggingActor { public static Props props(FiniteDuration prepareCoffeeDuration) { return Props.create(Barista.class, () -> new Barista(prepareCoffeeDuration)); } private Barista(FiniteDuration prepareCoffeeDuration); @Override Receive createReceive(); static Props props(FiniteDuration prepareCof... |
@Test public void shouldCreateNGuestsBasedOnCount() { new JavaTestKit(system) {{ new CoffeeHouseApp(system) { @Override protected ActorRef createCoffeeHouse() { return getRef(); } }.createGuest(2, new Coffee.Akkaccino(), Integer.MAX_VALUE); expectMsgAllOf(new CoffeeHouse.CreateGuest(new Coffee.Akkaccino()), new CoffeeH... | void createGuest(int count, Coffee coffee, int maxCoffeeCount) { for (int i = 0; i < count; i++) { coffeeHouse.tell(new CoffeeHouse.CreateGuest(coffee), ActorRef.noSender()); } } | CoffeeHouseApp implements Terminal { void createGuest(int count, Coffee coffee, int maxCoffeeCount) { for (int i = 0; i < count; i++) { coffeeHouse.tell(new CoffeeHouse.CreateGuest(coffee), ActorRef.noSender()); } } } | CoffeeHouseApp implements Terminal { void createGuest(int count, Coffee coffee, int maxCoffeeCount) { for (int i = 0; i < count; i++) { coffeeHouse.tell(new CoffeeHouse.CreateGuest(coffee), ActorRef.noSender()); } } CoffeeHouseApp(final ActorSystem system); } | CoffeeHouseApp implements Terminal { void createGuest(int count, Coffee coffee, int maxCoffeeCount) { for (int i = 0; i < count; i++) { coffeeHouse.tell(new CoffeeHouse.CreateGuest(coffee), ActorRef.noSender()); } } CoffeeHouseApp(final ActorSystem system); static void main(final String[] args); } | CoffeeHouseApp implements Terminal { void createGuest(int count, Coffee coffee, int maxCoffeeCount) { for (int i = 0; i < count; i++) { coffeeHouse.tell(new CoffeeHouse.CreateGuest(coffee), ActorRef.noSender()); } } CoffeeHouseApp(final ActorSystem system); static void main(final String[] args); } |
@Test public void argsToOptsShouldConvertArgsToOpts() { final Map<String, String> result = CoffeeHouseApp.argsToOpts(Arrays.asList("a=1", "b", "-Dc=2")); assertThat(result).contains(MapEntry.entry("a", "1"), MapEntry.entry("-Dc", "2")); } | static Map<String, String> argsToOpts(final List<String> args) { final Map<String, String> opts = new HashMap<>(); for (final String arg : args) { final Matcher matcher = optPattern.matcher(arg); if (matcher.matches()) opts.put(matcher.group(1), matcher.group(2)); } return opts; } | CoffeeHouseApp implements Terminal { static Map<String, String> argsToOpts(final List<String> args) { final Map<String, String> opts = new HashMap<>(); for (final String arg : args) { final Matcher matcher = optPattern.matcher(arg); if (matcher.matches()) opts.put(matcher.group(1), matcher.group(2)); } return opts; } } | CoffeeHouseApp implements Terminal { static Map<String, String> argsToOpts(final List<String> args) { final Map<String, String> opts = new HashMap<>(); for (final String arg : args) { final Matcher matcher = optPattern.matcher(arg); if (matcher.matches()) opts.put(matcher.group(1), matcher.group(2)); } return opts; } C... | CoffeeHouseApp implements Terminal { static Map<String, String> argsToOpts(final List<String> args) { final Map<String, String> opts = new HashMap<>(); for (final String arg : args) { final Matcher matcher = optPattern.matcher(arg); if (matcher.matches()) opts.put(matcher.group(1), matcher.group(2)); } return opts; } C... | CoffeeHouseApp implements Terminal { static Map<String, String> argsToOpts(final List<String> args) { final Map<String, String> opts = new HashMap<>(); for (final String arg : args) { final Matcher matcher = optPattern.matcher(arg); if (matcher.matches()) opts.put(matcher.group(1), matcher.group(2)); } return opts; } C... |
@Test public void sendingServeCoffeeShouldResultInPrepareCoffeeToBarista() { new JavaTestKit(system) {{ ActorRef barista = getRef(); TestProbe guest = new TestProbe(system); ActorRef waiter = system.actorOf(Waiter.props(barista)); waiter.tell(new Waiter.ServeCoffee(new Coffee.Akkaccino()), guest.ref()); expectMsgEquals... | public static Props props(ActorRef barista) { return Props.create(Waiter.class, () -> new Waiter(barista)); } | Waiter extends AbstractLoggingActor { public static Props props(ActorRef barista) { return Props.create(Waiter.class, () -> new Waiter(barista)); } } | Waiter extends AbstractLoggingActor { public static Props props(ActorRef barista) { return Props.create(Waiter.class, () -> new Waiter(barista)); } Waiter(ActorRef barista); } | Waiter extends AbstractLoggingActor { public static Props props(ActorRef barista) { return Props.create(Waiter.class, () -> new Waiter(barista)); } Waiter(ActorRef barista); @Override Receive createReceive(); static Props props(ActorRef barista); } | Waiter extends AbstractLoggingActor { public static Props props(ActorRef barista) { return Props.create(Waiter.class, () -> new Waiter(barista)); } Waiter(ActorRef barista); @Override Receive createReceive(); static Props props(ActorRef barista); } |
@Test public void shouldLogMessageWhenCreated() { new JavaTestKit(system) {{ interceptDebugLogMessage(this, ".*[Oo]pen.*", 1, () -> system.actorOf(CoffeeHouse.props())); }}; } | static Props props() { return Props.create(CoffeeHouse.class, CoffeeHouse::new); } | CoffeeHouse extends AbstractLoggingActor { static Props props() { return Props.create(CoffeeHouse.class, CoffeeHouse::new); } } | CoffeeHouse extends AbstractLoggingActor { static Props props() { return Props.create(CoffeeHouse.class, CoffeeHouse::new); } CoffeeHouse(); } | CoffeeHouse extends AbstractLoggingActor { static Props props() { return Props.create(CoffeeHouse.class, CoffeeHouse::new); } CoffeeHouse(); @Override Receive createReceive(); } | CoffeeHouse extends AbstractLoggingActor { static Props props() { return Props.create(CoffeeHouse.class, CoffeeHouse::new); } CoffeeHouse(); @Override Receive createReceive(); } |
@Test public void sendingServeCoffeeShouldResultInCoffeeServedResponse() { new JavaTestKit(system) {{ ActorRef waiter = system.actorOf(Waiter.props()); waiter.tell(new Waiter.ServeCoffee(new Coffee.Akkaccino()), getRef()); expectMsgEquals(new Waiter.CoffeeServed(new Coffee.Akkaccino())); }}; } | static Props props() { return Props.create(Waiter.class, Waiter::new); } | Waiter extends AbstractLoggingActor { static Props props() { return Props.create(Waiter.class, Waiter::new); } } | Waiter extends AbstractLoggingActor { static Props props() { return Props.create(Waiter.class, Waiter::new); } private Waiter(); } | Waiter extends AbstractLoggingActor { static Props props() { return Props.create(Waiter.class, Waiter::new); } private Waiter(); @Override Receive createReceive(); } | Waiter extends AbstractLoggingActor { static Props props() { return Props.create(Waiter.class, Waiter::new); } private Waiter(); @Override Receive createReceive(); } |
@Test public void sendingCoffeeServedShouldIncreaseCoffeeCount() { new JavaTestKit(system) {{ ActorRef guest = system.actorOf(Guest.props(system.deadLetters(), new Coffee.Akkaccino(), duration("100 milliseconds"))); interceptInfoLogMessage(this, ".*[Ee]njoy.*1\\.*", 1, () -> { guest.tell(new Waiter.CoffeeServed(new Cof... | static Props props( final ActorRef waiter, final Coffee favoriteCoffee, FiniteDuration finishCoffeeDuration) { return Props.create(Guest.class, () -> new Guest(waiter, favoriteCoffee, finishCoffeeDuration)); } | Guest extends AbstractLoggingActor { static Props props( final ActorRef waiter, final Coffee favoriteCoffee, FiniteDuration finishCoffeeDuration) { return Props.create(Guest.class, () -> new Guest(waiter, favoriteCoffee, finishCoffeeDuration)); } } | Guest extends AbstractLoggingActor { static Props props( final ActorRef waiter, final Coffee favoriteCoffee, FiniteDuration finishCoffeeDuration) { return Props.create(Guest.class, () -> new Guest(waiter, favoriteCoffee, finishCoffeeDuration)); } Guest(ActorRef waiter, Coffee favoriteCoffee, FiniteDuration finishCoffee... | Guest extends AbstractLoggingActor { static Props props( final ActorRef waiter, final Coffee favoriteCoffee, FiniteDuration finishCoffeeDuration) { return Props.create(Guest.class, () -> new Guest(waiter, favoriteCoffee, finishCoffeeDuration)); } Guest(ActorRef waiter, Coffee favoriteCoffee, FiniteDuration finishCoffee... | Guest extends AbstractLoggingActor { static Props props( final ActorRef waiter, final Coffee favoriteCoffee, FiniteDuration finishCoffeeDuration) { return Props.create(Guest.class, () -> new Guest(waiter, favoriteCoffee, finishCoffeeDuration)); } Guest(ActorRef waiter, Coffee favoriteCoffee, FiniteDuration finishCoffee... |
@Test public void parseFrame() { final String uaid = UUIDUtil.newUAID(); final String json = "{\"messageType\": \"hello\", \"uaid\": \"" + uaid + "\", \"channelIDs\": [\"123abc\", \"efg456\"]}"; final MessageType messageType = JsonUtil.parseFrame(json); assertThat(messageType.getMessageType(), is(equalTo(MessageType.Ty... | public static MessageType parseFrame(final String json) { return fromJson(json, MessageType.class); } | JsonUtil { public static MessageType parseFrame(final String json) { return fromJson(json, MessageType.class); } } | JsonUtil { public static MessageType parseFrame(final String json) { return fromJson(json, MessageType.class); } private JsonUtil(); } | JsonUtil { public static MessageType parseFrame(final String json) { return fromJson(json, MessageType.class); } private JsonUtil(); static T fromJson(final String json, final Class<T> type); static String toJson(final Object obj); static MessageType parseFrame(final String json); } | JsonUtil { public static MessageType parseFrame(final String json) { return fromJson(json, MessageType.class); } private JsonUtil(); static T fromJson(final String json, final Class<T> type); static String toJson(final Object obj); static MessageType parseFrame(final String json); } |
@Test public void removeAcknowledged() throws ChannelNotFoundException { final String uaid = UUIDUtil.newUAID(); final Channel channel1 = newChannel(uaid, UUID.randomUUID().toString(), 10); final Channel channel2 = newChannel(uaid, UUID.randomUUID().toString(), 2); jpaDataStore.saveChannel(channel1); jpaDataStore.saveC... | @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked) { final JpaOperation<Set<Ack>> removeAck = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final List<String> channelIds = new ArrayList<String>(acked.size()); for (Ack ack : acked) { channel... | JpaDataStore implements DataStore { @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked) { final JpaOperation<Set<Ack>> removeAck = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final List<String> channelIds = new ArrayList<String>(acked.size... | JpaDataStore implements DataStore { @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked) { final JpaOperation<Set<Ack>> removeAck = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final List<String> channelIds = new ArrayList<String>(acked.size... | JpaDataStore implements DataStore { @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked) { final JpaOperation<Set<Ack>> removeAck = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final List<String> channelIds = new ArrayList<String>(acked.size... | JpaDataStore implements DataStore { @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked) { final JpaOperation<Set<Ack>> removeAck = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final List<String> channelIds = new ArrayList<String>(acked.size... |
@Test public void getUnacknowledgedNoChannelsSavedYet() { final String uaid = UUIDUtil.newUAID(); final Set<Ack> storedUpdates = jpaDataStore.getUnacknowledged(uaid); assertThat(storedUpdates.size(), is(0)); } | @Override public Set<Ack> getUnacknowledged(final String uaid) { final JpaOperation<Set<Ack>> getUnacks = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final UserAgentDTO userAgent = em.find(UserAgentDTO.class, uaid); if (userAgent == null) { return Collections.emptySet(); }... | JpaDataStore implements DataStore { @Override public Set<Ack> getUnacknowledged(final String uaid) { final JpaOperation<Set<Ack>> getUnacks = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final UserAgentDTO userAgent = em.find(UserAgentDTO.class, uaid); if (userAgent == null... | JpaDataStore implements DataStore { @Override public Set<Ack> getUnacknowledged(final String uaid) { final JpaOperation<Set<Ack>> getUnacks = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final UserAgentDTO userAgent = em.find(UserAgentDTO.class, uaid); if (userAgent == null... | JpaDataStore implements DataStore { @Override public Set<Ack> getUnacknowledged(final String uaid) { final JpaOperation<Set<Ack>> getUnacks = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final UserAgentDTO userAgent = em.find(UserAgentDTO.class, uaid); if (userAgent == null... | JpaDataStore implements DataStore { @Override public Set<Ack> getUnacknowledged(final String uaid) { final JpaOperation<Set<Ack>> getUnacks = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final UserAgentDTO userAgent = em.find(UserAgentDTO.class, uaid); if (userAgent == null... |
@Test public void handleHandshake() { final HelloResponse response = server.handleHandshake(new HelloMessageImpl()); assertThat(response.getUAID(), is(notNullValue())); } | @Override public HelloResponse handleHandshake(final HelloMessage handshake) { final Set<String> oldChannels = store.getChannelIds(handshake.getUAID()); for (String channelId : handshake.getChannelIds()) { if (!oldChannels.contains(channelId)) { store.saveChannel(new DefaultChannel(handshake.getUAID(), channelId, gener... | DefaultSimplePushServer implements SimplePushServer { @Override public HelloResponse handleHandshake(final HelloMessage handshake) { final Set<String> oldChannels = store.getChannelIds(handshake.getUAID()); for (String channelId : handshake.getChannelIds()) { if (!oldChannels.contains(channelId)) { store.saveChannel(ne... | DefaultSimplePushServer implements SimplePushServer { @Override public HelloResponse handleHandshake(final HelloMessage handshake) { final Set<String> oldChannels = store.getChannelIds(handshake.getUAID()); for (String channelId : handshake.getChannelIds()) { if (!oldChannels.contains(channelId)) { store.saveChannel(ne... | DefaultSimplePushServer implements SimplePushServer { @Override public HelloResponse handleHandshake(final HelloMessage handshake) { final Set<String> oldChannels = store.getChannelIds(handshake.getUAID()); for (String channelId : handshake.getChannelIds()) { if (!oldChannels.contains(channelId)) { store.saveChannel(ne... | DefaultSimplePushServer implements SimplePushServer { @Override public HelloResponse handleHandshake(final HelloMessage handshake) { final Set<String> oldChannels = store.getChannelIds(handshake.getUAID()); for (String channelId : handshake.getChannelIds()) { if (!oldChannels.contains(channelId)) { store.saveChannel(ne... |
@Test public void handeRegister() { final RegisterResponse response = server.handleRegister(new RegisterMessageImpl("someChannelId"), UUIDUtil.newUAID()); assertThat(response.getChannelId(), equalTo("someChannelId")); assertThat(response.getMessageType(), equalTo(MessageType.Type.REGISTER)); assertThat(response.getStat... | @Override public RegisterResponse handleRegister(final RegisterMessage register, final String uaid) { final String channelId = register.getChannelId(); final String endpointToken = generateEndpointToken(uaid, channelId); final boolean saved = store.saveChannel(new DefaultChannel(uaid, channelId, endpointToken)); final ... | DefaultSimplePushServer implements SimplePushServer { @Override public RegisterResponse handleRegister(final RegisterMessage register, final String uaid) { final String channelId = register.getChannelId(); final String endpointToken = generateEndpointToken(uaid, channelId); final boolean saved = store.saveChannel(new D... | DefaultSimplePushServer implements SimplePushServer { @Override public RegisterResponse handleRegister(final RegisterMessage register, final String uaid) { final String channelId = register.getChannelId(); final String endpointToken = generateEndpointToken(uaid, channelId); final boolean saved = store.saveChannel(new D... | DefaultSimplePushServer implements SimplePushServer { @Override public RegisterResponse handleRegister(final RegisterMessage register, final String uaid) { final String channelId = register.getChannelId(); final String endpointToken = generateEndpointToken(uaid, channelId); final boolean saved = store.saveChannel(new D... | DefaultSimplePushServer implements SimplePushServer { @Override public RegisterResponse handleRegister(final RegisterMessage register, final String uaid) { final String channelId = register.getChannelId(); final String endpointToken = generateEndpointToken(uaid, channelId); final boolean saved = store.saveChannel(new D... |
@Test public void removeChannel() throws ChannelNotFoundException { final String channelId = "testChannelId"; final String uaid = UUIDUtil.newUAID(); server.handleRegister(new RegisterMessageImpl(channelId), uaid); assertThat(server.getChannel(channelId).getChannelId(), is(equalTo(channelId))); assertThat(server.remove... | public boolean removeChannel(final String channnelId, final String uaid) { try { final Channel channel = store.getChannel(channnelId); if (channel.getUAID().equals(uaid)) { store.removeChannels(new HashSet<String>(Arrays.asList(channnelId))); return true; } } catch (final ChannelNotFoundException ignored) { } return fa... | DefaultSimplePushServer implements SimplePushServer { public boolean removeChannel(final String channnelId, final String uaid) { try { final Channel channel = store.getChannel(channnelId); if (channel.getUAID().equals(uaid)) { store.removeChannels(new HashSet<String>(Arrays.asList(channnelId))); return true; } } catch ... | DefaultSimplePushServer implements SimplePushServer { public boolean removeChannel(final String channnelId, final String uaid) { try { final Channel channel = store.getChannel(channnelId); if (channel.getUAID().equals(uaid)) { store.removeChannels(new HashSet<String>(Arrays.asList(channnelId))); return true; } } catch ... | DefaultSimplePushServer implements SimplePushServer { public boolean removeChannel(final String channnelId, final String uaid) { try { final Channel channel = store.getChannel(channnelId); if (channel.getUAID().equals(uaid)) { store.removeChannels(new HashSet<String>(Arrays.asList(channnelId))); return true; } } catch ... | DefaultSimplePushServer implements SimplePushServer { public boolean removeChannel(final String channnelId, final String uaid) { try { final Channel channel = store.getChannel(channnelId); if (channel.getUAID().equals(uaid)) { store.removeChannels(new HashSet<String>(Arrays.asList(channnelId))); return true; } } catch ... |
@Test public void getUAID() throws ChannelNotFoundException { final String channelId = UUID.randomUUID().toString(); final String uaid = UUIDUtil.newUAID(); server.handleRegister(new RegisterMessageImpl(channelId), uaid); assertThat(server.getUAID(channelId), is(equalTo(uaid))); } | public String getUAID(final String channelId) throws ChannelNotFoundException { return getChannel(channelId).getUAID(); } | DefaultSimplePushServer implements SimplePushServer { public String getUAID(final String channelId) throws ChannelNotFoundException { return getChannel(channelId).getUAID(); } } | DefaultSimplePushServer implements SimplePushServer { public String getUAID(final String channelId) throws ChannelNotFoundException { return getChannel(channelId).getUAID(); } DefaultSimplePushServer(final DataStore store, final SimplePushServerConfig config, final byte[] privateKey); } | DefaultSimplePushServer implements SimplePushServer { public String getUAID(final String channelId) throws ChannelNotFoundException { return getChannel(channelId).getUAID(); } DefaultSimplePushServer(final DataStore store, final SimplePushServerConfig config, final byte[] privateKey); @Override HelloResponse handleHand... | DefaultSimplePushServer implements SimplePushServer { public String getUAID(final String channelId) throws ChannelNotFoundException { return getChannel(channelId).getUAID(); } DefaultSimplePushServer(final DataStore store, final SimplePushServerConfig config, final byte[] privateKey); @Override HelloResponse handleHand... |
@Test public void handleNotification() throws ChannelNotFoundException { final String channelId = UUID.randomUUID().toString(); final String uaid = UUIDUtil.newUAID(); final RegisterResponse registerResponse = server.handleRegister(new RegisterMessageImpl(channelId), uaid); final String endpointToken = extractEndpointT... | @Override public Notification handleNotification(final String endpointToken, final String body) throws ChannelNotFoundException { final Long version = Long.valueOf(VersionExtractor.extractVersion(body)); final String channelId = store.updateVersion(endpointToken, version); if (channelId == null) { throw new ChannelNotF... | DefaultSimplePushServer implements SimplePushServer { @Override public Notification handleNotification(final String endpointToken, final String body) throws ChannelNotFoundException { final Long version = Long.valueOf(VersionExtractor.extractVersion(body)); final String channelId = store.updateVersion(endpointToken, ve... | DefaultSimplePushServer implements SimplePushServer { @Override public Notification handleNotification(final String endpointToken, final String body) throws ChannelNotFoundException { final Long version = Long.valueOf(VersionExtractor.extractVersion(body)); final String channelId = store.updateVersion(endpointToken, ve... | DefaultSimplePushServer implements SimplePushServer { @Override public Notification handleNotification(final String endpointToken, final String body) throws ChannelNotFoundException { final Long version = Long.valueOf(VersionExtractor.extractVersion(body)); final String channelId = store.updateVersion(endpointToken, ve... | DefaultSimplePushServer implements SimplePushServer { @Override public Notification handleNotification(final String endpointToken, final String body) throws ChannelNotFoundException { final Long version = Long.valueOf(VersionExtractor.extractVersion(body)); final String channelId = store.updateVersion(endpointToken, ve... |
@Test public void createSSLEngine() { final SockJsConfig sockJsConfig = SockJsConfig.withPrefix("/echo") .tls(true) .keyStore("/simplepush-sample.keystore") .keyStorePassword("simplepush") .build(); final SSLEngine engine = new WebSocketSslServerSslContext(sockJsConfig).sslContext().createSSLEngine(); assertThat(engine... | public SSLContext sslContext() { try { final SSLContext serverContext = SSLContext.getInstance(PROTOCOL); serverContext.init(keyManagerFactory(loadKeyStore()).getKeyManagers(), null, null); return serverContext; } catch (final Exception e) { throw new RuntimeException("Failed to initialize the server-side SSLContext", ... | WebSocketSslServerSslContext { public SSLContext sslContext() { try { final SSLContext serverContext = SSLContext.getInstance(PROTOCOL); serverContext.init(keyManagerFactory(loadKeyStore()).getKeyManagers(), null, null); return serverContext; } catch (final Exception e) { throw new RuntimeException("Failed to initializ... | WebSocketSslServerSslContext { public SSLContext sslContext() { try { final SSLContext serverContext = SSLContext.getInstance(PROTOCOL); serverContext.init(keyManagerFactory(loadKeyStore()).getKeyManagers(), null, null); return serverContext; } catch (final Exception e) { throw new RuntimeException("Failed to initializ... | WebSocketSslServerSslContext { public SSLContext sslContext() { try { final SSLContext serverContext = SSLContext.getInstance(PROTOCOL); serverContext.init(keyManagerFactory(loadKeyStore()).getKeyManagers(), null, null); return serverContext; } catch (final Exception e) { throw new RuntimeException("Failed to initializ... | WebSocketSslServerSslContext { public SSLContext sslContext() { try { final SSLContext serverContext = SSLContext.getInstance(PROTOCOL); serverContext.init(keyManagerFactory(loadKeyStore()).getKeyManagers(), null, null); return serverContext; } catch (final Exception e) { throw new RuntimeException("Failed to initializ... |
@Test (expected = RuntimeException.class) public void createSSLContextKeyStoreNotFound() { final SockJsConfig sockJsConfig = SockJsConfig.withPrefix("/echo") .tls(true) .keyStore("/missing.keystore") .keyStorePassword("simplepush") .build(); new WebSocketSslServerSslContext(sockJsConfig).sslContext(); } | public SSLContext sslContext() { try { final SSLContext serverContext = SSLContext.getInstance(PROTOCOL); serverContext.init(keyManagerFactory(loadKeyStore()).getKeyManagers(), null, null); return serverContext; } catch (final Exception e) { throw new RuntimeException("Failed to initialize the server-side SSLContext", ... | WebSocketSslServerSslContext { public SSLContext sslContext() { try { final SSLContext serverContext = SSLContext.getInstance(PROTOCOL); serverContext.init(keyManagerFactory(loadKeyStore()).getKeyManagers(), null, null); return serverContext; } catch (final Exception e) { throw new RuntimeException("Failed to initializ... | WebSocketSslServerSslContext { public SSLContext sslContext() { try { final SSLContext serverContext = SSLContext.getInstance(PROTOCOL); serverContext.init(keyManagerFactory(loadKeyStore()).getKeyManagers(), null, null); return serverContext; } catch (final Exception e) { throw new RuntimeException("Failed to initializ... | WebSocketSslServerSslContext { public SSLContext sslContext() { try { final SSLContext serverContext = SSLContext.getInstance(PROTOCOL); serverContext.init(keyManagerFactory(loadKeyStore()).getKeyManagers(), null, null); return serverContext; } catch (final Exception e) { throw new RuntimeException("Failed to initializ... | WebSocketSslServerSslContext { public SSLContext sslContext() { try { final SSLContext serverContext = SSLContext.getInstance(PROTOCOL); serverContext.init(keyManagerFactory(loadKeyStore()).getKeyManagers(), null, null); return serverContext; } catch (final Exception e) { throw new RuntimeException("Failed to initializ... |
@Test public void timestamp() { final UserAgent<ChannelHandlerContext> userAgent = new UserAgent<ChannelHandlerContext>(UUIDUtil.newUAID(), mock(ChannelHandlerContext.class), 1368781528407L); final long addedTimeout = userAgent.timestamp() + 10000; final long now = System.currentTimeMillis(); assertThat(addedTimeout < ... | public long timestamp() { return timestamp.get(); } | UserAgent { public long timestamp() { return timestamp.get(); } } | UserAgent { public long timestamp() { return timestamp.get(); } UserAgent(final String uaid, final T transport, final long timestamp); } | UserAgent { public long timestamp() { return timestamp.get(); } UserAgent(final String uaid, final T transport, final long timestamp); String uaid(); T context(); long timestamp(); void timestamp(final long timestamp); @Override String toString(); } | UserAgent { public long timestamp() { return timestamp.get(); } UserAgent(final String uaid, final T transport, final long timestamp); String uaid(); T context(); long timestamp(); void timestamp(final long timestamp); @Override String toString(); } |
@Test public void content() { final MessageFrame messageFrame = new MessageFrame("first", "second"); assertThat(messageFrame.content().toString(CharsetUtil.UTF_8), equalTo("a[\"first\",\"second\"]")); messageFrame.release(); } | @Override public String toString() { return StringUtil.simpleClassName(this) + "[messages=" + messages + ']'; } | MessageFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[messages=" + messages + ']'; } } | MessageFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[messages=" + messages + ']'; } MessageFrame(final String message); MessageFrame(final String... messages); MessageFrame(final List<String> messages); } | MessageFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[messages=" + messages + ']'; } MessageFrame(final String message); MessageFrame(final String... messages); MessageFrame(final List<String> messages); List<String> messages(); @... | MessageFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[messages=" + messages + ']'; } MessageFrame(final String message); MessageFrame(final String... messages); MessageFrame(final List<String> messages); List<String> messages(); @... |
@Test public void jpaDataStore() { final StandaloneConfig config = ConfigReader.parse(ConfigReaderTest.class.getResourceAsStream("/simplepush-jpa-config.json")); assertThat(config.dataStore(), is(instanceOf(JpaDataStore.class))); } | public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != null) { in.close(... | ConfigReader { public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != nu... | ConfigReader { public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != nu... | ConfigReader { public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != nu... | ConfigReader { public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != nu... |
@Test public void sampleConfig() { final StandaloneConfig config = ConfigReader.parse(ConfigReaderTest.class.getResourceAsStream("/simplepush-config.json")); assertThat(config.simplePushServerConfig().host(), equalTo("0.0.0.0")); assertThat(config.simplePushServerConfig().port(), is(7777)); assertThat(config.simplePush... | public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != null) { in.close(... | ConfigReader { public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != nu... | ConfigReader { public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != nu... | ConfigReader { public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != nu... | ConfigReader { public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally { if (in != nu... |
@Test public void rawWebSocketUpgradeRequest() throws Exception { final SimplePushServerConfig simplePushConfig = DefaultSimplePushConfig.create().password("test").build(); final SockJsConfig sockjsConf = SockJsConfig.withPrefix("/simplepush").webSocketProtocols("push-notification").build(); final byte[] privateKey = C... | @Override public SockJsConfig config() { return sockjsConfig; } | SimplePushSockJSService implements SockJsService { @Override public SockJsConfig config() { return sockjsConfig; } } | SimplePushSockJSService implements SockJsService { @Override public SockJsConfig config() { return sockjsConfig; } SimplePushSockJSService(final SockJsConfig sockjsConfig, final SimplePushServer simplePushServer); } | SimplePushSockJSService implements SockJsService { @Override public SockJsConfig config() { return sockjsConfig; } SimplePushSockJSService(final SockJsConfig sockjsConfig, final SimplePushServer simplePushServer); @Override SockJsConfig config(); @Override void onOpen(final SockJsSessionContext session); @Override @Sup... | SimplePushSockJSService implements SockJsService { @Override public SockJsConfig config() { return sockjsConfig; } SimplePushSockJSService(final SockJsConfig sockjsConfig, final SimplePushServer simplePushServer); @Override SockJsConfig config(); @Override void onOpen(final SockJsSessionContext session); @Override @Sup... |
@Test public void equalsContractSymetric() { final Channel x = new DefaultChannel("test", "123abc", 1, "33ddd2elaeee"); final Channel y = new DefaultChannel("test", "123abc", 1, "33ddd2elaeee"); assertThat(x, equalTo(y)); assertThat(y, equalTo(x)); assertThat(x.hashCode(), equalTo(y.hashCode())); } | @Override public int hashCode() { int result = 1; result = 31 * result + ((channelId == null) ? 0 : channelId.hashCode()); result = 31 * result + ((endpointToken == null) ? 0 : endpointToken.hashCode()); result = 31 * result + (int) (version ^ (version >>> 32)); return result; } | DefaultChannel implements Channel { @Override public int hashCode() { int result = 1; result = 31 * result + ((channelId == null) ? 0 : channelId.hashCode()); result = 31 * result + ((endpointToken == null) ? 0 : endpointToken.hashCode()); result = 31 * result + (int) (version ^ (version >>> 32)); return result; } } | DefaultChannel implements Channel { @Override public int hashCode() { int result = 1; result = 31 * result + ((channelId == null) ? 0 : channelId.hashCode()); result = 31 * result + ((endpointToken == null) ? 0 : endpointToken.hashCode()); result = 31 * result + (int) (version ^ (version >>> 32)); return result; } Defa... | DefaultChannel implements Channel { @Override public int hashCode() { int result = 1; result = 31 * result + ((channelId == null) ? 0 : channelId.hashCode()); result = 31 * result + ((endpointToken == null) ? 0 : endpointToken.hashCode()); result = 31 * result + (int) (version ^ (version >>> 32)); return result; } Defa... | DefaultChannel implements Channel { @Override public int hashCode() { int result = 1; result = 31 * result + ((channelId == null) ? 0 : channelId.hashCode()); result = 31 * result + ((endpointToken == null) ? 0 : endpointToken.hashCode()); result = 31 * result + (int) (version ^ (version >>> 32)); return result; } Defa... |
@Test public void equalsContractTransitive() { final Channel x = new DefaultChannel("test", "123abc", 1, "33ddd2elaeee"); final Channel y = new DefaultChannel("test", "123abc", 1, "33ddd2elaeee"); final Channel z = new DefaultChannel("test", "123abc", 1, "33ddd2elaeee"); assertThat(x, equalTo(y)); assertThat(y, equalTo... | @Override public int hashCode() { int result = 1; result = 31 * result + ((channelId == null) ? 0 : channelId.hashCode()); result = 31 * result + ((endpointToken == null) ? 0 : endpointToken.hashCode()); result = 31 * result + (int) (version ^ (version >>> 32)); return result; } | DefaultChannel implements Channel { @Override public int hashCode() { int result = 1; result = 31 * result + ((channelId == null) ? 0 : channelId.hashCode()); result = 31 * result + ((endpointToken == null) ? 0 : endpointToken.hashCode()); result = 31 * result + (int) (version ^ (version >>> 32)); return result; } } | DefaultChannel implements Channel { @Override public int hashCode() { int result = 1; result = 31 * result + ((channelId == null) ? 0 : channelId.hashCode()); result = 31 * result + ((endpointToken == null) ? 0 : endpointToken.hashCode()); result = 31 * result + (int) (version ^ (version >>> 32)); return result; } Defa... | DefaultChannel implements Channel { @Override public int hashCode() { int result = 1; result = 31 * result + ((channelId == null) ? 0 : channelId.hashCode()); result = 31 * result + ((endpointToken == null) ? 0 : endpointToken.hashCode()); result = 31 * result + (int) (version ^ (version >>> 32)); return result; } Defa... | DefaultChannel implements Channel { @Override public int hashCode() { int result = 1; result = 31 * result + ((channelId == null) ? 0 : channelId.hashCode()); result = 31 * result + ((endpointToken == null) ? 0 : endpointToken.hashCode()); result = 31 * result + (int) (version ^ (version >>> 32)); return result; } Defa... |
@Test public void equalsConsistent() { final Channel x = new DefaultChannel("test", "123abc", 1, "33ddd2elaeee"); final Channel y = new DefaultChannel("test", "xyz987", 1, "33ddd2elaeee"); assertThat(x.equals(y), is(false)); } | @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Channel)) { return false; } final DefaultChannel o = (DefaultChannel) obj; return (uaid == null ? o.uaid == null : uaid.equals(o.uaid)) && (channelId == null ? o.channelId == null : ch... | DefaultChannel implements Channel { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Channel)) { return false; } final DefaultChannel o = (DefaultChannel) obj; return (uaid == null ? o.uaid == null : uaid.equals(o.uaid)) && (channelI... | DefaultChannel implements Channel { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Channel)) { return false; } final DefaultChannel o = (DefaultChannel) obj; return (uaid == null ? o.uaid == null : uaid.equals(o.uaid)) && (channelI... | DefaultChannel implements Channel { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Channel)) { return false; } final DefaultChannel o = (DefaultChannel) obj; return (uaid == null ? o.uaid == null : uaid.equals(o.uaid)) && (channelI... | DefaultChannel implements Channel { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Channel)) { return false; } final DefaultChannel o = (DefaultChannel) obj; return (uaid == null ? o.uaid == null : uaid.equals(o.uaid)) && (channelI... |
@Test public void equalsContractNull() { final Channel x = new DefaultChannel("test", "123abc", 1, "33ddd2elaeee"); assertThat(x.equals(null), is(false)); } | @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Channel)) { return false; } final DefaultChannel o = (DefaultChannel) obj; return (uaid == null ? o.uaid == null : uaid.equals(o.uaid)) && (channelId == null ? o.channelId == null : ch... | DefaultChannel implements Channel { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Channel)) { return false; } final DefaultChannel o = (DefaultChannel) obj; return (uaid == null ? o.uaid == null : uaid.equals(o.uaid)) && (channelI... | DefaultChannel implements Channel { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Channel)) { return false; } final DefaultChannel o = (DefaultChannel) obj; return (uaid == null ? o.uaid == null : uaid.equals(o.uaid)) && (channelI... | DefaultChannel implements Channel { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Channel)) { return false; } final DefaultChannel o = (DefaultChannel) obj; return (uaid == null ? o.uaid == null : uaid.equals(o.uaid)) && (channelI... | DefaultChannel implements Channel { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Channel)) { return false; } final DefaultChannel o = (DefaultChannel) obj; return (uaid == null ? o.uaid == null : uaid.equals(o.uaid)) && (channelI... |
@Test public void messageReceivedNoPayload() { final FullHttpResponse response = processHttpRequest(requestWithBody(null)); assertThat(response.getStatus(), equalTo(HttpResponseStatus.INTERNAL_SERVER_ERROR)); assertThat(response.getProtocolVersion(), equalTo(HttpVersion.HTTP_1_1)); assertThat(response.content().toStrin... | @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } XhrSendTransport(final SockJsConfig config); } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } XhrSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(); } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } XhrSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(); ... |
@Test public void messageReceivedNoPayloadHttpVersion1_0() { final FullHttpResponse response = processHttpRequest(requestWithBody(null, HttpVersion.HTTP_1_0)); assertThat(response.getStatus(), equalTo(HttpResponseStatus.INTERNAL_SERVER_ERROR)); assertThat(response.getProtocolVersion(), equalTo(HttpVersion.HTTP_1_0)); a... | @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } XhrSendTransport(final SockJsConfig config); } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } XhrSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(); } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } XhrSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(); ... |
@Test public void messageReceivedNoFormDataParameter() { final FullHttpResponse response = processHttpRequest(requestWithFormData(null)); assertThat(response.getStatus(), equalTo(HttpResponseStatus.INTERNAL_SERVER_ERROR)); assertThat(response.getProtocolVersion(), equalTo(HttpVersion.HTTP_1_1)); assertThat(response.con... | @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } XhrSendTransport(final SockJsConfig config); } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } XhrSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(); } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } XhrSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(); ... |
@Test public void messageReceivedInvalidJson() { final String data = "[\"some message"; final FullHttpResponse response = processHttpRequest(requestWithFormData(data)); assertThat(response.getStatus(), equalTo(HttpResponseStatus.INTERNAL_SERVER_ERROR)); assertThat(response.getProtocolVersion(), equalTo(HttpVersion.HTTP... | @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } XhrSendTransport(final SockJsConfig config); } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } XhrSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(); } | XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } XhrSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(); ... |
@Test public void messageReceivedNoPayload() { final FullHttpResponse response = processHttpRequest(requestWithBody(null)); assertThat(response.getStatus(), equalTo(HttpResponseStatus.INTERNAL_SERVER_ERROR)); assertThat(response.getProtocolVersion(), equalTo(HttpVersion.HTTP_1_1)); assertThat(response.content().toStrin... | @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(... | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(... |
@Test public void messageReceivedNoPayloadHttpVersion1_0() { final FullHttpResponse response = processHttpRequest(requestWithBody(null, HttpVersion.HTTP_1_0)); assertThat(response.getStatus(), equalTo(HttpResponseStatus.INTERNAL_SERVER_ERROR)); assertThat(response.getProtocolVersion(), equalTo(HttpVersion.HTTP_1_0)); a... | @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(... | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(... |
@Test public void messageReceived() { final String body = "[\"some message\"]"; final FullHttpResponse response = processHttpRequest(requestWithBody(body)); assertThat(response.getStatus(), equalTo(HttpResponseStatus.OK)); assertThat(response.getProtocolVersion(), equalTo(HttpVersion.HTTP_1_1)); assertThat(response.con... | @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(... | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(... |
@Test public void messageReceivedNoFormDataParameter() { final FullHttpResponse response = processHttpRequest(requestWithFormData(null)); assertThat(response.getStatus(), equalTo(HttpResponseStatus.INTERNAL_SERVER_ERROR)); assertThat(response.getProtocolVersion(), equalTo(HttpVersion.HTTP_1_1)); assertThat(response.con... | @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(... | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(... |
@Test public void messageReceivedFormDataParameter() { final String data = "[\"some message\"]"; final FullHttpResponse response = processHttpRequest(requestWithFormData(data)); assertThat(response.getStatus(), equalTo(HttpResponseStatus.OK)); assertThat(response.getProtocolVersion(), equalTo(HttpVersion.HTTP_1_1)); as... | @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); } | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(... | JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String toString(... |
@Test public void constructWithUpdates() { final Set<Ack> acks = acks(ack("abc123", 1L), ack("efg456", 20L)); final AckMessage ack = new AckMessageImpl(acks); assertThat(ack.getAcks(), hasItems(ack("abc123", 1L), ack("efg456", 20L))); } | @Override public Set<Ack> getAcks() { return Collections.unmodifiableSet(acks); } | AckMessageImpl implements AckMessage { @Override public Set<Ack> getAcks() { return Collections.unmodifiableSet(acks); } } | AckMessageImpl implements AckMessage { @Override public Set<Ack> getAcks() { return Collections.unmodifiableSet(acks); } AckMessageImpl(final Set<Ack> acks); } | AckMessageImpl implements AckMessage { @Override public Set<Ack> getAcks() { return Collections.unmodifiableSet(acks); } AckMessageImpl(final Set<Ack> acks); @Override Type getMessageType(); @Override Set<Ack> getAcks(); @Override String toString(); } | AckMessageImpl implements AckMessage { @Override public Set<Ack> getAcks() { return Collections.unmodifiableSet(acks); } AckMessageImpl(final Set<Ack> acks); @Override Type getMessageType(); @Override Set<Ack> getAcks(); @Override String toString(); } |
@Test public void write() throws IOException { final String url = "/test/htmlfile?c=%63allback"; final EmbeddedChannel ch = newHtmlFileChannel("/test/htmlfile?c=%63allback"); ch.writeInbound(new DefaultHttpRequest(HTTP_1_1, GET, url)); ch.writeOutbound(new OpenFrame()); final HttpResponse response = ch.readOutbound(); ... | @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { if (msg instanceof Frame) { final Frame frame = (Frame) msg; if (headerSent.compareAndSet(false, true)) { final HttpResponse response = createResponse(Transports.CONTENT_TYPE_HTML); final Byte... | HtmlFileTransport extends ChannelHandlerAdapter { @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { if (msg instanceof Frame) { final Frame frame = (Frame) msg; if (headerSent.compareAndSet(false, true)) { final HttpResponse response = create... | HtmlFileTransport extends ChannelHandlerAdapter { @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { if (msg instanceof Frame) { final Frame frame = (Frame) msg; if (headerSent.compareAndSet(false, true)) { final HttpResponse response = create... | HtmlFileTransport extends ChannelHandlerAdapter { @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { if (msg instanceof Frame) { final Frame frame = (Frame) msg; if (headerSent.compareAndSet(false, true)) { final HttpResponse response = create... | HtmlFileTransport extends ChannelHandlerAdapter { @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { if (msg instanceof Frame) { final Frame frame = (Frame) msg; if (headerSent.compareAndSet(false, true)) { final HttpResponse response = create... |
@Test public void isHAProxyRequest() { assertThat(WebSocketHAProxyHandshaker.isHAProxyReqeust(wsUpgradeRequest()), is(true)); assertThat(WebSocketHAProxyHandshaker.isHAProxyReqeust(wsUpgradeRequestWithBody()), is(false)); } | public static boolean isHAProxyReqeust(final FullHttpRequest request) { final String version = request.headers().get(Names.SEC_WEBSOCKET_VERSION); return version == null && request.content().readableBytes() == 0; } | WebSocketHAProxyHandshaker extends WebSocketServerHandshaker00 { public static boolean isHAProxyReqeust(final FullHttpRequest request) { final String version = request.headers().get(Names.SEC_WEBSOCKET_VERSION); return version == null && request.content().readableBytes() == 0; } } | WebSocketHAProxyHandshaker extends WebSocketServerHandshaker00 { public static boolean isHAProxyReqeust(final FullHttpRequest request) { final String version = request.headers().get(Names.SEC_WEBSOCKET_VERSION); return version == null && request.content().readableBytes() == 0; } WebSocketHAProxyHandshaker(final String ... | WebSocketHAProxyHandshaker extends WebSocketServerHandshaker00 { public static boolean isHAProxyReqeust(final FullHttpRequest request) { final String version = request.headers().get(Names.SEC_WEBSOCKET_VERSION); return version == null && request.content().readableBytes() == 0; } WebSocketHAProxyHandshaker(final String ... | WebSocketHAProxyHandshaker extends WebSocketServerHandshaker00 { public static boolean isHAProxyReqeust(final FullHttpRequest request) { final String version = request.headers().get(Names.SEC_WEBSOCKET_VERSION); return version == null && request.content().readableBytes() == 0; } WebSocketHAProxyHandshaker(final String ... |
@Test public void write() { final EmbeddedChannel ch = newEventSourceChannel(); ch.writeOutbound(new OpenFrame()); final HttpResponse response = ch.readOutbound(); assertThat(response.getStatus(), equalTo(HttpResponseStatus.OK)); assertThat(response.headers().get(CONTENT_TYPE), equalTo(EventSourceTransport.CONTENT_TYPE... | @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { if (msg instanceof Frame) { final Frame frame = (Frame) msg; if (headerSent.compareAndSet(false, true)) { ctx.write(createResponse(CONTENT_TYPE_EVENT_STREAM), promise); ctx.writeAndFlush(new D... | EventSourceTransport extends ChannelHandlerAdapter { @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { if (msg instanceof Frame) { final Frame frame = (Frame) msg; if (headerSent.compareAndSet(false, true)) { ctx.write(createResponse(CONTENT_... | EventSourceTransport extends ChannelHandlerAdapter { @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { if (msg instanceof Frame) { final Frame frame = (Frame) msg; if (headerSent.compareAndSet(false, true)) { ctx.write(createResponse(CONTENT_... | EventSourceTransport extends ChannelHandlerAdapter { @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { if (msg instanceof Frame) { final Frame frame = (Frame) msg; if (headerSent.compareAndSet(false, true)) { ctx.write(createResponse(CONTENT_... | EventSourceTransport extends ChannelHandlerAdapter { @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { if (msg instanceof Frame) { final Frame frame = (Frame) msg; if (headerSent.compareAndSet(false, true)) { ctx.write(createResponse(CONTENT_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.