Diff
stringlengths
5
2k
FaultInducingLabel
int64
0
1
* Find the scheme for the provider of a layered file system. * <p> * This will check the FileContentInfo or file extension. * @return Scheme supporting the file type or null (if unknonw). // no specific mime-type - if it is a file also check the extension if (!file.isFile()) { return null; // VFS-490 folders don't use extensions for mime-type }
0
import org.apache.http.conn.params.ConnPerRouteBean; HttpConnectionManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(1));
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. */ package org.apache.cocoon.components.store.impl; import org.apache.avalon.framework.parameters.ParameterException; import org.apache.avalon.framework.parameters.Parameters; import org.apache.excalibur.store.impl.MRUMemoryStore; /** * Default implementation of Cocoon's transient store. This is a <code>MRUMemoryStore</code> * that cannot be backed by a persistent store (this ensure it is really transient). * * @version $Id$ */ public class DefaultTransientStore extends MRUMemoryStore { public void parameterize(Parameters params) throws ParameterException { if (params.getParameterAsBoolean("use-persistent-cache", false)) { throw new ParameterException("A transient store cannot be backed by a persistent store."); } super.parameterize(params); } }
0
package org.apache.accumulo.test.randomwalk.shard; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test;
0
@Timed("db_storage_fetch_job") @Override public JobConfiguration fetchJob(final String managerId, final String jobKey) { MorePreconditions.checkNotBlank(managerId); MorePreconditions.checkNotBlank(jobKey); return transactionTemplate.execute(new TransactionCallback<JobConfiguration>() { @Override public JobConfiguration doInTransaction(TransactionStatus transactionStatus) { return queryJob(managerId, jobKey); } }); } private static final RowMapper<JobConfiguration> JOB_CONFIGURATION_ROW_MAPPER = new RowMapper<JobConfiguration>() { @Override public JobConfiguration mapRow(ResultSet resultSet, int rowIndex) throws SQLException { try { return ThriftBinaryCodec.decode(JobConfiguration.class, resultSet.getBytes(1)); } catch (CodingException e) { throw new SQLException("Problem decoding JobConfiguration", e); } } }; JOB_CONFIGURATION_ROW_MAPPER, managerId); } @Nullable private JobConfiguration queryJob(String managerId, String jobKey) { List<JobConfiguration> results = jdbcTemplate.query( "SELECT job_configuration FROM job_state WHERE manager_id = ? AND job_key = ?", JOB_CONFIGURATION_ROW_MAPPER, managerId, jobKey); return Iterables.getOnlyElement(results, null); return getTaskStoreSize(); @VisibleForTesting int getTaskStoreSize() { return transactionTemplate.execute(new TransactionCallback<Integer>() { @Override public Integer doInTransaction(TransactionStatus transactionStatus) { return jdbcTemplate.queryForInt("SELECT COUNT(task_id) FROM task_state"); } }); }
0
import com.google.common.base.Preconditions; import org.apache.beam.model.pipeline.v1.RunnerApi; Preconditions.checkState( environment.getUrn().equals(RunnerApi.StandardEnvironments.Environments.DOCKER.toString()), "The passed environment does not contain a DockerPayload."); final RunnerApi.DockerPayload dockerPayload = RunnerApi.DockerPayload.parseFrom(environment.getPayload()); final String workerId = idGenerator.getId(); String containerImage = dockerPayload.getContainerImage(); dockerPayload.getContainerImage(),
0
@NamedQuery(name = "repositoryVersionByStackNameAndVersion", query = "SELECT repoversion FROM RepositoryVersionEntity repoversion WHERE repoversion.stack.stackName=:stackName AND repoversion.version=:version") /** * Determine if the version belongs to the stack. * Right now, this is only applicable for the HDP stack. * @param stackId Stack, such as HDP-2.3 * @param version Version number, such as 2.3.0.0, or 2.3.0.0-1234 * @return Return true if the version starts with the digits of the stack. */ public static boolean isVersionInStack(StackId stackId, String version) { if (null != version && !StringUtils.isBlank(version)) { // HDP Stack if (stackId.getStackName().equalsIgnoreCase(StackId.HDP_STACK) || stackId.getStackName().equalsIgnoreCase(StackId.HDPWIN_STACK)) { String leading = stackId.getStackVersion(); // E.g, 2.3 // In some cases during unit tests, the leading can contain 3 digits, so only the major number (first two parts) are needed. String[] leadingParts = leading.split("."); if (null != leadingParts && leadingParts.length > 2) { leading = leadingParts[0] + "." + leadingParts[1]; } return version.startsWith(leading); } // For other stacks, don't make the check. return true; } return false; }
0
* @author <a href="mailto:[email protected]">Christian Haul</a> * @version CVS $Id: ValidatorActionHelper.java,v 1.3 2004/02/15 21:30:00 haul Exp $
0
* @param charDecoder decoder to be used for decoding HTTP protocol elements. * @param charEncoder encoder to be used for encoding HTTP protocol elements. final CharsetDecoder charDecoder, final CharsetEncoder charEncoder, super(h1Config, charDecoder, charEncoder); final CharsetDecoder charDecoder, final CharsetEncoder charEncoder) { this(h1Config, charDecoder, charEncoder, null, null, null, null);
0
import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE; // use cluster of 1 node that has data + master roles @ESIntegTestCase.ClusterScope(scope = SUITE, numDataNodes = 1, supportsDedicatedMasters = false)
0
ResolverState state, Set<BundleRevision> mandatoryRevisions, Set<BundleRevision> optionalRevisions, Set<BundleRevision> ondemandFragments); Set<BundleRevision> ondemandFragments);
0
import com.google.cloud.dataflow.sdk.options.PipelineOptions; return null; // TODO
0
import org.apache.beam.vendor.grpc.v1_13_1.com.google.protobuf.NullValue; import org.apache.beam.vendor.grpc.v1_13_1.com.google.protobuf.Struct; import org.apache.beam.vendor.grpc.v1_13_1.com.google.protobuf.Value;
0
import org.apache.hc.core5.io.ShutdownType; conn.shutdown(ShutdownType.GRACEFUL); conn.shutdown(ShutdownType.GRACEFUL);
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
0
import org.apache.beam.sdk.values.WindowingStrategy;
0
* This is based on {@link org.apache.beam.runners.dataflow.DataflowPipelineTranslator}
0
return allEvents .apply(Filter.by(IS_BID)) .apply(getName() + ".SelectEvent", new SelectEvent(Type.BID)) .apply(QUERY) .apply(Convert.fromRows(Bid.class));
0
import org.apache.flink.api.java.operators.DataSink; DataSink<T> dataSink = inputDataSet.writeAsText(filenamePrefix); if (numShards > 0) { dataSink.setParallelism(numShards); }
0
import org.apache.commons.vfs.FileName; FileName parseURI(String uri) throws FileSystemException;
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.io.input; import static org.junit.Assert.*; import java.io.ByteArrayInputStream; import java.security.MessageDigest; import java.util.Random; import org.junit.Test; public class MessageDigestCalculatingInputStreamTest { public static byte[] generateRandomByteStream(int pSize) { final byte[] buffer = new byte[pSize]; final Random rnd = new Random(); rnd.nextBytes(buffer); return buffer; } @Test public void test() throws Exception { for (int i = 256; i < 8192; i = i*2) { final byte[] buffer = generateRandomByteStream(i); final MessageDigest md5Sum = MessageDigest.getInstance("MD5"); final byte[] expect = md5Sum.digest(buffer); final MessageDigestCalculatingInputStream md5InputStream = new MessageDigestCalculatingInputStream(new ByteArrayInputStream(buffer)); md5InputStream.consume(); final byte[] got = md5InputStream.getMessageDigest().digest(); assertArrayEquals(expect, got); } } }
0
* @version $Revision$ $Date$
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 /** * ISBNValidator Test Case. * * @version $Revision$ $Date$ */
0
assertTrue(uuid.createNewFile()); assertTrue(instanceId.mkdir() || instanceId.isDirectory()); assertTrue(uuid.createNewFile());
0
processFn.setStateInternalsFactory(key -> (StateInternals) stepContext.stateInternals()); processFn.setTimerInternalsFactory(key -> stepContext.timerInternals()); return (options, fn, sideInputs, sideInputReader, outputManager, mainOutputTag, additionalOutputTags, stepContext, windowingStrategy) -> { ProcessFn<InputT, OutputT, RestrictionT, ?> processFn = (ProcessFn) fn;
0
package org.apache.felix.gogo.runtime;
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
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//digester/src/java/org/apache/commons/digester/SetRootRule.java,v 1.9 2003/10/05 15:06:50 rdonkin Exp $ * $Revision: 1.9 $ * $Date: 2003/10/05 15:06:50 $ * * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * notice, this list of conditions and the following disclaimer. * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgement: * "This product includes software developed by the * 4. The names "Apache", "The Jakarta Project", "Commons", and "Apache Software * from this software without prior written permission. For written * 5. Products derived from this software may not be called "Apache", * "Apache" nor may "Apache" appear in their names without prior * written permission of the Apache Software Foundation. */ * @version $Revision: 1.9 $ $Date: 2003/10/05 15:06:50 $
0
import org.apache.felix.sigil.eclipse.internal.repository.manager.RepositoryMap; import org.apache.felix.sigil.eclipse.model.project.IRepositoryMap.RepositoryCache;
0
@Mock JobInvoker invoker; @Mock JobInvocation invocation; JobApi.PrepareJobRequest.newBuilder()
1
import org.apache.sshd.common.session.SessionContext; SessionContext session, String resourceKey, String beginMarker, String endMarker, FilePasswordProvider passwordProvider, InputStream stream) PrivateKey prvKey = decodePEMPrivateKeyPKCS8(oidAlgorithm, encBytes); public static PrivateKey decodePEMPrivateKeyPKCS8(List<Integer> oidAlgorithm, byte[] keyBytes) throws GeneralSecurityException { return decodePEMPrivateKeyPKCS8(GenericUtils.join(oidAlgorithm, '.'), keyBytes); public static PrivateKey decodePEMPrivateKeyPKCS8(String oid, byte[] keyBytes)
0
this(pipeline, ImmutableList.of());
0
* @param buffer the buffer from which to parse * @param indexFrom where to start parsing in the buffer * @param indexTo where to stop parsing in the buffer *
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. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.http.client.cache; /** * Represents a disposable system resource. * * @since 4.1 */ public interface Resource { void dispose(); }
0
map.put(Integer.valueOf(20), "Five");
0
private static final int DEFAULT_MAXIMUM_CACHE_SIZE = 20; private transient Node<E> firstCachedNode; private transient int cacheSize; private int maximumCacheSize;
1
* @param params the configuration parameters final File workDir = (File) m_context.get(Constants.CONTEXT_WORK_DIR);
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
@Test public void testAgainstURI() throws Exception { // Check that the URI generated by URI builder agrees with that generated by using URI directly final String scheme="https"; final String host="localhost"; final String specials="/abcd!$&*()_-+.,=:;'~@[]?<>|#^%\"{}\\`xyz"; // N.B. excludes space URI uri = new URI(scheme, specials, host, 80, specials, specials, specials); URI bld = new URIBuilder() .setScheme(scheme) .setHost(host) .setUserInfo(specials) .setPath(specials) .addParameter(specials, null) // hack to bypass parsing of query data .setFragment(specials) .build(); Assert.assertEquals(uri.getHost(), bld.getHost()); Assert.assertEquals(uri.getUserInfo(), bld.getUserInfo()); Assert.assertEquals(uri.getPath(), bld.getPath()); Assert.assertEquals(uri.getQuery(), bld.getQuery()); Assert.assertEquals(uri.getFragment(), bld.getFragment()); }
0
import java.io.OutputStream; import org.apache.sshd.util.TeeOutputStream; OutputStream pipedIn = channel.getInvertedIn();
0
* <p> * <p> * See <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/channels/package-summary.html" * <p>The result is the (possibly empty) set of specifications that match.
0
import org.apache.http.client.protocol.HttpClientContext; public synchronized final HttpContext getDefaultContext() { populateContext(defaultContext); context = new HttpClientContext(getDefaultContext()); context = new HttpClientContext(getDefaultContext());
0
package org.apache.accumulo.shell.commands; import org.apache.accumulo.shell.Shell; import org.apache.accumulo.shell.Token; import org.apache.accumulo.shell.Shell.Command;
0
QuorumPeer peer = new QuorumPeer(peers, tmpdir[1], tmpdir[1], port[1], 3, 1, 1000, 2, 2, 2); QuorumPeer peer = new QuorumPeer(peers, tmpdir[0], tmpdir[0], port[0], 3, 0, 1000, 2, 2, 2);
0
import org.apache.accumulo.core.conf.ClientConfiguration; AccumuloOutputFormat.setZooKeeperInstance(job, ClientConfiguration.loadDefault().withInstance(instance).withZkHosts(zookeepers));
0
import com.twitter.mesos.gen.GetJobsResponse; public GetJobsResponse getJobs(String ownerRole) { return schedulerController.getJobs(ownerRole); } @Override
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: Py.java,v 1.3 2004/03/05 13:02:21 bdelacretaz Exp $
1
package org.apache.cocoon.spring.configurator.impl; import org.apache.cocoon.spring.configurator.ResourceUtils;
0
LOG.debug("Calculated Digest: {}", calculatedDigest); LOG.debug("Calculated Digest: {}", calculatedDigest);
1
package org.apache.accumulo.core.util.shell.commands; import java.io.File; import org.apache.accumulo.core.util.shell.Shell; import org.apache.accumulo.core.util.shell.Shell.Command; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; public class ExecfileCommand extends Command { private Option verboseOption; @Override public String description() { return "specifies a file containing accumulo commands to execute"; } @Override public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception { java.util.Scanner scanner = new java.util.Scanner(new File(cl.getArgs()[0])); while (scanner.hasNextLine()) shellState.execCommand(scanner.nextLine(), true, cl.hasOption(verboseOption.getOpt())); return 0; } @Override public int numArgs() { return 1; } @Override public Options getOptions() { Options opts = new Options(); verboseOption = new Option("v", "verbose", false, "displays command prompt as commands are executed"); opts.addOption(verboseOption); return opts; } }
1
* http://www.apache.org/licenses/LICENSE-2.0
0
* @version $Id$
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//beanutils/src/java/org/apache/commons/beanutils/MappedPropertyDescriptor.java,v 1.13 2002/12/09 22:33:03 rwaldhoff Exp $ * $Revision: 1.13 $ * $Date: 2002/12/09 22:33:03 $ * @version $Revision: 1.13 $ $Date: 2002/12/09 22:33:03 $ String base = capitalizePropertyName(propertyName); private static String capitalizePropertyName(String s) {
0
import java.io.IOException; if (argv.length != 1) { System.out.println("Usage: BCELifier classname"); System.out.println("\tThe class must exist on the classpath"); return; } JavaClass java_class = getJavaClass(argv[0]); BCELifier bcelifier = new BCELifier(java_class, System.out); bcelifier.start(); } // Needs to be accessible from unit test code static JavaClass getJavaClass(String name) throws ClassNotFoundException, IOException { return java_class;
0
content = updateLuceneMatchVersion(content, "7.3.1"); content = updateLuceneMatchVersion(content,"7.3.1");
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestCommonsLinkedList.java,v 1.7 2003/10/06 21:02:50 scolebourne Exp $ * @version $Revision: 1.7 $ $Date: 2003/10/06 21:02:50 $ return "3";
0
* @version CVS $Id: DefaultSelectionListBuilder.java,v 1.3 2004/03/28 20:51:24 antonio Exp $ if (source != null) { } if (resolver != null) { }
0
AgentCommand scheduledCommand = ac.get(0); assertTrue(scheduledCommand instanceof ExecutionCommand); assertEquals("1-977", ((ExecutionCommand) scheduledCommand).getCommandId()); assertEquals(clusterHostInfo, ((ExecutionCommand) scheduledCommand).getClusterHostInfo()); ac = waitForQueueSize(hostname, aq, 2, scheduler); // first command is cancel for previous scheduledCommand = ac.get(1); assertTrue(scheduledCommand instanceof ExecutionCommand); assertEquals("1-977", ((ExecutionCommand) scheduledCommand).getCommandId()); assertEquals(clusterHostInfo, ((ExecutionCommand) scheduledCommand).getClusterHostInfo()); // Check was generated cancel command on timeout assertFalse(aq.dequeue(hostname, AgentCommandType.CANCEL_COMMAND).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 CVS $Id: Environment.java,v 1.6 2004/03/05 13:02:54 bdelacretaz Exp $
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 * 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 ArrayList<InputStream> inputStreamList = new ArrayList<>(); private final ArrayList<RandomAccessContent> randomAccessContentList = new ArrayList<>(); private DefaultFileContent.FileContentOutputStream outputStream; void addInstr(final InputStream inputStream) this.inputStreamList.add(inputStream); void setOutstr(final DefaultFileContent.FileContentOutputStream outputStream) this.outputStream = outputStream; return this.outputStream; void addRastr(final RandomAccessContent randomAccessContent) this.randomAccessContentList.add(randomAccessContent); return this.inputStreamList.size(); return this.inputStreamList.remove(pos); public void removeInstr(final InputStream inputStream) this.inputStreamList.remove(inputStream); return this.randomAccessContentList.remove(pos); public void removeRastr(final RandomAccessContent randomAccessContent) this.randomAccessContentList.remove(randomAccessContent); return inputStreamList.size() > 0 || outputStream != null || randomAccessContentList.size() > 0; outputStream.close(); outputStream = null; return randomAccessContentList.size();
0
Document doc = XMLUtils.newDocument(true, false); Document doc = XMLUtils.newDocument(false);
0
getListIterator().add(object); getListIterator().set(object);
0
rounds = Integer.parseInt(m.group(3));
0
} if (Throwable.class.isAssignableFrom(actualType)) { Throwable t = GenericUtils.peelException((Throwable) value); if (t != value) { value = t; actualType = value.getClass(); } if (IOException.class.isAssignableFrom(actualType)) { throw (IOException) value; }
0
}, false);
0
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Lists; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Sets;
0
* * * @param session The {@link ServerSession} attempting the authentication
1
private Object[] getJobReturns; private transient int getJobCallsCount; this.getJobReturns = new Object[0]; this.getJobCallsCount = 0; * Sets the return values to mock {@link JobService#getJob}. * * <p>Throws if the {@link Object} is a {@link InterruptedException}, returns otherwise. */ public FakeJobService getJobReturns(Object... getJobReturns) { this.getJobReturns = getJobReturns; return this; } /** @Override public Job getJob(JobReference jobRef) throws InterruptedException { if (!Strings.isNullOrEmpty(executingProject)) { checkArgument( jobRef.getProjectId().equals(executingProject), "Project id: %s is not equal to executing project: %s", jobRef.getProjectId(), executingProject); } if (getJobCallsCount < getJobReturns.length) { Object ret = getJobReturns[getJobCallsCount++]; if (ret == null) { return null; } else if (ret instanceof Job) { return (Job) ret; } else if (ret instanceof InterruptedException) { throw (InterruptedException) ret; } else { throw new RuntimeException("Unexpected return type: " + ret.getClass()); } } else { throw new RuntimeException( "Exceeded expected number of calls: " + getJobReturns.length); } } .getJobReturns((Job) null)
0
import org.apache.http.conn.routing.HttpRoutePlanner;
0
* * @author <a href="mailto:[email protected]">Felix Project Team</a> public class ObjectClassDefinitionImpl implements ObjectClassDefinition { public ObjectClassDefinitionImpl(String id, String name, String description, List propertiesMetaData, Resource resource) { public AttributeDefinition[] getAttributeDefinitions(int filter) { for (int i = 0; i < m_propertiesMetaData.size(); i++) { switch (filter) { if (!metaData.isRequired()) { if (metaData.isRequired()) { public String getDescription() { public String getID() { public InputStream getIcon(int size) throws IOException { public String getName() {
0
public static final String EXT_SPACE_AVAILABLE = "space-available";
0
* @deprecated (4.3) use {@link org.apache.http.conn.socket.ConnectionSocketFactory} * Please note that {@link org.apache.http.conn.HttpInetSocketAddress} class should * be used in order to pass the target remote address along with the original * {@link org.apache.http.HttpHost} value used to resolve the address. The use of * {@link org.apache.http.conn.HttpInetSocketAddress} can also ensure that no reverse * DNS lookup will be performed if the target remote address was specified * as an IP address. * @see org.apache.http.conn.HttpInetSocketAddress
0
private InetAddress[] translateIp(final String ip) throws UnknownHostException {
0
import org.apache.ambari.server.AmbariException;
0
additionalInputs.put(sideInput.getTagInternal(), sideInput.getPCollection()); additionalInputs.put(sideInput.getTagInternal(), sideInput.getPCollection());
0
/** Map decorator for this DynaBean */ private transient Map mapDecorator; /** * Return a Map representation of this DynaBean. * </p> * This, for example, could be used in JSTL in the following way to access * a DynaBean's <code>fooProperty</code>: * <ul><li><code>${myDynaBean.<b>map</b>.fooProperty}</code></li></ul> * * @return a Map representation of this DynaBean */ public Map getMap() { // cache the Map if (mapDecorator == null) { mapDecorator = new DynaBeanMapDecorator(this); } return mapDecorator; }
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
0
* @author <a href="mailto:[email protected]">Felix Project Team</a>
0
public static final String USE_GROUPBY_AGGREGATOR_QUERIES = "timeline.metrics.service.use.groupBy.aggregators"; public static final String HANDLER_THREAD_COUNT = "timeline.metrics.service.handler.thread.count"; public int getTimelineMetricsServiceHandlerThreadCount() { if (metricsConf != null) { return Integer.parseInt(metricsConf.get(HANDLER_THREAD_COUNT, "20")); } return 20; }
0
PCollection<KV<String, Long>> leftCollection = p .apply("CreateLeft", Create.of(leftListOfKv)); PCollection<KV<String, String>> rightCollection = p .apply("CreateRight", Create.of(listRightOfKv)); PCollection<KV<String, Long>> leftCollection = p .apply("CreateLeft", Create.of(leftListOfKv)); PCollection<KV<String, String>> rightCollection = p .apply("CreateRight", Create.of(listRightOfKv)); PCollection<KV<String, Long>> leftCollection = p .apply("CreateLeft", Create.of(leftListOfKv)); PCollection<KV<String, String>> rightCollection = p .apply("CreateRight", Create.of(listRightOfKv)); PCollection<KV<String, Long>> leftCollection = p .apply("CreateLeft", Create.of(leftListOfKv)); PCollection<KV<String, String>> rightCollection = p .apply("CreateRight", Create.of(listRightOfKv)); Join.leftOuterJoin( p.apply("CreateLeft", Create.of(leftListOfKv)), p.apply("CreateRight", Create.of(listRightOfKv)), null);
0
* dynaClass.add("orders", java.util.TreeMap.class); // add mapped property * dynaClass.add("myMap", java.util.TreeMap.class); // add mapped property
0
target.addEventListener(SVG_EVENT_CLICK, target.addEventListener(SVG_EVENT_MOUSEOVER, target.addEventListener(SVG_EVENT_MOUSEOUT, false); }
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/NonSerializableLongCollectionCollection.java,v 1.3 2003/11/07 20:07:51 rwaldhoff Exp $ * * @deprecated This code has been moved to Jakarta Commons Primitives (http://jakarta.apache.org/commons/primitives/) * * @version $Revision: 1.3 $ $Date: 2003/11/07 20:07:51 $
0
* Copyright (C) 2015 Google Inc.
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. */ package org.apache.cocoon.samples.tour.beans; import java.util.Iterator; /** Simple test of the DatabaseFacade */ public class DatabaseFacadeTest { public static void main(String[] args) { System.out.println("TaskBean objects provided by DatabaseFacade:"); final DatabaseFacade db = DatabaseFacade.getInstance(); for(Iterator it=db.getTasks().iterator(); it.hasNext(); ) { System.out.println(it.next()); } } }
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestCircularFifoBuffer.java,v 1.3 2003/08/31 17:28:43 scolebourne Exp $ * any, must include the following acknowledgement: * Alternately, this acknowledgement may appear in the software itself, * if and wherever such third-party acknowledgements normally appear. * @version $Revision: 1.3 $ $Date: 2003/08/31 17:28:43 $
0
import java.util.Collections; import java.util.List; public class RangeExpression extends AbstractFunctionExpression { private TraversalStepType stepType; private int startIndex; private int endIndex; public RangeExpression(TraversalStepType stepType, GroovyExpression parent, int offset, int count) { super(parent); this.startIndex = offset; this.endIndex = count; this.stepType = stepType; getCaller().generateGroovy(context); new LiteralExpression(startIndex).generateGroovy(context); new LiteralExpression(endIndex).generateGroovy(context); @Override public List<GroovyExpression> getChildren() { return Collections.singletonList(getCaller()); } @Override public GroovyExpression copy(List<GroovyExpression> newChildren) { assert newChildren.size() == 1; return new RangeExpression(stepType, newChildren.get(0), startIndex, endIndex); } @Override public TraversalStepType getType() { return stepType; } public int getStartIndex() { return startIndex; } public void setStartIndex(int startIndex) { this.startIndex = startIndex; } public int getEndIndex() { return endIndex; } public void setEndIndex(int endIndex) { this.endIndex = endIndex; }
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. */ package org.apache.cocoon.taglib; import org.apache.cocoon.xml.XMLConsumer; /** * @version $Id$ */ public abstract class XMLProducerTagSupport extends TagSupport implements XMLProducerTag { protected XMLConsumer xmlConsumer; /* * @see XMLProducer#setConsumer(XMLConsumer) */ public void setConsumer(XMLConsumer xmlConsumer) { this.xmlConsumer = xmlConsumer; } /* * @see Recyclable#recycle() */ public void recycle() { this.xmlConsumer = null; super.recycle(); } }
0
import com.google.common.collect.Sets;
0
List<BundleCapability> capList = new ArrayList<BundleCapability>(m_revision.getDeclaredCapabilities(null)); List<BundleRequirement> reqList = new ArrayList(m_revision.getDeclaredRequirements(null));
0
* @version $Revision: 1.5 $ $Date: 2002/10/21 01:40:38 $ throw new FileSystemException( "vfs.impl/init-replicator.error", null, e ); throw new FileSystemException( "vfs.impl/replicate-file.error", new Object[]{srcFile.getName()}, e );
0
impl = new DefaultHostnameVerifier(); impl.verify("\u82b1\u5b50.foo.com", x509); impl.verify("\u82b1\u5b50.bar.com", x509);
0
Copyright 2000-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
public MetricDefinition(String type, Map<String, String> properties, Map<String, Map<String, Metric>> metrics) { this.type = type; this.properties = properties; this.metrics = metrics; }
0
/* * Copyright 1999-2005 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. */ package org.apache.cocoon.portal.layout.impl; import org.apache.cocoon.portal.layout.AbstractLayout; import org.apache.cocoon.portal.layout.LayoutFactory; /** * A frame layout holds a source URI. The URI can be changed dynamically through * events. The URI may contain any URI that can be resolved by the Cocoon * {@link org.apache.cocoon.environment.SourceResolver}. * * @version $Id$ */ public class FrameLayout extends AbstractLayout { protected String source; /** * Create a new frame layout object. * Never create a layout object directly. Use the * {@link LayoutFactory} instead. * @param id The unique identifier of the layout object or null. * @param name The name of the layout. */ public FrameLayout(String id, String name) { super(id, name); } /** * @return String */ public String getSource() { return source; } /** * Sets the source. * @param source The source to set */ public void setSource(String source) { this.source = source; } /** * @see java.lang.Object#clone() */ protected Object clone() throws CloneNotSupportedException { FrameLayout clone = (FrameLayout)super.clone(); clone.source = this.source; return clone; } }
0
this(file.readUnsignedShort(), file.readUnsignedShort()); * @param name_index the name index of this constant * @param signature_index the signature index in the constant pool of this type
0
import static org.junit.Assert.assertEquals; import com.google.cloud.dataflow.sdk.util.common.worker.StateSampler.ScopedState; @Test public void reuseStateByNameTest() throws Exception { StateSampler stateSampler = new StateSampler("test-", new CounterSet().getAddCounterMutator(), 200); int state1 = stateSampler.stateForName("test_state", StateKind.USER); int state2 = stateSampler.stateForName("test_state", StateKind.USER); assertEquals(state1, state2); stateSampler.close(); } @Test public void reuseManyStatesByName() throws Exception { // Issue big number of stateForName() and setState calls to StateSampler. CounterSet counters = new CounterSet(); StateSampler stateSampler = new StateSampler("test-", counters.getAddCounterMutator(), 200); for (int i = 0; i < 10000; i++) { for (int j = 0; j < 10000; j++) { int state = stateSampler.stateForName("state" + j, StateKind.USER); try (ScopedState scope = stateSampler.scopedState(state)) {} } } // All counters got reused. assertEquals(10000, counters.size()); stateSampler.close(); }
0
@Test public void testStartClientComponent() { // FIXME write test after meta data integration // start should fail } @Test public void testStartClientHostComponent() { // FIXME write test after meta data integration // start should fail }
0
exchangeHandler.failed(new ConnectionClosedException());
0