repo_name stringlengths 7 104 | file_path stringlengths 13 198 | context stringlengths 67 7.15k | import_statement stringlengths 16 4.43k | code stringlengths 40 6.98k | prompt stringlengths 227 8.27k | next_line stringlengths 8 795 |
|---|---|---|---|---|---|---|
meethai/mithai | src/test/java/edu/sjsu/mithai/data/MetadataGenerationTaskTest.java | // Path: src/main/java/edu/sjsu/mithai/util/BaseTest.java
// public abstract class BaseTest {
//
// protected Configuration config;
//
// public BaseTest() throws IOException {
// loadConfig();
// }
//
// public abstract void test() throws Exception;
//
// public void loadConfig() throws... | import edu.sjsu.mithai.util.BaseTest;
import edu.sjsu.mithai.util.TaskManager;
import java.io.IOException; | package edu.sjsu.mithai.data;
public class MetadataGenerationTaskTest extends BaseTest {
public MetadataGenerationTaskTest() throws IOException {}
public static void main(String[] args) {
MetadataGenerationTaskTest test = null;
try {
test = new MetadataGenerationTaskTest();
... | // Path: src/main/java/edu/sjsu/mithai/util/BaseTest.java
// public abstract class BaseTest {
//
// protected Configuration config;
//
// public BaseTest() throws IOException {
// loadConfig();
// }
//
// public abstract void test() throws Exception;
//
// public void loadConfig() throws... | TaskManager.getInstance().submitTask(task); |
meethai/mithai | src/main/java/edu/sjsu/mithai/export/http/HttpExporter.java | // Path: src/main/java/edu/sjsu/mithai/export/ExportMessage.java
// public class ExportMessage implements Serializable {
//
// //TODO in future we may need to add fields to this.
//
// protected final String message;
//
// public ExportMessage(String message) {
// this.message = message;
// ... | import edu.sjsu.mithai.export.ExportMessage;
import edu.sjsu.mithai.export.HttpExportMessage;
import edu.sjsu.mithai.export.IExporter;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.clie... | package edu.sjsu.mithai.export.http;
public class HttpExporter implements IExporter<ExportMessage> {
private CloseableHttpClient client;
public HttpExporter() {
}
@Override
public void setup() throws Exception {
this.client = HttpClients.createDefault();
}
@Override
public... | // Path: src/main/java/edu/sjsu/mithai/export/ExportMessage.java
// public class ExportMessage implements Serializable {
//
// //TODO in future we may need to add fields to this.
//
// protected final String message;
//
// public ExportMessage(String message) {
// this.message = message;
// ... | if (message instanceof HttpExportMessage) { |
meethai/mithai | src/test/java/edu/sjsu/mithai/config/ConfigurationTest.java | // Path: src/main/java/edu/sjsu/mithai/util/BaseTest.java
// public abstract class BaseTest {
//
// protected Configuration config;
//
// public BaseTest() throws IOException {
// loadConfig();
// }
//
// public abstract void test() throws Exception;
//
// public void loadConfig() throws... | import edu.sjsu.mithai.util.BaseTest;
import edu.sjsu.mithai.util.TaskManager;
import org.junit.Test;
import java.io.IOException; | package edu.sjsu.mithai.config;
public class ConfigurationTest extends BaseTest {
public ConfigurationTest() throws IOException {
}
@Test
public void test() {
// start monitor task | // Path: src/main/java/edu/sjsu/mithai/util/BaseTest.java
// public abstract class BaseTest {
//
// protected Configuration config;
//
// public BaseTest() throws IOException {
// loadConfig();
// }
//
// public abstract void test() throws Exception;
//
// public void loadConfig() throws... | TaskManager.getInstance().submitTask(new ConfigMonitorTask(config)); |
meethai/mithai | src/main/java/edu/sjsu/mithai/apps/temperature/TemperatureHandler.java | // Path: src/main/java/edu/sjsu/mithai/export/ExportMessage.java
// public class ExportMessage implements Serializable {
//
// //TODO in future we may need to add fields to this.
//
// protected final String message;
//
// public ExportMessage(String message) {
// this.message = message;
// ... | import com.google.gson.Gson;
import edu.sjsu.mithai.export.ExportMessage;
import edu.sjsu.mithai.spark.Store;
import edu.sjsu.mithai.util.Ihandler;
import java.util.HashMap;
import java.util.Map; | package edu.sjsu.mithai.apps.temperature;
public class TemperatureHandler implements Ihandler {
private Gson gson;
public TemperatureHandler() {
this.gson = new Gson();
}
@Override
public void handle(String functionName, String msg) {
if (functionName.equals("average")) {
... | // Path: src/main/java/edu/sjsu/mithai/export/ExportMessage.java
// public class ExportMessage implements Serializable {
//
// //TODO in future we may need to add fields to this.
//
// protected final String message;
//
// public ExportMessage(String message) {
// this.message = message;
// ... | ExportMessage exportMessage = new ExportMessage(gson.toJson(data)); |
meethai/mithai | src/main/scala/edu/sjsu/mithai/data/DataGenerationTask.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.config.MithaiProperties;
import edu.sjsu.mithai.mqtt.MQTTPublisher;
import edu.sjsu.mithai.mqtt.MqttService;
import edu.sjsu.mithai.sensors.IDevice;
import edu.sjsu.mithai.util.StoppableExecutableTask;
import org.eclipse.paho.client.mqttv3.MqttExceptio... | package edu.sjsu.mithai.data;
public class DataGenerationTask extends StoppableExecutableTask {
private static final Logger logger = LoggerFactory.getLogger(DataGenerationTask.class);
private SensorStore sensorStore; | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | private Configuration configuration; |
meethai/mithai | src/main/scala/edu/sjsu/mithai/data/DataGenerationTask.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.config.MithaiProperties;
import edu.sjsu.mithai.mqtt.MQTTPublisher;
import edu.sjsu.mithai.mqtt.MqttService;
import edu.sjsu.mithai.sensors.IDevice;
import edu.sjsu.mithai.util.StoppableExecutableTask;
import org.eclipse.paho.client.mqttv3.MqttExceptio... | package edu.sjsu.mithai.data;
public class DataGenerationTask extends StoppableExecutableTask {
private static final Logger logger = LoggerFactory.getLogger(DataGenerationTask.class);
private SensorStore sensorStore;
private Configuration configuration;
private MQTTPublisher publisher;
private ... | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | this.publisher = MqttService.getPublisher(configuration); |
meethai/mithai | src/main/scala/edu/sjsu/mithai/data/DataGenerationTask.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.config.MithaiProperties;
import edu.sjsu.mithai.mqtt.MQTTPublisher;
import edu.sjsu.mithai.mqtt.MqttService;
import edu.sjsu.mithai.sensors.IDevice;
import edu.sjsu.mithai.util.StoppableExecutableTask;
import org.eclipse.paho.client.mqttv3.MqttExceptio... | package edu.sjsu.mithai.data;
public class DataGenerationTask extends StoppableExecutableTask {
private static final Logger logger = LoggerFactory.getLogger(DataGenerationTask.class);
private SensorStore sensorStore;
private Configuration configuration;
private MQTTPublisher publisher;
private ... | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | for (IDevice device : sensorStore.getDevices()) { |
meethai/mithai | src/main/java/edu/sjsu/mithai/export/Exporter.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import edu.sjsu.mithai.config.Configuration; | package edu.sjsu.mithai.export;
public class Exporter {
private IExporter exporter; | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | private Configuration configuration; |
meethai/mithai | src/main/java/edu/sjsu/mithai/apps/parkinglot/ParkingResponseHandler.java | // Path: src/main/java/edu/sjsu/mithai/export/HttpExportMessage.java
// public class HttpExportMessage extends ExportMessage {
//
// private String uri;
//
// public HttpExportMessage(String message, String uri) {
// super(message);
// this.uri = uri;
// }
//
// public String getUri()... | import com.google.gson.Gson;
import edu.sjsu.mithai.export.HttpExportMessage;
import edu.sjsu.mithai.spark.Store;
import edu.sjsu.mithai.util.Ihandler;
import java.util.LinkedHashMap;
import java.util.Map; | package edu.sjsu.mithai.apps.parkinglot;
public class ParkingResponseHandler implements Ihandler {
private Gson gson;
private Map<String, Integer> parkingStatus;
public ParkingResponseHandler() {
this.gson = new Gson();
this.parkingStatus = new LinkedHashMap<>();
}
@Override
... | // Path: src/main/java/edu/sjsu/mithai/export/HttpExportMessage.java
// public class HttpExportMessage extends ExportMessage {
//
// private String uri;
//
// public HttpExportMessage(String message, String uri) {
// super(message);
// this.uri = uri;
// }
//
// public String getUri()... | HttpExportMessage message = new HttpExportMessage(gson.toJson(parkingStatus), |
meethai/mithai | src/main/java/edu/sjsu/mithai/util/Client.java | // Path: src/main/java/edu/sjsu/mithai/sensors/TemperatureSensor.java
// public class TemperatureSensor extends AbstractDevice {
//
// private double min;
// private Random random;
//
// public TemperatureSensor(String id) {
// super(id);
// random = new Random();
// min = random.n... | import edu.sjsu.mithai.sensors.TemperatureSensor; | package edu.sjsu.mithai.util;
public class Client {
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
TaskManager.getInstance().submitTask(new TemperatureSensorTask(i));
}
// for (int i = 0; i < 5; i++) {
// TaskManager.getInstance().submitTask... | // Path: src/main/java/edu/sjsu/mithai/sensors/TemperatureSensor.java
// public class TemperatureSensor extends AbstractDevice {
//
// private double min;
// private Random random;
//
// public TemperatureSensor(String id) {
// super(id);
// random = new Random();
// min = random.n... | TemperatureSensor sensor; |
meethai/mithai | src/test/java/edu/sjsu/mithai/data/DataGenerationTaskTest.java | // Path: src/main/java/edu/sjsu/mithai/sensors/IDevice.java
// public interface IDevice {
//
// public double sense();
//
// public String getId();
//
// }
//
// Path: src/main/java/edu/sjsu/mithai/util/BaseTest.java
// public abstract class BaseTest {
//
// protected Configuration config;
//
// p... | import edu.sjsu.mithai.sensors.IDevice;
import edu.sjsu.mithai.util.BaseTest;
import edu.sjsu.mithai.util.TaskManager;
import java.io.IOException;
import java.util.Random; | package edu.sjsu.mithai.data;
public class DataGenerationTaskTest extends BaseTest {
public DataGenerationTaskTest() throws IOException {
}
public static void main(String[] args) {
try {
DataGenerationTaskTest test = new DataGenerationTaskTest();
test.test();
}... | // Path: src/main/java/edu/sjsu/mithai/sensors/IDevice.java
// public interface IDevice {
//
// public double sense();
//
// public String getId();
//
// }
//
// Path: src/main/java/edu/sjsu/mithai/util/BaseTest.java
// public abstract class BaseTest {
//
// protected Configuration config;
//
// p... | sensorStore.addDevice(new IDevice() { |
meethai/mithai | src/test/java/edu/sjsu/mithai/data/DataGenerationTaskTest.java | // Path: src/main/java/edu/sjsu/mithai/sensors/IDevice.java
// public interface IDevice {
//
// public double sense();
//
// public String getId();
//
// }
//
// Path: src/main/java/edu/sjsu/mithai/util/BaseTest.java
// public abstract class BaseTest {
//
// protected Configuration config;
//
// p... | import edu.sjsu.mithai.sensors.IDevice;
import edu.sjsu.mithai.util.BaseTest;
import edu.sjsu.mithai.util.TaskManager;
import java.io.IOException;
import java.util.Random; | package edu.sjsu.mithai.data;
public class DataGenerationTaskTest extends BaseTest {
public DataGenerationTaskTest() throws IOException {
}
public static void main(String[] args) {
try {
DataGenerationTaskTest test = new DataGenerationTaskTest();
test.test();
}... | // Path: src/main/java/edu/sjsu/mithai/sensors/IDevice.java
// public interface IDevice {
//
// public double sense();
//
// public String getId();
//
// }
//
// Path: src/main/java/edu/sjsu/mithai/util/BaseTest.java
// public abstract class BaseTest {
//
// protected Configuration config;
//
// p... | TaskManager.getInstance().submitTask(task); |
meethai/mithai | src/main/java/edu/sjsu/mithai/export/ExporterTask.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.config.MithaiProperties;
import edu.sjsu.mithai.util.StoppableRunnableTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; | package edu.sjsu.mithai.export;
public class ExporterTask extends StoppableRunnableTask {
private final Logger logger = LoggerFactory.getLogger(ExporterTask.class);
private static final String STOP_MESSAGE = "STOP";
| // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | private Configuration configuration; |
meethai/mithai | src/main/java/edu/sjsu/mithai/export/ExporterTask.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.config.MithaiProperties;
import edu.sjsu.mithai.util.StoppableRunnableTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; | package edu.sjsu.mithai.export;
public class ExporterTask extends StoppableRunnableTask {
private final Logger logger = LoggerFactory.getLogger(ExporterTask.class);
private static final String STOP_MESSAGE = "STOP";
private Configuration configuration;
private Exporter exporter;
private long se... | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | this.sendInterval = Long.parseLong(configuration.getProperty(MithaiProperties.EXPORTER_TIME_INTERVAL)); |
meethai/mithai | src/test/java/edu/sjsu/mithai/mqtt/MQTTDataReceiverTaskTest.java | // Path: src/main/java/edu/sjsu/mithai/util/BaseTest.java
// public abstract class BaseTest {
//
// protected Configuration config;
//
// public BaseTest() throws IOException {
// loadConfig();
// }
//
// public abstract void test() throws Exception;
//
// public void loadConfig() throws... | import edu.sjsu.mithai.util.BaseTest;
import edu.sjsu.mithai.util.TaskManager;
import org.junit.Test;
import java.io.IOException; | package edu.sjsu.mithai.mqtt;
/**
* Created by kaustubh on 9/21/16.
*/
public class MQTTDataReceiverTaskTest extends BaseTest {
public MQTTDataReceiverTaskTest() throws IOException {
}
public static void main(String[] args) throws IOException {
MQTTDataReceiverTaskTest mr = new MQTTDataR... | // Path: src/main/java/edu/sjsu/mithai/util/BaseTest.java
// public abstract class BaseTest {
//
// protected Configuration config;
//
// public BaseTest() throws IOException {
// loadConfig();
// }
//
// public abstract void test() throws Exception;
//
// public void loadConfig() throws... | TaskManager.getInstance().submitTask(new MQTTDataReceiverTask(config)); |
hortonworks-spark/spark-llap | src/test/java/com/hortonworks/spark/sql/hive/llap/TestReadSupport.java | // Path: src/test/java/com/hortonworks/spark/sql/hive/llap/TestSecureHS2Url.java
// static final String TEST_HS2_URL = "jdbc:hive2://example.com:10084";
| import org.apache.spark.sql.Row;
import org.junit.Test;
import static com.hortonworks.spark.sql.hive.llap.TestSecureHS2Url.TEST_HS2_URL;
import static org.junit.Assert.assertEquals; | package com.hortonworks.spark.sql.hive.llap;
public class TestReadSupport extends SessionTestBase {
@Test
public void testReadSupport() {
HiveWarehouseSession hive = HiveWarehouseBuilder.
session(session). | // Path: src/test/java/com/hortonworks/spark/sql/hive/llap/TestSecureHS2Url.java
// static final String TEST_HS2_URL = "jdbc:hive2://example.com:10084";
// Path: src/test/java/com/hortonworks/spark/sql/hive/llap/TestReadSupport.java
import org.apache.spark.sql.Row;
import org.junit.Test;
import static com.hortonworks... | hs2url(TEST_HS2_URL). |
hortonworks-spark/spark-llap | src/main/java/com/hortonworks/spark/sql/hive/llap/HiveWarehouseDataWriterFactory.java | // Path: src/main/java/com/hortonworks/spark/sql/hive/llap/util/SerializableHadoopConfiguration.java
// public class SerializableHadoopConfiguration implements Serializable {
// Configuration conf;
//
// public SerializableHadoopConfiguration(Configuration hadoopConf) {
// this.conf = hadoopConf;
//
// if... | import com.hortonworks.spark.sql.hive.llap.util.SerializableHadoopConfiguration;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapred.JobConf;
import org.apache.spark.sql.catalyst.InternalRow;
import org.apache.spark.sql.s... | package com.hortonworks.spark.sql.hive.llap;
public class HiveWarehouseDataWriterFactory implements DataWriterFactory<InternalRow> {
protected String jobId;
protected StructType schema;
private Path path; | // Path: src/main/java/com/hortonworks/spark/sql/hive/llap/util/SerializableHadoopConfiguration.java
// public class SerializableHadoopConfiguration implements Serializable {
// Configuration conf;
//
// public SerializableHadoopConfiguration(Configuration hadoopConf) {
// this.conf = hadoopConf;
//
// if... | private SerializableHadoopConfiguration conf; |
hortonworks-spark/spark-llap | src/test/java/com/hortonworks/spark/sql/hive/llap/TestWriteSupport.java | // Path: src/test/java/com/hortonworks/spark/sql/hive/llap/MockHiveWarehouseConnector.java
// public static int[] testVector = {1, 2, 3, 4, 5};
//
// Path: src/test/java/com/hortonworks/spark/sql/hive/llap/TestSecureHS2Url.java
// static final String TEST_HS2_URL = "jdbc:hive2://example.com:10084";
| import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.catalyst.InternalRow;
import org.junit.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.hortonworks.spark.sql.hive.llap.MockHiveWarehouseConnector.testVector;
import static com... | package com.hortonworks.spark.sql.hive.llap;
public class TestWriteSupport extends SessionTestBase {
@Test
public void testWriteSupport() {
HiveWarehouseSession hive = HiveWarehouseBuilder.
session(session). | // Path: src/test/java/com/hortonworks/spark/sql/hive/llap/MockHiveWarehouseConnector.java
// public static int[] testVector = {1, 2, 3, 4, 5};
//
// Path: src/test/java/com/hortonworks/spark/sql/hive/llap/TestSecureHS2Url.java
// static final String TEST_HS2_URL = "jdbc:hive2://example.com:10084";
// Path: src/test... | hs2url(TEST_HS2_URL). |
hortonworks-spark/spark-llap | src/test/java/com/hortonworks/spark/sql/hive/llap/HiveWarehouseSessionHiveQlTest.java | // Path: src/test/java/com/hortonworks/spark/sql/hive/llap/HiveWarehouseBuilderTest.java
// class HiveWarehouseBuilderTest extends SessionTestBase {
//
// static final String TEST_USER = "userX";
// static final String TEST_PASSWORD = "passwordX";
// static final String TEST_DBCP2_CONF = "defaultQueryTimeo... | import org.junit.Before;
import org.junit.Test;
import static com.hortonworks.spark.sql.hive.llap.HiveWarehouseBuilderTest.*;
import static com.hortonworks.spark.sql.hive.llap.TestSecureHS2Url.TEST_HS2_URL;
import static org.junit.Assert.assertEquals; | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | // Path: src/test/java/com/hortonworks/spark/sql/hive/llap/HiveWarehouseBuilderTest.java
// class HiveWarehouseBuilderTest extends SessionTestBase {
//
// static final String TEST_USER = "userX";
// static final String TEST_PASSWORD = "passwordX";
// static final String TEST_DBCP2_CONF = "defaultQueryTimeo... | .hs2url(TEST_HS2_URL) |
hortonworks-spark/spark-llap | src/main/java/com/hortonworks/hwc/HiveWarehouseSession.java | // Path: src/main/java/com/hortonworks/spark/sql/hive/llap/HiveWarehouseBuilder.java
// public class HiveWarehouseBuilder {
//
// HiveWarehouseSessionState sessionState = new HiveWarehouseSessionState();
//
// //Can only be instantiated through session(SparkSession session)
// private HiveWarehouseBuilder... | import com.hortonworks.spark.sql.hive.llap.HiveWarehouseBuilder;
import org.apache.spark.sql.SparkSession; | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | // Path: src/main/java/com/hortonworks/spark/sql/hive/llap/HiveWarehouseBuilder.java
// public class HiveWarehouseBuilder {
//
// HiveWarehouseSessionState sessionState = new HiveWarehouseSessionState();
//
// //Can only be instantiated through session(SparkSession session)
// private HiveWarehouseBuilder... | static HiveWarehouseBuilder session(SparkSession session) { |
hortonworks-spark/spark-llap | src/main/java/com/hortonworks/spark/sql/hive/llap/streaming/HiveStreamingDataSource.java | // Path: src/main/java/com/hortonworks/spark/sql/hive/llap/HiveWarehouseSession.java
// public interface HiveWarehouseSession {
//
// String HIVE_WAREHOUSE_CONNECTOR = "com.hortonworks.spark.sql.hive.llap.HiveWarehouseConnector";
// String SPARK_DATASOURCES_PREFIX = "spark.datasource";
// String HIVE_WAREH... | import java.util.Arrays;
import java.util.List;
import com.hortonworks.spark.sql.hive.llap.HiveWarehouseSession;
import org.apache.spark.sql.sources.v2.DataSourceOptions;
import org.apache.spark.sql.sources.v2.DataSourceV2;
import org.apache.spark.sql.sources.v2.StreamWriteSupport;
import org.apache.spark.sql.sources.v... | package com.hortonworks.spark.sql.hive.llap.streaming;
public class HiveStreamingDataSource implements DataSourceV2, StreamWriteSupport, SessionConfigSupport {
private static Logger LOG = LoggerFactory.getLogger(HiveStreamingDataSource.class);
@Override
public StreamWriter createStreamWriter(final String quer... | // Path: src/main/java/com/hortonworks/spark/sql/hive/llap/HiveWarehouseSession.java
// public interface HiveWarehouseSession {
//
// String HIVE_WAREHOUSE_CONNECTOR = "com.hortonworks.spark.sql.hive.llap.HiveWarehouseConnector";
// String SPARK_DATASOURCES_PREFIX = "spark.datasource";
// String HIVE_WAREH... | return HiveWarehouseSession.HIVE_WAREHOUSE_POSTFIX; |
hortonworks-spark/spark-llap | src/main/java/com/hortonworks/spark/sql/hive/llap/streaming/HiveStreamingDataSourceWriter.java | // Path: src/main/java/com/hortonworks/spark/sql/hive/llap/HiveStreamingDataWriterFactory.java
// public class HiveStreamingDataWriterFactory implements DataWriterFactory<InternalRow> {
//
// private String jobId;
// private StructType schema;
// private long commitIntervalRows;
// private String db;
// priv... | import java.util.List;
import org.apache.spark.sql.catalyst.InternalRow;
import org.apache.spark.sql.sources.v2.writer.DataWriterFactory;
import org.apache.spark.sql.sources.v2.writer.SupportsWriteInternalRow;
import org.apache.spark.sql.sources.v2.writer.WriterCommitMessage;
import org.apache.spark.sql.sources.v2.writ... | package com.hortonworks.spark.sql.hive.llap.streaming;
public class HiveStreamingDataSourceWriter implements SupportsWriteInternalRow, StreamWriter {
private static Logger LOG = LoggerFactory.getLogger(HiveStreamingDataSourceWriter.class);
private String jobId;
private StructType schema;
private String db;... | // Path: src/main/java/com/hortonworks/spark/sql/hive/llap/HiveStreamingDataWriterFactory.java
// public class HiveStreamingDataWriterFactory implements DataWriterFactory<InternalRow> {
//
// private String jobId;
// private StructType schema;
// private long commitIntervalRows;
// private String db;
// priv... | return new HiveStreamingDataWriterFactory(jobId, schema, -1, db, table, partition, metastoreUri, |
hortonworks-spark/spark-llap | src/main/java/com/hortonworks/spark/sql/hive/llap/util/SchemaUtil.java | // Path: src/main/java/com/hortonworks/spark/sql/hive/llap/CreateTableBuilder.java
// public class CreateTableBuilder implements com.hortonworks.hwc.CreateTableBuilder {
// private HiveWarehouseSession hive;
// private String database;
// private String tableName;
// private boolean ifNotExists;
// ... | import com.hortonworks.spark.sql.hive.llap.CreateTableBuilder;
import org.apache.hadoop.hive.llap.FieldDesc;
import org.apache.hadoop.hive.llap.Schema;
import org.apache.spark.sql.types.*;
import java.util.ArrayList;
import java.util.List;
import static java.lang.String.format; | package com.hortonworks.spark.sql.hive.llap.util;
public class SchemaUtil {
private static final String HIVE_TYPE_STRING = "HIVE_TYPE_STRING";
public static StructType convertSchema(Schema schema) {
List<FieldDesc> columns = schema.getColumns();
List<String> types = new ArrayList<>();
for(FieldDes... | // Path: src/main/java/com/hortonworks/spark/sql/hive/llap/CreateTableBuilder.java
// public class CreateTableBuilder implements com.hortonworks.hwc.CreateTableBuilder {
// private HiveWarehouseSession hive;
// private String database;
// private String tableName;
// private boolean ifNotExists;
// ... | CreateTableBuilder createTableBuilder = new CreateTableBuilder(null, database, table); |
hortonworks-spark/spark-llap | src/test/java/com/hortonworks/spark/sql/hive/llap/MockWriteSupport.java | // Path: src/main/java/com/hortonworks/spark/sql/hive/llap/util/SerializableHadoopConfiguration.java
// public class SerializableHadoopConfiguration implements Serializable {
// Configuration conf;
//
// public SerializableHadoopConfiguration(Configuration hadoopConf) {
// this.conf = hadoopConf;
//
// if... | import com.hortonworks.spark.sql.hive.llap.util.SerializableHadoopConfiguration;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.spark.sql.catalyst.InternalRow;
import org.apac... | package com.hortonworks.spark.sql.hive.llap;
public class MockWriteSupport {
public static class MockHiveWarehouseDataSourceWriter extends HiveWarehouseDataSourceWriter {
public MockHiveWarehouseDataSourceWriter(Map<String, String> options, String jobId, StructType schema, Path path,
Configuration c... | // Path: src/main/java/com/hortonworks/spark/sql/hive/llap/util/SerializableHadoopConfiguration.java
// public class SerializableHadoopConfiguration implements Serializable {
// Configuration conf;
//
// public SerializableHadoopConfiguration(Configuration hadoopConf) {
// this.conf = hadoopConf;
//
// if... | return new MockHiveWarehouseDataWriterFactory(jobId, schema, path, new SerializableHadoopConfiguration(conf)); |
jenkinsci/mesos-plugin | src/main/java/org/jenkinsci/plugins/mesos/api/LaunchCommandBuilder.java | // Path: src/main/java/org/jenkinsci/plugins/mesos/MesosAgentSpecTemplate.java
// public static class ContainerInfo extends AbstractDescribableImpl<ContainerInfo> {
//
// private final String type;
// private final String dockerImage;
// private final List<Volume> volumes;
// private final Network networking;
... | import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.mesosphere.usi.core.models.PodId;
import com.mesosphere.usi.core.models.commands.LaunchPod;
import com.mesosphere.usi.core.models.constraints.AgentFilter;
import com.mesosphere.usi.core.models.constraints.... | package org.jenkinsci.plugins.mesos.api;
/**
* A simpler factory for building {@link com.mesosphere.usi.core.models.commands.LaunchPod} for
* Jenkins agents.
*/
public class LaunchCommandBuilder {
public LaunchCommandBuilder() {}
private static final String AGENT_JAR_URI_SUFFIX = "jnlpJars/agent.jar";
// ... | // Path: src/main/java/org/jenkinsci/plugins/mesos/MesosAgentSpecTemplate.java
// public static class ContainerInfo extends AbstractDescribableImpl<ContainerInfo> {
//
// private final String type;
// private final String dockerImage;
// private final List<Volume> volumes;
// private final Network networking;
... | private Optional<ContainerInfo> containerInfo = Optional.empty(); |
jenkinsci/mesos-plugin | src/test/java/org/jenkinsci/plugins/mesos/MesosJenkinsAgentTest.java | // Path: src/test/java/org/jenkinsci/plugins/mesos/fixture/AgentSpecMother.java
// public class AgentSpecMother {
//
// public static final MesosAgentSpecTemplate simple =
// new MesosAgentSpecTemplate(
// "label",
// Mode.EXCLUSIVE,
// "0.1",
// "32",
// 1,
//... | import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertThrows;
import akka.actor.ActorSystem;
import akka.stream.ActorMaterializer;
impo... | package org.jenkinsci.plugins.mesos;
@ExtendWith(TestUtils.JenkinsParameterResolver.class)
public class MesosJenkinsAgentTest {
static ActorSystem system = ActorSystem.create("agent-test");
static ActorMaterializer materializer = ActorMaterializer.create(system);
@Test
void shortcircuitWaitUntilOnline(Test... | // Path: src/test/java/org/jenkinsci/plugins/mesos/fixture/AgentSpecMother.java
// public class AgentSpecMother {
//
// public static final MesosAgentSpecTemplate simple =
// new MesosAgentSpecTemplate(
// "label",
// Mode.EXCLUSIVE,
// "0.1",
// "32",
// 1,
//... | AgentSpecMother.simple, |
jenkinsci/mesos-plugin | src/test/java/org/jenkinsci/plugins/mesos/api/SessionTest.java | // Path: src/test/java/org/jenkinsci/plugins/mesos/TestUtils.java
// public class TestUtils {
// public static class JenkinsRule extends org.jvnet.hudson.test.JenkinsRule {
// private final ParameterContext context;
//
// JenkinsRule(ParameterContext context) {
// this.context = context;
// }
//
/... | import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import akka.NotUsed;
import akka.actor.ActorSystem;
import akka.stream.ActorMaterializer;
import akka.stream.QueueOfferResult;
import akka.stream.javadsl.Flow;
import akka.stream.javadsl.SourceQueueWithComplete;
import com.meso... | package org.jenkinsci.plugins.mesos.api;
@ExtendWith(JenkinsParameterResolver.class)
public class SessionTest {
private static final Logger logger = LoggerFactory.getLogger(SessionTest.class);
static ActorSystem system = ActorSystem.create("mesos-scheduler-test");
static ActorMaterializer materializer = Acto... | // Path: src/test/java/org/jenkinsci/plugins/mesos/TestUtils.java
// public class TestUtils {
// public static class JenkinsRule extends org.jvnet.hudson.test.JenkinsRule {
// private final ParameterContext context;
//
// JenkinsRule(ParameterContext context) {
// this.context = context;
// }
//
/... | public void testLaunchOverflow(TestUtils.JenkinsRule j) throws Exception { |
jenkinsci/mesos-plugin | src/main/java/org/jenkinsci/plugins/mesos/MesosSlaveInfo.java | // Path: src/main/java/org/jenkinsci/plugins/mesos/MesosAgentSpecTemplate.java
// public static class ContainerInfo extends AbstractDescribableImpl<ContainerInfo> {
//
// private final String type;
// private final String dockerImage;
// private final List<Volume> volumes;
// private final Network networking;
... | import com.google.common.annotations.VisibleForTesting;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
import hudson.model.Node;
import java.util.Iterator;
import java.util.List;
import net.sf.json.JSONExce... | package org.jenkinsci.plugins.mesos;
/**
* This POJO describes a Jenkins agent for Mesos on 0.x and 1.x of the plugin. It is used to migrate
* older configurations to {@link MesosAgentSpecTemplate} during deserialization. See {@link
* MesosCloud#readResolve()} for the full migration.
*/
public class MesosSlaveInf... | // Path: src/main/java/org/jenkinsci/plugins/mesos/MesosAgentSpecTemplate.java
// public static class ContainerInfo extends AbstractDescribableImpl<ContainerInfo> {
//
// private final String type;
// private final String dockerImage;
// private final List<Volume> volumes;
// private final Network networking;
... | private transient ContainerInfo containerInfo; |
jenkinsci/mesos-plugin | src/test/java/org/jenkinsci/plugins/mesos/MesosAgentSpecTemplateDescriptorTest.java | // Path: src/main/java/org/jenkinsci/plugins/mesos/MesosAgentSpecTemplate.java
// @Extension
// public static final class DescriptorImpl extends Descriptor<MesosAgentSpecTemplate> {
//
// public DescriptorImpl() {
// load();
// }
//
// /**
// * Validate that CPUs is a positive double.
// *
// * @pa... | import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import hudson.util.FormValidation.Kind;
import org.jenkinsci.plugins.mesos.MesosAgentSpecTemplate.DescriptorImpl;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; | package org.jenkinsci.plugins.mesos;
@ExtendWith(TestUtils.JenkinsParameterResolver.class)
public class MesosAgentSpecTemplateDescriptorTest {
@Test
public void validateCpus(TestUtils.JenkinsRule j) { | // Path: src/main/java/org/jenkinsci/plugins/mesos/MesosAgentSpecTemplate.java
// @Extension
// public static final class DescriptorImpl extends Descriptor<MesosAgentSpecTemplate> {
//
// public DescriptorImpl() {
// load();
// }
//
// /**
// * Validate that CPUs is a positive double.
// *
// * @pa... | MesosAgentSpecTemplate.DescriptorImpl descriptor = new DescriptorImpl(); |
jenkinsci/mesos-plugin | src/test/java/org/jenkinsci/plugins/mesos/integration/MesosJenkinsAgentLifecycleTest.java | // Path: src/test/java/org/jenkinsci/plugins/mesos/fixture/AgentSpecMother.java
// public class AgentSpecMother {
//
// public static final MesosAgentSpecTemplate simple =
// new MesosAgentSpecTemplate(
// "label",
// Mode.EXCLUSIVE,
// "0.1",
// "32",
// 1,
//... | import static org.awaitility.Awaitility.await;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertThrows;
import akka.actor.ActorSystem;
import akka.stream.ActorMaterializer;
impor... | package org.jenkinsci.plugins.mesos.integration;
@ExtendWith(TestUtils.JenkinsParameterResolver.class)
@IntegrationTest
public class MesosJenkinsAgentLifecycleTest {
@RegisterExtension static ZookeeperServerExtension zkServer = new ZookeeperServerExtension();
static ActorSystem system = ActorSystem.create("mes... | // Path: src/test/java/org/jenkinsci/plugins/mesos/fixture/AgentSpecMother.java
// public class AgentSpecMother {
//
// public static final MesosAgentSpecTemplate simple =
// new MesosAgentSpecTemplate(
// "label",
// Mode.EXCLUSIVE,
// "0.1",
// "32",
// 1,
//... | final MesosAgentSpecTemplate spec = AgentSpecMother.simple; |
IYCI/MyClass | app/src/main/java/com/YC2010/MyClass/utils/Constants.java | // Path: app/src/main/java/com/YC2010/MyClass/model/Reminder_item.java
// public class Reminder_item {
// // variables
// String id;
// String title;
// String location;
// GregorianCalendar mClaendar;
// String type;
//
// // type:
// // "c" customized
// // "e" exams
// ... | import com.YC2010.MyClass.model.Reminder_item;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.UUID; | package com.YC2010.MyClass.utils;
/**
* Created by Danny on 2015/6/27.
*/
public class Constants {
public static String UWAPIROOT = "https://api.uwaterloo.ca/v2/"; | // Path: app/src/main/java/com/YC2010/MyClass/model/Reminder_item.java
// public class Reminder_item {
// // variables
// String id;
// String title;
// String location;
// GregorianCalendar mClaendar;
// String type;
//
// // type:
// // "c" customized
// // "e" exams
// ... | public static List<Reminder_item> holiday_2015; |
IYCI/MyClass | app/src/main/java/com/YC2010/MyClass/data/ReminderDBHandler.java | // Path: app/src/main/java/com/YC2010/MyClass/model/Reminder_item.java
// public class Reminder_item {
// // variables
// String id;
// String title;
// String location;
// GregorianCalendar mClaendar;
// String type;
//
// // type:
// // "c" customized
// // "e" exams
// ... | import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteStatement;
import android.util.Log;
import com.YC2010.MyClass.model.Reminder_item;
im... | package com.YC2010.MyClass.data;
/**
* Created by Jason on 2015-06-02.
*/
public class ReminderDBHandler extends SQLiteOpenHelper {
// DB Version
private static final int DATABASE_VERSION = 3;
// DB Name
private static final String DATABASE_NAME = "ReminderManager";
// Table name
private... | // Path: app/src/main/java/com/YC2010/MyClass/model/Reminder_item.java
// public class Reminder_item {
// // variables
// String id;
// String title;
// String location;
// GregorianCalendar mClaendar;
// String type;
//
// // type:
// // "c" customized
// // "e" exams
// ... | public void addReminder(Reminder_item reminder) { |
IYCI/MyClass | app/src/main/java/com/YC2010/MyClass/ui/fragments/SearchExamFragment.java | // Path: app/src/main/java/com/YC2010/MyClass/ui/adapters/FinalsListAdapter.java
// public class FinalsListAdapter extends BaseAdapter {
// ArrayList<FinalObject> mArrayList;
// Context mContext;
// LayoutInflater mLayoutInflater;
//
// public FinalsListAdapter(Context context, int textViewResourceId, ... | import android.app.Activity;
import android.app.Fragment;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.Tex... | package com.YC2010.MyClass.ui.fragments;
/**
* Created by Danny on 2015/12/26.
*/
public class SearchExamFragment extends Fragment {
private Activity mActivity;
private View mView;
private Bundle mFetchedResult;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate... | // Path: app/src/main/java/com/YC2010/MyClass/ui/adapters/FinalsListAdapter.java
// public class FinalsListAdapter extends BaseAdapter {
// ArrayList<FinalObject> mArrayList;
// Context mContext;
// LayoutInflater mLayoutInflater;
//
// public FinalsListAdapter(Context context, int textViewResourceId, ... | FinalsListAdapter FinalsAdapter = new FinalsListAdapter(mActivity, R.layout.section_item, mFetchedResult); |
IYCI/MyClass | app/src/main/java/com/YC2010/MyClass/ui/adapters/FinalsListAdapter.java | // Path: app/src/main/java/com/YC2010/MyClass/model/FinalObject.java
// public class FinalObject implements Parcelable {
// private String section;
// private String time;
// private String location;
// private String date;
// private boolean isOnline;
//
// public FinalObject() {}
//
// @... | import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.YC2010.MyClass.model.FinalObject;
import com.YC2010.MyClass.utils.... | package com.YC2010.MyClass.ui.adapters;
public class FinalsListAdapter extends BaseAdapter {
ArrayList<FinalObject> mArrayList;
Context mContext;
LayoutInflater mLayoutInflater;
public FinalsListAdapter(Context context, int textViewResourceId, Bundle bundle) {
mLayoutInflater = LayoutInflat... | // Path: app/src/main/java/com/YC2010/MyClass/model/FinalObject.java
// public class FinalObject implements Parcelable {
// private String section;
// private String time;
// private String location;
// private String date;
// private boolean isOnline;
//
// public FinalObject() {}
//
// @... | mArrayList = bundle.getParcelableArrayList(Constants.finalObjectListKey); |
IYCI/MyClass | app/src/main/java/com/YC2010/MyClass/ui/adapters/TutListAdapter.java | // Path: app/src/main/java/com/YC2010/MyClass/model/TutorialObject.java
// public class TutorialObject implements Parcelable {
// private String number;
// private String section;
// private String time;
// private String location;
// private String capacity;
// private String total;
//
// ... | import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.YC2010.MyClass.model.TutorialObject;
import com.YC2010.MyClass.uti... | package com.YC2010.MyClass.ui.adapters;
public class TutListAdapter extends BaseAdapter {
ArrayList<TutorialObject> mArrayList;
Context mContext;
LayoutInflater mLayoutInflater;
public TutListAdapter(Context context, int textViewResourceId, Bundle bundle) {
mLayoutInflater = LayoutInflater.... | // Path: app/src/main/java/com/YC2010/MyClass/model/TutorialObject.java
// public class TutorialObject implements Parcelable {
// private String number;
// private String section;
// private String time;
// private String location;
// private String capacity;
// private String total;
//
// ... | mArrayList = bundle.getParcelableArrayList(Constants.tutorialObjectListKey); |
IYCI/MyClass | app/src/main/java/com/YC2010/MyClass/ui/fragments/CatalogNumFragment.java | // Path: app/src/main/java/com/YC2010/MyClass/callbacks/AsyncTaskCallbackInterface.java
// public interface AsyncTaskCallbackInterface {
// public void onOperationComplete(Bundle bundle);
// }
//
// Path: app/src/main/java/com/YC2010/MyClass/data/fetchtasks/CatalogNumFetchTask.java
// public class CatalogNumFetchT... | import android.app.ListFragment;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import com.YC2010.MyClass.callbacks.AsyncTaskCallbackInterface;
import... | package com.YC2010.MyClass.ui.fragments;
/**
* A fragment representing a list of Items.
* <p/>
* <p/>
* Activities containing this fragment MUST implement the {@link OnFragmentInteractionListener}
* interface.
*/
public class CatalogNumFragment extends ListFragment {
// the fragment initialization parame... | // Path: app/src/main/java/com/YC2010/MyClass/callbacks/AsyncTaskCallbackInterface.java
// public interface AsyncTaskCallbackInterface {
// public void onOperationComplete(Bundle bundle);
// }
//
// Path: app/src/main/java/com/YC2010/MyClass/data/fetchtasks/CatalogNumFetchTask.java
// public class CatalogNumFetchT... | final CatalogNumFetchTask catalogNumFetchTask = new CatalogNumFetchTask(mSubject, new AsyncTaskCallbackInterface() { |
IYCI/MyClass | app/src/main/java/com/YC2010/MyClass/ui/fragments/CatalogNumFragment.java | // Path: app/src/main/java/com/YC2010/MyClass/callbacks/AsyncTaskCallbackInterface.java
// public interface AsyncTaskCallbackInterface {
// public void onOperationComplete(Bundle bundle);
// }
//
// Path: app/src/main/java/com/YC2010/MyClass/data/fetchtasks/CatalogNumFetchTask.java
// public class CatalogNumFetchT... | import android.app.ListFragment;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import com.YC2010.MyClass.callbacks.AsyncTaskCallbackInterface;
import... | package com.YC2010.MyClass.ui.fragments;
/**
* A fragment representing a list of Items.
* <p/>
* <p/>
* Activities containing this fragment MUST implement the {@link OnFragmentInteractionListener}
* interface.
*/
public class CatalogNumFragment extends ListFragment {
// the fragment initialization parame... | // Path: app/src/main/java/com/YC2010/MyClass/callbacks/AsyncTaskCallbackInterface.java
// public interface AsyncTaskCallbackInterface {
// public void onOperationComplete(Bundle bundle);
// }
//
// Path: app/src/main/java/com/YC2010/MyClass/data/fetchtasks/CatalogNumFetchTask.java
// public class CatalogNumFetchT... | final CatalogNumFetchTask catalogNumFetchTask = new CatalogNumFetchTask(mSubject, new AsyncTaskCallbackInterface() { |
IYCI/MyClass | app/src/main/java/com/YC2010/MyClass/ui/adapters/TstListAdapter.java | // Path: app/src/main/java/com/YC2010/MyClass/utils/Constants.java
// public class Constants {
// public static String UWAPIROOT = "https://api.uwaterloo.ca/v2/";
// public static List<Reminder_item> holiday_2015;
// public static List<Reminder_item> sample_reminder;
//
// public static String lectureS... | import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.YC2010.MyClass.utils.Constants;
import com.YC2010.MyClass.model.Te... | package com.YC2010.MyClass.ui.adapters;
public class TstListAdapter extends BaseAdapter {
ArrayList<TestObject> mArrayList;
Context mContext;
LayoutInflater mLayoutInflater;
public TstListAdapter(Context context, int textViewResourceId, Bundle bundle) {
mLayoutInflater = LayoutInflater.from... | // Path: app/src/main/java/com/YC2010/MyClass/utils/Constants.java
// public class Constants {
// public static String UWAPIROOT = "https://api.uwaterloo.ca/v2/";
// public static List<Reminder_item> holiday_2015;
// public static List<Reminder_item> sample_reminder;
//
// public static String lectureS... | mArrayList = bundle.getParcelableArrayList(Constants.testObjectListKey); |
IYCI/MyClass | app/src/main/java/com/YC2010/MyClass/data/Connections.java | // Path: app/src/main/java/com/YC2010/MyClass/utils/Constants.java
// public class Constants {
// public static String UWAPIROOT = "https://api.uwaterloo.ca/v2/";
// public static List<Reminder_item> holiday_2015;
// public static List<Reminder_item> sample_reminder;
//
// public static String lectureS... | import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
import com.YC2010.MyClass.utils.Constants;
import com.YC2010.MyClass.utils.Tools;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.BufferedReade... | package com.YC2010.MyClass.data;
/**
* Created by Danny on 2015/10/25.
*/
public class Connections {
// /courses/{subject}/{catalog_number}
public static String getCourseInfoURL(String input) {
String subject = "";
String cataNum = "";
boolean isCoursePrefix = true;
inp... | // Path: app/src/main/java/com/YC2010/MyClass/utils/Constants.java
// public class Constants {
// public static String UWAPIROOT = "https://api.uwaterloo.ca/v2/";
// public static List<Reminder_item> holiday_2015;
// public static List<Reminder_item> sample_reminder;
//
// public static String lectureS... | return Constants.UWAPIROOT + "courses/" + subject + "/" + cataNum + ".json" + URLEnding(); |
kuaijibird/palmsuda | src/com/mialab/palmsuda/tools/util/FileUtils.java | // Path: src/com/mialab/palmsuda/common/Constants.java
// public class Constants {
// public static boolean TEST_MODE = false;
// public static boolean DEBUG_MODE =true;
// public static final String APP_TAG = "PalmSuda";
// public static final String APP_DIR = "PalmSuda";
// public static final String APP_CACHE ... | import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import com.mialab.palmsuda.common.Constants;
import android.content.Context;
import android.os.Environment;
import a... | * @param fileName
* @return
*/
public boolean isFileExist(String fileName) {
File file = new File(FileUtils.getSDPath() + fileName);
return file.exists();
}
public boolean delExistFile(String fileName) {
File file = new File(FileUtils.getSDPath() + fileName);
if (file.exists()) {
return file.delete... | // Path: src/com/mialab/palmsuda/common/Constants.java
// public class Constants {
// public static boolean TEST_MODE = false;
// public static boolean DEBUG_MODE =true;
// public static final String APP_TAG = "PalmSuda";
// public static final String APP_DIR = "PalmSuda";
// public static final String APP_CACHE ... | + "/" + Constants.APP_DIR;// 获取根目录 |
Asqatasun/Contrast-Finder | engine/impl/src/main/java/org/asqatasun/contrastfinder/result/factory/ColorResultFactoryImpl.java | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/result/ColorResult.java
// public interface ColorResult {
//
// /**
// * @param foreground
// * @param backgroud
// * @param threashold
// */
// void setSubmittedColors(Color foreground, Color backgroud, Float threashold);
//
/... | import org.asqatasun.contrastfinder.result.ColorResult;
import org.asqatasun.contrastfinder.result.ColorResultImpl; | /*
* Contrast Finder
* Copyright (C) 2008-2019 Contrast-Finder.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any la... | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/result/ColorResult.java
// public interface ColorResult {
//
// /**
// * @param foreground
// * @param backgroud
// * @param threashold
// */
// void setSubmittedColors(Color foreground, Color backgroud, Float threashold);
//
/... | public ColorResult getColorResult() { |
Asqatasun/Contrast-Finder | engine/impl/src/main/java/org/asqatasun/contrastfinder/result/factory/ColorResultFactoryImpl.java | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/result/ColorResult.java
// public interface ColorResult {
//
// /**
// * @param foreground
// * @param backgroud
// * @param threashold
// */
// void setSubmittedColors(Color foreground, Color backgroud, Float threashold);
//
/... | import org.asqatasun.contrastfinder.result.ColorResult;
import org.asqatasun.contrastfinder.result.ColorResultImpl; | /*
* Contrast Finder
* Copyright (C) 2008-2019 Contrast-Finder.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any la... | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/result/ColorResult.java
// public interface ColorResult {
//
// /**
// * @param foreground
// * @param backgroud
// * @param threashold
// */
// void setSubmittedColors(Color foreground, Color backgroud, Float threashold);
//
/... | return (new ColorResultImpl(new ColorCombinaisonFactoryImpl())); |
Asqatasun/Contrast-Finder | engine/hsv/src/test/java/org/asqatasun/contrastfinder/hsv/ColorFinderHsvTest.java | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/result/ColorCombinaison.java
// public interface ColorCombinaison {
//
//
// /**
// * @return Gap
// */
// Float getGap();
//
// /**
// * @return Color object
// */
// Color getColor();
//
// /**
// * @param ... | import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import static junit.framework.Assert.assertEquals;
import junit.framework.TestCase;
import org.junit.Test; // Junit 4 anotation @Test
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.asqatasun.contrastfinder.result.ColorCombin... | /*
* Contrast Finder
* Copyright (C) 2008-2019 Contrast-Finder.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any la... | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/result/ColorCombinaison.java
// public interface ColorCombinaison {
//
//
// /**
// * @return Gap
// */
// Float getGap();
//
// /**
// * @return Color object
// */
// Color getColor();
//
// /**
// * @param ... | List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>(); |
Asqatasun/Contrast-Finder | engine/api/src/main/java/org/asqatasun/contrastfinder/ColorFinder.java | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/result/ColorResult.java
// public interface ColorResult {
//
// /**
// * @param foreground
// * @param backgroud
// * @param threashold
// */
// void setSubmittedColors(Color foreground, Color backgroud, Float threashold);
//
/... | import java.awt.Color;
import org.asqatasun.contrastfinder.result.ColorResult; | /*
* Contrast Finder
* Copyright (C) 2008-2019 Contrast-Finder.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any la... | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/result/ColorResult.java
// public interface ColorResult {
//
// /**
// * @param foreground
// * @param backgroud
// * @param threashold
// */
// void setSubmittedColors(Color foreground, Color backgroud, Float threashold);
//
/... | ColorResult getColorResult(); |
Asqatasun/Contrast-Finder | engine/impl/src/main/java/org/asqatasun/contrastfinder/factory/ColorFinderFactoryImpl.java | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/ColorFinder.java
// public interface ColorFinder {
//
// /**
// * @param foregroundColor
// * @param backgroundColor
// * @param isBackgroundTested
// * @param coefficientLevel
// */
// void findColors (
// Colo... | import org.asqatasun.contrastfinder.ColorFinder;
import java.util.HashMap;
import java.util.Map; | /*
* Contrast Finder
* Copyright (C) 2008-2019 Contrast-Finder.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any la... | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/ColorFinder.java
// public interface ColorFinder {
//
// /**
// * @param foregroundColor
// * @param backgroundColor
// * @param isBackgroundTested
// * @param coefficientLevel
// */
// void findColors (
// Colo... | public ColorFinder getColorFinder(String colorFinderKey) { |
Asqatasun/Contrast-Finder | engine/impl/src/main/java/org/asqatasun/contrastfinder/result/ColorResultImpl.java | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/result/factory/ColorCombinaisonFactory.java
// public interface ColorCombinaisonFactory {
//
// /**
// *
// * @param color1
// * @param color2
// * @param threashold
// * @return a ColorCombinaison instance
// */
// Co... | import java.awt.Color;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
import org.asqatasun.contrastfinder.result.factory.ColorCombinaisonFactory;
import org.asqatasun.utils.distancecalculator.DistanceCalculator; | /*
* Contrast Finder
* Copyright (C) 2008-2019 Contrast-Finder.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any la... | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/result/factory/ColorCombinaisonFactory.java
// public interface ColorCombinaisonFactory {
//
// /**
// *
// * @param color1
// * @param color2
// * @param threashold
// * @return a ColorCombinaison instance
// */
// Co... | private ColorCombinaisonFactory colorCombinaisonFactory; |
Asqatasun/Contrast-Finder | engine/impl/src/main/java/org/asqatasun/contrastfinder/result/ColorResultImpl.java | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/result/factory/ColorCombinaisonFactory.java
// public interface ColorCombinaisonFactory {
//
// /**
// *
// * @param color1
// * @param color2
// * @param threashold
// * @return a ColorCombinaison instance
// */
// Co... | import java.awt.Color;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
import org.asqatasun.contrastfinder.result.factory.ColorCombinaisonFactory;
import org.asqatasun.utils.distancecalculator.DistanceCalculator; | public Float getThreashold() {
return Float.valueOf(submittedColors.getThreshold().floatValue());
}
@Override
public void setSubmittedColors(Color colorToChange, Color colorToKeep, Float threashold) {
submittedColors =
colorCombinaisonFactory.getColorCombinaison(
... | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/result/factory/ColorCombinaisonFactory.java
// public interface ColorCombinaisonFactory {
//
// /**
// *
// * @param color1
// * @param color2
// * @param threashold
// * @return a ColorCombinaison instance
// */
// Co... | colorCombinaison.setDistanceFromInitialColor(DistanceCalculator.calculate(submittedColors.getColor(), colorCombinaison.getColor())); |
Asqatasun/Contrast-Finder | engine/hsv/src/test/java/org/asqatasun/contrastfinder/hsv/ColorFinderRgbTest.java | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/result/ColorCombinaison.java
// public interface ColorCombinaison {
//
//
// /**
// * @return Gap
// */
// Float getGap();
//
// /**
// * @return Color object
// */
// Color getColor();
//
// /**
// * @param ... | import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import junit.framework.TestCase;
import org.junit.Test; // Junit 4 anotation @Test
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.asqatasun.contrastfinder.result.ColorCombinaison; | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.asqatasun.contrastfinder.hsv;
/**
*
* @author alingua
*/
public class ColorFinderRgbTest extends TestCase {
private static final Logger LOGGER = LoggerFactory.getLogger(ColorFinderRgbTest.class);
... | // Path: engine/api/src/main/java/org/asqatasun/contrastfinder/result/ColorCombinaison.java
// public interface ColorCombinaison {
//
//
// /**
// * @return Gap
// */
// Float getGap();
//
// /**
// * @return Color object
// */
// Color getColor();
//
// /**
// * @param ... | List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>(); |
michaeltandy/contraction-hierarchies | src/main/java/uk/me/mjt/ch/ContractedDijkstra.java | // Path: src/main/java/uk/me/mjt/ch/PartialSolution.java
// public static class DownwardSolution extends PartialSolution {
// public DownwardSolution(List<DijkstraSolution> ds) {
// super(ds);
// }
// public DownwardSolution(ByteBuffer bb) {
// super(bb);
// }
// }
//
// Path: src/main/... | import java.nio.IntBuffer;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.*;
import uk.me.mjt.ch.PartialSolution.DownwardSolution;
import uk.me.mjt.ch.PartialSolution.UpwardSolution; |
package uk.me.mjt.ch;
public class ContractedDijkstra {
public static DijkstraSolution contractedGraphDijkstra(MapData allNodes, Node startNode, Node endNode, ExecutorService es) {
throw new UnsupportedOperationException("Temporarily broken");
}
/*public static DijkstraSolution contrac... | // Path: src/main/java/uk/me/mjt/ch/PartialSolution.java
// public static class DownwardSolution extends PartialSolution {
// public DownwardSolution(List<DijkstraSolution> ds) {
// super(ds);
// }
// public DownwardSolution(ByteBuffer bb) {
// super(bb);
// }
// }
//
// Path: src/main/... | UpwardSolution upwardSolution = calculateUpwardSolution(startNode); |
michaeltandy/contraction-hierarchies | src/main/java/uk/me/mjt/ch/ContractedDijkstra.java | // Path: src/main/java/uk/me/mjt/ch/PartialSolution.java
// public static class DownwardSolution extends PartialSolution {
// public DownwardSolution(List<DijkstraSolution> ds) {
// super(ds);
// }
// public DownwardSolution(ByteBuffer bb) {
// super(bb);
// }
// }
//
// Path: src/main/... | import java.nio.IntBuffer;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.*;
import uk.me.mjt.ch.PartialSolution.DownwardSolution;
import uk.me.mjt.ch.PartialSolution.UpwardSolution; |
package uk.me.mjt.ch;
public class ContractedDijkstra {
public static DijkstraSolution contractedGraphDijkstra(MapData allNodes, Node startNode, Node endNode, ExecutorService es) {
throw new UnsupportedOperationException("Temporarily broken");
}
/*public static DijkstraSolution contrac... | // Path: src/main/java/uk/me/mjt/ch/PartialSolution.java
// public static class DownwardSolution extends PartialSolution {
// public DownwardSolution(List<DijkstraSolution> ds) {
// super(ds);
// }
// public DownwardSolution(ByteBuffer bb) {
// super(bb);
// }
// }
//
// Path: src/main/... | DownwardSolution downwardSolution = calculateDownwardSolution(endNode); |
michaeltandy/contraction-hierarchies | src/main/java/uk/me/mjt/ch/cache/UpAndDownPair.java | // Path: src/main/java/uk/me/mjt/ch/PartialSolution.java
// public static class DownwardSolution extends PartialSolution {
// public DownwardSolution(List<DijkstraSolution> ds) {
// super(ds);
// }
// public DownwardSolution(ByteBuffer bb) {
// super(bb);
// }
// }
//
// Path: src/main/... | import uk.me.mjt.ch.PartialSolution.DownwardSolution;
import uk.me.mjt.ch.PartialSolution.UpwardSolution; |
package uk.me.mjt.ch.cache;
public class UpAndDownPair {
public final UpwardSolution up; | // Path: src/main/java/uk/me/mjt/ch/PartialSolution.java
// public static class DownwardSolution extends PartialSolution {
// public DownwardSolution(List<DijkstraSolution> ds) {
// super(ds);
// }
// public DownwardSolution(ByteBuffer bb) {
// super(bb);
// }
// }
//
// Path: src/main/... | public final DownwardSolution down; |
michaeltandy/contraction-hierarchies | src/main/java/uk/me/mjt/ch/profile/ArrayTimeProfile.java | // Path: src/main/java/uk/me/mjt/ch/Preconditions.java
// public class Preconditions {
// public static void checkNoneNull(Object... args) {
// for (int i=0 ; i<args.length ; i++) {
// if (args[i] == null) {
// throw new IllegalArgumentException("Argument index " + i + " was null... | import java.util.Arrays;
import uk.me.mjt.ch.Preconditions; | if (toCheck[i] < 0)
throw new IllegalArgumentException("Invalid array - negative");
int delta = toCheck[i]-lastVal;
if (delta < -SEGMENT_WIDTH_MS) {
throw new IllegalArgumentException("Invalid array - profile to steep");
... | // Path: src/main/java/uk/me/mjt/ch/Preconditions.java
// public class Preconditions {
// public static void checkNoneNull(Object... args) {
// for (int i=0 ; i<args.length ; i++) {
// if (args[i] == null) {
// throw new IllegalArgumentException("Argument index " + i + " was null... | Preconditions.checkNoneNull(after); |
michaeltandy/contraction-hierarchies | src/main/java/uk/me/mjt/ch/MapData.java | // Path: src/main/java/uk/me/mjt/ch/status/DiscardingStatusMonitor.java
// public class DiscardingStatusMonitor implements StatusMonitor {
// @Override
// public void updateStatus(MonitoredProcess process, long completed, long total) { }
// }
//
// Path: src/main/java/uk/me/mjt/ch/status/MonitoredProcess.java
... | import java.util.*;
import java.util.concurrent.atomic.AtomicLong;
import uk.me.mjt.ch.status.DiscardingStatusMonitor;
import uk.me.mjt.ch.status.MonitoredProcess;
import uk.me.mjt.ch.status.StatusMonitor; |
package uk.me.mjt.ch;
public class MapData {
private final HashMap<Long,Node> nodesById;
private final Set<TurnRestriction> turnRestrictions;
private final AtomicLong maxEdgeId = new AtomicLong();
private final Multimap<Long,Node> nodesBySourceDataNodeId = new Multimap<>();
public MapData(Co... | // Path: src/main/java/uk/me/mjt/ch/status/DiscardingStatusMonitor.java
// public class DiscardingStatusMonitor implements StatusMonitor {
// @Override
// public void updateStatus(MonitoredProcess process, long completed, long total) { }
// }
//
// Path: src/main/java/uk/me/mjt/ch/status/MonitoredProcess.java
... | this(indexNodesById(nodes), new HashSet(), new DiscardingStatusMonitor()); |
michaeltandy/contraction-hierarchies | src/main/java/uk/me/mjt/ch/MapData.java | // Path: src/main/java/uk/me/mjt/ch/status/DiscardingStatusMonitor.java
// public class DiscardingStatusMonitor implements StatusMonitor {
// @Override
// public void updateStatus(MonitoredProcess process, long completed, long total) { }
// }
//
// Path: src/main/java/uk/me/mjt/ch/status/MonitoredProcess.java
... | import java.util.*;
import java.util.concurrent.atomic.AtomicLong;
import uk.me.mjt.ch.status.DiscardingStatusMonitor;
import uk.me.mjt.ch.status.MonitoredProcess;
import uk.me.mjt.ch.status.StatusMonitor; |
package uk.me.mjt.ch;
public class MapData {
private final HashMap<Long,Node> nodesById;
private final Set<TurnRestriction> turnRestrictions;
private final AtomicLong maxEdgeId = new AtomicLong();
private final Multimap<Long,Node> nodesBySourceDataNodeId = new Multimap<>();
public MapData(Co... | // Path: src/main/java/uk/me/mjt/ch/status/DiscardingStatusMonitor.java
// public class DiscardingStatusMonitor implements StatusMonitor {
// @Override
// public void updateStatus(MonitoredProcess process, long completed, long total) { }
// }
//
// Path: src/main/java/uk/me/mjt/ch/status/MonitoredProcess.java
... | public MapData(HashMap<Long,Node> nodesById, Set<TurnRestriction> turnRestrictions, StatusMonitor monitor) { |
michaeltandy/contraction-hierarchies | src/main/java/uk/me/mjt/ch/MapData.java | // Path: src/main/java/uk/me/mjt/ch/status/DiscardingStatusMonitor.java
// public class DiscardingStatusMonitor implements StatusMonitor {
// @Override
// public void updateStatus(MonitoredProcess process, long completed, long total) { }
// }
//
// Path: src/main/java/uk/me/mjt/ch/status/MonitoredProcess.java
... | import java.util.*;
import java.util.concurrent.atomic.AtomicLong;
import uk.me.mjt.ch.status.DiscardingStatusMonitor;
import uk.me.mjt.ch.status.MonitoredProcess;
import uk.me.mjt.ch.status.StatusMonitor; |
package uk.me.mjt.ch;
public class MapData {
private final HashMap<Long,Node> nodesById;
private final Set<TurnRestriction> turnRestrictions;
private final AtomicLong maxEdgeId = new AtomicLong();
private final Multimap<Long,Node> nodesBySourceDataNodeId = new Multimap<>();
public MapData(Co... | // Path: src/main/java/uk/me/mjt/ch/status/DiscardingStatusMonitor.java
// public class DiscardingStatusMonitor implements StatusMonitor {
// @Override
// public void updateStatus(MonitoredProcess process, long completed, long total) { }
// }
//
// Path: src/main/java/uk/me/mjt/ch/status/MonitoredProcess.java
... | monitor.updateStatus(MonitoredProcess.INDEX_MAP_DATA, nodesCheckedSoFar, nodesById.size()); |
michaeltandy/contraction-hierarchies | src/main/java/uk/me/mjt/ch/AdjustGraphForRestrictions.java | // Path: src/main/java/uk/me/mjt/ch/TurnRestriction.java
// public static enum TurnRestrictionType { NOT_ALLOWED, ONLY_ALLOWED }
| import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.concurrent.atomic.AtomicLong;
import uk.me.mjt.ch.TurnRestriction.TurnRestrictionType; |
return new NodeAndState(toNode, turnRestrictionsAfter, aos, gs, us, toEdge);
}
private HashSet<TurnRestriction> getUpdatedTurnRestrictionsIfLegal(DirectedEdge fromEdge, NodeAndState fromNode, DirectedEdge toEdge, Multimap<Long,TurnRestriction> turnRestrictionsByStartEdge, DirectedEdge prio... | // Path: src/main/java/uk/me/mjt/ch/TurnRestriction.java
// public static enum TurnRestrictionType { NOT_ALLOWED, ONLY_ALLOWED }
// Path: src/main/java/uk/me/mjt/ch/AdjustGraphForRestrictions.java
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.c... | if (tr.type == TurnRestrictionType.ONLY_ALLOWED && !restrictionCoversMove) { |
michaeltandy/contraction-hierarchies | src/test/java/uk/me/mjt/ch/MakeTestData.java | // Path: src/main/java/uk/me/mjt/ch/status/DiscardingStatusMonitor.java
// public class DiscardingStatusMonitor implements StatusMonitor {
// @Override
// public void updateStatus(MonitoredProcess process, long completed, long total) { }
// }
| import java.util.*;
import uk.me.mjt.ch.status.DiscardingStatusMonitor; | /**
* No right turn 3->2->5
* <pre>
* 1 4
* | |
* 2---5
* | |
* 3 6
* </pre>
*/
public static MapData makeTurnRestrictedH() {
HashMap<Long,Node> nodes = new HashMap();
for (long i=1 ; i<=6 ; i++) {
nodes.put(i, new Node(i... | // Path: src/main/java/uk/me/mjt/ch/status/DiscardingStatusMonitor.java
// public class DiscardingStatusMonitor implements StatusMonitor {
// @Override
// public void updateStatus(MonitoredProcess process, long completed, long total) { }
// }
// Path: src/test/java/uk/me/mjt/ch/MakeTestData.java
import java.u... | return new MapData(nodes,Collections.singleton(tr), new DiscardingStatusMonitor()); |
michaeltandy/contraction-hierarchies | src/main/java/uk/me/mjt/ch/GraphContractor.java | // Path: src/main/java/uk/me/mjt/ch/Dijkstra.java
// public enum Direction{FORWARDS,BACKWARDS};
| import uk.me.mjt.ch.Dijkstra.Direction;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java... | DirectedEdge newShortcut = s.cloneWithEdgeId(allNodes.getEdgeIdCounter().incrementAndGet());
newShortcut.from.edgesFrom.add(newShortcut);
newShortcut.to.edgesTo.add(newShortcut);
}
n.contractionOrder = order;
}
public ArrayList<DirectedEdge> findShortcuts... | // Path: src/main/java/uk/me/mjt/ch/Dijkstra.java
// public enum Direction{FORWARDS,BACKWARDS};
// Path: src/main/java/uk/me/mjt/ch/GraphContractor.java
import uk.me.mjt.ch.Dijkstra.Direction;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.concurren... | Direction.FORWARDS); |
sindremehus/subsonic | subsonic-main/src/test/java/net/sourceforge/subsonic/io/RangeOutputStreamTestCase.java | // Path: subsonic-main/src/main/java/net/sourceforge/subsonic/util/HttpRange.java
// public class HttpRange {
//
// private static final Pattern PATTERN = Pattern.compile("bytes=(\\d+)-(\\d*)");
// private final Long firstBytePos;
// private final Long lastBytePos;
//
// /**
// * Parses the given... | import junit.framework.TestCase;
import net.sourceforge.subsonic.util.HttpRange;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream; | doTestWrap(0, 99, 100, 100);
doTestWrap(10, 99, 100, 1);
doTestWrap(10, 99, 100, 10);
doTestWrap(10, 99, 100, 13);
doTestWrap(10, 99, 100, 70);
doTestWrap(10, 99, 100, 100);
doTestWrap(66, 66, 100, 1);
doTestWrap(66, 66, 100, 2);
doTestWrap(10, ... | // Path: subsonic-main/src/main/java/net/sourceforge/subsonic/util/HttpRange.java
// public class HttpRange {
//
// private static final Pattern PATTERN = Pattern.compile("bytes=(\\d+)-(\\d*)");
// private final Long firstBytePos;
// private final Long lastBytePos;
//
// /**
// * Parses the given... | OutputStream rangeOut = RangeOutputStream.wrap(out, new HttpRange((long) first, last == null ? null : last.longValue())); |
sindremehus/subsonic | subsonic-main/src/main/java/net/sourceforge/subsonic/dao/ShareDao.java | // Path: subsonic-main/src/main/java/net/sourceforge/subsonic/domain/Share.java
// public class Share {
//
// private int id;
// private String name;
// private String description;
// private String username;
// private Date created;
// private Date expires;
// private Date lastVisited;
// ... | import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import net.sourceforge.subsonic.domain.MusicFolder;
import net.sourceforge.subsonic.domain.Sha... | /*
This file is part of Subsonic.
Subsonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Subsonic is distributed in the hope that i... | // Path: subsonic-main/src/main/java/net/sourceforge/subsonic/domain/Share.java
// public class Share {
//
// private int id;
// private String name;
// private String description;
// private String username;
// private Date created;
// private Date expires;
// private Date lastVisited;
// ... | public synchronized void createShare(Share share) { |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/ResourceOwnerPasswordTokenRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.entities.XWwwFormUrlEncodedEntity;
import org.dmfs.iterables.elementary.PresentValues;
import org.dmfs.jems.iterable.composite.Joined;
import org.dmfs.jems.iterable.elementary.Seq;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmf... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | public ResourceOwnerPasswordTokenRequest(OAuth2Scope scope, CharSequence username, CharSequence password) |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/ResourceOwnerPasswordTokenRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.entities.XWwwFormUrlEncodedEntity;
import org.dmfs.iterables.elementary.PresentValues;
import org.dmfs.jems.iterable.composite.Joined;
import org.dmfs.jems.iterable.elementary.Seq;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmf... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | new GrantTypeParam("password"), |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/ResourceOwnerPasswordTokenRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.entities.XWwwFormUrlEncodedEntity;
import org.dmfs.iterables.elementary.PresentValues;
import org.dmfs.jems.iterable.composite.Joined;
import org.dmfs.jems.iterable.elementary.Seq;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmf... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | new UsernameParam(username), |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/ResourceOwnerPasswordTokenRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.entities.XWwwFormUrlEncodedEntity;
import org.dmfs.iterables.elementary.PresentValues;
import org.dmfs.jems.iterable.composite.Joined;
import org.dmfs.jems.iterable.elementary.Seq;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmf... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | new PasswordParam(password)), |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/ResourceOwnerPasswordTokenRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.entities.XWwwFormUrlEncodedEntity;
import org.dmfs.iterables.elementary.PresentValues;
import org.dmfs.jems.iterable.composite.Joined;
import org.dmfs.jems.iterable.elementary.Seq;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmf... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | new PresentValues<>(new OptionalScopeParam(scope))))); |
dmfs/oauth2-essentials | src/test/java/org/dmfs/oauth2/client/tokens/JsonAccessTokenTest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.jems.hamcrest.matchers.optional.AbsentMatcher;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmfs.oauth2.client.scope.StringScope;
import org.hamcrest.Matchers;
import org.json.JSONObject;
import org.junit.Test;
import static org.dmfs.jems.hamcrest.matchers.optional.PresentMatcher.present;
impor... | /*
* Copyright 2017 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | OAuth2Scope dummyScope = dummy(OAuth2Scope.class); |
dmfs/oauth2-essentials | src/test/java/org/dmfs/oauth2/client/tokens/JsonAccessTokenTest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.jems.hamcrest.matchers.optional.AbsentMatcher;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmfs.oauth2.client.scope.StringScope;
import org.hamcrest.Matchers;
import org.json.JSONObject;
import org.junit.Test;
import static org.dmfs.jems.hamcrest.matchers.optional.PresentMatcher.present;
impor... | /*
* Copyright 2017 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | assertThat(new JsonAccessToken(jsonObject, dummyScope).scope(), Matchers.<OAuth2Scope>is(new StringScope("scope1 scope2"))); |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/OAuth2AuthorizationRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/pkce/PkceCodeChallenge.java
// public interface PkceCodeChallenge
// {
// /**
// * Returns a {@link Token} that identifies the method this code challenge uses.
// *
// * @return A {@link Token} containing the method name.
// */
// Token method();... | import org.dmfs.oauth2.client.pkce.PkceCodeChallenge;
import org.dmfs.rfc3986.Uri;
import java.net.URI; | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/pkce/PkceCodeChallenge.java
// public interface PkceCodeChallenge
// {
// /**
// * Returns a {@link Token} that identifies the method this code challenge uses.
// *
// * @return A {@link Token} containing the method name.
// */
// Token method();... | OAuth2AuthorizationRequest withCodeChallenge(PkceCodeChallenge codeChallenge); |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/BasicOAuth2ClientCredentials.java | // Path: src/main/java/org/dmfs/oauth2/client/http/decorators/BasicAuthHeaderDecoration.java
// public final class BasicAuthHeaderDecoration implements Decoration<Headers>
// {
// // TODO: use a generic authorization header instead (once we have one)
// private final HeaderType<String> AUTHORIZATION_HEADER_TYPE... | import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.decoration.HeaderDecorated;
import org.dmfs.oauth2.client.http.decorators.BasicAuthHeaderDecoration; | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/http/decorators/BasicAuthHeaderDecoration.java
// public final class BasicAuthHeaderDecoration implements Decoration<Headers>
// {
// // TODO: use a generic authorization header instead (once we have one)
// private final HeaderType<String> AUTHORIZATION_HEADER_TYPE... | return new HeaderDecorated<>(request, new BasicAuthHeaderDecoration(mClientId, mClientSecret)); |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/utils/Parameters.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmfs.rfc3986.Uri;
import org.dmfs.rfc3986.parameters.ParameterType;
import org.dmfs.rfc3986.parameters.parametertypes.BasicParameterType;
import org.dmfs.rfc3986.parameters.valuetypes.TextValueType;
import org.dmfs.rfc5545.Duration; | /*
* Copyright 2017 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | public final static ParameterType<OAuth2Scope> SCOPE = new BasicParameterType<OAuth2Scope>("scope", new OAuth2ScopeValueType()); |
dmfs/oauth2-essentials | src/test/java/org/dmfs/oauth2/client/http/requests/RefreshTokenRequestTest.java | // Path: src/main/java/org/dmfs/oauth2/client/scope/StringScope.java
// public final class StringScope implements OAuth2Scope
// {
// private final String mScope;
//
//
// /**
// * Creates an {@link OAuth2Scope} from the given space separated token list.
// *
// * @param scope
// */
// ... | import static org.dmfs.jems.hamcrest.matchers.LambdaMatcher.having;
import static org.dmfs.jems.hamcrest.matchers.optional.PresentMatcher.present;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.allOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat... | /*
* Copyright 2019 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/scope/StringScope.java
// public final class StringScope implements OAuth2Scope
// {
// private final String mScope;
//
//
// /**
// * Creates an {@link OAuth2Scope} from the given space separated token list.
// *
// * @param scope
// */
// ... | HttpRequestEntity entity = new RefreshTokenRequest(new StringScope("s1 s2"), "token").requestEntity(); |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/RefreshTokenRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.entities.XWwwFormUrlEncodedEntity;
import org.dmfs.iterables.elementary.PresentValues;
import org.dmfs.jems.iterable.composite.Joined;
import org.dmfs.jems.iterable.elementary.Seq;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmf... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | public RefreshTokenRequest(CharSequence refreshToken, OAuth2Scope scope) |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/RefreshTokenRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.entities.XWwwFormUrlEncodedEntity;
import org.dmfs.iterables.elementary.PresentValues;
import org.dmfs.jems.iterable.composite.Joined;
import org.dmfs.jems.iterable.elementary.Seq;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmf... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | new GrantTypeParam("refresh_token"), |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/RefreshTokenRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.entities.XWwwFormUrlEncodedEntity;
import org.dmfs.iterables.elementary.PresentValues;
import org.dmfs.jems.iterable.composite.Joined;
import org.dmfs.jems.iterable.elementary.Seq;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmf... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | new RefreshTokenParam(refreshToken)), |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/RefreshTokenRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.entities.XWwwFormUrlEncodedEntity;
import org.dmfs.iterables.elementary.PresentValues;
import org.dmfs.jems.iterable.composite.Joined;
import org.dmfs.jems.iterable.elementary.Seq;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmf... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | new PresentValues<>(new OptionalScopeParam(scope))))); |
dmfs/oauth2-essentials | src/test/java/org/dmfs/oauth2/client/BasicOAuth2AuthCodeAuthorizationTest.java | // Path: src/main/java/org/dmfs/oauth2/client/scope/BasicScope.java
// public final class BasicScope implements OAuth2Scope
// {
// private final String[] mTokens;
//
//
// /**
// * Creates a new {@link OAuth2Scope} that contains the given tokens.
// *
// * @param tokens
// * The s... | import org.dmfs.httpessentials.exceptions.ProtocolException;
import org.dmfs.oauth2.client.scope.BasicScope;
import org.dmfs.rfc3986.encoding.Precoded;
import org.dmfs.rfc3986.uris.LazyUri;
import org.junit.Test;
import static org.junit.Assert.assertEquals; | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/scope/BasicScope.java
// public final class BasicScope implements OAuth2Scope
// {
// private final String[] mTokens;
//
//
// /**
// * Creates a new {@link OAuth2Scope} that contains the given tokens.
// *
// * @param tokens
// * The s... | new BasicScope("scope"), |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/tokens/ImplicitGrantAccessToken.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AccessToken.java
// public interface OAuth2AccessToken
// {
// /**
// * Returns the actual access token String.
// *
// * @return
// *
// * @throws ProtocolException
// */
// public CharSequence accessToken() throws ProtocolExcept... | import org.dmfs.httpessentials.exceptions.ProtocolException;
import org.dmfs.jems.optional.Optional;
import org.dmfs.oauth2.client.OAuth2AccessToken;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmfs.rfc3986.Uri;
import org.dmfs.rfc3986.parameters.ParameterList;
import org.dmfs.rfc3986.parameters.adapters.Opti... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AccessToken.java
// public interface OAuth2AccessToken
// {
// /**
// * Returns the actual access token String.
// *
// * @return
// *
// * @throws ProtocolException
// */
// public CharSequence accessToken() throws ProtocolExcept... | private final OAuth2Scope mScope; |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/tokens/ImplicitGrantAccessToken.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AccessToken.java
// public interface OAuth2AccessToken
// {
// /**
// * Returns the actual access token String.
// *
// * @return
// *
// * @throws ProtocolException
// */
// public CharSequence accessToken() throws ProtocolExcept... | import org.dmfs.httpessentials.exceptions.ProtocolException;
import org.dmfs.jems.optional.Optional;
import org.dmfs.oauth2.client.OAuth2AccessToken;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmfs.rfc3986.Uri;
import org.dmfs.rfc3986.parameters.ParameterList;
import org.dmfs.rfc3986.parameters.adapters.Opti... | @Override
public CharSequence tokenType() throws ProtocolException
{
OptionalParameter<CharSequence> tokenType = new OptionalParameter<>(TOKEN_TYPE, mRedirectUriParameters);
if (!tokenType.isPresent())
{
throw new ProtocolException(String.format("Missing token_type in fra... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AccessToken.java
// public interface OAuth2AccessToken
// {
// /**
// * Returns the actual access token String.
// *
// * @return
// *
// * @throws ProtocolException
// */
// public CharSequence accessToken() throws ProtocolExcept... | return mIssueDate.addDuration(new OptionalParameter<>(EXPIRES_IN, mRedirectUriParameters).value(mDefaultExpiresIn)); |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/tokens/ImplicitGrantAccessToken.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AccessToken.java
// public interface OAuth2AccessToken
// {
// /**
// * Returns the actual access token String.
// *
// * @return
// *
// * @throws ProtocolException
// */
// public CharSequence accessToken() throws ProtocolExcept... | import org.dmfs.httpessentials.exceptions.ProtocolException;
import org.dmfs.jems.optional.Optional;
import org.dmfs.oauth2.client.OAuth2AccessToken;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmfs.rfc3986.Uri;
import org.dmfs.rfc3986.parameters.ParameterList;
import org.dmfs.rfc3986.parameters.adapters.Opti... | }
return tokenType.value("");
}
@Override
public boolean hasRefreshToken()
{
// implicit grants don't issue a refresh token
return false;
}
@Override
public CharSequence refreshToken() throws ProtocolException
{
throw new NoSuchElementException... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AccessToken.java
// public interface OAuth2AccessToken
// {
// /**
// * Returns the actual access token String.
// *
// * @return
// *
// * @throws ProtocolException
// */
// public CharSequence accessToken() throws ProtocolExcept... | return new OptionalParameter<>(SCOPE, mRedirectUriParameters).value(mScope); |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/utils/OAuth2ScopeValueType.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmfs.oauth2.client.scope.StringScope;
import org.dmfs.rfc3986.parameters.ValueType; | /*
* Copyright 2017 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | return new StringScope(valueText.toString()); |
dmfs/oauth2-essentials | src/test/java/org/dmfs/oauth2/client/BasicOAuth2AuthorizationRequestTest.java | // Path: src/main/java/org/dmfs/oauth2/client/scope/BasicScope.java
// public final class BasicScope implements OAuth2Scope
// {
// private final String[] mTokens;
//
//
// /**
// * Creates a new {@link OAuth2Scope} that contains the given tokens.
// *
// * @param tokens
// * The s... | import org.dmfs.oauth2.client.scope.BasicScope;
import org.dmfs.oauth2.client.scope.EmptyScope;
import org.dmfs.rfc3986.encoding.Precoded;
import org.dmfs.rfc3986.parameters.ParameterList;
import org.dmfs.rfc3986.parameters.ParameterType;
import org.dmfs.rfc3986.parameters.parametersets.BasicParameterList;
import org.d... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/scope/BasicScope.java
// public final class BasicScope implements OAuth2Scope
// {
// private final String[] mTokens;
//
//
// /**
// * Creates a new {@link OAuth2Scope} that contains the given tokens.
// *
// * @param tokens
// * The s... | EmptyScope.INSTANCE, "1234") |
dmfs/oauth2-essentials | src/test/java/org/dmfs/oauth2/client/BasicOAuth2AuthorizationRequestTest.java | // Path: src/main/java/org/dmfs/oauth2/client/scope/BasicScope.java
// public final class BasicScope implements OAuth2Scope
// {
// private final String[] mTokens;
//
//
// /**
// * Creates a new {@link OAuth2Scope} that contains the given tokens.
// *
// * @param tokens
// * The s... | import org.dmfs.oauth2.client.scope.BasicScope;
import org.dmfs.oauth2.client.scope.EmptyScope;
import org.dmfs.rfc3986.encoding.Precoded;
import org.dmfs.rfc3986.parameters.ParameterList;
import org.dmfs.rfc3986.parameters.ParameterType;
import org.dmfs.rfc3986.parameters.parametersets.BasicParameterList;
import org.d... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/scope/BasicScope.java
// public final class BasicScope implements OAuth2Scope
// {
// private final String[] mTokens;
//
//
// /**
// * Creates a new {@link OAuth2Scope} that contains the given tokens.
// *
// * @param tokens
// * The s... | new BasicScope("calendar"), "1234") |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/parameters/AuthCodeParam.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AuthCodeAuthorization.java
// public interface OAuth2AuthCodeAuthorization
// {
// /**
// * Returns the actual authorization code.
// *
// * @return
// */
// public CharSequence code();
//
// /**
// * Returns the scope that this a... | import org.dmfs.oauth2.client.OAuth2AuthCodeAuthorization; | /*
* Copyright 2019 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AuthCodeAuthorization.java
// public interface OAuth2AuthCodeAuthorization
// {
// /**
// * Returns the actual authorization code.
// *
// * @return
// */
// public CharSequence code();
//
// /**
// * Returns the scope that this a... | public AuthCodeParam(OAuth2AuthCodeAuthorization authorization) |
dmfs/oauth2-essentials | src/test/java/org/dmfs/oauth2/client/http/requests/ClientCredentialsTokenRequestTest.java | // Path: src/main/java/org/dmfs/oauth2/client/scope/StringScope.java
// public final class StringScope implements OAuth2Scope
// {
// private final String mScope;
//
//
// /**
// * Creates an {@link OAuth2Scope} from the given space separated token list.
// *
// * @param scope
// */
// ... | import static org.dmfs.jems.hamcrest.matchers.LambdaMatcher.having;
import static org.dmfs.jems.hamcrest.matchers.optional.PresentMatcher.present;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.allOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat... | /*
* Copyright 2019 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/scope/StringScope.java
// public final class StringScope implements OAuth2Scope
// {
// private final String mScope;
//
//
// /**
// * Creates an {@link OAuth2Scope} from the given space separated token list.
// *
// * @param scope
// */
// ... | HttpRequestEntity entity = new ClientCredentialsTokenRequest(new StringScope("s1 s2")).requestEntity(); |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/ClientCredentialsTokenRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.entities.XWwwFormUrlEncodedEntity;
import org.dmfs.iterables.SingletonIterable;
import org.dmfs.iterables.elementary.PresentValues;
import org.dmfs.jems.iterable.composite.Joined;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmfs... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | this(EmptyScope.INSTANCE); |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/ClientCredentialsTokenRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.entities.XWwwFormUrlEncodedEntity;
import org.dmfs.iterables.SingletonIterable;
import org.dmfs.iterables.elementary.PresentValues;
import org.dmfs.jems.iterable.composite.Joined;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmfs... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | public ClientCredentialsTokenRequest(OAuth2Scope scope) |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/ClientCredentialsTokenRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.entities.XWwwFormUrlEncodedEntity;
import org.dmfs.iterables.SingletonIterable;
import org.dmfs.iterables.elementary.PresentValues;
import org.dmfs.jems.iterable.composite.Joined;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmfs... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | new GrantTypeParam("client_credentials")), |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/ClientCredentialsTokenRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.entities.XWwwFormUrlEncodedEntity;
import org.dmfs.iterables.SingletonIterable;
import org.dmfs.iterables.elementary.PresentValues;
import org.dmfs.jems.iterable.composite.Joined;
import org.dmfs.oauth2.client.OAuth2Scope;
import org.dmfs... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | new OptionalScopeParam(scope))))); |
dmfs/oauth2-essentials | src/test/java/org/dmfs/oauth2/client/tokens/ImplicitGrantAccessTokenTest.java | // Path: src/main/java/org/dmfs/oauth2/client/scope/EmptyScope.java
// public final class EmptyScope implements OAuth2Scope
// {
// public final static EmptyScope INSTANCE = new EmptyScope();
//
//
// @Override
// public boolean isEmpty()
// {
// return true;
// }
//
//
// @Override
... | import org.dmfs.jems.hamcrest.matchers.optional.AbsentMatcher;
import org.dmfs.oauth2.client.scope.EmptyScope;
import org.dmfs.rfc3986.encoding.Precoded;
import org.dmfs.rfc3986.uris.LazyUri;
import org.dmfs.rfc5545.Duration;
import org.hamcrest.Matchers;
import org.junit.Test;
import static org.dmfs.jems.hamcrest.matc... | /*
* Copyright 2017 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/scope/EmptyScope.java
// public final class EmptyScope implements OAuth2Scope
// {
// public final static EmptyScope INSTANCE = new EmptyScope();
//
//
// @Override
// public boolean isEmpty()
// {
// return true;
// }
//
//
// @Override
... | new EmptyScope(), |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/responsehandlers/TokenErrorResponseHandler.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AccessToken.java
// public interface OAuth2AccessToken
// {
// /**
// * Returns the actual access token String.
// *
// * @return
// *
// * @throws ProtocolException
// */
// public CharSequence accessToken() throws ProtocolExcept... | import org.dmfs.httpessentials.client.HttpResponse;
import org.dmfs.httpessentials.client.HttpResponseHandler;
import org.dmfs.httpessentials.exceptions.ProtocolError;
import org.dmfs.httpessentials.exceptions.ProtocolException;
import org.dmfs.httpessentials.responsehandlers.StringResponseHandler;
import org.dmfs.http... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AccessToken.java
// public interface OAuth2AccessToken
// {
// /**
// * Returns the actual access token String.
// *
// * @return
// *
// * @throws ProtocolException
// */
// public CharSequence accessToken() throws ProtocolExcept... | throw new TokenRequestError(new JSONObject(responseString)); |
dmfs/oauth2-essentials | src/test/java/org/dmfs/oauth2/client/http/requests/AuthorizationCodeTokenRequestTest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AuthCodeAuthorization.java
// public interface OAuth2AuthCodeAuthorization
// {
// /**
// * Returns the actual authorization code.
// *
// * @return
// */
// public CharSequence code();
//
// /**
// * Returns the scope that this a... | import org.dmfs.httpessentials.HttpMethod;
import org.dmfs.httpessentials.client.HttpRequestEntity;
import org.dmfs.httpessentials.types.MediaType;
import org.dmfs.httpessentials.types.StringMediaType;
import org.dmfs.jems.hamcrest.matchers.optional.PresentMatcher;
import org.dmfs.oauth2.client.OAuth2AuthCodeAuthorizat... | /*
* Copyright 2017 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AuthCodeAuthorization.java
// public interface OAuth2AuthCodeAuthorization
// {
// /**
// * Returns the actual authorization code.
// *
// * @return
// */
// public CharSequence code();
//
// /**
// * Returns the scope that this a... | OAuth2AuthCodeAuthorization authorization = new OAuth2AuthCodeAuthorization() |
dmfs/oauth2-essentials | src/test/java/org/dmfs/oauth2/client/http/requests/AuthorizationCodeTokenRequestTest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AuthCodeAuthorization.java
// public interface OAuth2AuthCodeAuthorization
// {
// /**
// * Returns the actual authorization code.
// *
// * @return
// */
// public CharSequence code();
//
// /**
// * Returns the scope that this a... | import org.dmfs.httpessentials.HttpMethod;
import org.dmfs.httpessentials.client.HttpRequestEntity;
import org.dmfs.httpessentials.types.MediaType;
import org.dmfs.httpessentials.types.StringMediaType;
import org.dmfs.jems.hamcrest.matchers.optional.PresentMatcher;
import org.dmfs.oauth2.client.OAuth2AuthCodeAuthorizat... | /*
* Copyright 2017 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AuthCodeAuthorization.java
// public interface OAuth2AuthCodeAuthorization
// {
// /**
// * Returns the actual authorization code.
// *
// * @return
// */
// public CharSequence code();
//
// /**
// * Returns the scope that this a... | public OAuth2Scope scope() |
dmfs/oauth2-essentials | src/test/java/org/dmfs/oauth2/client/http/requests/AuthorizationCodeTokenRequestTest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AuthCodeAuthorization.java
// public interface OAuth2AuthCodeAuthorization
// {
// /**
// * Returns the actual authorization code.
// *
// * @return
// */
// public CharSequence code();
//
// /**
// * Returns the scope that this a... | import org.dmfs.httpessentials.HttpMethod;
import org.dmfs.httpessentials.client.HttpRequestEntity;
import org.dmfs.httpessentials.types.MediaType;
import org.dmfs.httpessentials.types.StringMediaType;
import org.dmfs.jems.hamcrest.matchers.optional.PresentMatcher;
import org.dmfs.oauth2.client.OAuth2AuthCodeAuthorizat... | /*
* Copyright 2017 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AuthCodeAuthorization.java
// public interface OAuth2AuthCodeAuthorization
// {
// /**
// * Returns the actual authorization code.
// *
// * @return
// */
// public CharSequence code();
//
// /**
// * Returns the scope that this a... | return new BasicScope("scope1", "scope2"); |
dmfs/oauth2-essentials | src/test/java/org/dmfs/oauth2/client/http/requests/ResourceOwnerPasswordTokenRequestTest.java | // Path: src/main/java/org/dmfs/oauth2/client/scope/StringScope.java
// public final class StringScope implements OAuth2Scope
// {
// private final String mScope;
//
//
// /**
// * Creates an {@link OAuth2Scope} from the given space separated token list.
// *
// * @param scope
// */
// ... | import static org.dmfs.jems.hamcrest.matchers.LambdaMatcher.having;
import static org.dmfs.jems.hamcrest.matchers.optional.PresentMatcher.present;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.allOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat... | /*
* Copyright 2019 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/scope/StringScope.java
// public final class StringScope implements OAuth2Scope
// {
// private final String mScope;
//
//
// /**
// * Creates an {@link OAuth2Scope} from the given space separated token list.
// *
// * @param scope
// */
// ... | HttpRequestEntity entity = new ResourceOwnerPasswordTokenRequest(new StringScope("s1 s2"), "user", "pass").requestEntity(); |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/BasicOAuth2AuthCodeAuthorization.java | // Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> AUTH_CODE = new BasicParameterType<>("code", TextValueType.INSTANCE);
//
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> STATE = ... | import org.dmfs.httpessentials.exceptions.ProtocolException;
import org.dmfs.rfc3986.Uri;
import org.dmfs.rfc3986.parameters.ParameterList;
import org.dmfs.rfc3986.parameters.adapters.OptionalParameter;
import org.dmfs.rfc3986.parameters.adapters.TextParameter;
import org.dmfs.rfc3986.parameters.adapters.XwfueParameter... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> AUTH_CODE = new BasicParameterType<>("code", TextValueType.INSTANCE);
//
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> STATE = ... | if (!state.toString().equals(new TextParameter(STATE, mQueryParameters).toString())) |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/BasicOAuth2AuthCodeAuthorization.java | // Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> AUTH_CODE = new BasicParameterType<>("code", TextValueType.INSTANCE);
//
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> STATE = ... | import org.dmfs.httpessentials.exceptions.ProtocolException;
import org.dmfs.rfc3986.Uri;
import org.dmfs.rfc3986.parameters.ParameterList;
import org.dmfs.rfc3986.parameters.adapters.OptionalParameter;
import org.dmfs.rfc3986.parameters.adapters.TextParameter;
import org.dmfs.rfc3986.parameters.adapters.XwfueParameter... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> AUTH_CODE = new BasicParameterType<>("code", TextValueType.INSTANCE);
//
// Path: src/main/java/org/dmfs/oauth2/client/utils/Parameters.java
// public final static ParameterType<CharSequence> STATE = ... | if (!new OptionalParameter<CharSequence>(AUTH_CODE, mQueryParameters).isPresent()) |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/decorators/BearerAuthenticatedRequest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AccessToken.java
// public interface OAuth2AccessToken
// {
// /**
// * Returns the actual access token String.
// *
// * @return
// *
// * @throws ProtocolException
// */
// public CharSequence accessToken() throws ProtocolExcept... | import org.dmfs.httpessentials.HttpMethod;
import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.client.HttpRequestEntity;
import org.dmfs.httpessentials.client.HttpResponse;
import org.dmfs.httpessentials.client.HttpResponseHandler;
import org.dmfs.httpessentials.converters.PlainStringHeade... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AccessToken.java
// public interface OAuth2AccessToken
// {
// /**
// * Returns the actual access token String.
// *
// * @return
// *
// * @throws ProtocolException
// */
// public CharSequence accessToken() throws ProtocolExcept... | private final OAuth2AccessToken mAccessToken; |
dmfs/oauth2-essentials | src/test/java/org/dmfs/oauth2/client/http/decorators/BearerAuthenticatedRequestTest.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AccessToken.java
// public interface OAuth2AccessToken
// {
// /**
// * Returns the actual access token String.
// *
// * @return
// *
// * @throws ProtocolException
// */
// public CharSequence accessToken() throws ProtocolExcept... | import mockit.Expectations;
import mockit.Injectable;
import mockit.integration.junit4.JMockit;
import org.dmfs.httpessentials.HttpMethod;
import org.dmfs.httpessentials.client.HttpRequest;
import org.dmfs.httpessentials.client.HttpRequestEntity;
import org.dmfs.httpessentials.client.HttpResponse;
import org.dmfs.httpe... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2AccessToken.java
// public interface OAuth2AccessToken
// {
// /**
// * Returns the actual access token String.
// *
// * @return
// *
// * @throws ProtocolException
// */
// public CharSequence accessToken() throws ProtocolExcept... | private OAuth2AccessToken accessToken; |
dmfs/oauth2-essentials | src/main/java/org/dmfs/oauth2/client/http/requests/parameters/OptionalScopeParam.java | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | import org.dmfs.jems.optional.adapters.Conditional;
import org.dmfs.jems.optional.decorators.DelegatingOptional;
import org.dmfs.jems.optional.decorators.Mapped;
import org.dmfs.jems.pair.Pair;
import org.dmfs.jems.pair.elementary.ValuePair;
import org.dmfs.oauth2.client.OAuth2Scope; | /*
* Copyright 2019 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/OAuth2Scope.java
// public interface OAuth2Scope
// {
// /**
// * Returns whether this scope is empty.
// *
// * @return <code>true</code> if this scope is empty, <code>false</code> otherwise.
// */
// boolean isEmpty();
//
// /**
// * ... | public OptionalScopeParam(OAuth2Scope scope) |
dmfs/oauth2-essentials | src/test/java/org/dmfs/oauth2/client/http/responsehandlers/TokenErrorResponseHandlerTest.java | // Path: src/main/java/org/dmfs/oauth2/client/errors/TokenRequestError.java
// public final class TokenRequestError extends ProtocolError
// {
// private static final long serialVersionUID = 1L;
//
// private final String mErrorResponse;
//
// /**
// * {@link JSONObject} is not a {@link Serializable}... | import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import org.dmfs.httpessentials.HttpStatus;
import org.dmfs.httpessentials.exceptions.ProtocolError;
import org.dmfs.httpessentials.exceptions.ProtocolException;
import org.dmfs.httpessentials.hea... | /*
* Copyright 2016 dmfs GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | // Path: src/main/java/org/dmfs/oauth2/client/errors/TokenRequestError.java
// public final class TokenRequestError extends ProtocolError
// {
// private static final long serialVersionUID = 1L;
//
// private final String mErrorResponse;
//
// /**
// * {@link JSONObject} is not a {@link Serializable}... | catch (TokenRequestError e) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.