Diff stringlengths 5 2k | FaultInducingLabel int64 0 1 |
|---|---|
// Required protocol interceptors
// Recommended protocol interceptors | 0 |
import org.apache.cocoon.el.util.MultiMap; | 0 |
import org.apache.http.HttpResponseFactory;
protected final ByteBufferAllocator allocator;
protected final NHttpClientHandler handler;
protected final HttpParams params;
protected HttpResponseFactory createHttpResponseFactory() {
return new DefaultHttpResponseFactory();
}
createHttpResponseFactory(), | 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.felix.dm.runtime.itest.tests;
import org.apache.felix.dm.itest.util.Ensure;
import org.apache.felix.dm.itest.util.TestBase;
import org.apache.felix.dm.runtime.itest.components.FELIX5337;
import org.osgi.framework.ServiceRegistration;
/**
* Test test validates that we can lookup ALL existing services using annotation, and "(objectClass=*)" filter.
*/
public class FELIX5337Test extends TestBase {
public void testCatchAllServicesUsingAnnotation() {
Ensure e = new Ensure();
ServiceRegistration sr = register(e, FELIX5337.ENSURE);
// wait for S to be started
e.waitForStep(2, 5000);
// remove our sequencer: this will stop S
sr.unregister();
// ensure that S is stopped and destroyed
e.waitForStep(3, 10000);
}
} | 0 |
package org.apache.felix.main;
import org.apache.felix.framework.Felix; | 0 |
import org.apache.commons.configuration.event.EventSource;
public interface ConfigurationBuilder<T extends Configuration> extends EventSource | 0 |
storage.write(new MutateWork.NoResult.Quiet() { | 0 |
private static void dump(final File repoDirectory) throws Exception
final TransientRepository repository = getTransientRepository(repoDirectory);
private static void dump(final Node node) throws RepositoryException
final PropertyIterator properties = node.getProperties();
final Property property = properties.nextProperty();
final Value[] values = property.getValues();
for (final Value value : values)
final NodeIterator nodes = node.getNodes();
private static Session getSession(final TransientRepository repository) throws RepositoryException
private static TransientRepository getTransientRepository(final File repoDirectory) throws IOException
private static void importFiles(final File repoDirectory, final File sourceDir) throws Exception
final TransientRepository repository = getTransientRepository(repoDirectory);
for (final File file : files)
private static void message(final IOException e)
private static void message(final String string)
private static void startJackrabbit(final File repoDirectory) throws Exception
} catch (final IOException e)
final WebdavFileSystemConfigBuilder builder = (WebdavFileSystemConfigBuilder) manager
final FileSystemOptions opts = new FileSystemOptions(); | 1 |
import org.apache.zookeeper.TestableZooKeeper;
TestableZooKeeper zk = createClient();
// we've asked to close, wait for it to finish closing
// all the sub-threads otw the selector may not be
// closed when we check (false positive on test failure
zk.testableWaitForShutdown(CONNECTION_TIMEOUT);
threads[i].join(CONNECTION_TIMEOUT);
| 0 |
import java.util.HashMap;
import java.util.Set;
import java.util.Map.Entry;
import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
HashMap<String,Set<SecurityErrorCode>> tables = new HashMap<String,Set<SecurityErrorCode>>();
for (Entry<KeyExtent,Set<SecurityErrorCode>> ke : e.getAuthorizationFailures().entrySet()) {
Set<SecurityErrorCode> secCodes = tables.get(ke.getKey().getTableId().toString());
if (secCodes == null) {
secCodes = new HashSet<SecurityErrorCode>();
tables.put(ke.getKey().getTableId().toString(), secCodes);
}
secCodes.addAll(ke.getValue()); | 0 |
package org.apache.felix.framework.cache;
import org.apache.felix.moduleloader.*;
// We do not actually close the associated content
// from which we are filtering our directory because
// we assume that this will be close manually by
// the owner of that content.
public synchronized Enumeration getEntries()
{
if (!m_opened)
{
throw new IllegalStateException("ContentDirectoryContent is not open");
}
return new EntriesEnumeration(m_content.getEntries(), m_rootPath);
}
public synchronized byte[] getEntryAsBytes(String name) throws IllegalStateException
return m_content.getEntryAsBytes(m_rootPath + name);
public IContent getEntryAsContent(String name)
if ((name.length() > 0) && (name.charAt(0) == '/'))
{
name = name.substring(1);
}
return m_content.getEntryAsContent(m_rootPath + name);
}
public String getEntryAsNativeLibrary(String name)
{
if (!m_opened)
{
throw new IllegalStateException("ContentDirectoryContent is not open");
}
if ((name.length() > 0) && (name.charAt(0) == '/'))
{
name = name.substring(1);
}
return m_content.getEntryAsNativeLibrary(m_rootPath + name); | 0 |
enum LockArea {
LockArea(String configurationProperty) {
enum LockType { | 0 |
*
*
*
*
*
*
*
* | 1 |
* @version CVS $Id: Processor.java,v 1.4 2003/07/31 03:20:37 vgritsenko Exp $
* If no match is found in the sitemap <code>false</code> | 0 |
n= (Integer) hints.get(PNGTranscoder.KEY_INDEXED); | 0 |
@Test(timeout=60*1000)
BatchScanner bs = getConnector().createBatchScanner("bss", Authorizations.EMPTY, 4);
bs.close(); | 0 |
* @version $Revision: 1.14 $ $Date: 2004/05/20 13:07:43 $
if (isReadOnly()) {
throw new SQLException("Cannot commit a readonly connection");
}
if (isReadOnly()) {
throw new SQLException("Cannot rollback a readonly connection");
} | 0 |
assertTrue(ac.get(0) instanceof ExecutionCommand);
assertEquals("1-977", ((ExecutionCommand) (ac.get(0))).getCommandId());
assertEquals(clusterHostInfo, ((ExecutionCommand) (ac.get(0))).getClusterHostInfo());
ac = waitForQueueSize(hostname, aq, 1, scheduler);
assertTrue(ac.get(0) instanceof ExecutionCommand);
assertEquals("1-977", ((ExecutionCommand) (ac.get(0))).getCommandId());
assertEquals(clusterHostInfo, ((ExecutionCommand) (ac.get(0))).getClusterHostInfo()); | 0 |
/*
* Copyright (C) 2015 Google Inc.
*
* 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 com.google.cloud.dataflow.sdk.util;
import com.google.cloud.dataflow.sdk.transforms.windowing.BoundedWindow;
import com.google.cloud.dataflow.sdk.values.PCollectionView;
import javax.annotation.Nullable;
/**
* The interface to objects that provide side inputs. Particular implementations
* may read a side input directly or use appropriate sorts of caching, etc.
*/
public interface SideInputReader {
/**
* Returns the value of the given {@link PCollectionView} for the given {@link BoundedWindow}.
*
* <p>It is valid for a side input to be {@code null}. It is <i>not</i> valid for this to
* return {@code null} for any other reason.
*/
@Nullable
public <T> T get(PCollectionView<T> view, BoundedWindow window);
/**
* Returns true if the given {@link PCollectionView} is valid for this reader.
*/
public <T> boolean contains(PCollectionView<T> view);
/**
* Returns true if there are no side inputs in this reader.
*/
public boolean isEmpty();
} | 0 |
import org.apache.commons.collections.CollectionUtils;
if(CollectionUtils.isNotEmpty(groups)) {
for (String group : groups) {
isAccessAllowed = checkAccess(group, resourceType, resource, map);
if (isAccessAllowed) {
break;
} | 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.hc.client5.http.client.cache;
/**
* Signals that {@link HttpCacheStorage} encountered an error performing an
* processChallenge operation.
*
* @since 4.1
*/
public class HttpCacheUpdateException extends Exception {
private static final long serialVersionUID = 823573584868632876L;
public HttpCacheUpdateException(final String message) {
super(message);
}
public HttpCacheUpdateException(final String message, final Throwable cause) {
super(message);
initCause(cause);
}
} | 0 |
* <p>This class is immutable and thread-safe.</p> | 0 |
ctx.initialize((SVGDocument)svgDocument, this); | 0 |
/*
JavaUtils.writeBytesToFilename("data/temp" + "/c14n-" + i
*/ | 0 |
package org.apache.commons.digester3.plugins; | 1 |
boolean isStatic = Modifier.isStatic( method.getModifiers() ); | 0 |
private static final org.slf4j.Logger LOG = | 1 |
private static final LONG_Upper singleton = new LONG_Upper();
return singleton; | 0 |
BigQueryReader.BigQueryReaderIterator iterator = reader.iterator();
BigQueryReader.BigQueryReaderIterator iterator = reader.iterator();
BigQueryReader.BigQueryReaderIterator iterator = reader.iterator(); | 0 |
// InclusiveWithComments C14N 1.1 | 0 |
JobUpdateKey mutableKey,
final IJobUpdateKey key = IJobUpdateKey.build(mutableKey);
JobKeys.assertValid(key.getJob());
context = authorizeJobUpdateAction(key, session);
change.modifyUpdate(jobUpdateController, key, context.getIdentity());
void modifyUpdate(JobUpdateController controller, IJobUpdateKey key, String invokingUser)
public void modifyUpdate(JobUpdateController controller, IJobUpdateKey key, String invokingUser)
controller.pause(key, invokingUser);
public void modifyUpdate(JobUpdateController controller, IJobUpdateKey key, String invokingUser)
controller.resume(key, invokingUser);
public void modifyUpdate(JobUpdateController controller, IJobUpdateKey key, String invokingUser)
controller.abort(key, invokingUser);
public Response pauseJobUpdate(JobUpdateKey mutableKey, SessionKey session) {
return changeJobUpdateState(mutableKey, session, PAUSE);
public Response resumeJobUpdate(JobUpdateKey mutableKey, SessionKey session) {
return changeJobUpdateState(mutableKey, session, RESUME);
public Response abortJobUpdate(JobUpdateKey mutableKey, SessionKey session) {
return changeJobUpdateState(mutableKey, session, ABORT); | 0 |
* <p>Adds all necessary coders to the components builder.
*
* <p>Adds all necessary coders to the components builder.
*
* @return id of a windowed value coder containing the PCollection's element coder | 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 |
@Path("znodes/v1{path: /.*}")
private void ensurePathNotNull(String path) {
if (path == null) {
throw new IllegalArgumentException("Invalid path \"" + path + "\"");
}
}
MediaType.APPLICATION_XML})
public Response existsZNode(@PathParam("path") String path,
@Context UriInfo ui)
throws InterruptedException, KeeperException
{
Stat stat = zk.exists(path, false);
if (stat == null) {
throwNotFound(path, ui);
}
return Response.status(Response.Status.OK).build();
}
@HEAD
@Produces({MediaType.APPLICATION_OCTET_STREAM})
public Response existsZNodeAsOctet(@PathParam("path") String path,
@Context UriInfo ui)
return Response.status(Response.Status.NO_CONTENT).build();
ensurePathNotNull(path);
ensurePathNotNull(path);
ensurePathNotNull(path);
ensurePathNotNull(path);
ensurePathNotNull(path);
if (path.equals("/")) {
path += name;
} else {
path += "/" + name;
}
ensurePathNotNull(path);
if (path.equals("/")) {
path += name;
} else {
path += "/" + name;
}
ensurePathNotNull(path); | 0 |
public void testDurationIsDeterministic() throws NonDeterministicException {
// Duration can be encoded deterministically.
verifyDeterministic(ProtoCoder.of(Duration.class)); | 0 |
final ClusterDAO clusterDAO = injector.getInstance(ClusterDAO.class);
List<ClusterEntity> clusters = clusterDAO.findAll();
for (ClusterEntity cluster : clusters) {
for (ClusterConfigMappingEntity configMapping : cluster.getConfigMappingEntities()) {
if (configMapping.getType().equals(Configuration.MAPREDUCE2_LOG4J_CONFIG_TAG)) {
configMapping.setSelected(0);
clusterDAO.merge(cluster); | 0 |
* @throws IOEXception if an I/O Exception occurs in readUnsignedShort
* @throws IOEXception if an I/O Exception occurs in writeShort | 0 |
package org.apache.felix.dm.impl; | 0 |
* <p>{@link Empty} is an override used in {@link JdbcDriver#connect(TableProvider,
* org.apache.beam.sdk.options.PipelineOptions)} to avoid loading all available table providers.
* This is the override to create an empty schema, used in {@link JdbcDriver#connect(TableProvider
* , org.apache.beam.sdk.options.PipelineOptions)} to avoid loading all table providers. This
* schema is expected to be replaced by an actual functional schema by the same code that
* specified this override in the first place. | 0 |
private Set<String> errors = new HashSet<>();
Map<String, QuickLinks> map = new HashMap<>(); | 0 |
public void startVector(List<?> v, String tag) throws IOException {
public void endVector(List<?> v, String tag) throws IOException {
public void startMap(TreeMap<?,?> v, String tag) throws IOException {
public void endMap(TreeMap<?,?> v, String tag) throws IOException { | 0 |
lazzyRef = Utils.getServiceReference(context, Architecture.class.getName(), "(architecture.instance="+compName+")");
immRef = Utils.getServiceReference(context, Architecture.class.getName(), "(architecture.instance="+compName2+")"); | 0 |
import org.apache.http.conn.util.SocketUtils;
SocketUtils.connect(sock, host, port, connTimeout);
| 0 |
@Override
@Override
@Override | 0 |
package org.apache.cocoon.portal.sitemap.modules; | 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 |
public static final TokenType DerivedKeyToken = new TokenType("DerivedKeyToken"); | 0 |
try (AccumuloClient client = getClient()) {
client.tableOperations().create(tableName);
SortedSet<Text> splits = new TreeSet<>();
for (int i = 0; i < 1000; i++) {
splits.add(new Text("" + i));
}
client.tableOperations().addSplits(tableName, splits);
// give a short wait for balancing
sleepUninterruptibly(10, TimeUnit.SECONDS);
// find out where the tablets are
Iterator<Integer> i;
try (Scanner s = client.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
s.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
s.setRange(MetadataSchema.TabletsSection.getRange());
Map<String,Integer> counts = new HashMap<>();
while (true) {
int total = 0;
counts.clear();
for (Entry<Key,Value> kv : s) {
String host = kv.getValue().toString();
if (!counts.containsKey(host))
counts.put(host, 0);
counts.put(host, counts.get(host) + 1);
total++;
}
// are enough tablets online?
if (total > 1000)
break;
// should be on all three servers
assertEquals(3, counts.size());
// and distributed evenly
i = counts.values().iterator();
int a = i.next();
int b = i.next();
int c = i.next();
assertTrue(Math.abs(a - b) < 3);
assertTrue(Math.abs(a - c) < 3);
assertTrue(a > 330); | 0 |
* Copyright 2016-2017 Seznam.cz, a.s. | 0 |
List<TableCell> cells = new ArrayList<>();
public void testInsertAll() throws Exception {
ids.add(""); | 0 |
import java.util.HashSet;
import java.util.Set;
* @version CVS $Id: FOM_JavaScriptInterpreter.java,v 1.21 2004/02/11 18:15:29 coliver Exp $
String uri = src.getURI();
Set set = (Set)sourceToClass.get(uri);
if (set == null) {
set = new HashSet();
sourceToClass.put(uri, set);
}
set.add(className);
Set set = (Set)sourceToClass.get(uri);
Iterator ii = set.iterator();
while (ii.hasNext()) {
String className = (String)ii.next();
sourceToClass.remove(className);
javaClass.remove(className);
classToSource.remove(className);
}
set.clear();
// no action
String errMsg) {
if (src != null) {
throw Context.reportRuntimeError(errMsg);
} | 0 |
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Charsets;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList; | 0 |
ImmutableList.of(SparkPipelineOptions.class), | 0 |
options.setStreaming(true); | 0 |
State windowState = getWindowState(window);
windowState.add(element.getValue());
// inlining: processTriggerResult(window, triggerResult, null);
if (triggerResult.isFlush()) {
windowState.flush();
}
if (triggerResult.isPurge()) {
windowState.close();
trigger.onClear(window, triggerContext);
}
// processTriggerResult(window, triggerResult, null);
windowState = getWindowState(mergingWindowSet.getStateWindow(window));
if (tr.isFlush()) {
windowState.flush();
}
if (tr.isPurge()) {
windowState.close();
trigger.onClear(window, triggerContext);
removeWindow(window, mergingWindowSet);
return stateFactory.apply(outputContext, storageProvider); | 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 |
properties.setProperty(Configuration.SHARED_RESOURCES_DIR_KEY, "src/test/resources/"); | 0 |
for (String variantURI : parent.getVariantMap().values()) { | 0 |
import org.apache.batik.util.SVGConstants;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
protected Boolean complex = null;
/**
* This method looks at the SVG font and checks if any of
* the glyphs use renderable child elements. If so this
* is a complex font in that full CSS inheritance needs to
* be applied. Otherwise if it only uses the 'd' attribute
* it does not need CSS treatment.
*/
public boolean isComplex() {
if (complex != null) return complex.booleanValue();
boolean ret = isComplex(fontElement, ctx);
complex = new Boolean(ret);
return ret;
}
public static boolean isComplex(Element fontElement, BridgeContext ctx) {
NodeList glyphElements = fontElement.getElementsByTagNameNS
(SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_GLYPH_TAG);
int numGlyphs = glyphElements.getLength();
for (int i = 0; i < numGlyphs; i++) {
Element glyph = (Element)glyphElements.item(i);
Node child = glyph.getFirstChild();
for (;child != null; child = child.getNextSibling()) {
if (child.getNodeType() != Node.ELEMENT_NODE)
continue;
Element e = (Element)child;
Bridge b = ctx.getBridge(e);
if ((b != null) && (b instanceof GraphicsNodeBridge)) {
return true;
}
}
}
return false;
} | 0 |
private String note;
@JsonProperty("service_config_version_note")
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
} | 0 |
import javax.persistence.EntityManager;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.anyString;
import static org.easymock.EasyMock.capture;
import static org.easymock.EasyMock.createMockBuilder;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.createStrictMock;
import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.reset;
import static org.easymock.EasyMock.verify;
import org.junit.BeforeClass;
private static Injector injector;
private static UpgradeCatalogHelper upgradeCatalogHelper;
private static StackEntity desiredStackEntity;
@BeforeClass
public static void classSetUp() {
@Before
public void init() {
reset(entityManagerProvider);
expect(entityManagerProvider.get()).andReturn(entityManager).anyTimes();
replay(entityManagerProvider);
}
| 0 |
addReturnToSelf();
appendSelf(transforms);
addReturnToSelf();
MessageDigestAlgorithm.getInstance(getDocument(), messageDigestAlgorithm);
appendSelf(digestMethodElem);
addReturnToSelf();
XMLUtils.createElementInSignatureSpace(getDocument(), Constants._TAG_DIGESTVALUE);
appendSelf(digestValueElement);
addReturnToSelf();
return MessageDigestAlgorithm.getInstance(getDocument(), uri);
setLocalAttribute(Constants._ATT_URI, uri);
return getLocalAttribute(Constants._ATT_URI);
setLocalIdAttribute(Constants._ATT_ID, id);
return getLocalAttribute(Constants._ATT_ID);
setLocalAttribute(Constants._ATT_TYPE, type);
return getLocalAttribute(Constants._ATT_TYPE);
Text t = createText(base64codedValue);
getElement().getAttributeNodeNS(null, Constants._ATT_URI);
return resolver.resolve(uriAttr, this.baseURI, secureValidation);
transforms = new Transforms(getDocument());
getElement().insertBefore(transforms.getElement(), digestMethodElem); | 0 |
import org.apache.sshd.server.Environment;
import org.apache.sshd.server.SignalListener;
public class SshTerminal extends Terminal implements SignalListener {
private Environment environment;
public SshTerminal(Environment environment) {
return Integer.valueOf(this.environment.getEnv().get(Environment.ENV_COLUMNS));
return Integer.valueOf(this.environment.getEnv().get(Environment.ENV_LINES)); | 0 |
Element rect = domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_RECT_TAG);
Element rect = domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_RECT_TAG); | 0 |
* Autogenerated by Thrift Compiler (0.12.0)
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)")
public @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer row; // required
public @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer colFamily; // required
public @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer colQualifier; // required
public @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer colVisibility; // required
@org.apache.thrift.annotation.Nullable
@org.apache.thrift.annotation.Nullable
this.row = row == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(row.clone());
public Key setRow(@org.apache.thrift.annotation.Nullable java.nio.ByteBuffer row) {
this.colFamily = colFamily == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(colFamily.clone());
public Key setColFamily(@org.apache.thrift.annotation.Nullable java.nio.ByteBuffer colFamily) {
this.colQualifier = colQualifier == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(colQualifier.clone());
public Key setColQualifier(@org.apache.thrift.annotation.Nullable java.nio.ByteBuffer colQualifier) {
this.colVisibility = colVisibility == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(colVisibility.clone());
public Key setColVisibility(@org.apache.thrift.annotation.Nullable java.nio.ByteBuffer colVisibility) {
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
@org.apache.thrift.annotation.Nullable
@org.apache.thrift.annotation.Nullable | 0 |
import org.apache.beam.runners.core.metrics.MetricsContainerImpl;
* {@link MetricsContainerImpl} to be active.
* Source.Reader decorator which registers {@link MetricsContainerImpl}. | 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.felix.cm.file;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Dictionary;
import junit.framework.TestCase;
public class ConfigurationHandlerTest extends TestCase
{
private static final String PAR_1 = "mongouri";
private static final String VAL_1 = "127.0.0.1:27017";
private static final String PAR_2 = "customBlobStore";
private static final String VAL_2 = "true";
private static final String CONFIG =
"#mongodb URI\n" +
PAR_1 + "=\"" + VAL_1 + "\"\n" +
"\n" +
" # custom datastore\n" +
PAR_2 + "=B\"" + VAL_2 + "\"\n";
public void testComments() throws IOException
{
final Dictionary dict = ConfigurationHandler.read(new ByteArrayInputStream(CONFIG.getBytes("UTF-8")));
assertEquals(2, dict.size());
assertEquals(VAL_1, dict.get(PAR_1));
assertEquals(VAL_2, dict.get(PAR_2).toString());
}
} | 0 |
Object result = new Object[1];
result = getAttribute(name, modeConf, objectModel);
return (result == null? null : new Object[]{result}); | 0 |
* @version $Revision$ | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/ReceiveTag.java,v 1.3 2003/10/09 21:21:20 rdonkin Exp $
* $Revision: 1.3 $
* $Date: 2003/10/09 21:21:20 $
* any, must include the following acknowledgement:
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
* permission of the Apache Software Foundation.
* $Id: ReceiveTag.java,v 1.3 2003/10/09 21:21:20 rdonkin Exp $
* @version $Revision: 1.3 $ | 0 |
import java.util.Map;
this.m_logger = logger;
this.m_revisionRootDir = revisionRootDir;
this.m_location = location;
return this.m_logger;
return this.m_revisionRootDir;
return this.m_location; | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/CompositeMap.java,v 1.5 2004/01/08 22:37:30 scolebourne Exp $
* @version $Revision: 1.5 $ $Date: 2004/01/08 22:37:30 $
* @param composite the CompositeMap with the collision | 0 |
import java.util.Optional;
public Type getType() {
return eventTimeFn.getClass() == Time.ProcessingTime.class
? Type.PROCESSING : Type.EVENT;
@Override
public Optional<UnaryFunction<T, Long>> getTimeAssigner() {
if (getType() == Type.EVENT)
return Optional.of(eventTimeFn);
return Optional.empty();
}
| 0 |
public interface IModelWalker
{
boolean visit( IModelElement element ); | 0 |
ReplicationTarget target = DistributedWorkQueueWorkAssignerHelper.fromQueueKey(workID)
.getValue();
log.error("Could not instantiate ReplicaSystem for {}, waiting before returning the work",
target, e);
log.debug("Current status for {} replicating to {}: {}", file, target,
ProtobufUtil.toString(status));
log.info("Received work request for {} and {}, but it does not need replication. Ignoring...",
file, target);
log.debug("Finished replicating {}. Original status: {}, New status: {}", filePath, status,
newStatus);
Map<String,String> configuredPeers = conf
.getAllPropertiesWithPrefix(Property.REPLICATION_PEERS);
protected Status getStatus(String file, ReplicationTarget target)
throws ReplicationTableOfflineException, AccumuloException, AccumuloSecurityException, | 0 |
clusters.mapAndPublishHostsToCluster(hostNames, clusterName);
clusters.mapAndPublishHostsToCluster(Collections.singleton("h-5"), clusterName); | 1 |
XmlAdapter<JaxbMapKeyMap[], Map<String, Map<String, String>>> {
public JaxbMapKeyMap[] marshal(Map<String, Map<String, String>> map)
JaxbMapKeyMap[] list = new JaxbMapKeyMap[map.size()];
int index=0;
JaxbMapKeyVal[] keyValList = mapAdapter.marshal(value);
list[index++] = new JaxbMapKeyMap(key, keyValList);
public Map<String, Map<String, String>> unmarshal(JaxbMapKeyMap[] list) | 1 |
* http://www.apache.org/licenses/LICENSE-2.0 | 0 |
} else if (Enum.class.isAssignableFrom(cls)) {
return null;
} else if (Enum.class.isAssignableFrom(targetCls)) {
if (object instanceof Boolean) {
try {
Method m = targetCls.getMethod("valueOf", String.class);
return m.invoke(null, object.toString().toUpperCase());
} catch (Exception e) {
throw new RuntimeException(e);
}
} else if (object instanceof Number) {
try {
Method m = targetCls.getMethod("values");
Object[] values = (Object[]) m.invoke(null);
return values[((Number) object).intValue()];
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return (T) m.invoke(null, object.toString()); | 0 |
import java.util.Collection;
import java.util.Collections;
import org.apache.ambari.server.orm.entities.ResourceEntity;
import org.apache.ambari.server.orm.entities.ResourceTypeEntity;
private static final long serialVersionUID = 1L;
static{
createAdminPrivilegeEntity(ADMIN_PRIV_ENTITY);
}
private static void createAdminPrivilegeEntity(PrivilegeEntity entity) {
entity.setPermission(pe);
ResourceEntity resource = new ResourceEntity();
resource.setId(1L);
ResourceTypeEntity rte = new ResourceTypeEntity();
rte.setId(ResourceTypeEntity.CLUSTER_RESOURCE_TYPE);
rte.setName(ResourceTypeEntity.CLUSTER_RESOURCE_TYPE_NAME);
resource.setResourceType(rte);
entity.setResource(resource); | 0 |
import org.apache.ambari.server.controller.spi.Predicate;
import org.apache.ambari.server.controller.utilities.PredicateHelper;
private static final Predicate PREDICATE_1 = new PredicateBuilder().property(PROPERTY_A).equals("Monkey").toPredicate();
private static final Predicate PREDICATE_2 = new PredicateBuilder().property(PROPERTY_B).equals("Runner").toPredicate();
private static final Predicate PREDICATE_3 = new AndPredicate(PREDICATE_1, PREDICATE_2);
private static final Predicate PREDICATE_4 = new OrPredicate(PREDICATE_1, PREDICATE_2);
private static final Predicate PREDICATE_5 = new CategoryIsEmptyPredicate("cat1");
PredicateHelper.visit(PREDICATE_1, visitor);
PredicateHelper.visit(PREDICATE_3, visitor);
PredicateHelper.visit(PREDICATE_4, visitor);
PredicateHelper.visit(PREDICATE_5, visitor); | 0 |
import org.apache.ambari.server.controller.internal.AbstractPropertyProvider;
import org.apache.ambari.server.controller.internal.PropertyInfo;
import org.apache.ambari.server.controller.spi.Predicate;
import org.apache.ambari.server.controller.spi.Request;
import org.apache.ambari.server.controller.spi.Resource;
import org.apache.ambari.server.controller.spi.SystemException;
public abstract class ThreadPoolEnabledPropertyProvider extends AbstractPropertyProvider {
private final MetricHostProvider metricHostProvider;
public ThreadPoolEnabledPropertyProvider(Map<String, Map<String, PropertyInfo>> componentMetrics,
String hostNamePropertyId,
MetricHostProvider metricHostProvider) {
this.metricHostProvider = metricHostProvider;
metricHostProvider.getHostName(clusterName, componentName) : | 0 |
* the value {@code -1} is returned. This method blocks until input
* {@code null} is returned. This method blocks until input data is | 0 |
} else if (!file.canRead() || file.isDirectory()) { | 0 |
expectedException.expectMessage(provider.SCHEMA_IS_NOT_SUPPORTED_MESSAGE); | 0 |
ElementProcessor createElementProcessor(final String name) | 0 |
List<AtlasEntity> entities = toAtlasEntities(entityHeaders, operation);
private List<AtlasEntity> toAtlasEntities(List<AtlasEntityHeader> entityHeaders, EntityOperation operation) throws AtlasBaseException {
String entityGuid = entityHeader.getGuid();
String typeName = entityHeader.getTypeName();
AtlasEntityType entityType = atlasTypeRegistry.getEntityTypeByName(typeName);
if (entityType == null) {
continue;
}
if (entityType.isInternalType()) {
final AtlasEntity entity;
// delete notifications don't need all attributes. Hence the special handling for delete operation
if (operation == EntityOperation.DELETE) {
entity = new AtlasEntity(typeName, entityHeader.getAttributes());
entity.setGuid(entityGuid);
} else {
AtlasEntityWithExtInfo entityWithExtInfo = instanceConverter.getAndCacheEntity(entityGuid);
entity = (entityWithExtInfo != null) ? entityWithExtInfo.getEntity() : null;
}
if (entity != null) {
ret.add(entity); | 0 |
import org.apache.commons.configuration.io.FileHandler;
FileHandler handler = new FileHandler(conf1);
handler.setFileName(testProperties);
handler.load(); | 0 |
package org.apache.batik.gvt.filter; | 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.bcel6.generic;
/**
* I2D - Convert int to double
* <PRE>Stack: ..., value -> ..., result.word1, result.word2</PRE>
*
* @version $Id$
* @author <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
*/
public class I2D extends ConversionInstruction {
private static final long serialVersionUID = 4267924152721121331L;
/** Convert int to double
*/
public I2D() {
super(org.apache.commons.bcel6.Constants.I2D);
}
/**
* 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
*/
@Override
public void accept( Visitor v ) {
v.visitTypedInstruction(this);
v.visitStackProducer(this);
v.visitStackConsumer(this);
v.visitConversionInstruction(this);
v.visitI2D(this);
}
} | 1 |
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.TestName;
private void checkResults(final Iterable<Entry<Key,Value>> scanner, final List<Key> results, final PartialKey pk) {
@Rule
public TestName test = new TestName();
private Connector conn;
@Before
public void setupInstance() throws Exception {
Instance inst = new org.apache.accumulo.core.client.mock.MockInstance(test.getMethodName());
conn = inst.getConnector("root", new PasswordToken(""));
}
| 0 |
m_parser.addBuilder(new ComponentBuilder()); | 0 |
* The key or value the variable.
* Whether the variable is a resource [false]
*/
private boolean resource = false;
/**
* The bundle for a variable (when resource = 'true').
*/
private String bundle = null;
/**
* Tests whether or not the value is a resource key or literal value.
* @return <code>true</code> if value is a resource key.
* @since Validator 1.2.0
*/
public boolean isResource() {
return this.resource;
}
/**
* Sets whether or not the value is a resource.
* @param resource If true indicates the value is a resource.
* @since Validator 1.2.0
*/
public void setResource(boolean resource) {
this.resource = resource;
}
/**
* Returns the resource bundle name.
* @return The bundle name.
* @since Validator 1.2.0
*/
public String getBundle() {
return this.bundle;
}
/**
* Sets the resource bundle name.
* @param bundle The new bundle name.
* @since Validator 1.2.0
*/
public void setBundle(String bundle) {
this.bundle = bundle;
}
/**
results.append(" resource=");
results.append(resource);
if (resource) {
results.append(" bundle=");
results.append(bundle);
} | 0 |
String worker = System.getProperty("worker_id");
expectedLogs.verifyDebug("Upload ID for url " + url + " on worker " + worker + " is abc"); | 0 |
// Implementation methods
} | 0 |
return super.toInt(character, leftPos, rightPos);
return super.toCheckDigit(charValue); | 0 |
import org.apache.ambari.server.orm.entities.ViewInstanceDataEntity;
* Remove the data entry keyed by the given key from the given instance entity.
*
* @param instanceEntity the instance entity
* @param key the data key
*/
public void removeInstanceData(ViewInstanceEntity instanceEntity, String key) {
ViewInstanceDataEntity dataEntity = instanceEntity.getInstanceData(key);
if (dataEntity != null) {
instanceDAO.removeData(dataEntity);
}
instanceEntity.removeInstanceData(key);
instanceDAO.merge(instanceEntity);
}
/**
ViewInstanceEntity instanceEntity = viewDefinition.getInstanceDefinition(viewInstanceEntity.getName());
if (instanceEntity == null) {
} else {
// apply overrides to the in-memory view instance entities
instanceEntity.setData(viewInstanceEntity.getData());
instanceEntity.setProperties(viewInstanceEntity.getProperties()); | 0 |
*
*
*/
* superclass are returned by reflection but an IllegalAccessException is thrown
*
| 0 |
import org.apache.beam.runners.direct.DirectRunner.CommittedBundle;
import org.apache.beam.runners.direct.WatermarkManager.FiredTimers;
import org.apache.beam.sdk.Pipeline;
import org.apache.beam.sdk.transforms.AppliedPTransform;
import org.apache.beam.sdk.transforms.PTransform;
import org.apache.beam.sdk.util.KeyedWorkItem;
import org.apache.beam.sdk.util.KeyedWorkItems;
import org.apache.beam.sdk.util.TimeDomain;
import org.apache.beam.sdk.util.TimerInternals.TimerData;
import org.apache.beam.sdk.util.WindowedValue;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.sdk.values.PCollectionView;
import org.apache.beam.sdk.values.PValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; | 0 |
.addExpr("LPAD('a', CAST(5 AS BIGINT), ' ')", " a")
.addExpr("LPAD('a', CAST(3 AS BIGINT), '-')", "--a")
@Test
public void testRightPad() throws Exception {
ExpressionChecker checker =
new ExpressionChecker()
.addExpr("RPAD('abcdef', CAST(0 AS BIGINT))", "")
.addExpr("RPAD('abcdef', CAST(0 AS BIGINT), 'defgh')", "")
.addExpr("RPAD('abcdef', CAST(6 AS BIGINT), 'defgh')", "abcdef")
.addExpr("RPAD('abcdef', CAST(5 AS BIGINT), 'defgh')", "abcde")
.addExpr("RPAD('abcdef', CAST(4 AS BIGINT), 'defgh')", "abcd")
.addExpr("RPAD('abcdef', CAST(3 AS BIGINT), 'defgh')", "abc")
.addExpr("RPAD('abc', CAST(4 AS BIGINT), 'defg')", "abcd")
.addExpr("RPAD('abc', CAST(5 AS BIGINT), 'defgh')", "abcde")
.addExpr("RPAD('abc', CAST(6 AS BIGINT), 'defgh')", "abcdef")
.addExpr("RPAD('abc', CAST(7 AS BIGINT), 'defg')", "abcdefg")
.addExpr("RPAD('abcd', CAST(10 AS BIGINT), 'defg')", "abcddefgde")
.addExpr("RPAD('中文', CAST(10 AS BIGINT), 'жщфЖЩФ')", "中文жщфЖЩФжщ")
.addExpr("RPAD('', CAST(5 AS BIGINT), ' ')", " ")
.addExpr("RPAD('', CAST(3 AS BIGINT), '-')", "---")
.addExpr("RPAD('a', CAST(5 AS BIGINT), ' ')", "a ")
.addExpr("RPAD('a', CAST(3 AS BIGINT), '-')", "a--")
.addExprWithNullExpectedValue(
"RPAD(CAST(NULL AS VARCHAR(0)), CAST(3 AS BIGINT), '-')", TypeName.STRING)
.addExprWithNullExpectedValue("RPAD('', CAST(NULL AS BIGINT), '-')", TypeName.STRING)
.addExprWithNullExpectedValue(
"RPAD('', CAST(3 AS BIGINT), CAST(NULL AS VARCHAR(0)))", TypeName.STRING);
checker.buildRunAndCheck();
} | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.