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 |
|---|---|---|---|---|---|---|---|
private void createCompressedWriter() throws Exception {
PowerMockito.mockStatic(FileUtil.class);
PowerMockito.mockStatic(ReflectionUtil.class);
FileWriter writer = Mockito.mock(FileWriter.class);
Mockito.when(
ReflectionUtil.createFileWriter(
Moc... | FileRegistryTest tests the file registry logic.
@author Pawel Garbacki (pawel@pinterest.com) | createCompressedWriter | java | pinterest/secor | src/test/java/com/pinterest/secor/common/FileRegistryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/common/FileRegistryTest.java | Apache-2.0 |
public void testGetOrCreateWriterCompressed() throws Exception {
createCompressedWriter();
mRegistry.getOrCreateWriter(mLogFilePathGz, new GzipCodec());
// Verify that the method has been called exactly once (the default).
PowerMockito.verifyStatic(FileUtil.class);
FileUtil.del... | FileRegistryTest tests the file registry logic.
@author Pawel Garbacki (pawel@pinterest.com) | testGetOrCreateWriterCompressed | java | pinterest/secor | src/test/java/com/pinterest/secor/common/FileRegistryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/common/FileRegistryTest.java | Apache-2.0 |
public void testDeletePath() throws Exception {
createWriter();
PowerMockito.mockStatic(FileUtil.class);
mRegistry.deletePath(mLogFilePath);
PowerMockito.verifyStatic(FileUtil.class);
FileUtil.delete(PATH);
PowerMockito.verifyStatic(FileUtil.class);
FileUtil.del... | FileRegistryTest tests the file registry logic.
@author Pawel Garbacki (pawel@pinterest.com) | testDeletePath | java | pinterest/secor | src/test/java/com/pinterest/secor/common/FileRegistryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/common/FileRegistryTest.java | Apache-2.0 |
public void testDeleteTopicPartition() throws Exception {
createWriter();
PowerMockito.mockStatic(FileUtil.class);
mRegistry.deleteTopicPartition(mTopicPartition);
PowerMockito.verifyStatic(FileUtil.class);
FileUtil.delete(PATH);
PowerMockito.verifyStatic(FileUtil.class... | FileRegistryTest tests the file registry logic.
@author Pawel Garbacki (pawel@pinterest.com) | testDeleteTopicPartition | java | pinterest/secor | src/test/java/com/pinterest/secor/common/FileRegistryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/common/FileRegistryTest.java | Apache-2.0 |
public void testGetSize() throws Exception {
createWriter();
assertEquals(123L, mRegistry.getSize(mTopicPartition));
} | FileRegistryTest tests the file registry logic.
@author Pawel Garbacki (pawel@pinterest.com) | testGetSize | java | pinterest/secor | src/test/java/com/pinterest/secor/common/FileRegistryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/common/FileRegistryTest.java | Apache-2.0 |
public void testGetModificationAgeSec() throws Exception {
PowerMockito.mockStatic(System.class);
PowerMockito.when(System.currentTimeMillis()).thenReturn(10000L)
.thenReturn(100000L);
createWriter();
assertEquals(90, mRegistry.getModificationAgeSec(mTopicPartition));
... | FileRegistryTest tests the file registry logic.
@author Pawel Garbacki (pawel@pinterest.com) | testGetModificationAgeSec | java | pinterest/secor | src/test/java/com/pinterest/secor/common/FileRegistryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/common/FileRegistryTest.java | Apache-2.0 |
@Override
protected void setUp() throws Exception {
super.setUp();
mLogFilePath = new LogFilePath(PREFIX, TOPIC, PARTITIONS, GENERATION, KAFKA_PARTITION,
LAST_COMMITTED_OFFSET, "");
timestamp = System.currentTimeMillis();
} | LogFileTest tests the logic operating on lof file paths.
@author Pawel Garbacki (pawel@pinterest.com) | setUp | java | pinterest/secor | src/test/java/com/pinterest/secor/common/LogFilePathTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/common/LogFilePathTest.java | Apache-2.0 |
public void testConstructFromMessage() throws Exception {
ParsedMessage message = new ParsedMessage(TOPIC, KAFKA_PARTITION, 1000, null,
"some_payload".getBytes(), PARTITIONS, timestamp, null);
LogFilePath logFilePath = new LogFilePath(PREFIX, GENERATION,... | LogFileTest tests the logic operating on lof file paths.
@author Pawel Garbacki (pawel@pinterest.com) | testConstructFromMessage | java | pinterest/secor | src/test/java/com/pinterest/secor/common/LogFilePathTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/common/LogFilePathTest.java | Apache-2.0 |
public void testConstructFromPath() throws Exception {
LogFilePath logFilePath = new LogFilePath("/some_parent_dir", PATH);
assertEquals(PATH, logFilePath.getLogFilePath());
assertEquals(TOPIC, logFilePath.getTopic());
assertTrue(Arrays.equals(PARTITIONS, logFilePath.getPartitions()));
... | LogFileTest tests the logic operating on lof file paths.
@author Pawel Garbacki (pawel@pinterest.com) | testConstructFromPath | java | pinterest/secor | src/test/java/com/pinterest/secor/common/LogFilePathTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/common/LogFilePathTest.java | Apache-2.0 |
public void testGetters() throws Exception {
assertEquals(TOPIC, mLogFilePath.getTopic());
assertTrue(Arrays.equals(PARTITIONS, mLogFilePath.getPartitions()));
assertEquals(GENERATION, mLogFilePath.getGeneration());
assertEquals(KAFKA_PARTITION, mLogFilePath.getKafkaPartition());
... | LogFileTest tests the logic operating on lof file paths.
@author Pawel Garbacki (pawel@pinterest.com) | testGetters | java | pinterest/secor | src/test/java/com/pinterest/secor/common/LogFilePathTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/common/LogFilePathTest.java | Apache-2.0 |
public void testGetLogFilePath() throws Exception {
assertEquals(PATH, mLogFilePath.getLogFilePath());
} | LogFileTest tests the logic operating on lof file paths.
@author Pawel Garbacki (pawel@pinterest.com) | testGetLogFilePath | java | pinterest/secor | src/test/java/com/pinterest/secor/common/LogFilePathTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/common/LogFilePathTest.java | Apache-2.0 |
public void testGetLogFileCrcPath() throws Exception {
assertEquals(CRC_PATH, mLogFilePath.getLogFileCrcPath());
} | LogFileTest tests the logic operating on lof file paths.
@author Pawel Garbacki (pawel@pinterest.com) | testGetLogFileCrcPath | java | pinterest/secor | src/test/java/com/pinterest/secor/common/LogFilePathTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/common/LogFilePathTest.java | Apache-2.0 |
@Override
public void setUp() throws Exception {
super.setUp();
mLogFilePath = new LogFilePath("/some_parent_dir", PATH);
mLogFilePathGz = new LogFilePath("/some_parent_dir", PATH_GZ);
} | Test the file readers and writers
@author Praveen Murugesan (praveen@uber.com) | setUp | java | pinterest/secor | src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | Apache-2.0 |
private void setupSequenceFileReaderConfig() {
PropertiesConfiguration properties = new PropertiesConfiguration();
properties.addProperty("secor.file.reader.writer.factory",
"com.pinterest.secor.io.impl.SequenceFileReaderWriterFactory");
mConfig = new SecorConfig(properties);
... | Test the file readers and writers
@author Praveen Murugesan (praveen@uber.com) | setupSequenceFileReaderConfig | java | pinterest/secor | src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | Apache-2.0 |
private void setupDelimitedTextFileWriterConfig() {
PropertiesConfiguration properties = new PropertiesConfiguration();
properties.addProperty("secor.file.reader.writer.factory",
"com.pinterest.secor.io.impl.DelimitedTextFileReaderWriterFactory");
mConfig = new SecorConfig(proper... | Test the file readers and writers
@author Praveen Murugesan (praveen@uber.com) | setupDelimitedTextFileWriterConfig | java | pinterest/secor | src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | Apache-2.0 |
private void mockDelimitedTextFileWriter(boolean isCompressed) throws Exception {
Path fsPath = (!isCompressed) ? new Path(PATH) : new Path(PATH_GZ);
GzipCodec codec = PowerMockito.mock(GzipCodec.class);
PowerMockito.whenNew(GzipCodec.class).withNoArguments()
.thenReturn(codec);... | Test the file readers and writers
@author Praveen Murugesan (praveen@uber.com) | mockDelimitedTextFileWriter | java | pinterest/secor | src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | Apache-2.0 |
private void mockSequenceFileWriter(boolean isCompressed)
throws Exception {
/* We have issues on mockito/javassist with FileSystem.class on JDK 9
Caused by: java.lang.IllegalStateException: Failed to transform class with name org.apache.hadoop.fs.FileSystem$Cache. Reason: org.apache.hadoop.... | Test the file readers and writers
@author Praveen Murugesan (praveen@uber.com) | mockSequenceFileWriter | java | pinterest/secor | src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | Apache-2.0 |
public void testSequenceFileReader() throws Exception {
setupSequenceFileReaderConfig();
mockSequenceFileWriter(false);
ReflectionUtil.createFileReader(mConfig.getFileReaderWriterFactory(), mLogFilePath, null, mConfig);
// Verify that the method has been called exactly once (the default... | Test the file readers and writers
@author Praveen Murugesan (praveen@uber.com) | testSequenceFileReader | java | pinterest/secor | src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | Apache-2.0 |
public void testSequenceFileWriter() throws Exception {
setupSequenceFileReaderConfig();
mockSequenceFileWriter(false);
FileWriter writer = ReflectionUtil.createFileWriter(mConfig.getFileReaderWriterFactory(),
mLogFilePath, null, mConfig);
// Verify that the method has ... | Test the file readers and writers
@author Praveen Murugesan (praveen@uber.com) | testSequenceFileWriter | java | pinterest/secor | src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | Apache-2.0 |
public void testDelimitedTextFileWriter() throws Exception {
setupDelimitedTextFileWriterConfig();
mockDelimitedTextFileWriter(false);
FileWriter writer = (FileWriter) ReflectionUtil
.createFileWriter(mConfig.getFileReaderWriterFactory(),
mLogFilePath, nul... | Test the file readers and writers
@author Praveen Murugesan (praveen@uber.com) | testDelimitedTextFileWriter | java | pinterest/secor | src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | Apache-2.0 |
public void testDelimitedTextFileReader() throws Exception {
setupDelimitedTextFileWriterConfig();
mockDelimitedTextFileWriter(false);
ReflectionUtil.createFileReader(mConfig.getFileReaderWriterFactory(), mLogFilePath, null, mConfig);
mockDelimitedTextFileWriter(true);
Reflect... | Test the file readers and writers
@author Praveen Murugesan (praveen@uber.com) | testDelimitedTextFileReader | java | pinterest/secor | src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/FileReaderWriterFactoryTest.java | Apache-2.0 |
@Before
public void setUp() throws Exception {
codec = new GzipCodec();
} | We want to use a pre-determined seed to make the tests deterministic. | setUp | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
private LogFilePath getTempLogFilePath(String topic) {
return new LogFilePath(Files.createTempDir().toString(),
topic,
new String[]{"part-1"},
0, 1, 0, ".log"
);
} | We want to use a pre-determined seed to make the tests deterministic. | getTempLogFilePath | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
@Test(expected = IllegalArgumentException.class)
public void testNoSchema() throws Exception {
PropertiesConfiguration properties = new PropertiesConfiguration();
properties.setProperty("secor.orc.schema.provider", DEFAULT_ORC_SCHEMA_PROVIDER);
SecorConfig config = new SecorConfig(propertie... | We want to use a pre-determined seed to make the tests deterministic. | testNoSchema | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
private ReadWriteRecords runTest(String schema, String topic, String... jsonRecords) throws Exception {
PropertiesConfiguration properties = new PropertiesConfiguration();
properties.setProperty("secor.orc.schema.provider", DEFAULT_ORC_SCHEMA_PROVIDER);
properties.setProperty(String.format("seco... | We want to use a pre-determined seed to make the tests deterministic. | runTest | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
private void runCommonTest(String schema, String topic, String... jsonRecords) throws Exception {
ReadWriteRecords records = runTest(schema, topic, jsonRecords);
for (int i = 0; i < jsonRecords.length; i++) {
// String comparisons make debugging a bit easier, albeit induce greater memory foo... | We want to use a pre-determined seed to make the tests deterministic. | runCommonTest | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
private KeyValue[] writeRecords(JsonORCFileReaderWriterFactory factory, LogFilePath tempLogFilePath,
String... jsonRecords) throws Exception {
FileWriter fileWriter = factory.BuildFileWriter(tempLogFilePath, codec);
KeyValue[] keyValues = new KeyValue[jsonRecords.leng... | We want to use a pre-determined seed to make the tests deterministic. | writeRecords | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
private KeyValue[] readRecords(JsonORCFileReaderWriterFactory factory, LogFilePath tempLogFilePath, int count)
throws Exception {
FileReader fileReader = factory.BuildFileReader(tempLogFilePath, codec);
KeyValue[] keyValues = new KeyValue[count];
for (int offset = 0; offset < count; ... | We want to use a pre-determined seed to make the tests deterministic. | readRecords | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
@Test
public void testMapOfStringToString() throws Exception {
runCommonTest(
"struct<mappings:map<string\\,string>>",
"string-to-string",
"{\"mappings\":{\"key1\":\"value1\",\"key2\":\"value2\"}}"
);
} | We want to use a pre-determined seed to make the tests deterministic. | testMapOfStringToString | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
@Test
public void testMapOfStringToInteger() throws Exception {
runCommonTest(
"struct<mappings:map<string\\,int>>",
"string-to-integer",
"{\"mappings\":{\"key1\":1,\"key2\":-2}}",
"{\"mappings\":{\"key3\":1523,\"key4\":3451325}}",
"{\"mappings\":{... | We want to use a pre-determined seed to make the tests deterministic. | testMapOfStringToInteger | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
@Test
public void testMultipleMaps() throws Exception {
runCommonTest(
"struct<f1:map<string\\,int>\\,f2:map<string\\,string>>",
"multiple-maps",
"{\"f1\":{\"k1\":0,\"k2\":1234},\"f2\":{\"k3\":\"test\"}}"
);
} | We want to use a pre-determined seed to make the tests deterministic. | testMultipleMaps | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
@Test
public void testJsonORCReadWriteRoundTrip() throws Exception {
runCommonTest(
"struct<firstname:string\\,age:int\\,test:map<string\\,string>>",
"round-trip",
"{\"firstname\":\"Jason\",\"age\":48,\"test\":{\"k1\":\"v1\",\"k2\":\"v2\"}}",
"{\"firstname\":\... | We want to use a pre-determined seed to make the tests deterministic. | testJsonORCReadWriteRoundTrip | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
private JsonObject makeJsonObject(int row, int keysetSize) {
JsonObject obj = new JsonObject();
JsonObject kvs = new JsonObject();
for (int i = 0; i < keysetSize; i++) {
String key = String.format("key-%d-%d", row, i);
int value = random.nextInt();
kvs.addPro... | Generates a JsonObject of a specified keyset size. | makeJsonObject | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
@Test
public void testWithLargeKeySet() throws Exception {
int rowCount = 100;
String[] jsonObjects = new String[rowCount];
for (int i = 0; i < rowCount; i++) {
int keyCount = random.nextInt(5000) + 1;
jsonObjects[i] = makeJsonObject(i, keyCount).toString();
}... | Generates a JsonObject of a specified keyset size. | testWithLargeKeySet | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
@Test(expected = IllegalArgumentException.class)
public void testWithNonStringKeys() throws Exception {
runCommonTest(
"struct<kvs:map<int\\,int>>",
"non-string-keys",
"{0:{1:2,3:4}}"
);
} | Generates a JsonObject of a specified keyset size. | testWithNonStringKeys | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
@Test
public void testUnionType() throws Exception {
runCommonTest(
"struct<values:uniontype<int\\,string>>",
"union-type",
"{\"values\":\"stringvalue\"}",
"{\"values\":1234}",
"{\"values\":null}"
);
} | Generates a JsonObject of a specified keyset size. | testUnionType | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
@Test(expected = UnsupportedOperationException.class)
public void testUnionTypeWithNonPrimitive() throws Exception {
runCommonTest(
"struct<v1:uniontype<int\\,struct<v2:string\\,v3:bigint>>>",
"union-type-with-non-primitive",
"{\"v1\":1234}",
"{\"v1\":{\"v2\":... | Generates a JsonObject of a specified keyset size. | testUnionTypeWithNonPrimitive | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
@Test
public void testReadListOfObject() throws Exception {
ReadWriteRecords records = runTest(
"struct<name:string\\,age:int>",
"list-of-objects",
"[{\"name\":\"Jon Smith\",\"age\":99}]"
);
assertEquals(1, records.read.length);
assertEquals(1, rec... | Generates a JsonObject of a specified keyset size. | testReadListOfObject | java | pinterest/secor | src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactoryTest.java | Apache-2.0 |
@Override
protected FileReader createReader(LogFilePath srcPath,
CompressionCodec codec) {
return mReader;
} | UploaderTest tests the log file uploader logic.
@author Pawel Garbacki (pawel@pinterest.com) | createReader | java | pinterest/secor | src/test/java/com/pinterest/secor/uploader/UploaderTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/uploader/UploaderTest.java | Apache-2.0 |
public FileReader getReader() {
return mReader;
} | UploaderTest tests the log file uploader logic.
@author Pawel Garbacki (pawel@pinterest.com) | getReader | java | pinterest/secor | src/test/java/com/pinterest/secor/uploader/UploaderTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/uploader/UploaderTest.java | Apache-2.0 |
@Override
public void setUp() throws Exception {
super.setUp();
mTopicPartition = new TopicPartition("some_topic", 0);
mLogFilePath = new LogFilePath("/some_parent_dir",
"/some_parent_dir/some_topic/some_partition/some_other_partition/"
+ "10_0_000000... | UploaderTest tests the log file uploader logic.
@author Pawel Garbacki (pawel@pinterest.com) | setUp | java | pinterest/secor | src/test/java/com/pinterest/secor/uploader/UploaderTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/uploader/UploaderTest.java | Apache-2.0 |
public void testUploadAtTime() throws Exception {
final int minuteUploadMark = 1;
PowerMockito.mockStatic(DateTime.class);
PowerMockito.when(DateTime.now()).thenReturn(new DateTime(2016,7,27,0,minuteUploadMark,0));
Mockito.when(mConfig.getUploadMinuteMark()).thenReturn(minuteUploadMark)... | UploaderTest tests the log file uploader logic.
@author Pawel Garbacki (pawel@pinterest.com) | testUploadAtTime | java | pinterest/secor | src/test/java/com/pinterest/secor/uploader/UploaderTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/uploader/UploaderTest.java | Apache-2.0 |
public void testUploadWhenManyFiles() throws Exception {
Mockito.when(mConfig.getMaxActiveFiles()).thenReturn(0);
mockS3Configs();
HashSet<LogFilePath> logFilePaths = new HashSet<LogFilePath>();
logFilePaths.add(mLogFilePath);
Mockito.when(mFileRegistry.getActiveFileCount()).th... | UploaderTest tests the log file uploader logic.
@author Pawel Garbacki (pawel@pinterest.com) | testUploadWhenManyFiles | java | pinterest/secor | src/test/java/com/pinterest/secor/uploader/UploaderTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/uploader/UploaderTest.java | Apache-2.0 |
public void testNoUploadWhenManyFiles() throws Exception {
Mockito.when(mConfig.getMaxActiveFiles()).thenReturn(10);
mockS3Configs();
HashSet<LogFilePath> logFilePaths = new HashSet<LogFilePath>();
logFilePaths.add(mLogFilePath);
Mockito.when(mFileRegistry.getActiveFileCount())... | UploaderTest tests the log file uploader logic.
@author Pawel Garbacki (pawel@pinterest.com) | testNoUploadWhenManyFiles | java | pinterest/secor | src/test/java/com/pinterest/secor/uploader/UploaderTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/uploader/UploaderTest.java | Apache-2.0 |
public void testUploadFiles() throws Exception {
Mockito.when(
mZookeeperConnector.getCommittedOffsetCount(mTopicPartition))
.thenReturn(11L);
Mockito.when(
mOffsetTracker.setCommittedOffsetCount(mTopicPartition, 11L))
.thenReturn(11L);
... | UploaderTest tests the log file uploader logic.
@author Pawel Garbacki (pawel@pinterest.com) | testUploadFiles | java | pinterest/secor | src/test/java/com/pinterest/secor/uploader/UploaderTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/uploader/UploaderTest.java | Apache-2.0 |
public void testDeleteTopicPartition() throws Exception {
Mockito.when(
mZookeeperConnector.getCommittedOffsetCount(mTopicPartition))
.thenReturn(31L);
Mockito.when(
mOffsetTracker.setCommittedOffsetCount(mTopicPartition, 30L))
.thenReturn(... | UploaderTest tests the log file uploader logic.
@author Pawel Garbacki (pawel@pinterest.com) | testDeleteTopicPartition | java | pinterest/secor | src/test/java/com/pinterest/secor/uploader/UploaderTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/uploader/UploaderTest.java | Apache-2.0 |
public void testTrimFiles() throws Exception {
Mockito.when(
mZookeeperConnector.getCommittedOffsetCount(mTopicPartition))
.thenReturn(21L);
// The second time it's called, it returns 21L because of the first call.
Mockito.when(
mOffsetTracker.setC... | UploaderTest tests the log file uploader logic.
@author Pawel Garbacki (pawel@pinterest.com) | testTrimFiles | java | pinterest/secor | src/test/java/com/pinterest/secor/uploader/UploaderTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/uploader/UploaderTest.java | Apache-2.0 |
@Override
public KeyValue answer(InvocationOnMock invocation) {
if (mCallCount == 2) {
return null;
}
return new KeyValue(20 + mCallCount++, null);
} | UploaderTest tests the log file uploader logic.
@author Pawel Garbacki (pawel@pinterest.com) | answer | java | pinterest/secor | src/test/java/com/pinterest/secor/uploader/UploaderTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/uploader/UploaderTest.java | Apache-2.0 |
private void mockS3Configs() {
Mockito.when(mConfig.getKafkaTopicFilter()).thenReturn("some_topic");
Mockito.when(mConfig.getCloudService()).thenReturn("S3");
Mockito.when(mConfig.getS3Bucket()).thenReturn("some_bucket");
Mockito.when(mConfig.getS3Path()).thenReturn("some_s3_parent_dir"... | UploaderTest tests the log file uploader logic.
@author Pawel Garbacki (pawel@pinterest.com) | mockS3Configs | java | pinterest/secor | src/test/java/com/pinterest/secor/uploader/UploaderTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/uploader/UploaderTest.java | Apache-2.0 |
@Before
public void setUp() throws Exception {} | @author Luke Sun (luke.skywalker.sun@gmail.com) | setUp | java | pinterest/secor | src/test/java/com/pinterest/secor/util/BackOffUtilTest.java | https://github.com/pinterest/secor/blob/master/src/test/java/com/pinterest/secor/util/BackOffUtilTest.java | Apache-2.0 |
@Override
public void loadData(Priority priority, final DataCallback<? super InputStream> callback) {
Request.Builder requestBuilder = new Request.Builder().url(url.toStringUrl());
for (Map.Entry<String, String> headerEntry : url.getHeaders().entrySet()) {
String key = headerEntry.getKey... | @author xiaobailong24
@date 2017/8/17
Fetches an {@link InputStream} using the okhttp library. | loadData | java | xiaobailong24/MVVMArms | arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpStreamFetcher.java | https://github.com/xiaobailong24/MVVMArms/blob/master/arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpStreamFetcher.java | Apache-2.0 |
@Override
public void onFailure(@NonNull Call call, @NonNull IOException e) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "OkHttp failed to obtain result", e);
}
callback.onLoadFailed(e);
} | @author xiaobailong24
@date 2017/8/17
Fetches an {@link InputStream} using the okhttp library. | onFailure | java | xiaobailong24/MVVMArms | arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpStreamFetcher.java | https://github.com/xiaobailong24/MVVMArms/blob/master/arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpStreamFetcher.java | Apache-2.0 |
@Override
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
responseBody = response.body();
if (response.isSuccessful()) {
long contentLength = responseBody.contentLength();
stream = ContentLengthInputStream.obtain(responseBody.byteSt... | @author xiaobailong24
@date 2017/8/17
Fetches an {@link InputStream} using the okhttp library. | onResponse | java | xiaobailong24/MVVMArms | arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpStreamFetcher.java | https://github.com/xiaobailong24/MVVMArms/blob/master/arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpStreamFetcher.java | Apache-2.0 |
@Override
public void cleanup() {
try {
if (stream != null) {
stream.close();
}
} catch (IOException e) {
// Ignored
}
if (responseBody != null) {
responseBody.close();
}
callback = null;
} | @author xiaobailong24
@date 2017/8/17
Fetches an {@link InputStream} using the okhttp library. | cleanup | java | xiaobailong24/MVVMArms | arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpStreamFetcher.java | https://github.com/xiaobailong24/MVVMArms/blob/master/arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpStreamFetcher.java | Apache-2.0 |
@Override
public void cancel() {
Call local = call;
if (local != null) {
local.cancel();
}
} | @author xiaobailong24
@date 2017/8/17
Fetches an {@link InputStream} using the okhttp library. | cancel | java | xiaobailong24/MVVMArms | arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpStreamFetcher.java | https://github.com/xiaobailong24/MVVMArms/blob/master/arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpStreamFetcher.java | Apache-2.0 |
@NonNull
@Override
public Class<InputStream> getDataClass() {
return InputStream.class;
} | @author xiaobailong24
@date 2017/8/17
Fetches an {@link InputStream} using the okhttp library. | getDataClass | java | xiaobailong24/MVVMArms | arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpStreamFetcher.java | https://github.com/xiaobailong24/MVVMArms/blob/master/arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpStreamFetcher.java | Apache-2.0 |
@NonNull
@Override
public DataSource getDataSource() {
return DataSource.REMOTE;
} | @author xiaobailong24
@date 2017/8/17
Fetches an {@link InputStream} using the okhttp library. | getDataSource | java | xiaobailong24/MVVMArms | arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpStreamFetcher.java | https://github.com/xiaobailong24/MVVMArms/blob/master/arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpStreamFetcher.java | Apache-2.0 |
@Override
public boolean handles(GlideUrl url) {
return true;
} | @author xiaobailong24
@date 2017/8/17
A simple model loader for fetching media over http/https using OkHttp. | handles | java | xiaobailong24/MVVMArms | arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpUrlLoader.java | https://github.com/xiaobailong24/MVVMArms/blob/master/arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpUrlLoader.java | Apache-2.0 |
@Override
public LoadData<InputStream> buildLoadData(GlideUrl model, int width, int height,
Options options) {
return new LoadData<>(model, new OkHttpStreamFetcher(client, model));
} | @author xiaobailong24
@date 2017/8/17
A simple model loader for fetching media over http/https using OkHttp. | buildLoadData | java | xiaobailong24/MVVMArms | arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpUrlLoader.java | https://github.com/xiaobailong24/MVVMArms/blob/master/arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpUrlLoader.java | Apache-2.0 |
private static Call.Factory getInternalClient() {
if (internalClient == null) {
synchronized (Factory.class) {
if (internalClient == null) {
internalClient = new OkHttpClient();
}
}
}
retu... | The default factory for {@link OkHttpUrlLoader}s. | getInternalClient | java | xiaobailong24/MVVMArms | arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpUrlLoader.java | https://github.com/xiaobailong24/MVVMArms/blob/master/arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpUrlLoader.java | Apache-2.0 |
@Override
public ModelLoader<GlideUrl, InputStream> build(MultiModelLoaderFactory multiFactory) {
return new OkHttpUrlLoader(client);
} | Constructor for a new Factory that runs requests using given client.
@param client this is typically an instance of {@code OkHttpClient}. | build | java | xiaobailong24/MVVMArms | arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpUrlLoader.java | https://github.com/xiaobailong24/MVVMArms/blob/master/arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpUrlLoader.java | Apache-2.0 |
@Override
public void teardown() {
// Do nothing, this instance doesn't own the client.
} | Constructor for a new Factory that runs requests using given client.
@param client this is typically an instance of {@code OkHttpClient}. | teardown | java | xiaobailong24/MVVMArms | arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpUrlLoader.java | https://github.com/xiaobailong24/MVVMArms/blob/master/arms/src/main/java/me/xiaobailong24/mvvmarms/http/OkHttpUrlLoader.java | Apache-2.0 |
@Override
public boolean isAdded() {
return mFragment != null && mFragment.isAdded();
} | Return true if the fragment is currently added to its activity. | isAdded | java | xiaobailong24/MVVMArms | lifecycle/src/main/java/me/xiaobailong24/mvvmarms/lifecycle/delegate/FragmentDelegateImpl.java | https://github.com/xiaobailong24/MVVMArms/blob/master/lifecycle/src/main/java/me/xiaobailong24/mvvmarms/lifecycle/delegate/FragmentDelegateImpl.java | Apache-2.0 |
@Override
public int describeContents() {
return 0;
} | Return true if the fragment is currently added to its activity. | describeContents | java | xiaobailong24/MVVMArms | lifecycle/src/main/java/me/xiaobailong24/mvvmarms/lifecycle/delegate/FragmentDelegateImpl.java | https://github.com/xiaobailong24/MVVMArms/blob/master/lifecycle/src/main/java/me/xiaobailong24/mvvmarms/lifecycle/delegate/FragmentDelegateImpl.java | Apache-2.0 |
@Override
public void writeToParcel(Parcel dest, int flags) {
} | Return true if the fragment is currently added to its activity. | writeToParcel | java | xiaobailong24/MVVMArms | lifecycle/src/main/java/me/xiaobailong24/mvvmarms/lifecycle/delegate/FragmentDelegateImpl.java | https://github.com/xiaobailong24/MVVMArms/blob/master/lifecycle/src/main/java/me/xiaobailong24/mvvmarms/lifecycle/delegate/FragmentDelegateImpl.java | Apache-2.0 |
@Override
public FragmentDelegateImpl createFromParcel(Parcel source) {
return new FragmentDelegateImpl(source);
} | Return true if the fragment is currently added to its activity. | createFromParcel | java | xiaobailong24/MVVMArms | lifecycle/src/main/java/me/xiaobailong24/mvvmarms/lifecycle/delegate/FragmentDelegateImpl.java | https://github.com/xiaobailong24/MVVMArms/blob/master/lifecycle/src/main/java/me/xiaobailong24/mvvmarms/lifecycle/delegate/FragmentDelegateImpl.java | Apache-2.0 |
@Override
public FragmentDelegateImpl[] newArray(int size) {
return new FragmentDelegateImpl[size];
} | Return true if the fragment is currently added to its activity. | newArray | java | xiaobailong24/MVVMArms | lifecycle/src/main/java/me/xiaobailong24/mvvmarms/lifecycle/delegate/FragmentDelegateImpl.java | https://github.com/xiaobailong24/MVVMArms/blob/master/lifecycle/src/main/java/me/xiaobailong24/mvvmarms/lifecycle/delegate/FragmentDelegateImpl.java | Apache-2.0 |
public static <T extends View> T findViewByName(Context context, View view, String viewName) {
int id = getResources(context).getIdentifier(viewName, "id", context.getPackageName());
T v = (T) view.findViewById(id);
return v;
} | findview
@param view
@param viewName
@param <T>
@return | findViewByName | java | xiaobailong24/MVVMArms | lifecycle/src/main/java/me/xiaobailong24/mvvmarms/lifecycle/utils/UiUtils.java | https://github.com/xiaobailong24/MVVMArms/blob/master/lifecycle/src/main/java/me/xiaobailong24/mvvmarms/lifecycle/utils/UiUtils.java | Apache-2.0 |
public static <T extends View> T findViewByName(Context context, Activity activity, String viewName) {
int id = getResources(context).getIdentifier(viewName, "id", context.getPackageName());
T v = (T) activity.findViewById(id);
return v;
} | findview
@param activity
@param viewName
@param <T>
@return | findViewByName | java | xiaobailong24/MVVMArms | lifecycle/src/main/java/me/xiaobailong24/mvvmarms/lifecycle/utils/UiUtils.java | https://github.com/xiaobailong24/MVVMArms/blob/master/lifecycle/src/main/java/me/xiaobailong24/mvvmarms/lifecycle/utils/UiUtils.java | Apache-2.0 |
public static <T> Resource<T> success(@Nullable T data) {
return new Resource<>(Status.SUCCESS, data, null);
} | @author xiaobailong24
@date 2017/11/22
A generic class that holds a value with its loading status. | success | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/http/Resource.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/http/Resource.java | Apache-2.0 |
public static <T> Resource<T> error(String msg, @Nullable T data) {
return new Resource<>(Status.ERROR, data, msg);
} | @author xiaobailong24
@date 2017/11/22
A generic class that holds a value with its loading status. | error | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/http/Resource.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/http/Resource.java | Apache-2.0 |
public static <T> Resource<T> loading(@Nullable T data) {
return new Resource<>(Status.LOADING, data, null);
} | @author xiaobailong24
@date 2017/11/22
A generic class that holds a value with its loading status. | loading | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/http/Resource.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/http/Resource.java | Apache-2.0 |
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Resource<?> resource = (Resource<?>) o;
if (status != resource.status) {
return false;
... | @author xiaobailong24
@date 2017/11/22
A generic class that holds a value with its loading status. | equals | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/http/Resource.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/http/Resource.java | Apache-2.0 |
@Override
public int hashCode() {
int result = status.hashCode();
result = 31 * result + (message != null ? message.hashCode() : 0);
result = 31 * result + (data != null ? data.hashCode() : 0);
return result;
} | @author xiaobailong24
@date 2017/11/22
A generic class that holds a value with its loading status. | hashCode | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/http/Resource.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/http/Resource.java | Apache-2.0 |
@Override
public String toString() {
return "Resource{" +
"status=" + status +
", message='" + message + '\'' +
", data=" + data +
'}';
} | @author xiaobailong24
@date 2017/11/22
A generic class that holds a value with its loading status. | toString | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/http/Resource.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/http/Resource.java | Apache-2.0 |
public static String decompressToStringForZlib(byte[] bytesToDecompress) {
return decompressToStringForZlib(bytesToDecompress, "UTF-8");
} | zlib decompress 2 String
@param bytesToDecompress byte[]
@return String | decompressToStringForZlib | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | Apache-2.0 |
public static String decompressToStringForZlib(byte[] bytesToDecompress, String charsetName) {
byte[] bytesDecompressed = decompressForZlib(bytesToDecompress);
String returnValue = null;
try {
returnValue = new String(bytesDecompressed, 0, bytesDecompressed.length, charsetName);
... | zlib decompress 2 String
@param bytesToDecompress byte[]
@param charsetName String
@return String | decompressToStringForZlib | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | Apache-2.0 |
public static byte[] decompressForZlib(byte[] bytesToDecompress) {
byte[] returnValues = null;
Inflater inflater = new Inflater();
int numberOfBytesToDecompress = bytesToDecompress.length;
inflater.setInput(bytesToDecompress, 0, numberOfBytesToDecompress);
int numberOfBytesDe... | zlib decompress 2 byte
@param bytesToDecompress byte[]
@return byte[] | decompressForZlib | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | Apache-2.0 |
public static byte[] compressForZlib(byte[] bytesToCompress) {
Deflater deflater = new Deflater();
deflater.setInput(bytesToCompress);
deflater.finish();
byte[] bytesCompressed = new byte[Short.MAX_VALUE];
int numberOfBytesAfterCompression = deflater.deflate(bytesCompressed);
... | zlib compress 2 byte
@param bytesToCompress byte[]
@return byte[] | compressForZlib | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | Apache-2.0 |
public static byte[] compressForZlib(String stringToCompress) {
byte[] returnValues = null;
try {
returnValues = compressForZlib(stringToCompress.getBytes("UTF-8"));
} catch (UnsupportedEncodingException uee) {
uee.printStackTrace();
}
return returnValue... | zlib compress 2 byte
@param stringToCompress String
@return byte[] | compressForZlib | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | Apache-2.0 |
public static byte[] compressForGzip(String string) {
ByteArrayOutputStream os = null;
GZIPOutputStream gos = null;
try {
os = new ByteArrayOutputStream(string.length());
gos = new GZIPOutputStream(os);
gos.write(string.getBytes("UTF-8"));
return o... | gzip compress 2 byte
@param string String
@return byte[] | compressForGzip | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | Apache-2.0 |
public static String decompressForGzip(byte[] compressed) {
return decompressForGzip(compressed, "UTF-8");
} | gzip decompress 2 string
@param compressed byte[]
@return String | decompressForGzip | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | Apache-2.0 |
public static String decompressForGzip(byte[] compressed, String charsetName) {
final int BUFFER_SIZE = compressed.length;
GZIPInputStream gis = null;
ByteArrayInputStream is = null;
try {
is = new ByteArrayInputStream(compressed);
gis = new GZIPInputStream(is, BU... | gzip decompress 2 string
@param compressed byte[]
@param charsetName String
@return String | decompressForGzip | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | Apache-2.0 |
public static void closeQuietly(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (RuntimeException rethrown) {
throw rethrown;
} catch (Exception ignored) {
}
}
} | gzip decompress 2 string
@param compressed byte[]
@param charsetName String
@return String | closeQuietly | java | xiaobailong24/MVVMArms | repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | https://github.com/xiaobailong24/MVVMArms/blob/master/repository/src/main/java/me/xiaobailong24/mvvmarms/repository/utils/ZipHelper.java | Apache-2.0 |
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("me.xiaobailong24.mvvmarms.weather", appContext.getPackageName());
} | Instrumentation test, which will execute on an Android device.
@see <a href="http://d.android.com/tools/testing">Testing documentation</a> | useAppContext | java | xiaobailong24/MVVMArms | weather/src/androidTest/java/me/xiaobailong24/mvvmarms/weather/ExampleInstrumentedTest.java | https://github.com/xiaobailong24/MVVMArms/blob/master/weather/src/androidTest/java/me/xiaobailong24/mvvmarms/weather/ExampleInstrumentedTest.java | Apache-2.0 |
@Override
public void onSubscribe(Subscription s) {
s.request(Integer.MAX_VALUE);
} | @author xiaobailong24
@date 2017/7/30
Room Database Test
{@link me.xiaobailong24.mvvmarms.weather.mvvm.model.db.WeatherNowDao} | onSubscribe | java | xiaobailong24/MVVMArms | weather/src/androidTest/java/me/xiaobailong24/mvvmarms/weather/db/WeatherNowDaoTest.java | https://github.com/xiaobailong24/MVVMArms/blob/master/weather/src/androidTest/java/me/xiaobailong24/mvvmarms/weather/db/WeatherNowDaoTest.java | Apache-2.0 |
@Override
public void onError(Throwable t) {
Log.e(TAG, "onError: ", t);
} | @author xiaobailong24
@date 2017/7/30
Room Database Test
{@link me.xiaobailong24.mvvmarms.weather.mvvm.model.db.WeatherNowDao} | onError | java | xiaobailong24/MVVMArms | weather/src/androidTest/java/me/xiaobailong24/mvvmarms/weather/db/WeatherNowDaoTest.java | https://github.com/xiaobailong24/MVVMArms/blob/master/weather/src/androidTest/java/me/xiaobailong24/mvvmarms/weather/db/WeatherNowDaoTest.java | Apache-2.0 |
@Override
public void onComplete() {
} | @author xiaobailong24
@date 2017/7/30
Room Database Test
{@link me.xiaobailong24.mvvmarms.weather.mvvm.model.db.WeatherNowDao} | onComplete | java | xiaobailong24/MVVMArms | weather/src/androidTest/java/me/xiaobailong24/mvvmarms/weather/db/WeatherNowDaoTest.java | https://github.com/xiaobailong24/MVVMArms/blob/master/weather/src/androidTest/java/me/xiaobailong24/mvvmarms/weather/db/WeatherNowDaoTest.java | Apache-2.0 |
@Override
public void onSubscribe(Subscription s) {
s.request(Integer.MAX_VALUE);
} | @author xiaobailong24
@date 2017/7/30
Room Database Test
{@link me.xiaobailong24.mvvmarms.weather.mvvm.model.db.WeatherNowDao} | onSubscribe | java | xiaobailong24/MVVMArms | weather/src/androidTest/java/me/xiaobailong24/mvvmarms/weather/db/WeatherNowDaoTest.java | https://github.com/xiaobailong24/MVVMArms/blob/master/weather/src/androidTest/java/me/xiaobailong24/mvvmarms/weather/db/WeatherNowDaoTest.java | Apache-2.0 |
@Override
public void onError(Throwable t) {
Log.e(TAG, "onError: ", t);
} | @author xiaobailong24
@date 2017/7/30
Room Database Test
{@link me.xiaobailong24.mvvmarms.weather.mvvm.model.db.WeatherNowDao} | onError | java | xiaobailong24/MVVMArms | weather/src/androidTest/java/me/xiaobailong24/mvvmarms/weather/db/WeatherNowDaoTest.java | https://github.com/xiaobailong24/MVVMArms/blob/master/weather/src/androidTest/java/me/xiaobailong24/mvvmarms/weather/db/WeatherNowDaoTest.java | Apache-2.0 |
@Override
public void onComplete() {
} | @author xiaobailong24
@date 2017/7/30
Room Database Test
{@link me.xiaobailong24.mvvmarms.weather.mvvm.model.db.WeatherNowDao} | onComplete | java | xiaobailong24/MVVMArms | weather/src/androidTest/java/me/xiaobailong24/mvvmarms/weather/db/WeatherNowDaoTest.java | https://github.com/xiaobailong24/MVVMArms/blob/master/weather/src/androidTest/java/me/xiaobailong24/mvvmarms/weather/db/WeatherNowDaoTest.java | Apache-2.0 |
@Override
public Fragment getItem(int position) {
return mFragments.get(position);
} | @author xiaobailong24
@date 2017/8/15
ViewPager Adapter for Fragment | getItem | java | xiaobailong24/MVVMArms | weather/src/main/java/me/xiaobailong24/mvvmarms/weather/mvvm/view/adapter/WeatherPagerAdapter.java | https://github.com/xiaobailong24/MVVMArms/blob/master/weather/src/main/java/me/xiaobailong24/mvvmarms/weather/mvvm/view/adapter/WeatherPagerAdapter.java | Apache-2.0 |
@Override
public int getCount() {
return mFragments.size();
} | @author xiaobailong24
@date 2017/8/15
ViewPager Adapter for Fragment | getCount | java | xiaobailong24/MVVMArms | weather/src/main/java/me/xiaobailong24/mvvmarms/weather/mvvm/view/adapter/WeatherPagerAdapter.java | https://github.com/xiaobailong24/MVVMArms/blob/master/weather/src/main/java/me/xiaobailong24/mvvmarms/weather/mvvm/view/adapter/WeatherPagerAdapter.java | Apache-2.0 |
@Override
public CharSequence getPageTitle(int position) {
return mTitles.get(position);
} | @author xiaobailong24
@date 2017/8/15
ViewPager Adapter for Fragment | getPageTitle | java | xiaobailong24/MVVMArms | weather/src/main/java/me/xiaobailong24/mvvmarms/weather/mvvm/view/adapter/WeatherPagerAdapter.java | https://github.com/xiaobailong24/MVVMArms/blob/master/weather/src/main/java/me/xiaobailong24/mvvmarms/weather/mvvm/view/adapter/WeatherPagerAdapter.java | Apache-2.0 |
@Override
public boolean canChildScrollUp() {
if (mScrollUpChild != null) {
return ViewCompat.canScrollVertically(mScrollUpChild, -1);
}
return super.canChildScrollUp();
} | @author xiaobailong24
@date 2017/7/31
Extends {@link SwipeRefreshLayout} to support non-direct descendant scrolling views.
<p>
{@link SwipeRefreshLayout} works as expected when a scroll view is a direct child: it triggers
the refresh only when the view is on top. This class adds a way (@link #setScrollUpChild} to
defin... | canChildScrollUp | java | xiaobailong24/MVVMArms | weather/src/main/java/me/xiaobailong24/mvvmarms/weather/mvvm/view/weight/ScrollChildSwipeRefreshLayout.java | https://github.com/xiaobailong24/MVVMArms/blob/master/weather/src/main/java/me/xiaobailong24/mvvmarms/weather/mvvm/view/weight/ScrollChildSwipeRefreshLayout.java | Apache-2.0 |
public void setScrollUpChild(View view) {
mScrollUpChild = view;
} | @author xiaobailong24
@date 2017/7/31
Extends {@link SwipeRefreshLayout} to support non-direct descendant scrolling views.
<p>
{@link SwipeRefreshLayout} works as expected when a scroll view is a direct child: it triggers
the refresh only when the view is on top. This class adds a way (@link #setScrollUpChild} to
defin... | setScrollUpChild | java | xiaobailong24/MVVMArms | weather/src/main/java/me/xiaobailong24/mvvmarms/weather/mvvm/view/weight/ScrollChildSwipeRefreshLayout.java | https://github.com/xiaobailong24/MVVMArms/blob/master/weather/src/main/java/me/xiaobailong24/mvvmarms/weather/mvvm/view/weight/ScrollChildSwipeRefreshLayout.java | Apache-2.0 |
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
} | Example local unit test, which will execute on the development machine (host).
@see <a href="http://d.android.com/tools/testing">Testing documentation</a> | addition_isCorrect | java | xiaobailong24/MVVMArms | weather/src/test/java/me/xiaobailong24/mvvmarms/weather/ExampleUnitTest.java | https://github.com/xiaobailong24/MVVMArms/blob/master/weather/src/test/java/me/xiaobailong24/mvvmarms/weather/ExampleUnitTest.java | Apache-2.0 |
private void printServiceUrls(MesosCluster cluster) {
// print independent from roles variables
String masterContainer = cluster.getMaster().getContainerId();
String gateway = String.format("export %s=%s", MesosCluster.TOKEN_NETWORK_GATEWAY, DockerContainersUtil.getGatewayIpAddress(masterContai... | Prints cluster services URLs and IPs
@param cluster to examine | printServiceUrls | java | ContainerSolutions/minimesos | cli/src/main/java/com/containersol/minimesos/main/CommandInfo.java | https://github.com/ContainerSolutions/minimesos/blob/master/cli/src/main/java/com/containersol/minimesos/main/CommandInfo.java | Apache-2.0 |
@Override
public boolean validateParameters() {
return true;
} | Prints cluster services URLs and IPs
@param cluster to examine | validateParameters | java | ContainerSolutions/minimesos | cli/src/main/java/com/containersol/minimesos/main/CommandInfo.java | https://github.com/ContainerSolutions/minimesos/blob/master/cli/src/main/java/com/containersol/minimesos/main/CommandInfo.java | Apache-2.0 |
@Override
public String getName() {
return CLINAME;
} | Prints cluster services URLs and IPs
@param cluster to examine | getName | java | ContainerSolutions/minimesos | cli/src/main/java/com/containersol/minimesos/main/CommandInfo.java | https://github.com/ContainerSolutions/minimesos/blob/master/cli/src/main/java/com/containersol/minimesos/main/CommandInfo.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.