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 testOpenAndReadFromMark() throws IOException { final FileBlockingQueue<String> queue = getFileBlockingQueue(); createFile(queue, 3000); int count = 0; for (String m : new Iterable<String>() { @Override public Iterator<String> iterator() { return queue.iterator(); } }) { assertEquals(m, "testString" + ... | @Override public Iterator<E> iterator() { return new Iterator<E>() { @Override public boolean hasNext() { return !isEmpty(); } @Override public E next() { try { E x = consumeElement(); return x; } catch (IOException e) { throw new RuntimeException(e); } } @Override public void remove() { throw new UnsupportedOperationE... | FileBlockingQueue extends AbstractQueue<E> implements BlockingQueue<E> { @Override public Iterator<E> iterator() { return new Iterator<E>() { @Override public boolean hasNext() { return !isEmpty(); } @Override public E next() { try { E x = consumeElement(); return x; } catch (IOException e) { throw new RuntimeException... | FileBlockingQueue extends AbstractQueue<E> implements BlockingQueue<E> { @Override public Iterator<E> iterator() { return new Iterator<E>() { @Override public boolean hasNext() { return !isEmpty(); } @Override public E next() { try { E x = consumeElement(); return x; } catch (IOException e) { throw new RuntimeException... | FileBlockingQueue extends AbstractQueue<E> implements BlockingQueue<E> { @Override public Iterator<E> iterator() { return new Iterator<E>() { @Override public boolean hasNext() { return !isEmpty(); } @Override public E next() { try { E x = consumeElement(); return x; } catch (IOException e) { throw new RuntimeException... | FileBlockingQueue extends AbstractQueue<E> implements BlockingQueue<E> { @Override public Iterator<E> iterator() { return new Iterator<E>() { @Override public boolean hasNext() { return !isEmpty(); } @Override public E next() { try { E x = consumeElement(); return x; } catch (IOException e) { throw new RuntimeException... |
@Test public void synchronizedQueue() throws InterruptedException { final int queueCapacity = 0; final MemoryQueue4Sink queue = new MemoryQueue4Sink(queueCapacity); final AtomicInteger sentCount = new AtomicInteger(); QueuedSink sink = new QueuedSink() { @Override protected void beforePolling() throws IOException { } @... | protected void initialize( String sinkId, MessageQueue4Sink queue4Sink, int batchSize, int batchTimeout, boolean pauseOnLongQueue) { this.sinkId = sinkId; this.queue4Sink = queue4Sink; this.batchSize = batchSize == 0 ? 1000 : batchSize; this.batchTimeout = batchTimeout == 0 ? 1000 : batchTimeout; this.pauseOnLongQueue ... | QueuedSink extends Thread { protected void initialize( String sinkId, MessageQueue4Sink queue4Sink, int batchSize, int batchTimeout, boolean pauseOnLongQueue) { this.sinkId = sinkId; this.queue4Sink = queue4Sink; this.batchSize = batchSize == 0 ? 1000 : batchSize; this.batchTimeout = batchTimeout == 0 ? 1000 : batchTim... | QueuedSink extends Thread { protected void initialize( String sinkId, MessageQueue4Sink queue4Sink, int batchSize, int batchTimeout, boolean pauseOnLongQueue) { this.sinkId = sinkId; this.queue4Sink = queue4Sink; this.batchSize = batchSize == 0 ? 1000 : batchSize; this.batchTimeout = batchTimeout == 0 ? 1000 : batchTim... | QueuedSink extends Thread { protected void initialize( String sinkId, MessageQueue4Sink queue4Sink, int batchSize, int batchTimeout, boolean pauseOnLongQueue) { this.sinkId = sinkId; this.queue4Sink = queue4Sink; this.batchSize = batchSize == 0 ? 1000 : batchSize; this.batchTimeout = batchTimeout == 0 ? 1000 : batchTim... | QueuedSink extends Thread { protected void initialize( String sinkId, MessageQueue4Sink queue4Sink, int batchSize, int batchTimeout, boolean pauseOnLongQueue) { this.sinkId = sinkId; this.queue4Sink = queue4Sink; this.batchSize = batchSize == 0 ? 1000 : batchSize; this.batchTimeout = batchTimeout == 0 ? 1000 : batchTim... |
@Test public void test() { String name = FileNameFormatter.get("/dir/"); System.out.println(name); assertEquals(name.indexOf("-"), -1); assertEquals(name.indexOf(":"), -1); } | public static String get(String dir) { StringBuilder sb = new StringBuilder(dir); if (!dir.endsWith("/")) { sb.append('/'); } sb.append(fmt.print(new DateTime())) .append(localHostAddr) .append(new UID().toString()); return sb.toString().replaceAll("[-:]", ""); } | FileNameFormatter { public static String get(String dir) { StringBuilder sb = new StringBuilder(dir); if (!dir.endsWith("/")) { sb.append('/'); } sb.append(fmt.print(new DateTime())) .append(localHostAddr) .append(new UID().toString()); return sb.toString().replaceAll("[-:]", ""); } } | FileNameFormatter { public static String get(String dir) { StringBuilder sb = new StringBuilder(dir); if (!dir.endsWith("/")) { sb.append('/'); } sb.append(fmt.print(new DateTime())) .append(localHostAddr) .append(new UID().toString()); return sb.toString().replaceAll("[-:]", ""); } } | FileNameFormatter { public static String get(String dir) { StringBuilder sb = new StringBuilder(dir); if (!dir.endsWith("/")) { sb.append('/'); } sb.append(fmt.print(new DateTime())) .append(localHostAddr) .append(new UID().toString()); return sb.toString().replaceAll("[-:]", ""); } static String get(String dir); } | FileNameFormatter { public static String get(String dir) { StringBuilder sb = new StringBuilder(dir); if (!dir.endsWith("/")) { sb.append('/'); } sb.append(fmt.print(new DateTime())) .append(localHostAddr) .append(new UID().toString()); return sb.toString().replaceAll("[-:]", ""); } static String get(String dir); stat... |
@Test public void testCleanUp() throws IOException, InterruptedException { String testdir = tempDir.newFolder().getAbsolutePath(); final int numFiles = 5; Set<String> filePathSet = new HashSet<String>(); for (int i = 0; i < numFiles; ++i) { String fileName = "testFile" + i + (i == numFiles - 1 ? LocalFileSink.suffix : ... | public int cleanUp(boolean fetchAll) { return cleanUp(outputDir, fetchAll); } | LocalFileSink extends QueuedSink implements Sink { public int cleanUp(boolean fetchAll) { return cleanUp(outputDir, fetchAll); } } | LocalFileSink extends QueuedSink implements Sink { public int cleanUp(boolean fetchAll) { return cleanUp(outputDir, fetchAll); } @JsonCreator LocalFileSink(
@JsonProperty("outputDir") String outputDir,
@JsonProperty("writer") FileWriter writer,
@JsonProperty("notice") Notice notice,... | LocalFileSink extends QueuedSink implements Sink { public int cleanUp(boolean fetchAll) { return cleanUp(outputDir, fetchAll); } @JsonCreator LocalFileSink(
@JsonProperty("outputDir") String outputDir,
@JsonProperty("writer") FileWriter writer,
@JsonProperty("notice") Notice notice,... | LocalFileSink extends QueuedSink implements Sink { public int cleanUp(boolean fetchAll) { return cleanUp(outputDir, fetchAll); } @JsonCreator LocalFileSink(
@JsonProperty("outputDir") String outputDir,
@JsonProperty("writer") FileWriter writer,
@JsonProperty("notice") Notice notice,... |
@Test public void testGetFileExt() { assertEquals(LocalFileSink.getFileExt("abc.done"), ".done"); assertNull(LocalFileSink.getFileExt("abcdone")); assertNull(LocalFileSink.getFileExt("abcdone.")); } | public static String getFileExt(String fileName) { int dotPos = fileName.lastIndexOf('.'); if (dotPos != -1 && dotPos != fileName.length() - 1) { return fileName.substring(dotPos); } else { return null; } } | LocalFileSink extends QueuedSink implements Sink { public static String getFileExt(String fileName) { int dotPos = fileName.lastIndexOf('.'); if (dotPos != -1 && dotPos != fileName.length() - 1) { return fileName.substring(dotPos); } else { return null; } } } | LocalFileSink extends QueuedSink implements Sink { public static String getFileExt(String fileName) { int dotPos = fileName.lastIndexOf('.'); if (dotPos != -1 && dotPos != fileName.length() - 1) { return fileName.substring(dotPos); } else { return null; } } @JsonCreator LocalFileSink(
@JsonProperty("output... | LocalFileSink extends QueuedSink implements Sink { public static String getFileExt(String fileName) { int dotPos = fileName.lastIndexOf('.'); if (dotPos != -1 && dotPos != fileName.length() - 1) { return fileName.substring(dotPos); } else { return null; } } @JsonCreator LocalFileSink(
@JsonProperty("output... | LocalFileSink extends QueuedSink implements Sink { public static String getFileExt(String fileName) { int dotPos = fileName.lastIndexOf('.'); if (dotPos != -1 && dotPos != fileName.length() - 1) { return fileName.substring(dotPos); } else { return null; } } @JsonCreator LocalFileSink(
@JsonProperty("output... |
@Test public void testCheckPause() throws IOException, InterruptedException { TopicCommand.createTopic(zk.getZkClient(), new TopicCommand.TopicCommandOptions(new String[]{ "--zookeeper", "dummy", "--create", "--topic", TOPIC_NAME + "check_pause", "--replication-factor", "2", "--partitions", "1"})); String description =... | @Override public long checkPause() { if (blockOnBufferFull) { return 0; } else { double totalBytes = producer.metrics().get( new MetricName( "buffer-total-bytes", "producer-metrics", "desc", "client-id", props.getProperty("client.id"))).value(); double availableBytes = producer.metrics().get( new MetricName( "buffer-av... | KafkaSink implements Sink { @Override public long checkPause() { if (blockOnBufferFull) { return 0; } else { double totalBytes = producer.metrics().get( new MetricName( "buffer-total-bytes", "producer-metrics", "desc", "client-id", props.getProperty("client.id"))).value(); double availableBytes = producer.metrics().get... | KafkaSink implements Sink { @Override public long checkPause() { if (blockOnBufferFull) { return 0; } else { double totalBytes = producer.metrics().get( new MetricName( "buffer-total-bytes", "producer-metrics", "desc", "client-id", props.getProperty("client.id"))).value(); double availableBytes = producer.metrics().get... | KafkaSink implements Sink { @Override public long checkPause() { if (blockOnBufferFull) { return 0; } else { double totalBytes = producer.metrics().get( new MetricName( "buffer-total-bytes", "producer-metrics", "desc", "client-id", props.getProperty("client.id"))).value(); double availableBytes = producer.metrics().get... | KafkaSink implements Sink { @Override public long checkPause() { if (blockOnBufferFull) { return 0; } else { double totalBytes = producer.metrics().get( new MetricName( "buffer-total-bytes", "producer-metrics", "desc", "client-id", props.getProperty("client.id"))).value(); double availableBytes = producer.metrics().get... |
@Test public void testRecover() throws Exception { ObjectMapper jsonMapper = new DefaultObjectMapper(); ElasticSearchSink sink = new ElasticSearchSink( "default", null, 10, 1000, Lists.newArrayList("localhost:" + getPort()), null, 0,0,0,0, 0, null, false, jsonMapper, null ); sink.open(); DateTime dt = new DateTime("201... | public void recover(Message message) { IndexInfo info = indexInfo.create(message); HttpResponse response = null; try { response = client.executeWithLoadBalancer( HttpRequest.newBuilder() .verb(HttpRequest.Verb.POST) .setRetriable(true) .uri(indexInfo.getIndexUri(info)) .entity(indexInfo.getSource(info)) .build()); if (... | ElasticSearchSink extends ThreadPoolQueuedSink implements Sink { public void recover(Message message) { IndexInfo info = indexInfo.create(message); HttpResponse response = null; try { response = client.executeWithLoadBalancer( HttpRequest.newBuilder() .verb(HttpRequest.Verb.POST) .setRetriable(true) .uri(indexInfo.getI... | ElasticSearchSink extends ThreadPoolQueuedSink implements Sink { public void recover(Message message) { IndexInfo info = indexInfo.create(message); HttpResponse response = null; try { response = client.executeWithLoadBalancer( HttpRequest.newBuilder() .verb(HttpRequest.Verb.POST) .setRetriable(true) .uri(indexInfo.getI... | ElasticSearchSink extends ThreadPoolQueuedSink implements Sink { public void recover(Message message) { IndexInfo info = indexInfo.create(message); HttpResponse response = null; try { response = client.executeWithLoadBalancer( HttpRequest.newBuilder() .verb(HttpRequest.Verb.POST) .setRetriable(true) .uri(indexInfo.getI... | ElasticSearchSink extends ThreadPoolQueuedSink implements Sink { public void recover(Message message) { IndexInfo info = indexInfo.create(message); HttpResponse response = null; try { response = client.executeWithLoadBalancer( HttpRequest.newBuilder() .verb(HttpRequest.Verb.POST) .setRetriable(true) .uri(indexInfo.getI... |
@Test public void shouldReturnNullOnParsingFailure() { DefaultIndexInfoBuilder builder = new DefaultIndexInfoBuilder( null, null, null, null, null, jsonMapper); assertNull(builder.create(new Message("routingkey", "message".getBytes()))); } | @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg.getPayload(), type); } return new IndexInfo() { priva... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... |
@Test public void testPositiveSelection() { MockRequestTrace requestTrace = Mockito.mock(MockRequestTrace.class); when(requestTrace.getClientInfoHostName()).thenReturn("localhost"); Map<String, Object> clientInfoMap = Maps.newHashMap(); clientInfoMap.put("clientName", "client"); clientInfoMap.put("clientId", (long) 10)... | @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } | PathValueMessageFilter extends BaseMessageFilter { @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } } | PathValueMessageFilter extends BaseMessageFilter { @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } PathValueMessageFilter(String path, Va... | PathValueMessageFilter extends BaseMessageFilter { @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } PathValueMessageFilter(String path, Va... | PathValueMessageFilter extends BaseMessageFilter { @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } PathValueMessageFilter(String path, Va... |
@Test public void shouldNullOrEmptyIndexTypeMapReturnRoutingKey() throws JsonProcessingException { DefaultIndexInfoBuilder builder = new DefaultIndexInfoBuilder( null, null, null, null, null, jsonMapper); Map<String, Object> msg = new ImmutableMap.Builder<String, Object>().put("f1", "v1").build(); IndexInfo info = buil... | @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg.getPayload(), type); } return new IndexInfo() { priva... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... |
@Test public void shouldIndexTypeMapReturnSetting() throws JsonProcessingException { DefaultIndexInfoBuilder builder = new DefaultIndexInfoBuilder( new ImmutableMap.Builder<String, String>() .put("routingkey1", "index1:type1") .put("routingkey2", "index2").build(), null, null, null, null, jsonMapper); Map<String, Objec... | @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg.getPayload(), type); } return new IndexInfo() { priva... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... |
@Test public void shouldIndexFormatterWorkWithTimestampField() throws JsonProcessingException { Properties props = new Properties(); props.put("dateFormat", "YYYYMMdd"); DefaultIndexInfoBuilder builder = new DefaultIndexInfoBuilder( new ImmutableMap.Builder<String, String>() .put("routingkey1", "index1:type1") .put("ro... | @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg.getPayload(), type); } return new IndexInfo() { priva... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... |
@Test public void shouldGetIdReturnNullOnEmptyList() throws JsonProcessingException { DefaultIndexInfoBuilder builder = new DefaultIndexInfoBuilder( null, null, null, null, null, jsonMapper); Map<String, Object> msg = new ImmutableMap.Builder<String, Object>() .put("f1", "v1").build(); IndexInfo info = builder.create(n... | @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg.getPayload(), type); } return new IndexInfo() { priva... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... |
@Test public void shouldGetIdReturnsConcatenatedStr() throws JsonProcessingException { Map<String, Object> msg = new ImmutableMap.Builder<String, Object>() .put("f1", "v1") .put("f2", "v2") .put("f3", "v3") .build(); DefaultIndexInfoBuilder builder = new DefaultIndexInfoBuilder( null, new ImmutableMap.Builder<String, L... | @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg.getPayload(), type); } return new IndexInfo() { priva... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... |
@Test public void shouldGetIdReturnsConcatedStrWithTimeslice() throws JsonProcessingException { DateTime dt = new DateTime("2014-10-12T12:12:12.000Z"); Map<String, Object> msg = new ImmutableMap.Builder<String, Object>() .put("f1", "v1") .put("f2", "v2") .put("f3", "v3") .put("ts", dt.getMillis()) .build(); DefaultInde... | @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg.getPayload(), type); } return new IndexInfo() { priva... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... |
@Test public void testCreation() throws IOException { String desc = "{\n" + " \"type\": \"default\",\n" + " \"indexTypeMap\":{\"routingkey1\":\"index1:type1\", \"routingkey2\":\"index2:type2\"},\n" + " \"idFields\":{\"routingkey\": [\"f1\", \"f2\", \"ts_minute\"]},\n" + " \"timestamp\": {\"field\":\"ts\"},\n" + " \"ind... | @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg.getPayload(), type); } return new IndexInfo() { priva... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... | DefaultIndexInfoBuilder implements IndexInfoBuilder { @Override public IndexInfo create(final Message msg) { try { final Map<String, Object> msgMap; if (dataConverter != null) { msgMap = dataConverter.convert((Map<String, Object>) jsonMapper.readValue(msg.getPayload(), type)); } else { msgMap = jsonMapper.readValue(msg... |
@Test public void shouldNullFormatReturnsLongTS() { TimestampField field = new TimestampField("ts", null); long ts = System.currentTimeMillis(); assertEquals( field.get( new ImmutableMap.Builder<String, Object>() .put("ts", ts) .put("field1", "value1").build()), ts); assertEquals( field.get( new ImmutableMap.Builder<St... | public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } } | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } @JsonCreator TimestampField(@JsonProperty("field") String fieldName, @JsonProperty("format") St... | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } @JsonCreator TimestampField(@JsonProperty("field") String fieldName, @JsonProperty("format") St... | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } @JsonCreator TimestampField(@JsonProperty("field") String fieldName, @JsonProperty("format") St... |
@Test(expected=IllegalArgumentException.class) public void shouldNonNullFormatThrowsException() { TimestampField field = new TimestampField("ts", "YYYY-MM-DD"); long ts = System.currentTimeMillis(); assertEquals( field.get( new ImmutableMap.Builder<String, Object>() .put("ts", ts) .put("field1", "value1").build()), ts)... | public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } } | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } @JsonCreator TimestampField(@JsonProperty("field") String fieldName, @JsonProperty("format") St... | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } @JsonCreator TimestampField(@JsonProperty("field") String fieldName, @JsonProperty("format") St... | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } @JsonCreator TimestampField(@JsonProperty("field") String fieldName, @JsonProperty("format") St... |
@Test public void testFormat() { TimestampField field = new TimestampField("ts", "EEE MMM dd HH:mm:ss zzz YYYY"); assertEquals( field.get(new ImmutableMap.Builder<String, Object>() .put("ts", "Fri Oct 03 18:25:08 GMT 2014") .put("field1", "value1").build()), new DateTime("2014-10-03T18:25:08.000Z").getMillis()); } | public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } } | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } @JsonCreator TimestampField(@JsonProperty("field") String fieldName, @JsonProperty("format") St... | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } @JsonCreator TimestampField(@JsonProperty("field") String fieldName, @JsonProperty("format") St... | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } @JsonCreator TimestampField(@JsonProperty("field") String fieldName, @JsonProperty("format") St... |
@Test public void testNonExistentValueShouldBeFiltered(){ MockRequestTrace requestTrace = Mockito.mock(MockRequestTrace.class); MessageFilter filter = new PathValueMessageFilter(" assertFalse(filter.apply(requestTrace)); } | @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } | PathValueMessageFilter extends BaseMessageFilter { @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } } | PathValueMessageFilter extends BaseMessageFilter { @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } PathValueMessageFilter(String path, Va... | PathValueMessageFilter extends BaseMessageFilter { @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } PathValueMessageFilter(String path, Va... | PathValueMessageFilter extends BaseMessageFilter { @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } PathValueMessageFilter(String path, Va... |
@Test public void testFormat2() { TimestampField field = new TimestampField("ts", "YYYY-MM-dd HH:mm:ss.SSS"); assertEquals( field.get(new ImmutableMap.Builder<String, Object>() .put("ts", "2014-10-17 19:53:26.001") .put("field1", "value1").build()), new DateTime("2014-10-17T19:53:26.001Z").getMillis()); } | public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } } | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } @JsonCreator TimestampField(@JsonProperty("field") String fieldName, @JsonProperty("format") St... | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } @JsonCreator TimestampField(@JsonProperty("field") String fieldName, @JsonProperty("format") St... | TimestampField { public long get(Map<String, Object> msg) { Object value = msg.get(fieldName); if (value instanceof Number) { return ((Number) value).longValue(); } return formatter.parser().parseMillis(value.toString()); } @JsonCreator TimestampField(@JsonProperty("field") String fieldName, @JsonProperty("format") St... |
@Test public void shouldNullTypeReturnsEmptyString() { IndexSuffixFormatter formatter = new IndexSuffixFormatter(null, null); assertEquals(formatter.format(any(IndexInfo.class)), ""); } | public String format(IndexInfo info) { return formatter.apply(info); } | IndexSuffixFormatter { public String format(IndexInfo info) { return formatter.apply(info); } } | IndexSuffixFormatter { public String format(IndexInfo info) { return formatter.apply(info); } @JsonCreator IndexSuffixFormatter(
@JsonProperty("type") String type,
@JsonProperty("properties") Properties props); } | IndexSuffixFormatter { public String format(IndexInfo info) { return formatter.apply(info); } @JsonCreator IndexSuffixFormatter(
@JsonProperty("type") String type,
@JsonProperty("properties") Properties props); String format(IndexInfo info); } | IndexSuffixFormatter { public String format(IndexInfo info) { return formatter.apply(info); } @JsonCreator IndexSuffixFormatter(
@JsonProperty("type") String type,
@JsonProperty("properties") Properties props); String format(IndexInfo info); } |
@Test public void shouldDateTypeReturnsCorrectOne() { System.setProperty("user.timezone", "GMT"); Properties props = new Properties(); props.put("dateFormat", "YYYYMMdd"); DateTime dt = new DateTime("2014-10-12T00:00:00.000Z"); IndexSuffixFormatter formatter = new IndexSuffixFormatter("date", props); IndexInfo info = m... | public String format(IndexInfo info) { return formatter.apply(info); } | IndexSuffixFormatter { public String format(IndexInfo info) { return formatter.apply(info); } } | IndexSuffixFormatter { public String format(IndexInfo info) { return formatter.apply(info); } @JsonCreator IndexSuffixFormatter(
@JsonProperty("type") String type,
@JsonProperty("properties") Properties props); } | IndexSuffixFormatter { public String format(IndexInfo info) { return formatter.apply(info); } @JsonCreator IndexSuffixFormatter(
@JsonProperty("type") String type,
@JsonProperty("properties") Properties props); String format(IndexInfo info); } | IndexSuffixFormatter { public String format(IndexInfo info) { return formatter.apply(info); } @JsonCreator IndexSuffixFormatter(
@JsonProperty("type") String type,
@JsonProperty("properties") Properties props); String format(IndexInfo info); } |
@Test public void testWeeklyRepresentation() { System.setProperty("user.timezone", "GMT"); Properties props = new Properties(); props.put("dateFormat", "YYYYMM_ww"); DateTime dt = new DateTime("2014-10-12T00:00:00.000Z"); IndexSuffixFormatter formatter = new IndexSuffixFormatter("date", props); IndexInfo info = mock(In... | public String format(IndexInfo info) { return formatter.apply(info); } | IndexSuffixFormatter { public String format(IndexInfo info) { return formatter.apply(info); } } | IndexSuffixFormatter { public String format(IndexInfo info) { return formatter.apply(info); } @JsonCreator IndexSuffixFormatter(
@JsonProperty("type") String type,
@JsonProperty("properties") Properties props); } | IndexSuffixFormatter { public String format(IndexInfo info) { return formatter.apply(info); } @JsonCreator IndexSuffixFormatter(
@JsonProperty("type") String type,
@JsonProperty("properties") Properties props); String format(IndexInfo info); } | IndexSuffixFormatter { public String format(IndexInfo info) { return formatter.apply(info); } @JsonCreator IndexSuffixFormatter(
@JsonProperty("type") String type,
@JsonProperty("properties") Properties props); String format(IndexInfo info); } |
@Test public void shouldBePopulatedWithNumberOfServersOnLessSenderThreads() throws Exception { props.setProperty(ClientConfig.ASYNC_SENDER_THREADS, "1"); createInjector(); ILoadBalancer lb = mock(ILoadBalancer.class); List<Server> servers = new LinkedList<Server>(); for (SuroServer4Test suroServer4Test : this.servers) ... | @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } | ConnectionPool { @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } } | ConnectionPool { @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } @Inject ConnectionPool(ClientConfig config, ILoadBalancer lb); } | ConnectionPool { @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } @Inject ConnectionPool(ClientConfig config, ILoadBalancer lb); @PreDestroy void shutdown(); @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) int getPoolSize(); int getOutPoolSize... | ConnectionPool { @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } @Inject ConnectionPool(ClientConfig config, ILoadBalancer lb); @PreDestroy void shutdown(); @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) int getPoolSize(); int getOutPoolSize... |
@Test public void shouldBePopulatedWithNumberOfServersOnMoreSenderThreads() throws Exception { props.setProperty(ClientConfig.ASYNC_SENDER_THREADS, "10"); createInjector(); ILoadBalancer lb = mock(ILoadBalancer.class); List<Server> servers = new LinkedList<Server>(); for (SuroServer4Test suroServer4Test : this.servers)... | @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } | ConnectionPool { @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } } | ConnectionPool { @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } @Inject ConnectionPool(ClientConfig config, ILoadBalancer lb); } | ConnectionPool { @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } @Inject ConnectionPool(ClientConfig config, ILoadBalancer lb); @PreDestroy void shutdown(); @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) int getPoolSize(); int getOutPoolSize... | ConnectionPool { @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } @Inject ConnectionPool(ClientConfig config, ILoadBalancer lb); @PreDestroy void shutdown(); @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) int getPoolSize(); int getOutPoolSize... |
@Test public void shouldPopulationFinishedOnTimeout() throws Exception { shutdownServers(servers); createInjector(); final ILoadBalancer lb = mock(ILoadBalancer.class); List<Server> servers = new LinkedList<Server>(); for (SuroServer4Test suroServer4Test : this.servers) { servers.add(new Server("localhost", suroServer4... | @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } | ConnectionPool { @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } } | ConnectionPool { @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } @Inject ConnectionPool(ClientConfig config, ILoadBalancer lb); } | ConnectionPool { @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } @Inject ConnectionPool(ClientConfig config, ILoadBalancer lb); @PreDestroy void shutdown(); @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) int getPoolSize(); int getOutPoolSize... | ConnectionPool { @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) public int getPoolSize() { return connectionList.size(); } @Inject ConnectionPool(ClientConfig config, ILoadBalancer lb); @PreDestroy void shutdown(); @Monitor(name = "PoolSize", type = DataSourceType.GAUGE) int getPoolSize(); int getOutPoolSize... |
@Test public void pingTest() throws Exception { final SuroServer4Test server4Test = new SuroServer4Test(); server4Test.start(); SuroPing ping = new SuroPing(); Server server = new Server("localhost", server4Test.getPort()); assertEquals(true, ping.isAlive(server)); server4Test.shutdown(); } | public boolean isAlive(Server server) { TSocket socket = null; TFramedTransport transport = null; try { socket = new TSocket(server.getHost(), server.getPort(), 2000); socket.getSocket().setTcpNoDelay(true); socket.getSocket().setKeepAlive(true); socket.getSocket().setSoLinger(true, 0); transport = new TFramedTransport... | SuroPing extends AbstractLoadBalancerPing { public boolean isAlive(Server server) { TSocket socket = null; TFramedTransport transport = null; try { socket = new TSocket(server.getHost(), server.getPort(), 2000); socket.getSocket().setTcpNoDelay(true); socket.getSocket().setKeepAlive(true); socket.getSocket().setSoLinge... | SuroPing extends AbstractLoadBalancerPing { public boolean isAlive(Server server) { TSocket socket = null; TFramedTransport transport = null; try { socket = new TSocket(server.getHost(), server.getPort(), 2000); socket.getSocket().setTcpNoDelay(true); socket.getSocket().setKeepAlive(true); socket.getSocket().setSoLinge... | SuroPing extends AbstractLoadBalancerPing { public boolean isAlive(Server server) { TSocket socket = null; TFramedTransport transport = null; try { socket = new TSocket(server.getHost(), server.getPort(), 2000); socket.getSocket().setTcpNoDelay(true); socket.getSocket().setKeepAlive(true); socket.getSocket().setSoLinge... | SuroPing extends AbstractLoadBalancerPing { public boolean isAlive(Server server) { TSocket socket = null; TFramedTransport transport = null; try { socket = new TSocket(server.getHost(), server.getPort(), 2000); socket.getSocket().setTcpNoDelay(true); socket.getSocket().setKeepAlive(true); socket.getSocket().setSoLinge... |
@Test public void pingFailTest() throws Exception { SuroPing ping = new SuroPing(); Server server = new Server("localhost", 7901); assertEquals(false, ping.isAlive(server)); } | public boolean isAlive(Server server) { TSocket socket = null; TFramedTransport transport = null; try { socket = new TSocket(server.getHost(), server.getPort(), 2000); socket.getSocket().setTcpNoDelay(true); socket.getSocket().setKeepAlive(true); socket.getSocket().setSoLinger(true, 0); transport = new TFramedTransport... | SuroPing extends AbstractLoadBalancerPing { public boolean isAlive(Server server) { TSocket socket = null; TFramedTransport transport = null; try { socket = new TSocket(server.getHost(), server.getPort(), 2000); socket.getSocket().setTcpNoDelay(true); socket.getSocket().setKeepAlive(true); socket.getSocket().setSoLinge... | SuroPing extends AbstractLoadBalancerPing { public boolean isAlive(Server server) { TSocket socket = null; TFramedTransport transport = null; try { socket = new TSocket(server.getHost(), server.getPort(), 2000); socket.getSocket().setTcpNoDelay(true); socket.getSocket().setKeepAlive(true); socket.getSocket().setSoLinge... | SuroPing extends AbstractLoadBalancerPing { public boolean isAlive(Server server) { TSocket socket = null; TFramedTransport transport = null; try { socket = new TSocket(server.getHost(), server.getPort(), 2000); socket.getSocket().setTcpNoDelay(true); socket.getSocket().setKeepAlive(true); socket.getSocket().setSoLinge... | SuroPing extends AbstractLoadBalancerPing { public boolean isAlive(Server server) { TSocket socket = null; TFramedTransport transport = null; try { socket = new TSocket(server.getHost(), server.getPort(), 2000); socket.getSocket().setTcpNoDelay(true); socket.getSocket().setKeepAlive(true); socket.getSocket().setSoLinge... |
@Test public void test() { AsyncSuroClient client = injector.getInstance(AsyncSuroClient.class); AsyncSuroSender sender = new AsyncSuroSender( TestConnectionPool.createMessageSet(100), client, injector.getInstance(ClientConfig.class)); sender.run(); assertEquals(client.getSentMessageCount(), 100); TestConnectionPool.ch... | public void run() { boolean sent = false; boolean retried = false; long startTS = System.currentTimeMillis(); for (int i = 0; i < config.getRetryCount(); ++i) { ConnectionPool.SuroConnection connection = connectionPool.chooseConnection(); if (connection == null) { continue; } try { Result result = connection.send(messa... | AsyncSuroSender implements Runnable { public void run() { boolean sent = false; boolean retried = false; long startTS = System.currentTimeMillis(); for (int i = 0; i < config.getRetryCount(); ++i) { ConnectionPool.SuroConnection connection = connectionPool.chooseConnection(); if (connection == null) { continue; } try {... | AsyncSuroSender implements Runnable { public void run() { boolean sent = false; boolean retried = false; long startTS = System.currentTimeMillis(); for (int i = 0; i < config.getRetryCount(); ++i) { ConnectionPool.SuroConnection connection = connectionPool.chooseConnection(); if (connection == null) { continue; } try {... | AsyncSuroSender implements Runnable { public void run() { boolean sent = false; boolean retried = false; long startTS = System.currentTimeMillis(); for (int i = 0; i < config.getRetryCount(); ++i) { ConnectionPool.SuroConnection connection = connectionPool.chooseConnection(); if (connection == null) { continue; } try {... | AsyncSuroSender implements Runnable { public void run() { boolean sent = false; boolean retried = false; long startTS = System.currentTimeMillis(); for (int i = 0; i < config.getRetryCount(); ++i) { ConnectionPool.SuroConnection connection = connectionPool.chooseConnection(); if (connection == null) { continue; } try {... |
@Test public void testNullValueCanBeAccepted(){ MockRequestTrace requestTrace = Mockito.mock(MockRequestTrace.class); MessageFilter filter = new PathValueMessageFilter(" assertTrue(filter.apply(requestTrace)); } | @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } | PathValueMessageFilter extends BaseMessageFilter { @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } } | PathValueMessageFilter extends BaseMessageFilter { @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } PathValueMessageFilter(String path, Va... | PathValueMessageFilter extends BaseMessageFilter { @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } PathValueMessageFilter(String path, Va... | PathValueMessageFilter extends BaseMessageFilter { @SuppressWarnings("unchecked") @Override public boolean apply(Object input) { JXPathContext jxpath = JXPathContext.newContext(input); jxpath.setLenient(true); Object value = jxpath.getValue(xpath); return predicate.apply(value); } PathValueMessageFilter(String path, Va... |
@Test public void testRestore() throws InterruptedException { AsyncSuroClient client = injector.getInstance(AsyncSuroClient.class); for (SuroServer4Test c : servers) { c.setTryLater(); } AsyncSuroSender sender = new AsyncSuroSender( TestConnectionPool.createMessageSet(600), client, injector.getInstance(ClientConfig.cla... | public void run() { boolean sent = false; boolean retried = false; long startTS = System.currentTimeMillis(); for (int i = 0; i < config.getRetryCount(); ++i) { ConnectionPool.SuroConnection connection = connectionPool.chooseConnection(); if (connection == null) { continue; } try { Result result = connection.send(messa... | AsyncSuroSender implements Runnable { public void run() { boolean sent = false; boolean retried = false; long startTS = System.currentTimeMillis(); for (int i = 0; i < config.getRetryCount(); ++i) { ConnectionPool.SuroConnection connection = connectionPool.chooseConnection(); if (connection == null) { continue; } try {... | AsyncSuroSender implements Runnable { public void run() { boolean sent = false; boolean retried = false; long startTS = System.currentTimeMillis(); for (int i = 0; i < config.getRetryCount(); ++i) { ConnectionPool.SuroConnection connection = connectionPool.chooseConnection(); if (connection == null) { continue; } try {... | AsyncSuroSender implements Runnable { public void run() { boolean sent = false; boolean retried = false; long startTS = System.currentTimeMillis(); for (int i = 0; i < config.getRetryCount(); ++i) { ConnectionPool.SuroConnection connection = connectionPool.chooseConnection(); if (connection == null) { continue; } try {... | AsyncSuroSender implements Runnable { public void run() { boolean sent = false; boolean retried = false; long startTS = System.currentTimeMillis(); for (int i = 0; i < config.getRetryCount(); ++i) { ConnectionPool.SuroConnection connection = connectionPool.chooseConnection(); if (connection == null) { continue; } try {... |
@Test public void testRestore() throws Exception { Properties props = new Properties(); props.setProperty(ClientConfig.RETRY_COUNT, "1"); props.setProperty(ClientConfig.ASYNC_TIMEOUT, "1"); setupFile(props); int messageCount = 3; AsyncSuroClient client = injector.getInstance(AsyncSuroClient.class); final CountDownLatch... | public void restore(Message message) { restoredMessages.incrementAndGet(); DynamicCounter.increment( MonitorConfig.builder(TagKey.RESTORED_COUNT) .withTag(TagKey.APP, config.getApp()) .withTag(TagKey.DATA_SOURCE, message.getRoutingKey()) .build()); for (Listener listener : listeners) { listener.restoredCallback(); } se... | AsyncSuroClient implements ISuroClient { public void restore(Message message) { restoredMessages.incrementAndGet(); DynamicCounter.increment( MonitorConfig.builder(TagKey.RESTORED_COUNT) .withTag(TagKey.APP, config.getApp()) .withTag(TagKey.DATA_SOURCE, message.getRoutingKey()) .build()); for (Listener listener : liste... | AsyncSuroClient implements ISuroClient { public void restore(Message message) { restoredMessages.incrementAndGet(); DynamicCounter.increment( MonitorConfig.builder(TagKey.RESTORED_COUNT) .withTag(TagKey.APP, config.getApp()) .withTag(TagKey.DATA_SOURCE, message.getRoutingKey()) .build()); for (Listener listener : liste... | AsyncSuroClient implements ISuroClient { public void restore(Message message) { restoredMessages.incrementAndGet(); DynamicCounter.increment( MonitorConfig.builder(TagKey.RESTORED_COUNT) .withTag(TagKey.APP, config.getApp()) .withTag(TagKey.DATA_SOURCE, message.getRoutingKey()) .build()); for (Listener listener : liste... | AsyncSuroClient implements ISuroClient { public void restore(Message message) { restoredMessages.incrementAndGet(); DynamicCounter.increment( MonitorConfig.builder(TagKey.RESTORED_COUNT) .withTag(TagKey.APP, config.getApp()) .withTag(TagKey.DATA_SOURCE, message.getRoutingKey()) .build()); for (Listener listener : liste... |
@Test public void shouldReturnStaticRoutingKey() throws Exception { ObjectMapper jsonMapper = new DefaultObjectMapper(); JsonLine jsonLine = new JsonLine( "staticRoutingKey", null, new DefaultObjectMapper()); Map<String, Object> msgMap = new ImmutableMap.Builder<String, Object>().put("f1", "v1").put("f2", "v2").build()... | @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = jsonMapper.readValue(data, S3Consumer... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... |
@Test public void shouldReturnRoutingKeyField() throws Exception { ObjectMapper jsonMapper = new DefaultObjectMapper(); JsonLine jsonLine = new JsonLine( null, "f1", new DefaultObjectMapper()); Map<String, Object> msgMap = new ImmutableMap.Builder<String, Object>().put("f1", "v1").put("f2", "v2").build(); List<MessageC... | @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = jsonMapper.readValue(data, S3Consumer... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... |
@Test public void shouldReturnStaticRoutingKeyOnNonExistingRoutingKeyField() throws Exception { ObjectMapper jsonMapper = new DefaultObjectMapper(); JsonLine jsonLine = new JsonLine( "defaultRoutingKey", "f1", new DefaultObjectMapper()); Map<String, Object> msgMap = new ImmutableMap.Builder<String, Object>().put("f3", ... | @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = jsonMapper.readValue(data, S3Consumer... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... |
@Test public void testWithNonParseableMessage() throws Exception { JsonLine jsonLine = new JsonLine( "defaultRoutingKey", "f1", new DefaultObjectMapper()); List<MessageContainer> messages = jsonLine.parse("non_parseable_msg"); assertEquals(messages.size(), 1); assertEquals(messages.get(0).getRoutingKey(), "defaultRouti... | @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = jsonMapper.readValue(data, S3Consumer... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... | JsonLine implements RecordParser { @Override public List<MessageContainer> parse(String data) { if (routingKey != null) { return new ImmutableList.Builder<MessageContainer>() .add(new DefaultMessageContainer( new Message(routingKey, data.getBytes()), jsonMapper)) .build(); } else { try { Map<String, Object> record = js... |
@Test public void test() throws Exception { RestS3Service s3Service = mock(RestS3Service.class); AccessControlList acl = new AccessControlList(); doReturn(acl).when(s3Service).getObjectAcl("bucket", "key"); doNothing().when(s3Service).putObjectAcl("bucket", "key", acl); GrantAcl grantAcl = new GrantAcl(s3Service, "1,2,... | public GrantAcl(RestS3Service s3Service, String s3Acl, int s3AclRetries) { this.s3Service = s3Service; this.s3Acl = s3Acl; this.s3AclRetries = s3AclRetries; } | GrantAcl { public GrantAcl(RestS3Service s3Service, String s3Acl, int s3AclRetries) { this.s3Service = s3Service; this.s3Acl = s3Acl; this.s3AclRetries = s3AclRetries; } } | GrantAcl { public GrantAcl(RestS3Service s3Service, String s3Acl, int s3AclRetries) { this.s3Service = s3Service; this.s3Acl = s3Acl; this.s3AclRetries = s3AclRetries; } GrantAcl(RestS3Service s3Service, String s3Acl, int s3AclRetries); } | GrantAcl { public GrantAcl(RestS3Service s3Service, String s3Acl, int s3AclRetries) { this.s3Service = s3Service; this.s3Acl = s3Acl; this.s3AclRetries = s3AclRetries; } GrantAcl(RestS3Service s3Service, String s3Acl, int s3AclRetries); boolean grantAcl(S3Object object); } | GrantAcl { public GrantAcl(RestS3Service s3Service, String s3Acl, int s3AclRetries) { this.s3Service = s3Service; this.s3Acl = s3Acl; this.s3AclRetries = s3AclRetries; } GrantAcl(RestS3Service s3Service, String s3Acl, int s3AclRetries); boolean grantAcl(S3Object object); } |
@Test public void testDefaultParameters() throws Exception { String testDir = tempDir.newFolder().getAbsolutePath(); Injector injector = getInjector(); final String s3FileSink = "{\n" + " \"type\": \"" + S3FileSink.TYPE + "\",\n" + " \"localFileSink\": {\n" + " \"type\": \"" + LocalFileSink.TYPE + "\",\n" + " \"outputD... | @Override public String recvNotice() { return notice.recv(); } | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } } | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... |
@Test public void test() throws Exception { String testDir = tempDir.newFolder().getAbsolutePath(); final String s3FileSink = "{\n" + " \"type\": \"" + S3FileSink.TYPE + "\",\n" + " \"localFileSink\": {\n" + " \"type\": \"" + LocalFileSink.TYPE + "\",\n" + " \"outputDir\": \"" + testDir + "\",\n" + " \"writer\": {\n" +... | @Override public String recvNotice() { return notice.recv(); } | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } } | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... |
@Test public void testTooManyFiles() throws IOException { String testDir = tempDir.newFolder().getAbsolutePath(); Injector injector = getInjector(); final String s3FileSink = "{\n" + " \"type\": \"" + S3FileSink.TYPE + "\",\n" + " \"localFileSink\": {\n" + " \"type\": \"" + LocalFileSink.TYPE + "\",\n" + " \"outputDir\... | @Override public String recvNotice() { return notice.recv(); } | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } } | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... |
@Test public void testNullIsAccepted() { assertTrue(NullValuePredicate.INSTANCE.apply(null)); } | @Override public boolean apply(final Object input) { return input == null; } | NullValuePredicate implements ValuePredicate { @Override public boolean apply(final Object input) { return input == null; } } | NullValuePredicate implements ValuePredicate { @Override public boolean apply(final Object input) { return input == null; } private NullValuePredicate(); } | NullValuePredicate implements ValuePredicate { @Override public boolean apply(final Object input) { return input == null; } private NullValuePredicate(); @Override boolean apply(final Object input); @Override String toString(); @Override final int hashCode(); @Override final boolean equals(Object obj); } | NullValuePredicate implements ValuePredicate { @Override public boolean apply(final Object input) { return input == null; } private NullValuePredicate(); @Override boolean apply(final Object input); @Override String toString(); @Override final int hashCode(); @Override final boolean equals(Object obj); static final Nu... |
@Test public void testUploadAll() throws IOException { String testDir = tempDir.newFolder().getAbsolutePath(); Injector injector = getInjector(); final String s3FileSink = "{\n" + " \"type\": \"" + S3FileSink.TYPE + "\",\n" + " \"localFileSink\": {\n" + " \"type\": \"" + LocalFileSink.TYPE + "\",\n" + " \"outputDir\": ... | @Override public String recvNotice() { return notice.recv(); } | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } } | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... |
@Test public void testAclFailure() throws IOException, ServiceException, InterruptedException { String testDir = tempDir.newFolder().getAbsolutePath(); final String s3FileSink = "{\n" + " \"type\": \"" + S3FileSink.TYPE + "\",\n" + " \"localFileSink\": {\n" + " \"type\": \"" + LocalFileSink.TYPE + "\",\n" + " \"outputD... | @Override public String recvNotice() { return notice.recv(); } | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } } | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... | S3FileSink extends RemoteFileSink { @Override public String recvNotice() { return notice.recv(); } @JsonCreator S3FileSink(
@JsonProperty("localFileSink") LocalFileSink localFileSink,
@JsonProperty("bucket") String bucket,
@JsonProperty("s3Endpoint") String s3Endpoint,
@... |
@Test public void testNonNullIsRejected() { assertFalse(NullValuePredicate.INSTANCE.apply(new Object())); } | @Override public boolean apply(final Object input) { return input == null; } | NullValuePredicate implements ValuePredicate { @Override public boolean apply(final Object input) { return input == null; } } | NullValuePredicate implements ValuePredicate { @Override public boolean apply(final Object input) { return input == null; } private NullValuePredicate(); } | NullValuePredicate implements ValuePredicate { @Override public boolean apply(final Object input) { return input == null; } private NullValuePredicate(); @Override boolean apply(final Object input); @Override String toString(); @Override final int hashCode(); @Override final boolean equals(Object obj); } | NullValuePredicate implements ValuePredicate { @Override public boolean apply(final Object input) { return input == null; } private NullValuePredicate(); @Override boolean apply(final Object input); @Override String toString(); @Override final int hashCode(); @Override final boolean equals(Object obj); static final Nu... |
@Test public void testValueComparison() throws Exception { Object[][] inputs = { {"abc", "abc", true}, {"", "", true}, {"AB", "A", false}, {null, null, true}, {null, "", false}, {"", null, false} }; for(Object[] input : inputs){ String value = (String)input[0]; String inputValue = (String)input[1]; boolean expected = (... | @Override public boolean apply(@Nullable String input) { return Objects.equal(value, input); } | StringValuePredicate implements ValuePredicate<String> { @Override public boolean apply(@Nullable String input) { return Objects.equal(value, input); } } | StringValuePredicate implements ValuePredicate<String> { @Override public boolean apply(@Nullable String input) { return Objects.equal(value, input); } StringValuePredicate(@Nullable String value); } | StringValuePredicate implements ValuePredicate<String> { @Override public boolean apply(@Nullable String input) { return Objects.equal(value, input); } StringValuePredicate(@Nullable String value); @Override boolean apply(@Nullable String input); @Override String toString(); @Override int hashCode(); @Override boolean ... | StringValuePredicate implements ValuePredicate<String> { @Override public boolean apply(@Nullable String input) { return Objects.equal(value, input); } StringValuePredicate(@Nullable String value); @Override boolean apply(@Nullable String input); @Override String toString(); @Override int hashCode(); @Override boolean ... |
@Test public void ShouldLoadPersistedLocale_WhenInitialized() { sut.initialize(); verify(localePersistor).load(); } | void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = resolver.resolveDefault(); ... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... |
@Test public void ShouldResolveFirstSupportedLocaleAsDefault_WhenResolveDefaultLocale_GivenNonMatchingLocales() { LocaleResolver sut = new LocaleResolver( Arrays.asList(LOCALE_ES_ES, LOCALE_IT_IT), Arrays.asList(LOCALE_EN_US, LOCALE_FR_FR), new LanguageMatchingAlgorithm(), ANY_PREFERENCE ); DefaultResolvedLocalePair de... | DefaultResolvedLocalePair resolveDefault() { MatchingLocales matchingPair = matchingAlgorithm.findDefaultMatch(supportedLocales, systemLocales); return matchingPair != null ? new DefaultResolvedLocalePair(matchingPair.getSupportedLocale(), matchingPair.getPreferredLocale(preference)) : new DefaultResolvedLocalePair(sup... | LocaleResolver { DefaultResolvedLocalePair resolveDefault() { MatchingLocales matchingPair = matchingAlgorithm.findDefaultMatch(supportedLocales, systemLocales); return matchingPair != null ? new DefaultResolvedLocalePair(matchingPair.getSupportedLocale(), matchingPair.getPreferredLocale(preference)) : new DefaultResol... | LocaleResolver { DefaultResolvedLocalePair resolveDefault() { MatchingLocales matchingPair = matchingAlgorithm.findDefaultMatch(supportedLocales, systemLocales); return matchingPair != null ? new DefaultResolvedLocalePair(matchingPair.getSupportedLocale(), matchingPair.getPreferredLocale(preference)) : new DefaultResol... | LocaleResolver { DefaultResolvedLocalePair resolveDefault() { MatchingLocales matchingPair = matchingAlgorithm.findDefaultMatch(supportedLocales, systemLocales); return matchingPair != null ? new DefaultResolvedLocalePair(matchingPair.getSupportedLocale(), matchingPair.getPreferredLocale(preference)) : new DefaultResol... | LocaleResolver { DefaultResolvedLocalePair resolveDefault() { MatchingLocales matchingPair = matchingAlgorithm.findDefaultMatch(supportedLocales, systemLocales); return matchingPair != null ? new DefaultResolvedLocalePair(matchingPair.getSupportedLocale(), matchingPair.getPreferredLocale(preference)) : new DefaultResol... |
@Test public void ShouldResolveGivenSupportedLocaleAsDefault_WhenResolveLocale_GivenNonMatchingLocales() throws UnsupportedLocaleException { LocaleResolver sut = new LocaleResolver( Arrays.asList(LOCALE_ES_ES, LOCALE_IT_IT), Arrays.asList(LOCALE_EN_US, LOCALE_FR_FR), new LanguageMatchingAlgorithm(), ANY_PREFERENCE ); L... | Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if (preference.equal... | LocaleResolver { Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if ... | LocaleResolver { Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if ... | LocaleResolver { Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if ... | LocaleResolver { Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if ... |
@Test public void ShouldResolveGivenSupportedLocaleDirectly_WhenResolveLocale_PreferringSupportedLocale() throws UnsupportedLocaleException { MatchingAlgorithm matchingAlgorithm = mock(MatchingAlgorithm.class); LocaleResolver sut = new LocaleResolver( Arrays.asList(LOCALE_ES_ES, LOCALE_IT_IT), Arrays.asList(LOCALE_EN_U... | Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if (preference.equal... | LocaleResolver { Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if ... | LocaleResolver { Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if ... | LocaleResolver { Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if ... | LocaleResolver { Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if ... |
@Test(expected = UnsupportedLocaleException.class) public void ShouldThrowException_WhenResolveLocale_GivenNotSupportedLocale() throws UnsupportedLocaleException { LocaleResolver sut = new LocaleResolver( Arrays.asList(LOCALE_ES_ES, LOCALE_IT_IT), Arrays.asList(LOCALE_EN_US, LOCALE_FR_FR), new LanguageMatchingAlgorithm... | Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if (preference.equal... | LocaleResolver { Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if ... | LocaleResolver { Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if ... | LocaleResolver { Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if ... | LocaleResolver { Locale resolve(Locale supportedLocale) throws UnsupportedLocaleException { if (!supportedLocales.contains(supportedLocale)) throw new UnsupportedLocaleException("The Locale you are trying to load is not in the supported list provided on library initialization"); MatchingLocales matchingPair = null; if ... |
@Test public void ShouldGetDefaultMatch_WhenInitialized_GivenNotPersisted() { doReturn(null).when(localePersistor).load(); sut.initialize(); verify(localeResolver).resolveDefault(); } | void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = resolver.resolveDefault(); ... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... |
@Test public void ShouldPersistSupportedLocale_WhenInitialized_GivenNotPersisted() { doReturn(null).when(localePersistor).load(); doReturn(defaultLocalePair).when(localeResolver).resolveDefault(); doReturn(ANY_LOCALE).when(defaultLocalePair).getSupportedLocale(); sut.initialize(); verify(localePersistor).save(ANY_LOCAL... | void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = resolver.resolveDefault(); ... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... |
@Test public void ShouldGetMatch_WhenInitialized_GivenPersisted() throws Exception { doReturn(ANY_LOCALE).when(localePersistor).load(); sut.initialize(); verify(localeResolver).resolve(ANY_LOCALE); } | void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = resolver.resolveDefault(); ... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... |
@Test public void ShouldChangeAppLocale_WhenInitialized_GivenNotPersisted() { doReturn(null).when(localePersistor).load(); sut.initialize(); verify(appLocaleChanger).change(defaultLocalePair.getResolvedLocale()); } | void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = resolver.resolveDefault(); ... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... |
@Test public void ShouldChangeAppLocale_WhenInitialized_GivenPersisted() throws UnsupportedLocaleException { doReturn(ANY_LOCALE).when(localePersistor).load(); doReturn(ANY_LOCALE).when(localeResolver).resolve(ANY_LOCALE); sut.initialize(); verify(appLocaleChanger).change(ANY_LOCALE); } | void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = resolver.resolveDefault(); ... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... | LocaleChangerDelegate { void initialize() { Locale persistedLocale = persistor.load(); if (persistedLocale != null) try { currentLocale = resolver.resolve(persistedLocale); } catch (UnsupportedLocaleException e) { persistedLocale = null; } if (persistedLocale == null) { DefaultResolvedLocalePair defaultLocalePair = res... |
@Test public void ShouldPersistLocaleWithSupportedLocale_WhenChanged_GivenSupportedLocale() { sut.setLocale(ANY_LOCALE); verify(localePersistor).save(ANY_LOCALE); } | void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } | LocaleChangerDelegate { void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } } | LocaleChangerDelegate { void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } LocaleChangerDelegate(LocalePersistor per... | LocaleChangerDelegate { void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } LocaleChangerDelegate(LocalePersistor per... | LocaleChangerDelegate { void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } LocaleChangerDelegate(LocalePersistor per... |
@Test public void ShouldChangeAppLocaleWithAMatchingLocale_WhenChanged_GivenSupportedLocale() throws UnsupportedLocaleException { doReturn(ANY_LOCALE).when(localeResolver).resolve(ANY_LOCALE); sut.setLocale(ANY_LOCALE); verify(appLocaleChanger).change(ANY_LOCALE); } | void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } | LocaleChangerDelegate { void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } } | LocaleChangerDelegate { void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } LocaleChangerDelegate(LocalePersistor per... | LocaleChangerDelegate { void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } LocaleChangerDelegate(LocalePersistor per... | LocaleChangerDelegate { void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } LocaleChangerDelegate(LocalePersistor per... |
@Test(expected = IllegalArgumentException.class) public void ShouldThrowIllegalArgumentException_WhenChanged_GivenNotSupportedLocale() throws UnsupportedLocaleException { doThrow(IllegalArgumentException.class).when(localeResolver).resolve(ANY_LOCALE); sut.setLocale(ANY_LOCALE); } | void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } | LocaleChangerDelegate { void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } } | LocaleChangerDelegate { void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } LocaleChangerDelegate(LocalePersistor per... | LocaleChangerDelegate { void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } LocaleChangerDelegate(LocalePersistor per... | LocaleChangerDelegate { void setLocale(Locale supportedLocale) { try { currentLocale = resolver.resolve(supportedLocale); persistor.save(supportedLocale); appLocaleChanger.change(currentLocale); } catch (UnsupportedLocaleException e) { throw new IllegalArgumentException(e); } } LocaleChangerDelegate(LocalePersistor per... |
@Test public void ShouldLoadPersistedLocale_WhenGetCurrentSupportedLocale() { doReturn(ANY_LOCALE).when(localePersistor).load(); Locale currentSupportedLocale = sut.getLocale(); assertEquals(ANY_LOCALE, currentSupportedLocale); } | Locale getLocale() { return persistor.load(); } | LocaleChangerDelegate { Locale getLocale() { return persistor.load(); } } | LocaleChangerDelegate { Locale getLocale() { return persistor.load(); } LocaleChangerDelegate(LocalePersistor persistor,
LocaleResolver resolver,
AppLocaleChanger appLocaleChanger); } | LocaleChangerDelegate { Locale getLocale() { return persistor.load(); } LocaleChangerDelegate(LocalePersistor persistor,
LocaleResolver resolver,
AppLocaleChanger appLocaleChanger); } | LocaleChangerDelegate { Locale getLocale() { return persistor.load(); } LocaleChangerDelegate(LocalePersistor persistor,
LocaleResolver resolver,
AppLocaleChanger appLocaleChanger); } |
@Test public void testSaveAndQueryAllBook() throws Exception { traverseData(); mDao.destoryDB(); } | public void destoryDB() { mDbOpenHelper = null; DataBaseOpenHelper.clearInstance(); } | LibraryDBDao implements Serializable { public void destoryDB() { mDbOpenHelper = null; DataBaseOpenHelper.clearInstance(); } } | LibraryDBDao implements Serializable { public void destoryDB() { mDbOpenHelper = null; DataBaseOpenHelper.clearInstance(); } LibraryDBDao(Context context); } | LibraryDBDao implements Serializable { public void destoryDB() { mDbOpenHelper = null; DataBaseOpenHelper.clearInstance(); } LibraryDBDao(Context context); void destoryDB(); boolean addBook(Book book); List<Book> queryAllBookList(); void updateBookInfo(String id, Book book); List<Book> searchBooks(String columnName, St... | LibraryDBDao implements Serializable { public void destoryDB() { mDbOpenHelper = null; DataBaseOpenHelper.clearInstance(); } LibraryDBDao(Context context); void destoryDB(); boolean addBook(Book book); List<Book> queryAllBookList(); void updateBookInfo(String id, Book book); List<Book> searchBooks(String columnName, St... |
@Test public void createdClassPathString_usesPathSeparator() throws Exception { String systemPath = "./jdk/jre/lib/rt.jar"; String classPath = "./user.jar" + File.pathSeparator + "./user2.jar" + File.pathSeparator + "./user3.jar"; assertThat(BatchEnvironment.createClassPath(classPath, systemPath).toString().split(File.... | public static ClassPath createClassPath(String classPathString, String sysClassPathString) { Path path = new Path(); if (sysClassPathString == null) { sysClassPathString = System.getProperty("sun.boot.class.path"); } if (sysClassPathString != null) { path.addFiles(sysClassPathString); } path.expandJarClassPaths(true); ... | BatchEnvironment extends org.glassfish.rmic.tools.javac.BatchEnvironment { public static ClassPath createClassPath(String classPathString, String sysClassPathString) { Path path = new Path(); if (sysClassPathString == null) { sysClassPathString = System.getProperty("sun.boot.class.path"); } if (sysClassPathString != nu... | BatchEnvironment extends org.glassfish.rmic.tools.javac.BatchEnvironment { public static ClassPath createClassPath(String classPathString, String sysClassPathString) { Path path = new Path(); if (sysClassPathString == null) { sysClassPathString = System.getProperty("sun.boot.class.path"); } if (sysClassPathString != nu... | BatchEnvironment extends org.glassfish.rmic.tools.javac.BatchEnvironment { public static ClassPath createClassPath(String classPathString, String sysClassPathString) { Path path = new Path(); if (sysClassPathString == null) { sysClassPathString = System.getProperty("sun.boot.class.path"); } if (sysClassPathString != nu... | BatchEnvironment extends org.glassfish.rmic.tools.javac.BatchEnvironment { public static ClassPath createClassPath(String classPathString, String sysClassPathString) { Path path = new Path(); if (sysClassPathString == null) { sysClassPathString = System.getProperty("sun.boot.class.path"); } if (sysClassPathString != nu... |
@Test public void constructNoArgVoidMethodType() throws Exception { Type methodType = TypeFactory.createMethodType("()V"); assertThat(methodType.getReturnType(), equalTo(Type.tVoid)); assertThat(methodType.getArgumentTypes(), emptyArray()); } | static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } |
@Test public void constructByteArrayToIntType() throws Exception { Type methodType = TypeFactory.createMethodType("([B)I"); assertThat(methodType.getReturnType(), equalTo(Type.tInt)); assertThat(methodType.getArgumentTypes(), arrayContaining(Type.tArray(Type.tByte))); } | static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } |
@Test public void constructAllNumericArgsToBooleanMethod() throws Exception { Type methodType = TypeFactory.createMethodType("(SIJFD)Z"); assertThat(methodType.getReturnType(), equalTo(Type.tBoolean)); assertThat(methodType.getArgumentTypes(), arrayContaining(Type.tShort, Type.tInt, Type.tLong, Type.tFloat, Type.tDoubl... | static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } |
@Test public void constructAllObjectArguments() throws Exception { Type methodType = TypeFactory.createMethodType("(Ljava/lang/String;Lorg/glassfish/rmic/classes/nestedClasses/TwoLevelNested$Level1;)V"); assertThat(methodType.getReturnType(), equalTo(Type.tVoid)); assertThat(methodType.getArgumentTypes(), arrayContaini... | static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } |
@Test public void constructObjectArrayArgument() throws Exception { Type methodType = TypeFactory.createMethodType("([Ljava/lang/Object;)V"); assertThat(methodType.getReturnType(), equalTo(Type.tVoid)); assertThat(methodType.getArgumentTypes(), arrayContaining(Type.tArray(Type.tObject))); } | static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } |
@Test public void constructCharArrayArgument() throws Exception { Type methodType = TypeFactory.createMethodType("([C)V"); assertThat(methodType.getReturnType(), equalTo(Type.tVoid)); assertThat(methodType.getArgumentTypes(), arrayContaining(Type.tArray(Type.tChar))); } | static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } | TypeFactory { static Type createMethodType(String descriptor) { org.objectweb.asm.Type returnType = org.objectweb.asm.Type.getReturnType(descriptor); return Type.tMethod(toRmicType(returnType), toTypeArray(org.objectweb.asm.Type.getArgumentTypes(descriptor))); } } |
@Test public void constructMultiDimensionalArrayType() throws Exception { assertThat(TypeFactory.createType("[[I"), equalTo(Type.tArray(Type.tArray(Type.tInt)))); } | static Type createType(String descriptor) { return toRmicType(org.objectweb.asm.Type.getType(descriptor)); } | TypeFactory { static Type createType(String descriptor) { return toRmicType(org.objectweb.asm.Type.getType(descriptor)); } } | TypeFactory { static Type createType(String descriptor) { return toRmicType(org.objectweb.asm.Type.getType(descriptor)); } } | TypeFactory { static Type createType(String descriptor) { return toRmicType(org.objectweb.asm.Type.getType(descriptor)); } } | TypeFactory { static Type createType(String descriptor) { return toRmicType(org.objectweb.asm.Type.getType(descriptor)); } } |
@Test public void whenNoErrorsOrWarnings_displayErrorsReturnsTrue() throws Exception { assertThat(main.displayErrors(environment), is(true)); } | boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return env.nerrors == 0; } | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... |
@Test public void whenNoErrorsOrWarnings_outputIsEmpty() throws Exception { main.displayErrors(environment); assertThat(getOutput(), isEmptyString()); } | boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return env.nerrors == 0; } | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... |
@Test public void afterOneError_outputReportsOneError() throws Exception { reportError(); main.displayErrors(environment); assertThat(getOutput(), containsString("1 error")); } | boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return env.nerrors == 0; } | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... |
@Test public void whenPropertyNotSet_chooseAsmParser() throws Exception { ClassDefinitionFactory factory = BatchEnvironment.createClassDefinitionFactory(); assertThat(factory, instanceOf(AsmClassFactory.class)); } | static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMIC is unable to parse class files at this JDK level without an ap... | BatchEnvironment extends Environment implements ErrorConsumer { static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMI... | BatchEnvironment extends Environment implements ErrorConsumer { static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMI... | BatchEnvironment extends Environment implements ErrorConsumer { static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMI... | BatchEnvironment extends Environment implements ErrorConsumer { static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMI... |
@Test public void afterThreeErrors_outputReportsNumberOfErrors() throws Exception { reportError(); reportError(); reportError(); main.displayErrors(environment); assertThat(getOutput(), containsString("3 errors")); } | boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return env.nerrors == 0; } | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... |
@Test public void afterOneWarning_outputReportsOneWarning() throws Exception { reportWarning(); main.displayErrors(environment); assertThat(getOutput(), containsString("1 warning")); } | boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return env.nerrors == 0; } | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... |
@Test public void afterThreeWarningss_outputReportsNumberOfErrors() throws Exception { reportWarning(); reportWarning(); reportWarning(); main.displayErrors(environment); assertThat(getOutput(), containsString("3 warnings")); } | boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return env.nerrors == 0; } | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... |
@Test public void afterOneErrorAndTwoWarnings_outputReportsNumbersOfBoth() throws Exception { reportError(); reportWarning(); reportWarning(); main.displayErrors(environment); assertThat(getOutput(), containsString("1 error, 2 warnings")); } | boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return env.nerrors == 0; } | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... |
@Test public void afterTwoErrorsAndOneWarnings_outputReportsNumbersOfBoth() throws Exception { reportError(); reportError(); reportWarning(); main.displayErrors(environment); assertThat(getOutput(), containsString("2 errors, 1 warning")); } | boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return env.nerrors == 0; } | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... | Main implements org.glassfish.rmic.Constants { boolean displayErrors(BatchEnvironment env) { List<String> summary = new ArrayList<>(); if (env.nerrors > 0) summary.add(getErrorSummary(env)); if (env.nwarnings > 0) summary.add(getWarningSummary(env)); if (!summary.isEmpty()) output(String.join(", ", summary)); return en... |
@Test(expected = RemarshalException.class) public void whenPIHandleReturnsRemarshalException_throwIt() throws Exception { orb.setPiEndingPointException(new RemarshalException()); impl.marshalingComplete(null, outputObject); } | @Subcontract public CDRInputObject marshalingComplete(java.lang.Object self, CDROutputObject outputObject) throws ApplicationException, org.omg.CORBA.portable.RemarshalException { MessageMediator messageMediator = outputObject.getMessageMediator(); ORB orb = messageMediator.getBroker(); operationAndId(messageMediator.g... | ClientRequestDispatcherImpl implements
ClientRequestDispatcher { @Subcontract public CDRInputObject marshalingComplete(java.lang.Object self, CDROutputObject outputObject) throws ApplicationException, org.omg.CORBA.portable.RemarshalException { MessageMediator messageMediator = outputObject.getMessageMediator()... | ClientRequestDispatcherImpl implements
ClientRequestDispatcher { @Subcontract public CDRInputObject marshalingComplete(java.lang.Object self, CDROutputObject outputObject) throws ApplicationException, org.omg.CORBA.portable.RemarshalException { MessageMediator messageMediator = outputObject.getMessageMediator()... | ClientRequestDispatcherImpl implements
ClientRequestDispatcher { @Subcontract public CDRInputObject marshalingComplete(java.lang.Object self, CDROutputObject outputObject) throws ApplicationException, org.omg.CORBA.portable.RemarshalException { MessageMediator messageMediator = outputObject.getMessageMediator()... | ClientRequestDispatcherImpl implements
ClientRequestDispatcher { @Subcontract public CDRInputObject marshalingComplete(java.lang.Object self, CDROutputObject outputObject) throws ApplicationException, org.omg.CORBA.portable.RemarshalException { MessageMediator messageMediator = outputObject.getMessageMediator()... |
@Test public void whenColocatedCallThrowsException_exceptionHasStackTrace() throws Throwable { try { handler.invoke(calledObject, throwExceptionMethod, new Object[0]); } catch (TestException exception) { assertThat(exception.getStackTrace(), not(emptyArray())); } } | public Object invoke( Object proxy, final Method method, Object[] args ) throws Throwable { Delegate delegate = null ; try { delegate = StubAdapter.getDelegate( stub ) ; } catch (SystemException ex) { throw Util.getInstance().mapSystemException(ex) ; } org.omg.CORBA.ORB delORB = delegate.orb( stub ) ; if (delORB instan... | StubInvocationHandlerImpl implements LinkedInvocationHandler { public Object invoke( Object proxy, final Method method, Object[] args ) throws Throwable { Delegate delegate = null ; try { delegate = StubAdapter.getDelegate( stub ) ; } catch (SystemException ex) { throw Util.getInstance().mapSystemException(ex) ; } org.... | StubInvocationHandlerImpl implements LinkedInvocationHandler { public Object invoke( Object proxy, final Method method, Object[] args ) throws Throwable { Delegate delegate = null ; try { delegate = StubAdapter.getDelegate( stub ) ; } catch (SystemException ex) { throw Util.getInstance().mapSystemException(ex) ; } org.... | StubInvocationHandlerImpl implements LinkedInvocationHandler { public Object invoke( Object proxy, final Method method, Object[] args ) throws Throwable { Delegate delegate = null ; try { delegate = StubAdapter.getDelegate( stub ) ; } catch (SystemException ex) { throw Util.getInstance().mapSystemException(ex) ; } org.... | StubInvocationHandlerImpl implements LinkedInvocationHandler { public Object invoke( Object proxy, final Method method, Object[] args ) throws Throwable { Delegate delegate = null ; try { delegate = StubAdapter.getDelegate( stub ) ; } catch (SystemException ex) { throw Util.getInstance().mapSystemException(ex) ; } org.... |
@Test public void whenObjectIsCorbaObject_returnIt() throws Exception { Object testObject = createStrictStub(org.omg.CORBA.Object.class); assertThat(impl.getStateToBind(testObject, null, null, env), sameInstance(testObject)); } | public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return null ; } Remote stub; try { stub = PortableRemoteO... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... |
@Test public void whenObjectIsNotRemote_returnNull() throws Exception { assertThat(impl.getStateToBind(new Object(), null, null, env), nullValue()); } | public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return null ; } Remote stub; try { stub = PortableRemoteO... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... |
@Test public void whenCannotGetOrbFromContext_returnNull() throws Exception { assertThat(impl.getStateToBind(remote, null, createStrictStub(Context.class), env), nullValue()); } | public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return null ; } Remote stub; try { stub = PortableRemoteO... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... |
@Test public void whenAsmClassesMissingOnJdk8_chooseBinaryParser() throws Exception { simulateAsmClassesMissing(); simulateJdkVersion("1.8"); ClassDefinitionFactory factory = BatchEnvironment.createClassDefinitionFactory(); assertThat(factory, instanceOf(BinaryClassFactory.class)); } | static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMIC is unable to parse class files at this JDK level without an ap... | BatchEnvironment extends Environment implements ErrorConsumer { static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMI... | BatchEnvironment extends Environment implements ErrorConsumer { static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMI... | BatchEnvironment extends Environment implements ErrorConsumer { static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMI... | BatchEnvironment extends Environment implements ErrorConsumer { static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMI... |
@Test public void whenObjectIsNotAStub_returnNull() throws Exception { installDelegate(createStrictStub(NoStubDelegate.class)); assertThat(impl.getStateToBind(remote, null, context, env), nullValue()); } | public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return null ; } Remote stub; try { stub = PortableRemoteO... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... |
@Test public void whenObjectIsAStub_returnIt() throws Exception { installDelegateForStub(corbaStub); Object state = impl.getStateToBind(remote, null, context, env); assertThat(state, sameInstance(corbaStub)); } | public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return null ; } Remote stub; try { stub = PortableRemoteO... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... |
@Test public void whenObjectIsAStub_connectIt() throws Exception { installDelegateForStub(corbaStub); impl.getStateToBind(remote, null, context, env); assertThat(corbaStub.connected, is(true)); } | public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return null ; } Remote stub; try { stub = PortableRemoteO... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... | JNDIStateFactoryImpl implements StateFactory { public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable<?,?> env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } if (!(orig instanceof Remote)) { return null; } ORB orb = getORB( ctx ) ; if (orb == null) { return nul... |
@Test public void whenCurrentBufferNull_allocateBufferAndRead() throws IOException { enqueData(DATA_TO_BE_READ); ByteBuffer buffer = reader.read(getSocketChannel(), null, 0); assertBufferContents(buffer, DATA_TO_BE_READ); } | public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } else if (numBytesRead ==... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... |
@Test public void whenCurrentBufferHasPartialData_readToAppendData() throws IOException { ByteBuffer oldBuffer = ByteBuffer.allocate(100); populateBuffer(oldBuffer, DATA_TO_BE_READ, 0, 3); enqueData(DATA_TO_BE_READ, 3, DATA_TO_BE_READ.length - 3); ByteBuffer buffer = reader.read(getSocketChannel(), oldBuffer, 0); asser... | public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } else if (numBytesRead ==... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... |
@Test public void whenCurrentBufferIsFull_readToAppendData() throws IOException { ByteBuffer oldBuffer = ByteBuffer.allocate(3); populateBuffer(oldBuffer, DATA_TO_BE_READ, 0, 3); enqueData(DATA_TO_BE_READ, 3, DATA_TO_BE_READ.length - 3); ByteBuffer buffer = reader.read(getSocketChannel(), oldBuffer, 0); assertBufferCon... | public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } else if (numBytesRead ==... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... |
@Test public void whenCurrentBufferTooSmallForIncomingData_reallocateAndAppend() throws IOException { ByteBuffer oldBuffer = ByteBuffer.allocate(5); populateBuffer(oldBuffer, DATA_TO_BE_READ, 0, 3); enqueData(DATA_TO_BE_READ, 3, DATA_TO_BE_READ.length - 3); ByteBuffer buffer = reader.read(getSocketChannel(), oldBuffer,... | public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } else if (numBytesRead ==... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... |
@Test public void whenMoreDataAvailableThanNeeded_ignoreIt() throws IOException { ByteBuffer oldBuffer = ByteBuffer.allocate(10); oldBuffer.flip(); enqueData(DATA_TO_BE_READ); getSocketChannel().setNumBytesToRead(3, 3); ByteBuffer buffer = reader.read(getSocketChannel(), oldBuffer, 2); assertBufferContents(buffer, getS... | public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } else if (numBytesRead ==... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... |
@Test(expected = EOFException.class) public void whenEOFDetectedThrowException() throws IOException { getSocketChannel().setEndOfInput(); ByteBuffer oldBuffer = ByteBuffer.allocate(5); reader.read(getSocketChannel(), oldBuffer, 0); } | public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } else if (numBytesRead ==... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... |
@Test public void whenNoDataRemains_returnNull() throws IOException { ByteBuffer oldBuffer = ByteBuffer.allocate(10); populateBuffer(oldBuffer, DATA_TO_BE_READ, 0, DATA_TO_BE_READ.length); ByteBuffer buffer = reader.read(getSocketChannel(), oldBuffer, 10); assertNull(buffer); assertPopulatedBufferContents(oldBuffer, DA... | public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } else if (numBytesRead ==... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... |
@Test(expected = BatchEnvironmentError.class) public void whenAsmClassesMissingOnJdk10_reportError() throws Exception { simulateAsmClassesMissing(); simulateJdkVersion("10"); BatchEnvironment.createClassDefinitionFactory(); } | static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMIC is unable to parse class files at this JDK level without an ap... | BatchEnvironment extends Environment implements ErrorConsumer { static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMI... | BatchEnvironment extends Environment implements ErrorConsumer { static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMI... | BatchEnvironment extends Environment implements ErrorConsumer { static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMI... | BatchEnvironment extends Environment implements ErrorConsumer { static ClassDefinitionFactory createClassDefinitionFactory() { try { return useBinaryClassFactory() ? new BinaryClassFactory() : new AsmClassFactory(); } catch (NoClassDefFoundError e) { if (!mayUseBinaryClassFactory()) throw new BatchEnvironmentError("RMI... |
@Test public void whenAtCapacityAndNoDataRemains_returnNullAndPreserveOldBuffer() throws IOException { ByteBuffer oldBuffer = ByteBuffer.wrap(DATA_TO_BE_READ); ByteBuffer buffer = reader.read(getSocketChannel(), oldBuffer, 10); assertNull(buffer); assertPopulatedBufferContents(oldBuffer, DATA_TO_BE_READ); } | public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } else if (numBytesRead ==... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... | SocketChannelReader { public ByteBuffer read(SocketChannel channel, ByteBuffer previouslyReadData, int minNeeded) throws IOException { ByteBuffer byteBuffer = prepareToAppendTo(previouslyReadData); int numBytesRead = channel.read(byteBuffer); if (numBytesRead < 0) { throw new EOFException("End of input detected"); } el... |
@Test public void whenRegisteringAcceptEventWithoutSelectThread_listenerThreadIsCreated() { eventHandler.setUseSelectThreadToWait(false); eventHandler.setInterestOps(SelectionKey.OP_ACCEPT); selector.registerForEvent(eventHandler); assertTrue(getWorkQueue().remove() instanceof ListenerThreadImpl); } | @Transport public void registerForEvent(EventHandler eventHandler) { if (isClosed()) { closedEventHandler(); return; } if (eventHandler.shouldUseSelectThreadToWait()) { synchronized (deferredRegistrations) { deferredRegistrations.add(eventHandler); } startSelector(); selector.wakeup(); return; } switch (eventHandler.ge... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { @Transport public void registerForEvent(EventHandler eventHandler) { if (isClosed()) { closedEventHandler(); return; } if (eventHandler.shouldUseSelectThreadToWait()) { synchronized (deferredRegistrations) { deferredRegistr... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { @Transport public void registerForEvent(EventHandler eventHandler) { if (isClosed()) { closedEventHandler(); return; } if (eventHandler.shouldUseSelectThreadToWait()) { synchronized (deferredRegistrations) { deferredRegistr... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { @Transport public void registerForEvent(EventHandler eventHandler) { if (isClosed()) { closedEventHandler(); return; } if (eventHandler.shouldUseSelectThreadToWait()) { synchronized (deferredRegistrations) { deferredRegistr... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { @Transport public void registerForEvent(EventHandler eventHandler) { if (isClosed()) { closedEventHandler(); return; } if (eventHandler.shouldUseSelectThreadToWait()) { synchronized (deferredRegistrations) { deferredRegistr... |
@Test public void whenRegisteringReadEventWithoutSelectThread_readerThreadIsCreated() { eventHandler.setUseSelectThreadToWait(false); eventHandler.setInterestOps(SelectionKey.OP_READ); selector.registerForEvent(eventHandler); assertTrue(getWorkQueue().remove() instanceof ReaderThreadImpl); } | @Transport public void registerForEvent(EventHandler eventHandler) { if (isClosed()) { closedEventHandler(); return; } if (eventHandler.shouldUseSelectThreadToWait()) { synchronized (deferredRegistrations) { deferredRegistrations.add(eventHandler); } startSelector(); selector.wakeup(); return; } switch (eventHandler.ge... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { @Transport public void registerForEvent(EventHandler eventHandler) { if (isClosed()) { closedEventHandler(); return; } if (eventHandler.shouldUseSelectThreadToWait()) { synchronized (deferredRegistrations) { deferredRegistr... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { @Transport public void registerForEvent(EventHandler eventHandler) { if (isClosed()) { closedEventHandler(); return; } if (eventHandler.shouldUseSelectThreadToWait()) { synchronized (deferredRegistrations) { deferredRegistr... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { @Transport public void registerForEvent(EventHandler eventHandler) { if (isClosed()) { closedEventHandler(); return; } if (eventHandler.shouldUseSelectThreadToWait()) { synchronized (deferredRegistrations) { deferredRegistr... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { @Transport public void registerForEvent(EventHandler eventHandler) { if (isClosed()) { closedEventHandler(); return; } if (eventHandler.shouldUseSelectThreadToWait()) { synchronized (deferredRegistrations) { deferredRegistr... |
@Test public void whenIoAvailable_dispatchToEventHandler() throws IOException { registerEventHandler(); selectorStub.setReady(channel, SelectionKey.OP_READ); selector.runSelectionLoopOnce(); assertEquals(1, eventHandler.numInvocations); } | void runSelectionLoopOnce() throws IOException { beginSelect(); int n = 0; handleDeferredRegistrations(); enableInterestOps(); try { n = selector.select(timeout); } catch (IOException e) { display( "Exception in select:", e ) ; } if (closed) { selector.close(); selectorClosed(); return; } Iterator<SelectionKey> iterato... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { void runSelectionLoopOnce() throws IOException { beginSelect(); int n = 0; handleDeferredRegistrations(); enableInterestOps(); try { n = selector.select(timeout); } catch (IOException e) { display( "Exception in select:", e... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { void runSelectionLoopOnce() throws IOException { beginSelect(); int n = 0; handleDeferredRegistrations(); enableInterestOps(); try { n = selector.select(timeout); } catch (IOException e) { display( "Exception in select:", e... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { void runSelectionLoopOnce() throws IOException { beginSelect(); int n = 0; handleDeferredRegistrations(); enableInterestOps(); try { n = selector.select(timeout); } catch (IOException e) { display( "Exception in select:", e... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { void runSelectionLoopOnce() throws IOException { beginSelect(); int n = 0; handleDeferredRegistrations(); enableInterestOps(); try { n = selector.select(timeout); } catch (IOException e) { display( "Exception in select:", e... |
@Test public void whenEventTimesOut_reportTimeout() throws IOException { registerEventHandler(); timer.setCurrentTime(1000); selector.runSelectionLoopOnce(); assertTrue(eventHandler.timeout); } | void runSelectionLoopOnce() throws IOException { beginSelect(); int n = 0; handleDeferredRegistrations(); enableInterestOps(); try { n = selector.select(timeout); } catch (IOException e) { display( "Exception in select:", e ) ; } if (closed) { selector.close(); selectorClosed(); return; } Iterator<SelectionKey> iterato... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { void runSelectionLoopOnce() throws IOException { beginSelect(); int n = 0; handleDeferredRegistrations(); enableInterestOps(); try { n = selector.select(timeout); } catch (IOException e) { display( "Exception in select:", e... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { void runSelectionLoopOnce() throws IOException { beginSelect(); int n = 0; handleDeferredRegistrations(); enableInterestOps(); try { n = selector.select(timeout); } catch (IOException e) { display( "Exception in select:", e... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { void runSelectionLoopOnce() throws IOException { beginSelect(); int n = 0; handleDeferredRegistrations(); enableInterestOps(); try { n = selector.select(timeout); } catch (IOException e) { display( "Exception in select:", e... | SelectorImpl extends
Thread implements
com.sun.corba.ee.spi.transport.Selector { void runSelectionLoopOnce() throws IOException { beginSelect(); int n = 0; handleDeferredRegistrations(); enableInterestOps(); try { n = selector.select(timeout); } catch (IOException e) { display( "Exception in select:", e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.