label
int64 0
10
| text
stringlengths 45
511
|
---|---|
4 | public Mastery getDataMastery(Region region, int id) throws RiotApiException {
return StaticDataMethod.getDataMastery(region.getName(), getKey(), id, null, null, null);
} |
10 | [Fact]
public void Should_set_header_parameter_value_to_header_property_when_initialized()
{
// Given
var headers = new Dictionary<string, IEnumerable<string>>();
// When
var request = new Request("GET", "/", headers, new MemoryStream());
// Then
request.Headers.ShouldBeSameAs(headers);
} |
4 | private void publishMessage(int action, String cacheName, Object key) {
Jboot.me().getMq().publish(new JbootEhredisMessage(clientId, action, cacheName, key), channel);
} |
3 | @Override
public boolean cancel() {
boolean cancelled = super.cancel();
if (!cancelled) {
return false;
}
synchronized (signal) {
signal.notifyAll();
}
// Try to force-quit the connection
if (connection != null) {
setTimeout(1);
connection.disconnect();
}
return true;
} |
2 | @Test
public void testToString() {
ColumnMapperBuilder columnMapper1 = new ColumnMapperStringBuilder();
ColumnMapperBuilder columnMapper2 = new ColumnMapperIntegerBuilder();
Map<String, ColumnMapperBuilder> columnMappers = new HashMap<>();
columnMappers.put("field1", columnMapper1);
columnMappers.put("field2", columnMapper2);
Schema schema = new Schema(columnMappers, null, null);
assertNotNull(schema.toString());
} |
2 | @Test
public void testUpdateWithBatchSize3GreaterThanNumRecords() {
db().update("update person set score=?") //
.batchSize(3) //
.parameters(1, 2, 3, 4) //
.counts() //
.test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) //
.assertValues(3, 3, 3, 3) //
.assertComplete();
} |
4 | public NodeAssert hasAttribute(String attributeName, String attributeValue) {
isNotNull();
final Map.Entry<QName, String> attribute = requestAttributeForName(attributeName);
if (!attribute.getValue().equals(attributeValue)) {
throwAssertionError(shouldHaveAttributeWithValue(actual, attributeName, attributeValue));
}
return this;
} |
4 | private R getRequestResponseResult(final Message message) {
final Integer status = MessageHelper.getApplicationProperty(
message.getApplicationProperties(),
MessageHelper.APP_PROPERTY_STATUS,
Integer.class);
final String payload = MessageHelper.getPayload(message);
final CacheDirective cacheDirective = CacheDirective.from(MessageHelper.getCacheDirective(message));
return getResult(status, payload, cacheDirective);
} |
4 | @Override
public User getWithNetworksById(long id) {
User user = find(id);
Set<Long> networkIds = userNetworkDao.findNetworksForUser(id);
if (networkIds == null) {
return user;
}
Set<Network> networks = new HashSet<>();
for (Long networkId : networkIds) {
Network network = networkDao.find(networkId);
networks.add(network);
}
user.setNetworks(networks);
return user;
} |
2 | @Before
public void setUp() throws Exception {
final Reader r = new InputStreamReader(getClass().getResourceAsStream(LIST_FILE), "UTF-8");
filter = new PublicSuffixFilter(new RFC2109DomainHandler());
final PublicSuffixListParser parser = new PublicSuffixListParser(filter);
parser.parse(r);
} |
3 | internal static void Init() {
LogToFile = Program.GlobalConfig.LogToFile;
if (LogToFile) {
lock (FileLock) {
try {
File.Delete(Program.LogFile);
} catch (Exception e) {
LogToFile = false;
LogGenericException(e);
}
}
}
} |
3 | @Override
public boolean disconnect(final Endpoint endpoint) {
LOG.info("Disconnect from {}", endpoint);
this.rpcClient.closeConnection(endpoint.toString());
return true;
} |
3 | public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, byte[]... signers) throws TransactionException, InvalidArgumentException {
updateChannelConfiguration(updateChannelConfiguration, getRandomOrderer(), signers);
} |
3 | public void await(long timeout, TimeUnit unit, boolean cancelOnTimeout) throws InterruptedException, TimeoutException {
final long end = System.currentTimeMillis() + unit.toMillis(timeout);
while (!isDone() && System.currentTimeMillis() < end) {
synchronized (signal) {
signal.wait(end - System.currentTimeMillis());
}
}
if (!isDone()) {
if (cancelOnTimeout) {
cancel();
}
throw new TimeoutException();
}
} |
4 | @Override
protected CommandLine processOptions(ObjectInspector[] argOIs) throws UDFArgumentException {
CommandLine cl = super.processOptions(argOIs);
this.eta0 = Primitives.parseFloat(cl.getOptionValue("eta0"), 0.1f);
this.eps = Primitives.parseFloat(cl.getOptionValue("eps"), 1.f);
this.scaling = Primitives.parseFloat(cl.getOptionValue("scale"), 100f);
return cl;
} |
4 | [Fact]
public void WritesInheritance() {
var declaration = parentClass.StartBlock as CodeClass.Declaration;
declaration.Inherits = new (){
Name = "someInterface"
};
codeElementWriter.WriteCodeElement(declaration, writer);
var result = tw.ToString();
Assert.Contains(":", result);
} |
2 | private void writeToFile(String message, String path) throws IOException{
if(StringUtils.isEmpty(message) || StringUtils.isEmpty(path)){
return ;
}
RandomAccessFile rf = new RandomAccessFile(path, "rw");
rf.seek(rf.length());
rf.write(message.getBytes());
rf.close();
} |
4 | private List<Challenge> fetchChallenges(JSON json) {
JSON.Array jsonChallenges = json.get("challenges").asArray();
List<Challenge> cr = new ArrayList<>();
for (JSON.Value c : jsonChallenges) {
Challenge ch = getSession().createChallenge(c.asObject());
if (ch != null) {
cr.add(ch);
}
}
return cr;
} |
2 | public static NSObject parse(File f) throws Exception {
FileInputStream fis = new FileInputStream(f);
return parse(fis);
} |
4 | boolean add(Side side, long price, long quantity) {
Long2LongRBTreeMap levels = getLevels(side);
long size = levels.get(price);
levels.put(price, size + quantity);
return price == levels.firstLongKey();
} |
3 | @Override
public void start() {
List<Account> accounts = getAccountList();
Set<String> addressList = new HashSet<>();
if (accounts != null && !accounts.isEmpty()) {
NulsContext.DEFAULT_ACCOUNT_ID = accounts.get(0).getAddress().getBase58();
for (Account account : accounts) {
addressList.add(account.getAddress().getBase58());
}
NulsContext.LOCAL_ADDRESS_LIST = addressList;
}
} |
2 | @BeforeClass
public void setup() {
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(htmlFilePath);
ExtentXReporter extentx = new ExtentXReporter("localhost");
extentx.config().setProjectName("extentreports");
extentx.config().setReportName(fileName);
extentx.config().setServerUrl("http://localhost:1337/");
extent = new ExtentReports();
extent.attachReporter(htmlReporter);
} |
4 | protected Object[] getEstimatorStep(){
List<Object[]> steps = getSteps();
if(steps.size() < 1){
throw new IllegalArgumentException("Missing estimator step");
}
return steps.get(steps.size() - 1);
} |
3 | void resetStatistics()
{
rehashes = 0L;
evictedEntries = 0L;
hitCount = 0L;
missCount = 0L;
putAddCount = 0L;
putReplaceCount = 0L;
removeCount = 0L;
} |
4 | public static final boolean isTracedEval(Map<String, Object> env) {
return (boolean) getInstance(env).getOption(Options.TRACE_EVAL);
} |
2 | public static byte[] tryDecompress(InputStream raw) throws Exception {
try {
GZIPInputStream gis
= new GZIPInputStream(raw);
ByteArrayOutputStream out
= new ByteArrayOutputStream();
IoUtils.copy(gis, out);
return out.toByteArray();
} catch (Exception e) {
e.printStackTrace();
}
return null;
} |
10 | [Test]
public void TestAddTo()
{
var foo = new Mock<IHeader>();
foo.Setup(m => m.Enable("foo"));
var bar = new SendGrid(foo.Object);
Assert.AreEqual(1, 2, "I suck");
} |
10 | [Fact]
public void Should_retrieve_modules_from_locator_when_handling_request()
{
// Given
var request = new Request("GET", "/", new Dictionary<string, IEnumerable<string>>(), new MemoryStream());
// When
this.engine.HandleRequest(request);
// Then
A.CallTo(() => this.locator.GetModules()).MustHaveHappened();
} |
4 | [Fact]
public void Test_HasEfferentRelationshipWith_ReturnsTrue_WhenThereIsARelationship()
{
SoftwareSystem softwareSystem1 = model.AddSoftwareSystem("System 1", "");
SoftwareSystem softwareSystem2 = model.AddSoftwareSystem("System 2", "");
softwareSystem1.Uses(softwareSystem2, "uses");
Assert.True(softwareSystem1.HasEfferentRelationshipWith(softwareSystem2));
} |
3 | public void run() {
this.startupRecover(); // initialize
this.markStartupDone();
long swapMillis = System.currentTimeMillis() + 1000L * 30;
while (this.released == false) {
if (System.currentTimeMillis() < swapMillis) {
this.waitingFor(100);
} else {
this.switchMasterAndSlaver();
swapMillis = System.currentTimeMillis() + 1000L * 30;
this.cleanupSlaver();
this.compressSlaver();
}
}
this.destroy();
} |
4 | @Override
public void render(Req req, Object value, OutputStream out) throws Exception {
Customization.of(req).jackson().writeValue(out, value);
} |
2 | private void load(String name, List<String> col) throws IOException {
BufferedReader r = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(name),"US-ASCII"));
String line;
while ((line=r.readLine())!=null)
col.add(line);
r.close();
} |
2 | private byte[] unHashBlockStream(SafeInputStream decryptedStream) throws IOException {
HashedBlockInputStream hashedBlockInputStream = new HashedBlockInputStream(decryptedStream);
byte[] hashedBlockBytes = StreamUtils.toByteArray(hashedBlockInputStream);
return hashedBlockBytes;
} |
10 | [TestMethod]
public void EnhancedSerialConnection_Constructor_WithoutParameters()
{
var connection = new EnhancedSerialConnection();
Assert.AreEqual(100, connection.ReadTimeout);
Assert.AreEqual(100, connection.WriteTimeout);
Assert.AreEqual(115200, connection.BaudRate);
} |
10 | public bool Start()
{
return new FFMpeg().StartConversion(Build());
} |
3 | public void start() {
if( thread != null )
throw new IllegalStateException( "Already started" );
new Thread( this ).start();
} |
4 | public static long getWallClockTimeFromCellTimeStamp(long tsOfCell) {
return TransactionFactory.getTransactionFactory().getTransactionContext().isPreExistingVersion(tsOfCell) ? tsOfCell : TransactionUtil.convertToMilliseconds(tsOfCell);
} |
10 | [TestMethod]
public void IsDownloadCompletedOnBeginTest()
{
// arrange
var size = 1024;
var chunk = new Chunk(0, size) { Storage = (new MemoryStorage()) };
// act
bool isDownloadCompleted = chunk.IsDownloadCompleted();
// assert
Assert.IsFalse(isDownloadCompleted);
} |
4 | public static List<String> getRegionNames(Location location) {
if (!isInRegion(location)) {
return null;
}
List<String> regionNames = new ArrayList<>();
getRegionSet(location).getRegions().forEach(r -> regionNames.add(r.getId()));
return regionNames;
} |
4 | @Override
public void setPixels(Object pixels)
{
int[] position = Index.create(0, 0, getPlanePosition());
setImagePlanePixels(this.imageData, position, pixels);
} |
4 | public override Tensor Call(Tensor preds, Tensor labels)
{
Tensor output = null;
if(!FromLogit)
{
output = labels.Clamp(1e-7f, 1f - 1e-7f);
output = output.CDiv(1 - output).Log();
}
return (preds.CMul(-output.Sigmoid().Log()) + (1 - preds).CMul(-(1 - output.Sigmoid()).Log()));
} |
4 | private boolean internalRemove(T element) {
Integer lrem = nest.cat(JOhmUtils.getId(owner)).cat(field.getName())
.lrem(1, JOhmUtils.getId(element).toString());
unindexValue(element);
return lrem > 0;
} |
2 | @Test
public void shouldHandleNullConfig() throws Throwable
{
// Given
Driver driver = GraphDatabase.driver( neo4j.address(), AuthTokens.none(), null );
Session session = driver.session();
// When
session.close();
// Then
assertFalse( session.isOpen() );
} |
4 | private void refreshTreeData() {
Collection<ZkCluster> zkClusters = RegistryCenterServiceImpl.ZKADDR_TO_ZKCLUSTER_MAP.values();
for (ZkCluster zkCluster : zkClusters) {
InitRegistryCenterService.initTreeJson(REGISTRY_CENTER_CONFIGURATION_MAP.get(zkCluster.getZkAddr()), zkCluster.getZkAddr());
}
} |
3 | @Override
public void handleDataChange(String dataPath, Object data) {
if (_zkClientForListener == null || _zkClientForListener.isClosed()) {
return;
}
resetZkResources();
} |
10 | public static string CreateSha256Hash(string input)
{
SHA256CryptoServiceProvider provider = new SHA256CryptoServiceProvider();
UTF8Encoding encoding = new UTF8Encoding();
byte[] inputBytes = encoding.GetBytes(input);
byte[] hashBytes = provider.ComputeHash(inputBytes);
string hash = Convert.ToBase64String(hashBytes);
return hash;
} |
10 | [Test, Ignore("#505: Failed to register object with ArgumentNullException")]
public void Can_register_an_object_by_type()
{
var c = new Container();
c.Register<object>();
} |
4 | @Test
public void testDuplicateMapIds() throws Exception {
MappingFileReader fileReader = new MappingFileReader("duplicateMapIdsMapping.xml");
MappingFileData mappingFileData = fileReader.read();
try {
parser.processMappings(mappingFileData.getClassMaps(), new Configuration());
fail("should have thrown exception");
} catch (Exception e) {
assertTrue("invalid exception thrown", e.getMessage().indexOf("Duplicate Map Id") != -1);
}
} |
10 | public static IEnumerable<dynamic> Query(this Stream stream, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null)
{
return ExcelReaderFactory.GetProvider(stream, ExcelTypeHelper.GetExcelType(stream, excelType),configuration).Query(useHeaderRow, sheetName, startCell);
} |
3 | long rehashes()
{
return rehashes;
} |
10 | internal bool LimitReached(string headerValue)
{
var counter = clients.GetOrAdd(headerValue, new Counter(_durationSeconds, headerValue, ref clients));
if (counter.Count < _limit)
{
counter.Increase();
Console.WriteLine("incresed: " + counter.GetHashCode().ToString() + " - " + counter.Count.ToString());
return false;
}
return true;
} |
10 | public Container CreateReuseScope()
{
return new Container(ResolutionRules, _factories, _decorators, _genericWrappers, _singletonScope, new Scope());
} |
4 | @Test
public void canUpsert() throws Exception {
/* when */
WriteResult writeResult = collection.upsert("{}", "{$set:{name:'John'}}");
/* then */
People john = collection.findOne("{name:'John'}").as(People.class);
assertThat(john.getName()).isEqualTo("John");
assertThat(writeResult).isNotNull();
} |
10 | [Fact]
public void Should_set_uri_parameter_value_to_uri_property_when_initialized()
{
// Given
const string uri = "/";
// When
var request = new Request("GET", uri, new Dictionary<string, IEnumerable<string>>(), new MemoryStream());
// Then
request.Uri.ShouldEqual(uri);
} |
3 | @Test
public void testSyncRefresh() throws IOException {
initialize(HeaderCacheElement.TOKEN_STALENESS_MS + 1);
Assert.assertEquals(CacheState.Good, underTest.headerCache.getCacheState());
} |
4 | public static AccessRight decodeJSON(JSONObject node) {
AccessRight right = new AccessRight();
// The values are stored as longs internally, despite us passing an int
right.setProtectionId(((Long) node.get("protection")).intValue());
right.setType(((Long) node.get("type")).intValue());
right.setName((String) node.get("name"));
right.setRights(((Long) node.get("rights")).intValue());
return right;
} |
4 | [Test]
public void GetDefault()
{
var auth = OpenAI_API.APIAuthentication.Default;
var envAuth = OpenAI_API.APIAuthentication.LoadFromEnv();
Assert.IsNotNull(auth);
Assert.IsNotNull(auth.APIKey);
Assert.AreEqual(envAuth.APIKey, auth.APIKey);
Assert.IsNotNull(auth.Secretkey);
Assert.AreEqual(envAuth.Secretkey, auth.Secretkey);
} |
3 | @Override
public A getArray() {
checkAvailability();
return objectArray;
} |
4 | @Test
public void deployAndExtractFunctions() throws Exception {
// This one can only work if you change the boot classpath to contain reactor-core
// and reactive-streams
expected.expect(ClassCastException.class);
@SuppressWarnings("unchecked")
Flux<String> result = (Flux<String>) deployer.lookupFunction("uppercase")
.apply(Flux.just("foo"));
assertThat(result.blockFirst()).isEqualTo("FOO");
} |
3 | void resetStatistics()
{
rehashes = 0L;
evictedEntries = 0L;
hitCount = 0L;
missCount = 0L;
putAddCount = 0L;
putReplaceCount = 0L;
removeCount = 0L;
lruCompactions = 0L;
} |
2 | @Test
public void testTuple4() {
db() //
.select("select name, score, name, score from person order by name") //
.getAs(String.class, Integer.class, String.class, Integer.class) //
.firstOrError() //
.test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) //
.assertComplete() //
.assertValue(Tuple4.create("FRED", 21, "FRED", 21)); //
} |
3 | public static CacheManager get() {
if (instance == null) {
synchronized (log) {
if (instance == null) {
instance = new CacheManager();
}
}
}
return instance;
} |
4 | @Override
public void parse(NulsByteBuffer buffer) throws NulsException {
magicNumber = (int) buffer.readVarInt();
severPort = (int) buffer.readVarInt();
port = severPort;
ip = new String(buffer.readByLengthByte());
this.groupSet = ConcurrentHashMap.newKeySet();
} |
10 | public virtual IEventStream OpenStream(Guid streamId, int minRevision, int maxRevision)
{
maxRevision = maxRevision <= 0 ? int.MaxValue : maxRevision;
var stream = new OptimisticEventStream(streamId, this, minRevision, maxRevision);
return stream.CommitSequence == 0 ? null : stream;
} |
2 | private static void testParseCommonsCSV() throws Exception {
for (int i = 0; i < max; i++) {
final BufferedReader reader = getReader();
final CSVParser parser = new CSVParser(reader, format);
final long t0 = System.currentTimeMillis();
final Stats s = iterate(parser);
reader.close();
show("CSV", s, t0);
}
show();
} |
10 | public Email SendAsync(SendCompletedEventHandler callback, object token = null)
{
var client = new SmtpClient();
client.SendCompleted += callback;
client.SendAsync(Message, token);
return this;
} |
4 | public boolean isMod() throws IOException, ParseException {
return Boolean.parseBoolean(info().get("is_mod").toString());
} |
2 | @Test
public void testParse_List1() {
BEParser parser = new BEParser("l4:spam4:eggsi1ee");
assertEquals(BEType.LIST, parser.readType());
assertArrayEquals(
new Object[] {"spam", "eggs", BigInteger.ONE},
parser.readList().toArray()
);
} |
2 | public IonValue singleValue(byte[] ionData)
{
Iterator<IonValue> it = iterate(ionData);
return singleValue(it);
} |
3 | public void bind() {
if (bound) throw new IllegalStateException("Already bound to " + assignedThread);
bound = true;
assignedThread = Thread.currentThread();
AffinitySupport.setAffinity(1L << id);
if (LOGGER.isLoggable(Level.INFO))
LOGGER.info("Assigning cpu " + id + " to " + assignedThread);
} |
3 | @Override
public void handleDataDeleted(String dataPath) {
if (_zkClientForListener == null || _zkClientForListener.isClosed()) {
return;
}
// Resubscribe
_zkClientForListener.unsubscribeAll();
_zkClientForListener.subscribeRoutingDataChanges(this, this);
resetZkResources();
} |
4 | @Test
public void should_run_post_build() {
ConfigSection afterRunSection = new AfterRunSection(configListOrSingleValue("spec integration1", "spec integration2"));
Combination combination = new Combination(ImmutableMap.of("script", "post_build"));
assertTrue(afterRunSection.toScript(combination, BuildType.BareMetal).toShellScript().contains("spec integration1"));
} |
2 | private static char[] readPassword(String msg) {
Console console = System.console();
if (console != null) {
return console.readPassword(msg);
} else {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
U.print(msg);
try {
return reader.readLine().toCharArray();
} catch (IOException e) {
throw U.rte(e);
}
}
} |
3 | public static void releaseEngine() {
if (engine != null) {
try {
engine.close();
} catch (Exception e) {
throw new GraphvizException("Problem closing engine", e);
}
}
engine = null;
engineQueue = null;
} |
4 | public static void setCurSrcDVDPalette(Palette pal) {
currentSourceDVDPalette = pal;
SubstreamDVD substreamDVD = null;
if (inMode == InputMode.VOBSUB) {
substreamDVD = subDVD;
} else if (inMode == InputMode.SUPIFO) {
substreamDVD = supDVD;
}
substreamDVD.setSrcPalette(currentSourceDVDPalette);
} |
4 | public List<Transformer> getTransformers(){
List<Object[]> steps = getSteps();
boolean flexible = isFlexible();
if(flexible && steps.size() > 0){
Estimator estimator = getEstimator();
if(estimator != null){
steps = steps.subList(0, steps.size() - 1);
}
}
return TransformerUtil.asTransformerList(TupleUtil.extractElementList(steps, 1));
} |
10 | [Test]
public void FontStyleSet_RespectsPriority()
{
ExpectComparisonOrder(
new SKFontStyle(500, 5, SKFontStyleSlant.Upright),
new SKFontStyle(600, 5, SKFontStyleSlant.Italic),
new SKFontStyle(600, 6, SKFontStyleSlant.Upright),
new SKFontStyle(500, 6, SKFontStyleSlant.Italic)
);
} |
4 | @Override
public boolean equals(Object obj) {
if (obj instanceof Function) {
Function fo = (Function) obj;
return (fo.getFile().equals(getFile()) && fo.start == start);
} else {
return false;
}
} |
7 | [TestMethod]
public void LongStringTests()
{
int length = 20000;
string json = @"[""" + new string(' ', length) + @"""]";
var o = SimpleJson.JsonDecode(json);
var a = (IList<object>)o;
Assert.IsInstanceOf<string>(a[0]);
Assert.AreEqual(20000, ((string)a[0]).Length);
} |
4 | @Test
public void whenWlsServerNotInCluster_serverStartupInfoHasNoClusterConfig() {
configureServer("ms1");
addWlsServer("ms1");
invokeStep();
assertThat(getServerStartupInfo("ms1").getClusterName(), nullValue());
} |
2 | public void writeToFile(String path) throws IOException {
FileOutputStream out = new FileOutputStream(path);
this.write(out);
this.close();
out.flush();
out.close();
} |
2 | private void displayJSON (HttpServletRequest request, HttpServletResponse response)
{
response.setContentType("text/plain");
try
{
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(response.getOutputStream()));
JSONArray out = new JSONArray();
for (JSONObject district : districts)
{
out.put(district);
}
writer.write(out.toString());
}
catch (IOException e)
{
e.printStackTrace();
}
} |
4 | private static List<KubernetesCloud> getUsageRestrictedKubernetesClouds() {
List<KubernetesCloud> clouds = new ArrayList<>();
for (Cloud cloud : Jenkins.getInstance().clouds) {
if(cloud instanceof KubernetesCloud) {
if (((KubernetesCloud) cloud).isUsageRestricted()) {
clouds.add((KubernetesCloud) cloud);
}
}
}
Collections.sort(clouds, CLOUD_BY_NAME);
return clouds;
} |
4 | public int linkKarma() throws IOException, ParseException {
return Integer.parseInt(Utils.toString(info().get("link_karma")));
} |
3 | @Override
public void close() {
if (_zkclient != null) {
_zkclient.close();
}
} |
10 | public Document ReadDocument(
(ulong collectionId, long docId) docId,
HashSet<string> select,
double? score = null)
{
var streamReader = GetOrCreateDocumentReader(docId.collectionId);
return ReadDocument(docId, select, streamReader, score);
} |
4 | @Test
public void describeAsAdditionalInfo_notEmpty() {
Correspondence.ExceptionStore exceptions = Correspondence.ExceptionStore.forIterable();
addCompareException(exceptions);
assertExpectedFacts(
exceptions.describeAsAdditionalInfo().asIterable(),
"additionally, one or more exceptions were thrown while comparing elements");
} |
4 | @Test
public void testFromSettingsDefault2() throws MojoExecutionException {
setupServers();
AuthConfig config = factory.createAuthConfig(null,settings,"tanja",null);
assertNotNull(config);
verifyAuthConfig(config,"tanja","doublesecret","tanja@jolokia.org");
} |
3 | public void init(int size, int packetSize) {
this.size = size;
this.maxSize = size;
this.packetSize = packetSize;
} |
2 | protected final void writeFile( File outFile, StringBuffer input )
throws IOException
{
OutputStream out = new BufferedOutputStream( new FileOutputStream( outFile ) );
out.write( input.toString().getBytes( PomHelper.POM_ENCODING ) );
out.close();
} |
10 | private void Inicializa(string xml, ConfiguracaoDanfeNfce configuracaoDanfe, string cIdToken, string csc, decimal troco, decimal totalPago, string font = null)
{
_cIdToken = cIdToken;
_csc = csc;
_troco = troco;
_totalPago = totalPago;
AdicionarTexto.FontPadrao = configuracaoDanfe.CarregarFontePadraoNfceNativa(font);
_logo = configuracaoDanfe.ObterLogo();
CarregarXml(xml);
} |
2 | public InputStream openClassfile(String classname) {
try {
if (packageName == null || classname.startsWith(packageName)) {
String jarname
= directory + classname.replace('.', '/') + ".class";
URLConnection con = fetchClass0(hostname, port, jarname);
return con.getInputStream();
}
}
catch (IOException e) {}
return null; // not found
} |
3 | protected void fireInstancesAdded(int... instanceIds) {
if (listener != null) {
listener.objectInstancesAdded(this, instanceIds);
}
} |
2 | public static GoogleTaskEventsTraceReader getInstance(
final CloudSim simulation,
final String filePath,
final Function<TaskEvent, Cloudlet> cloudletCreationFunction)
{
final InputStream reader = ResourceLoader.getInputStream(filePath, GoogleTaskEventsTraceReader.class);
return new GoogleTaskEventsTraceReader(simulation, filePath, reader, cloudletCreationFunction);
} |
10 | [Fact]
public void SetInvalidLogLevelTest()
{
var logLevelValue = "InvalidLogLevel";
var agent = new ApmAgent(new TestAgentComponents(logLevelValue));
var logger = agent.Logger as TestLogger;
Assert.Equal(LogLevel.Error, agent.ConfigurationReader.LogLevel);
Assert.Equal(
$"Error Config: Failed parsing log level from {TestAgentConfigurationReader.Origin}: {TestAgentConfigurationReader.Keys.Level}, value: {logLevelValue}. Defaulting to log level 'Error'",
logger.Lines[0]);
} |
2 | @Test
public void testShortArray_AsIntegers_LittleEndian() throws Exception {
assertArrayEquals(new byte []{2,1,4,3}, binStart().ByteOrder(JBBPByteOrder.LITTLE_ENDIAN).Short(0x0102,0x0304).end().toByteArray());
} |
3 | long missCount()
{
return missCount;
} |
4 | @Test
public void rythmEngineTest() {
// 字符串模板
TemplateEngine engine = new RythmEngine(new TemplateConfig("templates"));
Template template = engine.getTemplate("hello,@name");
String result = template.render(Dict.create().set("name", "hutool"));
Assert.assertEquals("hello,hutool", result);
// classpath中获取模板
Template template2 = engine.getTemplate("rythm_test.tmpl");
String result2 = template2.render(Dict.create().set("name", "hutool"));
Assert.assertEquals("hello,hutool", result2);
} |
4 | @Test
public void test() {
MessageHandler messageHandler = SpringContextUtil.getBean("MessageHandler","login");
messageHandler.handle(null,null,null,null);
} |
3 | public void downloadErrored(URL url, String reason) {
if (observer == null) {
return;
}
synchronized(observer) {
itemsPending.remove(url);
itemsErrored.put(url, reason);
observer.update(this, new RipStatusMessage(STATUS.DOWNLOAD_ERRORED, url + " : " + reason));
observer.notifyAll();
checkIfComplete();
}
} |