code
stringlengths 23
201k
| docstring
stringlengths 17
96.2k
| func_name
stringlengths 0
235
| language
stringclasses 1
value | repo
stringlengths 8
72
| path
stringlengths 11
317
| url
stringlengths 57
377
| license
stringclasses 7
values |
|---|---|---|---|---|---|---|---|
@Override
public void flush() throws IOException {
this.copy.flush();
this.original.flush();
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
flush
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity/src/test/java/extensions/velocity/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity/src/test/java/extensions/velocity/CaptureSystemOutput.java
|
Apache-2.0
|
@Test
@Disabled("Does not support template file yet")
void findByState() {
City city = cityMapper.findByState("CA");
assertThat(city.getId()).isEqualTo(1);
assertThat(city.getName()).isEqualTo("San Francisco");
assertThat(city.getState()).isEqualTo("CA");
assertThat(city.getCountry()).isEqualTo("US");
}
|
Tests for {@link CityMapper}.
@author Kazuki Shimizu
|
findByState
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity/src/test/java/sample/mybatis/velocity/mapper/CityMapperTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity/src/test/java/sample/mybatis/velocity/mapper/CityMapperTest.java
|
Apache-2.0
|
@Test
void findById() {
City city = cityMapper.findById(1L);
assertThat(city.getId()).isEqualTo(1);
assertThat(city.getName()).isEqualTo("San Francisco");
assertThat(city.getState()).isEqualTo("CA");
assertThat(city.getCountry()).isEqualTo("US");
}
|
Tests for {@link CityMapper}.
@author Kazuki Shimizu
|
findById
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity/src/test/java/sample/mybatis/velocity/mapper/CityMapperTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity/src/test/java/sample/mybatis/velocity/mapper/CityMapperTest.java
|
Apache-2.0
|
@Test
void findByName() {
City city = cityMapper.findByName("San Francisco");
assertThat(city.getId()).isEqualTo(1);
assertThat(city.getName()).isEqualTo("San Francisco");
assertThat(city.getState()).isEqualTo("CA");
assertThat(city.getCountry()).isEqualTo("US");
}
|
Tests for {@link CityMapper}.
@author Kazuki Shimizu
|
findByName
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity/src/test/java/sample/mybatis/velocity/mapper/CityMapperTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity/src/test/java/sample/mybatis/velocity/mapper/CityMapperTest.java
|
Apache-2.0
|
void captureOutput() {
this.copy = new ByteArrayOutputStream();
this.captureOut = new CaptureOutputStream(System.out, this.copy);
this.captureErr = new CaptureOutputStream(System.err, this.copy);
System.setOut(new PrintStream(this.captureOut));
System.setErr(new PrintStream(this.captureErr));
}
|
{@code OutputCapture} captures output to {@code System.out} and {@code System.err}.
<p>
To obtain an instance of {@code OutputCapture}, declare a parameter of type {@code OutputCapture} in a JUnit
Jupiter {@code @Test}, {@code @BeforeEach}, or {@code @AfterEach} method.
<p>
{@linkplain #expect Expectations} are supported via Hamcrest matchers.
<p>
To obtain all output to {@code System.out} and {@code System.err}, simply invoke {@link #toString()}.
@author Phillip Webb
@author Andy Wilkinson
@author Sam Brannen
|
captureOutput
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
Apache-2.0
|
void releaseOutput() {
System.setOut(this.captureOut.getOriginal());
System.setErr(this.captureErr.getOriginal());
this.copy = null;
}
|
{@code OutputCapture} captures output to {@code System.out} and {@code System.err}.
<p>
To obtain an instance of {@code OutputCapture}, declare a parameter of type {@code OutputCapture} in a JUnit
Jupiter {@code @Test}, {@code @BeforeEach}, or {@code @AfterEach} method.
<p>
{@linkplain #expect Expectations} are supported via Hamcrest matchers.
<p>
To obtain all output to {@code System.out} and {@code System.err}, simply invoke {@link #toString()}.
@author Phillip Webb
@author Andy Wilkinson
@author Sam Brannen
|
releaseOutput
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
Apache-2.0
|
private void flush() {
try {
this.captureOut.flush();
this.captureErr.flush();
} catch (IOException ex) {
// ignore
}
}
|
{@code OutputCapture} captures output to {@code System.out} and {@code System.err}.
<p>
To obtain an instance of {@code OutputCapture}, declare a parameter of type {@code OutputCapture} in a JUnit
Jupiter {@code @Test}, {@code @BeforeEach}, or {@code @AfterEach} method.
<p>
{@linkplain #expect Expectations} are supported via Hamcrest matchers.
<p>
To obtain all output to {@code System.out} and {@code System.err}, simply invoke {@link #toString()}.
@author Phillip Webb
@author Andy Wilkinson
@author Sam Brannen
|
flush
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
Apache-2.0
|
@Override
public String toString() {
flush();
return this.copy.toString();
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
toString
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
Apache-2.0
|
void reset() {
this.matchers.clear();
this.copy.reset();
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
reset
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
Apache-2.0
|
PrintStream getOriginal() {
return this.original;
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
getOriginal
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
Apache-2.0
|
@Override
public void write(int b) throws IOException {
this.copy.write(b);
this.original.write(b);
this.original.flush();
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
write
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
Apache-2.0
|
@Override
public void write(byte[] b) throws IOException {
write(b, 0, b.length);
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
write
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
Apache-2.0
|
@Override
public void write(byte[] b, int off, int len) throws IOException {
this.copy.write(b, off, len);
this.original.write(b, off, len);
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
write
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
Apache-2.0
|
@Override
public void flush() throws IOException {
this.copy.flush();
this.original.flush();
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
flush
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/extensions/velocity/legacy/CaptureSystemOutput.java
|
Apache-2.0
|
@Test
@Disabled("Does not support template file yet")
void findByState() {
City city = cityMapper.findByState("CA");
assertThat(city.getId()).isEqualTo(1);
assertThat(city.getName()).isEqualTo("San Francisco");
assertThat(city.getState()).isEqualTo("CA");
assertThat(city.getCountry()).isEqualTo("US");
}
|
Tests for {@link CityMapper}.
@author Kazuki Shimizu
|
findByState
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/sample/mybatis/velocity/legacy/mapper/CityMapperTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/sample/mybatis/velocity/legacy/mapper/CityMapperTest.java
|
Apache-2.0
|
@Test
void findById() {
City city = cityMapper.findById(1L);
assertThat(city.getId()).isEqualTo(1);
assertThat(city.getName()).isEqualTo("San Francisco");
assertThat(city.getState()).isEqualTo("CA");
assertThat(city.getCountry()).isEqualTo("US");
}
|
Tests for {@link CityMapper}.
@author Kazuki Shimizu
|
findById
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/sample/mybatis/velocity/legacy/mapper/CityMapperTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/sample/mybatis/velocity/legacy/mapper/CityMapperTest.java
|
Apache-2.0
|
@Test
void findByName() {
City city = cityMapper.findByName("San Francisco");
assertThat(city.getId()).isEqualTo(1);
assertThat(city.getName()).isEqualTo("San Francisco");
assertThat(city.getState()).isEqualTo("CA");
assertThat(city.getCountry()).isEqualTo("US");
}
|
Tests for {@link CityMapper}.
@author Kazuki Shimizu
|
findByName
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/sample/mybatis/velocity/legacy/mapper/CityMapperTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-velocity-legacy/src/test/java/sample/mybatis/velocity/legacy/mapper/CityMapperTest.java
|
Apache-2.0
|
@Test
void findByStateTest() {
City city = cityMapper.findByState("CA");
assertThat(city.getId()).isEqualTo(1);
assertThat(city.getName()).isEqualTo("San Francisco");
assertThat(city.getState()).isEqualTo("CA");
assertThat(city.getCountry()).isEqualTo("US");
}
|
Tests for {@link CityMapper}.
@author wonwoo
@since 1.2.1
|
findByStateTest
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-war/src/test/java/sample/mybatis/war/mapper/CityMapperTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-war/src/test/java/sample/mybatis/war/mapper/CityMapperTest.java
|
Apache-2.0
|
@Test
void findByStateTest() {
City city = cityMapper.findByState("CA");
assertThat(city.getId()).isEqualTo(1);
assertThat(city.getName()).isEqualTo("San Francisco");
assertThat(city.getState()).isEqualTo("CA");
assertThat(city.getCountry()).isEqualTo("US");
}
|
Tests for {@link CityMapper}.
@author wonwoo
@since 1.2.1
|
findByStateTest
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-web/src/test/java/sample/mybatis/web/mapper/CityMapperTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-web/src/test/java/sample/mybatis/web/mapper/CityMapperTest.java
|
Apache-2.0
|
void captureOutput() {
this.copy = new ByteArrayOutputStream();
this.captureOut = new CaptureOutputStream(System.out, this.copy);
this.captureErr = new CaptureOutputStream(System.err, this.copy);
System.setOut(new PrintStream(this.captureOut));
System.setErr(new PrintStream(this.captureErr));
}
|
{@code OutputCapture} captures output to {@code System.out} and {@code System.err}.
<p>
To obtain an instance of {@code OutputCapture}, declare a parameter of type {@code OutputCapture} in a JUnit
Jupiter {@code @Test}, {@code @BeforeEach}, or {@code @AfterEach} method.
<p>
{@linkplain #expect Expectations} are supported via Hamcrest matchers.
<p>
To obtain all output to {@code System.out} and {@code System.err}, simply invoke {@link #toString()}.
@author Phillip Webb
@author Andy Wilkinson
@author Sam Brannen
|
captureOutput
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
Apache-2.0
|
void releaseOutput() {
System.setOut(this.captureOut.getOriginal());
System.setErr(this.captureErr.getOriginal());
this.copy = null;
}
|
{@code OutputCapture} captures output to {@code System.out} and {@code System.err}.
<p>
To obtain an instance of {@code OutputCapture}, declare a parameter of type {@code OutputCapture} in a JUnit
Jupiter {@code @Test}, {@code @BeforeEach}, or {@code @AfterEach} method.
<p>
{@linkplain #expect Expectations} are supported via Hamcrest matchers.
<p>
To obtain all output to {@code System.out} and {@code System.err}, simply invoke {@link #toString()}.
@author Phillip Webb
@author Andy Wilkinson
@author Sam Brannen
|
releaseOutput
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
Apache-2.0
|
private void flush() {
try {
this.captureOut.flush();
this.captureErr.flush();
} catch (IOException ex) {
// ignore
}
}
|
{@code OutputCapture} captures output to {@code System.out} and {@code System.err}.
<p>
To obtain an instance of {@code OutputCapture}, declare a parameter of type {@code OutputCapture} in a JUnit
Jupiter {@code @Test}, {@code @BeforeEach}, or {@code @AfterEach} method.
<p>
{@linkplain #expect Expectations} are supported via Hamcrest matchers.
<p>
To obtain all output to {@code System.out} and {@code System.err}, simply invoke {@link #toString()}.
@author Phillip Webb
@author Andy Wilkinson
@author Sam Brannen
|
flush
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
Apache-2.0
|
@Override
public String toString() {
flush();
return this.copy.toString();
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
toString
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
Apache-2.0
|
void reset() {
this.matchers.clear();
this.copy.reset();
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
reset
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
Apache-2.0
|
PrintStream getOriginal() {
return this.original;
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
getOriginal
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
Apache-2.0
|
@Override
public void write(int b) throws IOException {
this.copy.write(b);
this.original.write(b);
this.original.flush();
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
write
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
Apache-2.0
|
@Override
public void write(byte[] b) throws IOException {
write(b, 0, b.length);
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
write
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
Apache-2.0
|
@Override
public void write(byte[] b, int off, int len) throws IOException {
this.copy.write(b, off, len);
this.original.write(b, off, len);
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
write
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
Apache-2.0
|
@Override
public void flush() throws IOException {
this.copy.flush();
this.original.flush();
}
|
Return all captured output to {@code System.out} and {@code System.err} as a single string.
|
flush
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/extensions/xml/CaptureSystemOutput.java
|
Apache-2.0
|
@Test
void selectCityByIdTest() {
City city = cityDao.selectCityById(1);
assertThat(city.getId()).isEqualTo(1);
assertThat(city.getName()).isEqualTo("San Francisco");
assertThat(city.getState()).isEqualTo("CA");
assertThat(city.getCountry()).isEqualTo("US");
}
|
Tests for {@link CityDao}.
@author wonwoo
@since 1.2.1
|
selectCityByIdTest
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/sample/mybatis/xml/dao/CityDaoTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/sample/mybatis/xml/dao/CityDaoTest.java
|
Apache-2.0
|
@Test
void selectByCityIdTest() {
Hotel hotel = hotelMapper.selectByCityId(1);
assertThat(hotel.getCity()).isEqualTo(1);
assertThat(hotel.getName()).isEqualTo("Conrad Treasury Place");
assertThat(hotel.getAddress()).isEqualTo("William & George Streets");
assertThat(hotel.getZip()).isEqualTo("4001");
}
|
Tests for {@link HotelMapper}.
@author wonwoo
@since 1.2.1
|
selectByCityIdTest
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/sample/mybatis/xml/mapper/HotelMapperTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml/src/test/java/sample/mybatis/xml/mapper/HotelMapperTest.java
|
Apache-2.0
|
@Override
protected String[] getProperties(Class<?> testClass) {
MybatisTest annotation = AnnotatedElementUtils.getMergedAnnotation(testClass, MybatisTest.class);
return (annotation != null) ? annotation.properties() : null;
}
|
{@link TestContextBootstrapper} for {@link MybatisTest @MybatisTest} support.
@author Kazuki Shimizu
@since 2.1.0
|
getProperties
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/main/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTestContextBootstrapper.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/main/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTestContextBootstrapper.java
|
Apache-2.0
|
@Override
protected boolean hasAnnotation() {
return this.annotation != null;
}
|
{@link TypeExcludeFilter} for {@link MybatisTest @MybatisTest}.
@author wonwoo
@since 1.2.1
|
hasAnnotation
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/main/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTypeExcludeFilter.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/main/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTypeExcludeFilter.java
|
Apache-2.0
|
@Override
protected ComponentScan.Filter[] getFilters(FilterType type) {
switch (type) {
case INCLUDE:
return this.annotation.includeFilters();
case EXCLUDE:
return this.annotation.excludeFilters();
default:
throw new IllegalStateException("Unsupported type " + type);
}
}
|
{@link TypeExcludeFilter} for {@link MybatisTest @MybatisTest}.
@author wonwoo
@since 1.2.1
|
getFilters
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/main/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTypeExcludeFilter.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/main/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTypeExcludeFilter.java
|
Apache-2.0
|
@Override
protected boolean isUseDefaultFilters() {
return this.annotation.useDefaultFilters();
}
|
{@link TypeExcludeFilter} for {@link MybatisTest @MybatisTest}.
@author wonwoo
@since 1.2.1
|
isUseDefaultFilters
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/main/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTypeExcludeFilter.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/main/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTypeExcludeFilter.java
|
Apache-2.0
|
@Override
protected Set<Class<?>> getDefaultIncludes() {
return Collections.emptySet();
}
|
{@link TypeExcludeFilter} for {@link MybatisTest @MybatisTest}.
@author wonwoo
@since 1.2.1
|
getDefaultIncludes
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/main/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTypeExcludeFilter.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/main/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTypeExcludeFilter.java
|
Apache-2.0
|
@Override
protected Set<Class<?>> getComponentIncludes() {
return Collections.emptySet();
}
|
{@link TypeExcludeFilter} for {@link MybatisTest @MybatisTest}.
@author wonwoo
@since 1.2.1
|
getComponentIncludes
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/main/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTypeExcludeFilter.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/main/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTypeExcludeFilter.java
|
Apache-2.0
|
public String getMessage() {
return "Hello!";
}
|
Example component that annotated {@link Component @Component} used with {@link MybatisTest} tests.
@author wonwoo
@since 1.2.1
|
getMessage
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/ExampleComponent.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/ExampleComponent.java
|
Apache-2.0
|
public String getMessage() {
return "Goodbye!";
}
|
Example component that annotated {@link Service @Service} used with {@link MybatisTest} tests.
@author Kazuki Shimizu
@since 1.2.1
|
getMessage
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/ExampleService.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/ExampleService.java
|
Apache-2.0
|
@Test
void testIncludeFilter() {
assertThat(component.getMessage()).isEqualTo("Hello!");
}
|
Integration test with custom filter for {@link MybatisTest}.
@author Kazuki Shimizu
@since 1.2.1
|
testIncludeFilter
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTestCustomFilterIntegrationTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTestCustomFilterIntegrationTest.java
|
Apache-2.0
|
@Test
void testExcludeFilter() {
assertThat(service).isNull();
}
|
Integration test with custom filter for {@link MybatisTest}.
@author Kazuki Shimizu
@since 1.2.1
|
testExcludeFilter
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTestCustomFilterIntegrationTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTestCustomFilterIntegrationTest.java
|
Apache-2.0
|
@Test
void testSqlSession() {
Map<String, Object> parameters = new HashMap<>();
parameters.put("id", 1);
parameters.put("name", "wonwoo");
sqlSession.insert("saveSample", parameters);
Sample findSample = sqlSession.selectOne("findSample", 1L);
assertThat(findSample.getId()).isNotNull().isEqualTo(1L);
assertThat(findSample.getName()).isNotNull().isEqualTo("wonwoo");
}
|
Integration tests for {@link MybatisTest}.
@author wonwoo
@since 1.2.1
|
testSqlSession
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTestIntegrationTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTestIntegrationTest.java
|
Apache-2.0
|
@Test
void testMapper() {
Map<String, Object> parameters = new HashMap<>();
parameters.put("id", 1);
parameters.put("name", "wonwoo");
sqlSession.insert("saveSample", parameters);
Sample sample = sampleMapper.findByName("wonwoo");
assertThat(sample.getId()).isNotNull().isEqualTo(1L);
assertThat(sample.getName()).isNotNull().isEqualTo("wonwoo");
}
|
Integration tests for {@link MybatisTest}.
@author wonwoo
@since 1.2.1
|
testMapper
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTestIntegrationTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTestIntegrationTest.java
|
Apache-2.0
|
@Test
void testAutoConfigureComponents() {
// @AutoConfigureMybatis
this.applicationContext.getBean(JdbcTemplate.class);
this.applicationContext.getBean(NamedParameterJdbcTemplate.class);
this.applicationContext.getBean(DataSourceTransactionManager.class);
this.applicationContext.getBean(TransactionInterceptor.class);
// @AutoConfigureCache
this.applicationContext.getBean(CacheManager.class);
this.applicationContext.getBean(CacheInterceptor.class);
}
|
Integration tests for {@link MybatisTest}.
@author wonwoo
@since 1.2.1
|
testAutoConfigureComponents
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTestIntegrationTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTestIntegrationTest.java
|
Apache-2.0
|
@Test
void didNotInjectExampleComponent() {
Assertions.assertThrows(NoSuchBeanDefinitionException.class,
() -> this.applicationContext.getBean(ExampleComponent.class));
}
|
Integration tests for {@link MybatisTest}.
@author wonwoo
@since 1.2.1
|
didNotInjectExampleComponent
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTestIntegrationTest.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/MybatisTestIntegrationTest.java
|
Apache-2.0
|
public Long getId() {
return id;
}
|
Example entity used with {@link MybatisTest} tests.
@author wonwoo
@since 1.2.1
|
getId
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/Sample.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/Sample.java
|
Apache-2.0
|
public void setId(Long id) {
this.id = id;
}
|
Example entity used with {@link MybatisTest} tests.
@author wonwoo
@since 1.2.1
|
setId
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/Sample.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/Sample.java
|
Apache-2.0
|
public String getName() {
return name;
}
|
Example entity used with {@link MybatisTest} tests.
@author wonwoo
@since 1.2.1
|
getName
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/Sample.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/Sample.java
|
Apache-2.0
|
public void setName(String name) {
this.name = name;
}
|
Example entity used with {@link MybatisTest} tests.
@author wonwoo
@since 1.2.1
|
setName
|
java
|
mybatis/spring-boot-starter
|
mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/Sample.java
|
https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-test-autoconfigure/src/test/java/org/mybatis/spring/boot/test/autoconfigure/Sample.java
|
Apache-2.0
|
void add(T value) {
final int c = capacity;
int o = offset;
if (o == c) {
Object[] next = new Object[c + 1];
tail[c] = next;
tail = next;
o = 0;
}
tail[o] = value;
offset = o + 1;
}
|
Append a non-null value to the list.
<p>Don't add null to the list!
@param value the value to append
|
add
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/AppendOnlyLinkedArrayList.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/AppendOnlyLinkedArrayList.java
|
Apache-2.0
|
@SuppressWarnings("unchecked")
void forEachWhile(NonThrowingPredicate<? super T> consumer) {
Object[] a = head;
final int c = capacity;
while (a != null) {
for (int i = 0; i < c; i++) {
Object o = a[i];
if (o == null) {
break;
}
if (consumer.test((T)o)) {
break;
}
}
a = (Object[])a[c];
}
}
|
Loops over all elements of the array until a null element is encountered or
the given predicate returns true.
@param consumer the consumer of values that returns true if the forEach should terminate
|
forEachWhile
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/AppendOnlyLinkedArrayList.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/AppendOnlyLinkedArrayList.java
|
Apache-2.0
|
@SuppressWarnings("unchecked")
void accept(Relay<? super T> observer) {
Object[] a = head;
final int c = capacity;
while (a != null) {
for (int i = 0; i < c; i++) {
Object o = a[i];
if (o == null) {
break;
}
observer.accept((T) o);
}
a = (Object[])a[c];
}
}
|
Loops over all elements of the array until a null element is encountered or
the given predicate returns true.
@param consumer the consumer of values that returns true if the forEach should terminate
|
accept
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/AppendOnlyLinkedArrayList.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/AppendOnlyLinkedArrayList.java
|
Apache-2.0
|
@CheckReturnValue
@NonNull
public static <T> BehaviorRelay<T> create() {
return new BehaviorRelay<T>();
}
|
Creates a {@link BehaviorRelay} without a default item.
|
create
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
@Override
protected void subscribeActual(Observer<? super T> observer) {
BehaviorDisposable<T> bs = new BehaviorDisposable<T>(observer, this);
observer.onSubscribe(bs);
add(bs);
if (bs.cancelled) {
remove(bs);
} else {
bs.emitFirst();
}
}
|
Constructs a BehaviorRelay with the given initial value.
@param defaultValue the initial value, not null (verified)
@throws NullPointerException if {@code defaultValue} is null
|
subscribeActual
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
@Override
public void accept(@NonNull T value) {
if (value == null) throw new NullPointerException("value == null");
setCurrent(value);
for (BehaviorDisposable<T> bs : subscribers.get()) {
bs.emitNext(value, index);
}
}
|
Constructs a BehaviorRelay with the given initial value.
@param defaultValue the initial value, not null (verified)
@throws NullPointerException if {@code defaultValue} is null
|
accept
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
@Override
public boolean hasObservers() {
return subscribers.get().length != 0;
}
|
Constructs a BehaviorRelay with the given initial value.
@param defaultValue the initial value, not null (verified)
@throws NullPointerException if {@code defaultValue} is null
|
hasObservers
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
int subscriberCount() {
return subscribers.get().length;
}
|
Constructs a BehaviorRelay with the given initial value.
@param defaultValue the initial value, not null (verified)
@throws NullPointerException if {@code defaultValue} is null
|
subscriberCount
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
@Nullable
public T getValue() {
return value.get();
}
|
Returns a single value the Relay currently has or null if no such value exists.
<p>The method is thread-safe.
|
getValue
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
public boolean hasValue() {
return value.get() != null;
}
|
Returns true if the subject has any value.
<p>The method is thread-safe.
@return true if the subject has any value
|
hasValue
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
void add(BehaviorDisposable<T> rs) {
for (;;) {
BehaviorDisposable<T>[] a = subscribers.get();
int len = a.length;
@SuppressWarnings("unchecked")
BehaviorDisposable<T>[] b = new BehaviorDisposable[len + 1];
System.arraycopy(a, 0, b, 0, len);
b[len] = rs;
if (subscribers.compareAndSet(a, b)) {
return;
}
}
}
|
Returns true if the subject has any value.
<p>The method is thread-safe.
@return true if the subject has any value
|
add
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
@SuppressWarnings("unchecked")
void remove(BehaviorDisposable<T> rs) {
for (;;) {
BehaviorDisposable<T>[] a = subscribers.get();
int len = a.length;
if (len == 0) {
return;
}
int j = -1;
for (int i = 0; i < len; i++) {
if (a[i] == rs) {
j = i;
break;
}
}
if (j < 0) {
return;
}
BehaviorDisposable<T>[] b;
if (len == 1) {
b = EMPTY;
} else {
b = new BehaviorDisposable[len - 1];
System.arraycopy(a, 0, b, 0, j);
System.arraycopy(a, j + 1, b, j, len - j - 1);
}
if (subscribers.compareAndSet(a, b)) {
return;
}
}
}
|
Returns true if the subject has any value.
<p>The method is thread-safe.
@return true if the subject has any value
|
remove
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
void setCurrent(@NonNull T o) {
writeLock.lock();
index++;
value.lazySet(o);
writeLock.unlock();
}
|
Returns true if the subject has any value.
<p>The method is thread-safe.
@return true if the subject has any value
|
setCurrent
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
@Override
public void dispose() {
if (!cancelled) {
cancelled = true;
state.remove(this);
}
}
|
Returns true if the subject has any value.
<p>The method is thread-safe.
@return true if the subject has any value
|
dispose
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
@Override
public boolean isDisposed() {
return cancelled;
}
|
Returns true if the subject has any value.
<p>The method is thread-safe.
@return true if the subject has any value
|
isDisposed
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
void emitFirst() {
if (cancelled) {
return;
}
T o;
synchronized (this) {
if (cancelled) {
return;
}
if (next) {
return;
}
BehaviorRelay<T> s = state;
Lock lock = s.readLock;
lock.lock();
index = s.index;
o = s.value.get();
lock.unlock();
emitting = o != null;
next = true;
}
if (o != null) {
test(o);
emitLoop();
}
}
|
Returns true if the subject has any value.
<p>The method is thread-safe.
@return true if the subject has any value
|
emitFirst
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
void emitNext(T value, long stateIndex) {
if (cancelled) {
return;
}
if (!fastPath) {
synchronized (this) {
if (cancelled) {
return;
}
if (index == stateIndex) {
return;
}
if (emitting) {
AppendOnlyLinkedArrayList<T> q = queue;
if (q == null) {
q = new AppendOnlyLinkedArrayList<T>(4);
queue = q;
}
q.add(value);
return;
}
next = true;
}
fastPath = true;
}
test(value);
}
|
Returns true if the subject has any value.
<p>The method is thread-safe.
@return true if the subject has any value
|
emitNext
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
@Override
public boolean test(T o) {
if (!cancelled) {
downstream.onNext(o);
}
return false;
}
|
Returns true if the subject has any value.
<p>The method is thread-safe.
@return true if the subject has any value
|
test
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
void emitLoop() {
for (;;) {
if (cancelled) {
return;
}
AppendOnlyLinkedArrayList<T> q;
synchronized (this) {
q = queue;
if (q == null) {
emitting = false;
return;
}
queue = null;
}
q.forEachWhile(this);
}
}
|
Returns true if the subject has any value.
<p>The method is thread-safe.
@return true if the subject has any value
|
emitLoop
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/BehaviorRelay.java
|
Apache-2.0
|
void add(PublishDisposable<T> ps) {
for (;;) {
PublishDisposable<T>[] a = subscribers.get();
int n = a.length;
@SuppressWarnings("unchecked")
PublishDisposable<T>[] b = new PublishDisposable[n + 1];
System.arraycopy(a, 0, b, 0, n);
b[n] = ps;
if (subscribers.compareAndSet(a, b)) {
return;
}
}
}
|
Adds the given subscriber to the subscribers array atomically.
@param ps the subscriber to add
|
add
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/PublishRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/PublishRelay.java
|
Apache-2.0
|
@SuppressWarnings("unchecked")
void remove(PublishDisposable<T> ps) {
for (;;) {
PublishDisposable<T>[] a = subscribers.get();
if (a == EMPTY) {
return;
}
int n = a.length;
int j = -1;
for (int i = 0; i < n; i++) {
if (a[i] == ps) {
j = i;
break;
}
}
if (j < 0) {
return;
}
PublishDisposable<T>[] b;
if (n == 1) {
b = EMPTY;
} else {
b = new PublishDisposable[n - 1];
System.arraycopy(a, 0, b, 0, j);
System.arraycopy(a, j + 1, b, j, n - j - 1);
}
if (subscribers.compareAndSet(a, b)) {
return;
}
}
}
|
Atomically removes the given subscriber if it is subscribed to the subject.
@param ps the subject to remove
|
remove
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/PublishRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/PublishRelay.java
|
Apache-2.0
|
@Override
public void accept(@NonNull T value) {
if (value == null) throw new NullPointerException("value == null");
for (PublishDisposable<T> s : subscribers.get()) {
s.onNext(value);
}
}
|
Atomically removes the given subscriber if it is subscribed to the subject.
@param ps the subject to remove
|
accept
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/PublishRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/PublishRelay.java
|
Apache-2.0
|
@Override
public boolean hasObservers() {
return subscribers.get().length != 0;
}
|
Atomically removes the given subscriber if it is subscribed to the subject.
@param ps the subject to remove
|
hasObservers
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/PublishRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/PublishRelay.java
|
Apache-2.0
|
public void onNext(T t) {
if (!get()) {
downstream.onNext(t);
}
}
|
Constructs a PublishSubscriber, wraps the actual subscriber and the state.
@param actual the actual subscriber
@param parent the parent PublishProcessor
|
onNext
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/PublishRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/PublishRelay.java
|
Apache-2.0
|
@Override
public void dispose() {
if (compareAndSet(false, true)) {
parent.remove(this);
}
}
|
Constructs a PublishSubscriber, wraps the actual subscriber and the state.
@param actual the actual subscriber
@param parent the parent PublishProcessor
|
dispose
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/PublishRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/PublishRelay.java
|
Apache-2.0
|
@Override
public boolean isDisposed() {
return get();
}
|
Constructs a PublishSubscriber, wraps the actual subscriber and the state.
@param actual the actual subscriber
@param parent the parent PublishProcessor
|
isDisposed
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/PublishRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/PublishRelay.java
|
Apache-2.0
|
@NonNull
@CheckReturnValue
public final Relay<T> toSerialized() {
if (this instanceof SerializedRelay) {
return this;
}
return new SerializedRelay<T>(this);
}
|
Wraps this Relay and serializes the calls to {@link #accept}, making it thread-safe.
<p>The method is thread-safe.
|
toSerialized
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/Relay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/Relay.java
|
Apache-2.0
|
@CheckReturnValue
@NonNull
public static <T> ReplayRelay<T> create() {
return new ReplayRelay<T>(new UnboundedReplayBuffer<T>(16));
}
|
Creates an unbounded replay relay.
<p>
The internal buffer is backed by an {@link ArrayList} and starts with an initial capacity of 16. Once the
number of items reaches this capacity, it will grow as necessary (usually by 50%). However, as the
number of items grows, this causes frequent array reallocation and copying, and may hurt performance
and latency. This can be avoided with the {@link #create(int)} overload which takes an initial capacity
parameter and can be tuned to reduce the array reallocation frequency as needed.
|
create
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@CheckReturnValue
@NonNull
public static <T> ReplayRelay<T> create(int capacityHint) {
return new ReplayRelay<T>(new UnboundedReplayBuffer<T>(capacityHint));
}
|
Creates an unbounded replay relay with the specified initial buffer capacity.
<p>
Use this method to avoid excessive array reallocation while the internal buffer grows to accommodate new
items. For example, if you know that the buffer will hold 32k items, you can ask the
{@code ReplayRelay} to preallocate its internal array with a capacity to hold that many items. Once
the items start to arrive, the internal array won't need to grow, creating less garbage and no overhead
due to frequent array-copying.
@param capacityHint
the initial buffer capacity
|
create
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@CheckReturnValue
@NonNull
public static <T> ReplayRelay<T> createWithSize(int maxSize) {
return new ReplayRelay<T>(new SizeBoundReplayBuffer<T>(maxSize));
}
|
Creates a size-bounded replay relay.
<p>
In this setting, the {@code ReplayRelay} holds at most {@code size} items in its internal buffer and
discards the oldest item.
<p>
When observers subscribe to a terminated {@code ReplayRelay}, they are guaranteed to see at most
{@code size} {@code onNext} events followed by a termination event.
<p>
If an observer subscribes while the {@code ReplayRelay} is active, it will observe all items in the
buffer at that point in time and each item observed afterwards, even if the buffer evicts items due to
the size constraint in the mean time. In other words, once an Observer subscribes, it will receive items
without gaps in the sequence.
@param maxSize
the maximum number of buffered items
|
createWithSize
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
static <T> ReplayRelay<T> createUnbounded() {
return new ReplayRelay<T>(new SizeBoundReplayBuffer<T>(Integer.MAX_VALUE));
}
|
Creates an unbounded replay replay with the bounded-implementation for testing purposes.
<p>
This variant behaves like the regular unbounded {@code ReplayRelay} created via {@link #create()} but
uses the structures of the bounded-implementation. This is by no means intended for the replacement of
the original, array-backed and unbounded {@code ReplayRelay} due to the additional overhead of the
linked-list based internal buffer. The sole purpose is to allow testing and reasoning about the behavior
of the bounded implementations without the interference of the eviction policies.
|
createUnbounded
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@CheckReturnValue
@NonNull
public static <T> ReplayRelay<T> createWithTime(long maxAge, TimeUnit unit, Scheduler scheduler) {
return new ReplayRelay<T>(new SizeAndTimeBoundReplayBuffer<T>(Integer.MAX_VALUE, maxAge, unit, scheduler));
}
|
Creates a time-bounded replay relay.
<p>
In this setting, the {@code ReplayRelay} internally tags each observed item with a timestamp value
supplied by the {@link Scheduler} and keeps only those whose age is less than the supplied time value
converted to milliseconds. For example, an item arrives at T=0 and the max age is set to 5; at T>=5
this first item is then evicted by any subsequent item or termination event, leaving the buffer empty.
<p>
Once the subject is terminated, observers subscribing to it will receive items that remained in the
buffer after the terminal event, regardless of their age.
<p>
If an observer subscribes while the {@code ReplayRelay} is active, it will observe only those items
from within the buffer that have an age less than the specified time, and each item observed thereafter,
even if the buffer evicts items due to the time constraint in the mean time. In other words, once an
observer subscribes, it observes items without gaps in the sequence except for any outdated items at the
beginning of the sequence.
<p>
Note that terminal notifications ({@code onError} and {@code onComplete}) trigger eviction as well. For
example, with a max age of 5, the first item is observed at T=0, then an {@code onComplete} notification
arrives at T=10. If an observer subscribes at T=11, it will find an empty {@code ReplayRelay} with just
an {@code onComplete} notification.
@param maxAge
the maximum age of the contained items
@param unit
the time unit of {@code time}
@param scheduler
the {@link Scheduler} that provides the current time
|
createWithTime
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
protected void subscribeActual(Observer<? super T> observer) {
ReplayDisposable<T> rs = new ReplayDisposable<T>(observer, this);
observer.onSubscribe(rs);
if (!rs.cancelled) {
if (add(rs)) {
if (rs.cancelled) {
remove(rs);
return;
}
}
buffer.replay(rs);
}
}
|
Constructs a ReplayRelay with the given custom ReplayBuffer instance.
@param buffer the ReplayBuffer instance, not null (not verified)
|
subscribeActual
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
public void accept(@NonNull T value) {
if (value == null) throw new NullPointerException("value == null");
ReplayBuffer<T> b = buffer;
b.add(value);
for (ReplayDisposable<T> rs : observers.get()) {
b.replay(rs);
}
}
|
Constructs a ReplayRelay with the given custom ReplayBuffer instance.
@param buffer the ReplayBuffer instance, not null (not verified)
|
accept
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
public boolean hasObservers() {
return observers.get().length != 0;
}
|
Constructs a ReplayRelay with the given custom ReplayBuffer instance.
@param buffer the ReplayBuffer instance, not null (not verified)
|
hasObservers
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
int observerCount() {
return observers.get().length;
}
|
Constructs a ReplayRelay with the given custom ReplayBuffer instance.
@param buffer the ReplayBuffer instance, not null (not verified)
|
observerCount
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Nullable
public T getValue() {
return buffer.getValue();
}
|
Returns a single value the Relay currently has or null if no such value exists.
<p>The method is thread-safe.
|
getValue
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
public Object[] getValues() {
@SuppressWarnings("unchecked")
T[] a = (T[])EMPTY_ARRAY;
T[] b = getValues(a);
if (b == EMPTY_ARRAY) {
return new Object[0];
}
return b;
}
|
Returns an Object array containing snapshot all values of the Relay.
<p>The method is thread-safe.
|
getValues
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
public boolean hasValue() {
return buffer.size() != 0; // NOPMD
}
|
Returns true if the relay has any value.
<p>The method is thread-safe.
|
hasValue
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
int size() {
return buffer.size();
}
|
Returns true if the relay has any value.
<p>The method is thread-safe.
|
size
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
boolean add(ReplayDisposable<T> rs) {
for (;;) {
ReplayDisposable<T>[] a = observers.get();
int len = a.length;
@SuppressWarnings("unchecked")
ReplayDisposable<T>[] b = new ReplayDisposable[len + 1];
System.arraycopy(a, 0, b, 0, len);
b[len] = rs;
if (observers.compareAndSet(a, b)) {
return true;
}
}
}
|
Returns true if the relay has any value.
<p>The method is thread-safe.
|
add
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@SuppressWarnings("unchecked")
void remove(ReplayDisposable<T> rs) {
for (;;) {
ReplayDisposable<T>[] a = observers.get();
if (a == EMPTY) {
return;
}
int len = a.length;
int j = -1;
for (int i = 0; i < len; i++) {
if (a[i] == rs) {
j = i;
break;
}
}
if (j < 0) {
return;
}
ReplayDisposable<T>[] b;
if (len == 1) {
b = EMPTY;
} else {
b = new ReplayDisposable[len - 1];
System.arraycopy(a, 0, b, 0, j);
System.arraycopy(a, j + 1, b, j, len - j - 1);
}
if (observers.compareAndSet(a, b)) {
return;
}
}
}
|
Returns true if the relay has any value.
<p>The method is thread-safe.
|
remove
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
public void dispose() {
if (!cancelled) {
cancelled = true;
state.remove(this);
}
}
|
Abstraction over a buffer that receives events and replays them to
individual Observers.
|
dispose
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
public boolean isDisposed() {
return cancelled;
}
|
Abstraction over a buffer that receives events and replays them to
individual Observers.
|
isDisposed
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
public void add(T value) {
buffer.add(value);
size++;
}
|
Abstraction over a buffer that receives events and replays them to
individual Observers.
|
add
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
public void trimHead() {
// no-op in this type of buffer
}
|
Abstraction over a buffer that receives events and replays them to
individual Observers.
|
trimHead
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
@Nullable
@SuppressWarnings("unchecked")
public T getValue() {
int s = size;
if (s != 0) {
return buffer.get(s - 1);
}
return null;
}
|
Abstraction over a buffer that receives events and replays them to
individual Observers.
|
getValue
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
@SuppressWarnings("unchecked")
public T[] getValues(T[] array) {
int s = size;
if (s == 0) {
if (array.length != 0) {
array[0] = null;
}
return array;
}
if (array.length < s) {
array = (T[]) Array.newInstance(array.getClass().getComponentType(), s);
}
List<T> b = buffer;
for (int i = 0; i < s; i++) {
array[i] = b.get(i);
}
if (array.length > s) {
array[s] = null;
}
return array;
}
|
Abstraction over a buffer that receives events and replays them to
individual Observers.
|
getValues
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
@SuppressWarnings("unchecked")
public void replay(ReplayDisposable<T> rs) {
if (rs.getAndIncrement() != 0) {
return;
}
int missed = 1;
final List<T> b = buffer;
final Observer<? super T> a = rs.downstream;
Integer indexObject = (Integer)rs.index;
int index;
if (indexObject != null) {
index = indexObject;
} else {
index = 0;
rs.index = 0;
}
for (;;) {
if (rs.cancelled) {
rs.index = null;
return;
}
int s = size;
while (s != index) {
if (rs.cancelled) {
rs.index = null;
return;
}
T o = b.get(index);
a.onNext(o);
index++;
}
if (index != size) {
continue;
}
rs.index = index;
missed = rs.addAndGet(-missed);
if (missed == 0) {
break;
}
}
}
|
Abstraction over a buffer that receives events and replays them to
individual Observers.
|
replay
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
public int size() {
return size;
}
|
Abstraction over a buffer that receives events and replays them to
individual Observers.
|
size
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
void trim() {
if (size > maxSize) {
size--;
Node<T> h = head;
head = h.get();
}
}
|
Abstraction over a buffer that receives events and replays them to
individual Observers.
|
trim
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.