Diff
stringlengths 5
2k
| FaultInducingLabel
int64 0
1
|
---|---|
/**
* 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 writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.aurora.common.net.loadbalancing;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.apache.aurora.common.net.pool.ResourceExhaustedException;
import java.util.Collection;
import java.util.List;
import java.util.Random;
import java.util.Set;
/**
* A load balancer that selects a random backend each time a request is made..
*
* @author William Farner
*/
public class RandomStrategy<S> extends StaticLoadBalancingStrategy<S> {
private List<S> targets = Lists.newArrayList();
private final Random random;
public RandomStrategy() {
this(new Random());
}
@VisibleForTesting
RandomStrategy(Random random) {
this.random = Preconditions.checkNotNull(random);
}
@Override
protected Collection<S> onBackendsOffered(Set<S> targets) {
this.targets = ImmutableList.copyOf(targets);
return this.targets;
}
@Override
public S nextBackend() throws ResourceExhaustedException {
if (targets.isEmpty()) throw new ResourceExhaustedException("No backends.");
return targets.get(random.nextInt(targets.size()));
}
} | 0 |
import com.twitter.mesos.JNICallback;
@JNICallback
@JNICallback
@JNICallback
@JNICallback
@JNICallback
@JNICallback | 0 |
* @author Geoff Howard ([email protected])
* @version $CVS$
/**
* Constructor requires any subclass of Event.
* @param ev
*/
/**
* Returns the specific Event this validity is based on.
*
* @return Event
*/
/**
* Basic implementation is always valid until event signals
* otherwise. May never need other behavior.
/**
* Older style of isValid
*/
public boolean equals(Object o) {
if (o instanceof EventValidity) {
return m_event.equals(((EventValidity)o).getEvent());
}
return false;
}
public int hashCode() {
return m_event.hashCode();
}
| 0 |
import org.apache.accumulo.test.categories.MiniClusterOnlyTests;
@Category({MiniClusterOnlyTests.class, SunnyDayTests.class}) | 0 |
protected final List requestInterceptors = new ArrayList();
protected final List responseInterceptors = new ArrayList(); | 0 |
import org.apache.http.Consts;
SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, Consts.ASCII);
SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, Consts.ASCII);
SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, Consts.ASCII);
SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, Consts.ASCII); | 0 |
package cz.seznam.euphoria.executor.local;
* Object passed inside local executor's processing pipelines.
| 0 |
import static java.nio.charset.StandardCharsets.UTF_8;
private boolean rootHasWritePermission;
wal.write(DfsLogger.LOG_FILE_HEADER_V3.getBytes(UTF_8), 0, DfsLogger.LOG_FILE_HEADER_V3.length() / 2); | 0 |
queryParser.setAllowLeadingWildcard(true); | 0 |
import static org.hamcrest.MatcherAssert.assertThat;
import org.apache.beam.sdk.util.CoderUtils;
@Test
public void testCoder() throws Exception {
TestStream<String> testStream =
TestStream.create(StringUtf8Coder.of())
.addElements("hey")
.advanceWatermarkTo(Instant.ofEpochMilli(22521600))
.advanceProcessingTime(Duration.millis(42))
.addElements("hey", "joe")
.advanceWatermarkToInfinity();
TestStream.TestStreamCoder<String> coder = TestStream.TestStreamCoder.of(StringUtf8Coder.of());
byte[] bytes = CoderUtils.encodeToByteArray(coder, testStream);
TestStream<String> recoveredStream = CoderUtils.decodeFromByteArray(coder, bytes);
assertThat(recoveredStream, is(testStream));
} | 0 |
private final Map<PropertyId, Object> properties = new HashMap<PropertyId, Object>();
properties.put(predicate.getPropertyId(), predicate.getValue());
for (BasePredicate predicate1 : predicates) {
predicate1.accept(this);
public Map<PropertyId, Object> getProperties() { | 0 |
package org.apache.felix.ipojo.test.scenarios.service.dependency;
import org.apache.felix.ipojo.test.scenarios.service.dependency.service.CheckService;
| 0 |
package org.apache.felix.sigil.junit.activator;
import org.apache.felix.sigil.junit.server.JUnitService;
import org.apache.felix.sigil.junit.server.impl.JUnitServiceFactory; | 0 |
identitiesProvider = AuthenticationIdentitiesProvider.wrap(identities);
int index = AuthenticationIdentitiesProvider.findIdentityIndex(
identities, AuthenticationIdentitiesProvider.PASSWORD_IDENTITY_COMPARATOR, password);
int index = AuthenticationIdentitiesProvider.findIdentityIndex(
identities, AuthenticationIdentitiesProvider.KEYPAIR_IDENTITY_COMPARATOR, kp);
return createSftpFileSystem(SftpVersionSelector.fixedVersionSelector(version));
return createSftpFileSystem(SftpVersionSelector.fixedVersionSelector(version), readBufferSize, writeBufferSize);
return NamedResource.getNames(getSignatureFactories()); | 0 |
public class ByteValidatorTest extends AbstractNumberValidatorTest { | 0 |
try (AccumuloClient c = getAccumuloClient()) {
String[] tableNames = getUniqueNames(2);
String table1 = tableNames[0];
c.tableOperations().create(table1);
String table2 = tableNames[1];
c.tableOperations().create(table2);
TreeSet<Text> splitRows = new TreeSet<>();
int splits = 3;
for (int i = (ROW_LIMIT / splits); i < ROW_LIMIT; i += (ROW_LIMIT / splits))
splitRows.add(createRow(i));
c.tableOperations().addSplits(table2, splitRows);
insertData(c, table1);
scanTable(c, table1);
insertData(c, table2);
scanTable(c, table2);
} | 0 |
import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.availability.MetricCollectorHAController;
MetricCollectorHAController haController) { | 0 |
import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
final BasicHttpTransportMetrics metrics,
final BasicHttpTransportMetrics metrics) { | 1 |
AccumuloClient c = getAccumuloClient(); | 0 |
/**
* 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 writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.aurora.common.util;
import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* Utilities for working with java {@link Date}s.
*
* @author John Sirois
*/
public final class DateUtils {
public static Date now() {
return new Date();
}
public static long toUnixTime(Date date) {
return toUnixTime(date.getTime());
}
public static long nowUnixTime() {
return toUnixTime(System.currentTimeMillis());
}
public static long toUnixTime(long millisSinceEpoch) {
return TimeUnit.MILLISECONDS.toSeconds(millisSinceEpoch);
}
public static Date ago(int calendarField, int amount) {
return ago(now(), calendarField, amount);
}
public static Date ago(Date referenceDate, int calendarField, int amount) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(referenceDate);
calendar.add(calendarField, -1 * amount);
return calendar.getTime();
}
private DateUtils() {
// utility
}
} | 0 |
import org.apache.aurora.scheduler.storage.entities.IMetadata;
if (!update.getSummary().getMetadata().isEmpty()) {
detailsMapper.insertJobUpdateMetadata(
key,
IMetadata.toBuildersSet(update.getSummary().getMetadata()));
}
| 0 |
import org.apache.beam.sdk.transforms.DoFnSchemaInformation;
new TupleTag<>(PropertyNames.OUTPUT) /* main output id */,
DoFnSchemaInformation.create()); | 0 |
public class SVGPolygonElementBridge extends SVGDecoratedShapeElementBridge {
protected boolean hasStartMarker(){
return false;
}
protected boolean hasEndMarker(){
return false;
} | 0 |
private static final SecureAction m_secureAction = new SecureAction();
m_secureAction.invokeBundleEventHook(
(org.osgi.framework.hooks.bundle.EventHook) eh,
(BundleEvent) event, shrinkable); | 0 |
exitWithError(ex.getMessage(), 1);
exit(0);
public void exit(int status) {
System.exit(status);
}
public void exitWithError(String message, int status) {
System.err.println(message);
exit(status);
} | 0 |
@NamedQuery(name = "ServiceConfigEntity.findLatestServiceConfigsByService", query = "SELECT scv FROM ServiceConfigEntity scv WHERE scv.clusterId = :clusterId AND scv.serviceName = :serviceName AND scv.version = (SELECT MAX(scv2.version) FROM ServiceConfigEntity scv2 WHERE (scv2.serviceName = :serviceName AND scv2.clusterId = :clusterId) AND (scv2.groupId = scv.groupId OR (scv2.groupId IS NULL AND scv.groupId IS NULL)))"),
@NamedQuery(name = "ServiceConfigEntity.findLatestServiceConfigsByCluster", query = "SELECT scv FROM ServiceConfigEntity scv WHERE scv.clusterId = :clusterId AND scv.serviceConfigId IN (SELECT MAX(scv1.serviceConfigId) FROM ServiceConfigEntity scv1 WHERE (scv1.clusterId = :clusterId) AND (scv1.groupId IS NULL) GROUP BY scv1.serviceName)")})
} | 0 |
import org.apache.accumulo.core.replication.proto.Replication.Status;
/**
* Determine if the given absolute file is still pending replication
* @param absolutePath Absolute path to a file
* @return True if the file still needs to be replicated
* @throws AccumuloException
* @throws AccumuloSecurityException
*/
Iterator<Entry<String,Status>> getReplicationNeededIterator() throws AccumuloException, AccumuloSecurityException; | 0 |
* @version $Revision$ | 1 |
* @return
* @return
* @return
return new URI(new URI(BaseURI), uri); | 0 |
* 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 not use this file except in compliance with
* the License. You may obtain a copy of the License at | 1 |
answer = value.evaluateAsString(context); | 0 |
Copyright 2001,2003 The Apache Software Foundation
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 writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/ | 0 |
private final List<ElementValueGen> evalues; | 0 |
final SoftReference<Object> ref = new SoftReference<>(new Object());
ArrayList<Object> list = new ArrayList<>(); | 0 |
* @author <a href="mailto:[email protected]">Felix Project Team</a> | 0 |
return "Master Server" + (masters.size() == 0 ? "" : ":" + AddressUtil.parseAddress(masters.get(0), false).getHost());
row.add(masters.size() == 0 ? "<div class='error'>Down</div>" : AddressUtil.parseAddress(masters.get(0), false).getHost());
row.add(AddressUtil.parseAddress(server.name, false).getHost()); | 1 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/BidiMap.java,v 1.3 2003/10/06 23:47:17 scolebourne Exp $
* This extended <code>Map</code> represents a mapping where a key may
* lookup a value and a value may lookup a key with equal ease.
* Th interface extends <code>Map</code> and so may be used anywhere a map
* is required. The interface provides an inverse map view, enabling
* full access to both directions of the <code>BidiMap</code>.
* <p>
* It should be noted that the quickest way to implement the <code>values</code>
* method is usually to return <code>inverseBidiMap().keySet()</code>.
*
* @see org.apache.commons.collections.DualHashBidiMap
* @version $Revision: 1.3 $ $Date: 2003/10/06 23:47:17 $
* BidiMap map1 = new DualHashBidiMap();
* BidiMap map2 = new DualHashBidiMap();
Object put(Object key, Object value);
Object getKey(Object value);
Object removeKey(Object value);
BidiMap inverseBidiMap(); | 0 |
import static org.apache.commons.lang.StringUtils.defaultString;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
private Integer restartRequired = 0;
return restartRequired == 0 ? false : true;
this.restartRequired = (restartRequired == false ? 0 : 1); | 0 |
/** * 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 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 writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.commons.cli2.option;import org.apache.commons.cli2.OptionException;/** * @author Rob Oxspring */public abstract class ArgumentTestCase extends OptionTestCase { public abstract void testProcessValues() throws OptionException;} | 0 |
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.xml.security.signature.ObjectContainer;
import org.apache.xml.security.signature.XMLSignature;
import org.apache.xml.security.transforms.Transforms;
import org.apache.xml.security.transforms.params.InclusiveNamespaces;
import org.apache.xml.security.transforms.params.XPathContainer;
import org.apache.xml.security.utils.JavaUtils;
import org.apache.xml.security.utils.XMLUtils;
import org.w3c.dom.Document; | 0 |
* Copyright 1999-2004 The Apache Software Foundation.
*
* 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 writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* @version CVS $Id: XScriptVariableScope.java,v 1.2 2004/03/05 13:02:54 bdelacretaz Exp $ | 1 |
out.println(sb); | 0 |
public Object clone() {
return super.clone(); | 0 |
/**
* 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 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 writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.zookeeper.server.command;
import java.io.PrintWriter;
import org.apache.zookeeper.server.NIOServerCnxnFactory;
import org.apache.zookeeper.server.ServerCnxn;
public class DumpCommand extends AbstractFourLetterCommand {
public DumpCommand(PrintWriter pw, ServerCnxn serverCnxn) {
super(pw, serverCnxn);
}
@Override
public void commandRun() {
if (zkServer == null) {
pw.println(ZK_NOT_SERVING);
} else {
pw.println("SessionTracker dump:");
zkServer.getSessionTracker().dumpSessions(pw);
pw.println("ephemeral nodes dump:");
zkServer.dumpEphemerals(pw);
pw.println("Connections dump:");
//dumpConnections connection is implemented only in NIOServerCnxnFactory
if (factory instanceof NIOServerCnxnFactory) {
((NIOServerCnxnFactory)factory).dumpConnections(pw);
}
}
}
} | 0 |
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableMap; | 0 |
public XMLSignatureFactoryTest() throws Exception {
fail("Should raise a NPE for null mechanismType");
" if specified provider is not found");
fail("Should raise a NPE for null mechanismType");
fail("Should raise a NPE for null provider");
factory.isFeatureSupported(null);
fail("Should raise a NPE for null feature");
fail("Should raise an NPE for null inputs");
fail("Should throw a CCE for input of wrong type");
" for wrong inputs");
fail("Should throw a MarshalException for non-XMLSignature inputs");
| 1 |
Map<String,InputTableConfig> configMap = new HashMap<>(); | 1 |
activeUser.setUserName(UserName.fromString(login)); | 0 |
import org.apache.commons.io.IOUtils;
IOUtils.closeQuietly( input ); | 0 |
new DefaultHttpResponseFactory(),
reqistry,
this.params); | 0 |
package aQute.lib.collections;
import java.util.*;
public class MultiMap<K,V> extends HashMap<K,Set<V>> {
private static final long serialVersionUID = 1L;
final Set<V> EMPTY = Collections.emptySet();
public boolean add( K key, V value ) {
Set<V> set = get(key);
if ( set == null) {
set=new HashSet<V>();
put(key,set);
}
return set.add(value);
}
public boolean addAll( K key, Collection<V> value ) {
Set<V> set = get(key);
if ( set == null) {
set=new HashSet<V>();
put(key,set);
}
return set.addAll(value);
}
public boolean remove( K key, V value ) {
Set<V> set = get(key);
if ( set == null) {
return false;
}
boolean result = set.remove(value);
if ( set.isEmpty())
remove(key);
return result;
}
public boolean removeAll( K key, Collection<V> value ) {
Set<V> set = get(key);
if ( set == null) {
return false;
}
boolean result = set.removeAll(value);
if ( set.isEmpty())
remove(key);
return result;
}
public Iterator<V> iterate(K key) {
Set<V> set = get(key);
if ( set == null)
return EMPTY.iterator();
else
return set.iterator();
}
public Iterator<V> all() {
return new Iterator<V>() {
Iterator<Set<V>> master = values().iterator();
Iterator<V> current = null;
public boolean hasNext() {
if ( current == null || !current.hasNext()) {
if ( master.hasNext()) {
current = master.next().iterator();
return current.hasNext();
}
return false;
}
return true;
}
public V next() {
return current.next();
}
public void remove() {
current.remove();
}
};
}
} | 0 |
V old = put(index, entry.getKey(), entry.getValue());
if (old == null) {
// if no key was replaced, increment the index
index++;
} else {
// otherwise put the next item after the currently inserted key
index = indexOf(entry.getKey()) + 1;
}
* would have been inserted had the remove not occurred. | 0 |
@Test
public void testSupportedCipher() throws Exception {
for (BuiltinCiphers expected : BuiltinCiphers.VALUES) {
if (!expected.isSupported()) {
System.out.append("Skip unsupported cipher: ").println(expected);
continue;
}
Cipher cipher = expected.create();
byte[] key = new byte[cipher.getBlockSize()];
byte[] iv = new byte[cipher.getIVSize()];
cipher.init(Cipher.Mode.Encrypt, key, iv);
}
} | 0 |
/*
* 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 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 writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.accumulo.tserver.tablet;
import java.util.Collection;
import java.util.List;
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.server.conf.TableConfiguration;
import org.apache.accumulo.tserver.InMemoryMap;
import org.apache.accumulo.tserver.log.DfsLogger;
public interface TabletCommitter {
void abortCommit(CommitSession commitSession, List<Mutation> value);
void commit(CommitSession commitSession, List<Mutation> mutations);
boolean beginUpdatingLogsUsed(InMemoryMap memTable, Collection<DfsLogger> copy, boolean mincFinish);
void finishUpdatingLogsUsed();
TableConfiguration getTableConfiguration();
KeyExtent getExtent();
int getLogId();
boolean getUseWAL();
void updateMemoryUsageStats(long estimatedSizeInBytes, long estimatedSizeInBytes2);
} | 1 |
* @since 3.0 | 0 |
import java.util.Optional;
return Optional.empty(); | 0 |
public ICapability getCapability(); | 0 |
Assert.assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test-10.java"))));
Assert.assertFalse(filter.accept(createFileSelectInfo(new File("test-.java"))));
Assert.assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.java"))));
Assert.assertFalse(filter.accept(createFileSelectInfo(new File("tEST.java"))));
filter = new RegexFileFilter(Pattern.compile("^test.java$", Pattern.CASE_INSENSITIVE));
Assert.assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.java"))));
Assert.assertTrue(filter.accept(createFileSelectInfo(new File("tEST.java"))));
Assert.assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.java"))));
Assert.assertTrue(filter.accept(createFileSelectInfo(new File("tEST.java"))));
Assert.assertTrue(filter.accept(createFileSelectInfo(new File("Test.java"))));
Assert.assertTrue(filter.accept(createFileSelectInfo(new File("test.java"))));
Assert.assertTrue(filter.accept(createFileSelectInfo(new File("tEST.java"))));
Assert.assertEquals(RegexFileFilter.PATTERN_IS_MISSING, ex.getMessage());
Assert.assertEquals(RegexFileFilter.PATTERN_IS_MISSING, ex.getMessage());
Assert.assertEquals(RegexFileFilter.PATTERN_IS_MISSING, ex.getMessage());
Assert.assertEquals(RegexFileFilter.PATTERN_IS_MISSING, ex.getMessage()); | 0 |
* 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 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 writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. | 0 |
* @return this <code>CommandBuilder</code> | 0 |
@Override
public StageWrapper.Type getStageWrapperType() {
return StageWrapper.Type.SERVER_SIDE_ACTION;
} | 0 |
super(org.apache.commons.bcel6.Const.MULTIANEWARRAY, index); | 0 |
*/
public IAND() {
super(org.apache.bcel.Constants.IAND);
}
/**
* Call corresponding visitor method(s). The order is:
* Call visitor methods of implemented interfaces first, then
* call methods according to the class hierarchy in descending order,
* i.e., the most specific visitXXX() call comes last.
*
* @param v Visitor object
*/
public void accept( Visitor v ) {
v.visitTypedInstruction(this);
v.visitStackProducer(this);
v.visitStackConsumer(this);
v.visitArithmeticInstruction(this);
v.visitIAND(this);
} | 0 |
@SuppressWarnings("boxing") // test code | 0 |
/*
* 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 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 writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.cauldron.sigil.ui.editors.project;
import java.util.Set;
import org.cauldron.sigil.model.IModelElement;
import org.cauldron.sigil.ui.util.ModelLabelProvider;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.widgets.Table;
public class ProjectTableViewer extends TableViewer {
private ModelLabelProvider labelProvider;
public ProjectTableViewer(Table table) {
super(table);
labelProvider = new ModelLabelProvider();
setLabelProvider(labelProvider);
}
@Override
public void setContentProvider(IContentProvider provider) {
super.setContentProvider(provider);
setInput(getTable());
}
public void setUnresolvedElements(Set<? extends IModelElement> elements) {
labelProvider.setUnresolvedElements(elements);
}
@Override
public ModelLabelProvider getLabelProvider() {
return labelProvider;
}
} | 0 |
checkState(
ModelCoders.urns().equals(BEAM_MODEL_CODER_URNS.values()),
"All Model %ss should have an associated java %s",
Coder.class.getSimpleName(),
Coder.class.getSimpleName()); | 0 |
* or more contributor license agreements. See the NOTICE file
* regarding copyright ownership. The ASF licenses this file
* with the License. You may obtain a copy of the License at
* KIND, either express or implied. See the License for the | 0 |
import org.testng.Assert;
assertCredentialEntryCorrect(entry);
assertCredentialEntryCorrect(entry);
assertCredentialEntryCorrect(entry);
}
protected void assertCredentialEntryCorrect(CredentialProvider.CredentialEntry entry) {
assertCredentialEntryCorrect(entry, defaultPass);
}
protected void assertCredentialEntryCorrect(CredentialProvider.CredentialEntry entry, char[] password) {
Assert.assertNotNull(entry);
Assert.assertEquals(entry.getCredential(), password);
assertCredentialEntryCorrect(entry);
assertCredentialEntryCorrect(entry);
assertCredentialEntryCorrect(entry);
assertCredentialEntryCorrect(entry);
assertCredentialEntryCorrect(entry);
assertCredentialEntryCorrect(entry);
assertCredentialEntryCorrect(entry, newpass);
assertCredentialEntryCorrect(entry, newpass);
assertCredentialEntryCorrect(entry, newpass); | 0 |
import org.apache.xml.security.stax.impl.util.IDGenerator;
new KeyNameSecurityToken(keyName, inboundSecurityContext);
new AbstractInboundSecurityToken(inboundSecurityContext, IDGenerator.generateID(null),
SecurityTokenConstants.KeyIdentifier_NoKeyInfo, false) {
new AbstractInboundSecurityToken(inboundSecurityContext, IDGenerator.generateID(null),
SecurityTokenConstants.KeyIdentifier_NoKeyInfo, false) {
return new RsaKeyValueSecurityToken(rsaKeyValueType, inboundSecurityContext);
return new DsaKeyValueSecurityToken(dsaKeyValueType, inboundSecurityContext);
return new ECKeyValueSecurityToken(ecKeyValueType, inboundSecurityContext);
IDGenerator.generateID(null), SecurityTokenConstants.KeyIdentifier_X509KeyIdentifier, true);
new X509IssuerSerialSecurityToken(
SecurityTokenConstants.X509V3Token, inboundSecurityContext, IDGenerator.generateID(null));
new X509SKISecurityToken(
SecurityTokenConstants.X509V3Token, inboundSecurityContext, IDGenerator.generateID(null));
new X509SubjectNameSecurityToken(
SecurityTokenConstants.X509V3Token, inboundSecurityContext, IDGenerator.generateID(null)); | 0 |
* @version $Id$ | 0 |
private static final String ARTIFACT_TABLE = "artifact";
createArtifactTable();
private void createArtifactTable() throws SQLException {
ArrayList<DBColumnInfo> columns = new ArrayList<DBColumnInfo>();
columns.add(new DBColumnInfo("artifact_name", String.class, 255, null, false));
columns.add(new DBColumnInfo("foreign_keys", String.class, null, null, false));
columns.add(new DBColumnInfo("artifact_data", char[].class, null, null, false));
dbAccessor.createTable(ARTIFACT_TABLE, columns, "artifact_name", "foreign_keys");
}
| 0 |
import org.apache.accumulo.core.file.FileOperations;
import org.apache.accumulo.hadoopImpl.mapreduce.lib.ConfiguratorBase;
FileSKVIterator sample = FileOperations.getInstance().newReaderBuilder() | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/MultiMap.java,v 1.5 2002/11/24 19:33:19 scolebourne Exp $
* $Revision: 1.5 $
* $Date: 2002/11/24 19:33:19 $
* <p>
* A <code>MultiMap</code> is a Map with slightly different semantics.
* Putting a value into the map will add the value to a Collection at that
* key. Getting a value will always return a Collection, holding all the
* values put to that key. This implementation uses an ArrayList as the
* collection.
* <p>
* For example:
* <pre>
* MultiMap mhm = new MultiHashMap();
* mhm.put(key, "A");
* mhm.put(key, "B");
* mhm.put(key, "C");
* Collection coll = (Collection) mhm.get(key);</pre>
* <p>
* <code>coll</code> will be a list containing "A", "B", "C".
* @author Stephen Colebourne
/**
* Removes a specific value from map.
* <p>
* The item is removed from the collection mapped to the specified key.
*
* @param key the key to remove from
* @param value the value to remove
* @return the value removed (which was passed in)
*/
public Object remove(Object key, Object item); | 0 |
/*
* 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 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 writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ambari.view.hive20.actor.message;
public class StartLogAggregation {
private String statement;
public StartLogAggregation() {
}
public StartLogAggregation(String statement) {
this.statement = statement;
}
public String getStatement() {
return statement;
}
} | 0 |
import org.apache.xml.security.stax.ext.XMLSecurityUtils;
XMLSecurityUtils.copy(inputStream, byteArrayOutputStream); | 0 |
Set<SubResourceDefinition> subs = new HashSet<>(); | 0 |
public static <K, V> Map<K, V> defaultedMap(Map<K, V> map, V defaultValue) {
return new DefaultedMap<K, V>(map, ConstantTransformer.constantTransformer(defaultValue));
public static <K, V> IterableMap<K, V> defaultedMap(Map<K, V> map, Factory<? extends V> factory) {
return new DefaultedMap<K, V>(map, FactoryTransformer.factoryTransformer(factory));
public static <K, V> Map<K, V> defaultedMap(Map<K, V> map, Transformer<? super K, ? extends V> transformer) {
this(ConstantTransformer.constantTransformer(defaultValue)); | 0 |
@SuppressWarnings("deprecation") // tests some deprecated classes | 0 |
import org.apache.ambari.api.services.serializers.ResultSerializer;
* Provides common functionality to all services.
public abstract class BaseService {
/**
* All requests are funneled through this method so that common logic can be executed.
* This consists of creating a {@link Request} instance, invoking the correct {@link RequestHandler} and
* applying the proper {@link ResultSerializer} to the result.
*
* @param headers http headers
* @param uriInfo uri information
* @param requestType http request type
* @param resourceDefinition resource definition that is being acted on
* @return the response of the operation in serialized form
*/
protected Response handleRequest(HttpHeaders headers, UriInfo uriInfo, Request.Type requestType,
Request request = getRequestFactory().createRequest(headers, uriInfo, requestType, resourceDefinition);
Result result = getRequestHandler().handleRequest(request);
return getResponseFactory().createResponse(request.getResultSerializer().serialize(result, uriInfo));
/**
* Obtain the factory from which to create Request instances.
*
* @return the Request factory
*/
/**
* Obtain the factory from which to create Response instances.
*
* @return the Response factory
*/
/**
* Obtain the appropriate RequestHandler for the request. At this time all requests are funneled through
* a delegating request handler which will ultimately delegate the request to the appropriate concrete
* request handler.
*
* @return the request handler to invoke
*/ | 1 |
/*
* 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 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 writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.beam.runners.dataflow.worker.util.common.worker;
/** Abstract interface that counts elements processed. */
public interface ElementCounter {
/** Updates output counters. */
public void update(Object elem) throws Exception;
/** Finishes output counters lazy updates. */
public void finishLazyUpdate(Object elem);
} | 0 |
/**
* Apply the configured iterators from the configuration to the scanner for the specified table name
*
* @param context
* the Hadoop context for the configured job
* @param scanner
* the scanner to configure
* @since 1.6.0
*/
@Override
protected void setupIterators(TaskAttemptContext context, Scanner scanner, String tableName) {
setupIterators(context, scanner);
}
/**
* Apply the configured iterators from the configuration to the scanner.
*
* @param context
* the Hadoop context for the configured job
* @param scanner
* the scanner to configure
*/
protected void setupIterators(TaskAttemptContext context, Scanner scanner) {
List<IteratorSetting> iterators = getIterators(context);
for (IteratorSetting iterator : iterators)
scanner.addScanIterator(iterator);
} | 0 |
import java.util.TreeMap;
TreeMap<Long, Double> vals = new TreeMap<Long, Double>(); | 0 |
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import java.nio.ByteBuffer;
private static class EmptySeekableByteChannel implements SeekableByteChannel {
@Override
public long position() {
return 0L;
}
@Override
public SeekableByteChannel position(long newPosition) {
return this;
}
@Override
public long size() {
return 0L;
}
@Override
public SeekableByteChannel truncate(long size) {
return this;
}
@Override
public int write(ByteBuffer src) {
return 0;
}
@Override
public int read(ByteBuffer dst) {
return 0;
}
@Override
public boolean isOpen() {
return true;
}
@Override
public void close() { }
}
.thenReturn(new EmptySeekableByteChannel());
// Any request for expansion gets a single bogus URL
// after we first run the expansion code (which will generally
// return no results, which causes a crash we aren't testing)
.thenReturn(Arrays.asList(GcsPath.fromUri("gs://bucket/foo")));
public void testReadNamed() {
p.apply(TextIO.Read.from("/tmp/file.txt"));
assertEquals("TextIO.Read.out", output1.getName());
p.apply(TextIO.Read.named("MyRead").from("/tmp/file.txt"));
assertEquals("MyRead.out", output2.getName());
p.apply(TextIO.Read.from("/tmp/file.txt").named("HerRead"));
assertEquals("HerRead.out", output3.getName());
pipeline.apply(TextIO.Read.from("gs://bucket/foo**/baz"));
// Check that running does fail.
pipeline.run();
File tmpFile = tmpFolder.newFile("test");
tmpFile.delete();
File tmpFile = tmpFolder.newFile("test");
tmpFile.delete(); | 0 |
tlsStrategy != null ? tlsStrategy : new H2ClientTlsStrategy()); | 0 |
if ( port != null && port.equals( "21" ) )
if ( userInfo != null )
if ( idx == -1 ) | 0 |
import org.apache.sshd.common.util.KeyUtils;
String alg = KeyUtils.getKeyType(key);
buffer.putString(alg);
Signature verif = NamedFactory.Utils.create(session.getFactoryManager().getSignatureFactories(), alg);
bs.putString(alg);
bs.putString(alg); | 0 |
if (schedulingFilter.filter(slot, host, task.getTask()).isEmpty()) { | 0 |
* Copyright 1999-2004 The Apache Software Foundation
* 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 writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* @version $Revision: 1.11 $ $Date: 2004/02/29 14:17:44 $ | 0 |
/** Tests for {@link AfterEach}. */
assertEquals(
new Instant(9),
AfterEach.inOrder(AfterWatermark.pastEndOfWindow(), AfterPane.elementCountAtLeast(4))
assertEquals(
BoundedWindow.TIMESTAMP_MAX_VALUE,
Repeatedly.forever(
AfterFirst.of(trigger1.getContinuationTrigger(), trigger2.getContinuationTrigger())),
Trigger trigger =
AfterEach.inOrder(
StubTrigger.named("t1"), StubTrigger.named("t2"), StubTrigger.named("t3")); | 1 |
binarySnapshotStore = createMock(new Clazz<SnapshotStore<byte[]>>() { }); | 0 |
Text row_value = new Text(
Long.toString(((r.nextLong() & 0x7fffffffffffffffl) / 177) % 100000000000l));
BatchWriter bw = connector.createBatchWriter(opts.getTableName(),
bwOpts.getBatchWriterConfig()); | 0 |
import org.apache.beam.sdk.transforms.windowing.TimestampCombiner;
public void testTimestampCombinerEarliest() {
.withTimestampCombiner(TimestampCombiner.EARLIEST))
public void testTimestampCombinerLatest() {
.withTimestampCombiner(TimestampCombiner.LATEST)) | 0 |
/** index of the loop variable. */
private static final int VAR_INDEX = 0;
/** index of the items. */
private static final int ITEMS_INDEX = 1;
/** index of the code to execute. */
private static final int STATEMENT_INDEX = 2;
/**
* Create the node given an id.
*
* @param id node id.
*/
/**
* Create a node with the given parser and id.
*
* @param p a parser.
* @param id node id.
*/
/** {@inheritDoc} */
/** {@inheritDoc} */
ASTReference loopVariable = (ASTReference) jjtGetChild(VAR_INDEX);
SimpleNode iterable = (SimpleNode) jjtGetChild(ITEMS_INDEX);
if (iterableValue != null && jjtGetNumChildren() >= (STATEMENT_INDEX + 1)) { | 0 |
ClusterVersionEntity effectiveClusterVersion = cluster.getEffectiveClusterVersion();
if (effectiveClusterVersion != null) {
commandParams.put(VERSION, effectiveClusterVersion.getRepositoryVersion().getVersion());
// TODO Alejandro, Called First. insert params.version. Called during Rebalance HDFS, ZOOKEEPER Restart, Zookeeper Service Check. | 0 |
import junit.framework.TestCase;
ConfigurationMap<String> holder = new TestConfigurationMap( new String[]
ConfigurationMap<String> holder = new TestConfigurationMap( null );
ConfigurationMap<String> holder = new TestConfigurationMap( null );
ConfigurationMap<String> holder = new TestConfigurationMap( new String[]
final ConfigurationMap<String> holder10 = new TestConfigurationMap( pids10 );
final ConfigurationMap<String> holder20 = new TestConfigurationMap( pids20 );
return new HashMap<>( size ); | 0 |
uri2 = folder2.getRoot().toURI() + ".*"; | 0 |
TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
XMLStreamReader securityStreamReader =
inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
// Check the SecurityEvents
checkSignatureToken(securityEventListener, getPublicKey("RSA"),
XMLSecurityConstants.XMLKeyIdentifierType.KEY_VALUE);
TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
XMLStreamReader securityStreamReader =
inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
// Check the SecurityEvents
checkSignatureToken(securityEventListener, getPublicKey("RSA"),
XMLSecurityConstants.XMLKeyIdentifierType.KEY_VALUE);
TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
XMLStreamReader securityStreamReader =
inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
// Check the SecurityEvents
checkSignatureToken(securityEventListener, getPublicKey("RSA"),
XMLSecurityConstants.XMLKeyIdentifierType.KEY_VALUE); | 0 |
import static org.apache.beam.vendor.guava.v20_0.com.google.common.base.Preconditions.checkArgument;
import static org.apache.beam.vendor.guava.v20_0.com.google.common.base.Preconditions.checkNotNull;
import static org.apache.beam.vendor.guava.v20_0.com.google.common.base.Preconditions.checkState;
import org.apache.beam.vendor.guava.v20_0.com.google.common.annotations.VisibleForTesting;
import org.apache.beam.vendor.guava.v20_0.com.google.common.base.MoreObjects;
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.ImmutableMap;
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.Iterables; | 0 |
import org.apache.beam.runners.core.construction.SerializablePipelineOptions;
private final SerializablePipelineOptions serializedOptions;
this.serializedOptions = new SerializablePipelineOptions(options);
serializedOptions.get(), doFn,
if ((serializedOptions.get().as(FlinkPipelineOptions.class)) | 0 |
List<String> octetList = new ArrayList<>(Arrays.asList(octets)); | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.