Diff
stringlengths 5
2k
| FaultInducingLabel
int64 0
1
|
---|---|
if (parentNode != null && Node.ELEMENT_NODE != parentNode.getNodeType()) {
| 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.server.api.resources;
import java.util.HashSet;
import java.util.Set;
import org.apache.ambari.server.controller.internal.ControllerType;
import org.apache.ambari.server.controller.spi.Resource;
/**
* Controller Resource Definition
*/
public class ControllerResourceDefinition extends BaseResourceDefinition {
private final ControllerType type;
public ControllerResourceDefinition(ControllerType type) {
super(Resource.Type.Controller);
this.type = type;
}
@Override
public String getPluralName() {
return "controllers";
}
@Override
public String getSingularName() {
return "controller";
}
@Override
public Set<SubResourceDefinition> getSubResourceDefinitions() {
final Set<SubResourceDefinition> subResourceDefinitions = new HashSet<SubResourceDefinition>();
if (type != null) {
switch (type) {
case LDAP:
break;
}
}
return subResourceDefinitions;
}
}
| 0 |
((PCollection<?>) Iterables.getOnlyElement(transform.getInputs().values()))
| 0 |
import com.google.common.annotations.VisibleForTesting;
private static Scanner createCloneScanner(String tableName, String tableId, Connector conn) throws TableNotFoundException {
@VisibleForTesting
public static void initializeClone(String tableName, String srcTableId, String tableId, Connector conn, BatchWriter bw) throws TableNotFoundException,
MutationsRejectedException {
ti = new TabletIterator(createCloneScanner(tableName, srcTableId, conn), new Range(), true, true);
ti = new TabletIterator(createCloneScanner(tableName, srcTableId, conn), new KeyExtent(new Text(srcTableId), null, null).toMetadataRange(), true, true);
@VisibleForTesting
public static int checkClone(String tableName, String srcTableId, String tableId, Connector conn, BatchWriter bw) throws TableNotFoundException,
MutationsRejectedException {
TabletIterator srcIter = new TabletIterator(createCloneScanner(tableName, srcTableId, conn),
new KeyExtent(new Text(srcTableId), null, null).toMetadataRange(), true, true);
TabletIterator cloneIter = new TabletIterator(createCloneScanner(tableName, tableId, conn), new KeyExtent(new Text(tableId), null, null).toMetadataRange(),
true, true);
initializeClone(MetadataTable.NAME, srcTableId, tableId, conn, bw);
int rewrites = checkClone(MetadataTable.NAME, srcTableId, tableId, conn, bw);
| 0 |
import org.apache.accumulo.core.util.StringUtil;
HashSet<String> nameSpacesReferenced = new HashSet<String>();
if (file.contains(":") && parts.length > 3) {
List<String> base = Arrays.asList(Arrays.copyOf(parts, parts.length - 3));
nameSpacesReferenced.add(StringUtil.join(base, "/"));
}
for (String tableDir : nameSpacesReferenced) {
| 0 |
if (log.isDebugEnabled()) {
log.debug("Updating replication for " + extent + " with " + files + " using " + stat.toString().replace("\n", ", "));
| 0 |
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOG = LoggerFactory.getLogger(CompatibleRepositoryVersionResourceProvider.class);
| 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 |
* Gets whether to keep on running.
*
* @return whether to keep on running.
* @since 2.5
*/
protected boolean getRun() {
return run;
}
/**
while (getRun() && reader == null) {
while (getRun()) {
if (getRun() && reOpen) {
while (getRun() && ((num = reader.read(inbuf)) != -1)) {
| 0 |
EvaluationContext evaluationContext)
EvaluationContext evaluationContext) {
new DirectAssignContext<>(windowFn, element);
public TransformResult finishBundle() throws Exception {
private static class DirectAssignContext<InputT, W extends BoundedWindow>
public DirectAssignContext(WindowFn<InputT, W> fn, WindowedValue<InputT> value) {
| 0 |
* {@link PTransform} for serializing objects to JSON {@link String Strings}. Transforms a {@code
* PCollection<InputT>} into a {@link PCollection} of JSON {@link String Strings} representing
* objects in the original {@link PCollection} using Jackson.
/** Use custom Jackson {@link ObjectMapper} instead of the default one. */
return input.apply(
MapElements.via(
new SimpleFunction<InputT, String>() {
@Override
public String apply(InputT input) {
try {
ObjectMapper mapper = Optional.fromNullable(customMapper).or(DEFAULT_MAPPER);
return mapper.writeValueAsString(input);
} catch (IOException e) {
throw new RuntimeException(
"Failed to serialize " + inputClass.getName() + " value: " + input, e);
}
}
}));
| 1 |
ENDS_WITH(new String[]{"endsWith", "ENDSWITH", "ends_with", "ENDS_WITH"}),
CONTAINS_ALL(new String[]{"containsAll", "CONTAINSALL", "contains_all", "CONTAINS_ALL"}),
IS_NULL(new String[]{"isNull", "ISNULL", "is_null", "IS_NULL"}),
NOT_NULL(new String[]{"notNull", "NOTNULL", "not_null", "NOT_NULL"}),
| 0 |
import com.google.common.base.Preconditions;
import org.springframework.transaction.TransactionException;
import com.twitter.mesos.scheduler.StateManagerVars.MutableState;
import com.twitter.mesos.scheduler.storage.Storage.Work.NoResult.Quiet;
protected MutableState mutableState;
private int transactionsUntilFailure = 0;
protected StateManager createStateManager(final Storage wrappedStorage) {
this.storage = new Storage() {
@Override public void prepare() {
wrappedStorage.prepare();
}
@Override public void start(Quiet initilizationLogic) {
wrappedStorage.start(initilizationLogic);
}
@Override public <T, E extends Exception> T doInTransaction(final Work<T, E> work)
throws StorageException, E {
return wrappedStorage.doInTransaction(new Work<T, E>() {
@Override public T apply(StoreProvider storeProvider) throws E {
T result = work.apply(storeProvider);
// Inject the failure after the work is performed in the transaction, so that we can
// check for unintended side effects remaining.
if ((transactionsUntilFailure != 0) && (--transactionsUntilFailure == 0)) {
throw new TransactionException("Injected storage failure.") { };
}
return result;
}
});
}
@Override public void stop() {
wrappedStorage.stop();
}
};
this.mutableState = new MutableState();
final StateManager stateManager = new StateManager(storage, clock, mutableState, true);
protected void failNthTransaction(int n) {
Preconditions.checkState(transactionsUntilFailure == 0, "Last failure has not yet occurred");
transactionsUntilFailure = n;
}
| 0 |
* Copyright (C) 2015 Google Inc.
| 0 |
CompositeIndexType compositeIndex = (CompositeIndexType)index;
subcondition = indexCover(compositeIndex, conditions, subcover);
// if this is unique index, use it!!
if (compositeIndex.getCardinality() == Cardinality.SINGLE && subcondition != null) {
bestCandidate = null; // will cause the outer while() to bail out
candidateSubcover = subcover;
candidateSubcondition = subcondition;
candidateSupportsSort = supportsSort;
if (log.isDebugEnabled()) {
log.debug("selected unique index {}", compositeIndex.getName());
}
if (coveredClauses.isEmpty()) {
isSorted = candidateSupportsSort;
}
coveredClauses.clear();;
coveredClauses.addAll(candidateSubcover);
jointQuery = new JointIndexQuery();
jointQuery.add(compositeIndex, serializer.getQuery(compositeIndex, (List<Object[]>)candidateSubcondition));
break;
}
| 0 |
import javax.persistence.EntityManager;
import org.apache.ambari.server.controller.MpackRequest;
import org.apache.ambari.server.controller.spi.Predicate;
import org.apache.ambari.server.controller.spi.Request;
import org.apache.ambari.server.controller.utilities.PredicateBuilder;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.state.Module;
import org.junit.Test;
import com.google.inject.util.Modules;
mpack.setMpackUri("../../../../../../../resources/mpacks-v2/abc.tar.gz");
| 0 |
package org.apache.commons.beanutils2.locale.converters;
import org.apache.commons.beanutils2.ConversionException;
import org.apache.commons.beanutils2.locale.BaseLocaleConverter;
* <p>Standard {@link org.apache.commons.beanutils2.locale.LocaleConverter}
* {@link org.apache.commons.beanutils2.ConversionException}
* Create a {@link org.apache.commons.beanutils2.locale.LocaleConverter}
* that will throw a {@link org.apache.commons.beanutils2.ConversionException}
* Create a {@link org.apache.commons.beanutils2.locale.LocaleConverter}
* that will throw a {@link org.apache.commons.beanutils2.ConversionException}
* Create a {@link org.apache.commons.beanutils2.locale.LocaleConverter}
* that will throw a {@link org.apache.commons.beanutils2.ConversionException}
* Create a {@link org.apache.commons.beanutils2.locale.LocaleConverter}
* that will throw a {@link org.apache.commons.beanutils2.ConversionException}
* Create a {@link org.apache.commons.beanutils2.locale.LocaleConverter}
* that will throw a {@link org.apache.commons.beanutils2.ConversionException}
* Create a {@link org.apache.commons.beanutils2.locale.LocaleConverter}
* that will throw a {@link org.apache.commons.beanutils2.ConversionException}
* Create a {@link org.apache.commons.beanutils2.locale.LocaleConverter}
* Create a {@link org.apache.commons.beanutils2.locale.LocaleConverter}
* Create a {@link org.apache.commons.beanutils2.locale.LocaleConverter}
* Create a {@link org.apache.commons.beanutils2.locale.LocaleConverter}
* Create a {@link org.apache.commons.beanutils2.locale.LocaleConverter}
* Create a {@link org.apache.commons.beanutils2.locale.LocaleConverter}
* @throws org.apache.commons.beanutils2.ConversionException
| 1 |
@SuppressWarnings("unchecked")
| 0 |
if ( index < 0 || itemList == null || index >= itemList.size() ){
| 0 |
import com.google.cloud.dataflow.sdk.values.TypeDescriptor;
return new CoderFactoryFromStaticMethods(clazz);
private CoderFactoryFromStaticMethods(Class<?> coderClazz) {
this.factoryMethod = getFactoryMethod(coderClazz);
this.getComponentsMethod = getInstanceComponentsMethod(coderClazz);
private <T> Method getInstanceComponentsMethod(Class<?> coderClazz) {
TypeDescriptor<?> coderType = TypeDescriptor.of(coderClazz);
TypeDescriptor<T> argumentType = getCodedType(coderType);
for (TypeDescriptor<?> supertype : coderType.getClasses()) {
TypeDescriptor<?> formalArgumentType = supertype.getArgumentTypes(method).get(0);
private <T> TypeDescriptor<T> getCodedType(TypeDescriptor<?> coderType) {
for (TypeDescriptor<?> ifaceType : coderType.getInterfaces()) {
TypeDescriptor<T> token =
(TypeDescriptor<T>) TypeDescriptor.of(coderIface.getActualTypeArguments()[0]);
| 0 |
/*
* $HeadURL:$
* $Revision:$
* $Date:$
*
* ====================================================================
* 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.nio;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
/**
* A {@link ReadableByteChannel} that delegates to a {@link ContentDecoder}.
* Attempts to close this channel are ignored, and isOpen always returns true.
*
* @author <a href="mailto:sberlin at gmail.com">Sam Berlin</a>
*/
public class ContentDecoderChannel implements ReadableByteChannel {
private final ContentDecoder decoder;
public ContentDecoderChannel(ContentDecoder decoder) {
this.decoder = decoder;
}
public int read(ByteBuffer dst) throws IOException {
return decoder.read(dst);
}
public void close() {}
public boolean isOpen() {
return true;
}
}
| 0 |
* @author <a href="mailto:[email protected]">Felix Project Team</a>
| 0 |
* @author William Farner
| 0 |
private static final Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
private static final Set<String> propertyIds = Sets.newHashSet(
| 0 |
import org.apache.commons.io.IOUtils;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import java.net.URI;
import java.net.URL;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
type
);
type);
String mpackUri = Paths.get("src/test/resources/mpacks-v2/abc.tar.gz").toUri().toURL().toString();
mpackRequest.setMpackUri(mpackUri);
MpackResponse response = new MpackResponse(setupMpack());
propertyMap.put(MpackResourceProvider.MPACK_URI,mpackUri);
Resource.Type.Mpack
);
Assert.assertEquals("../../../../../../../resources/mpacks-v2/abc.tar.gz",r.getPropertyValue(MpackResourceProvider.MPACK_URI));
public Mpacks setupMpack() {
Mpacks mpack = new Mpacks();
mpack.setMpackId((long)100);
mpack.setPacklets(new ArrayList<Packlet>());
mpack.setPrerequisites(new HashMap<String, String>());
mpack.setRegistryId(new Long(100));
mpack.setVersion("3.0");
mpack.setMpacksUri("../../../../../../../resources/mpacks-v2/abc.tar.gz");
mpack.setDescription("Test mpack");
mpack.setName("testMpack");
return mpack;
| 0 |
import org.apache.felix.ipojo.ConstructorInjector;
* This class managed the method invocation, field injection
* and constructor injection.
public class Property implements FieldInterceptor, ConstructorInjector {
* The index of the parameter in case of
* constructor injection.
*/
private int m_index = -1;
/**
}
public Property(String name, String field, String method, int index,
String value, String type, InstanceManager manager, Handler handler) throws ConfigurationException {
this(name, field, method, value, type, manager, handler);
m_index = index;
* Gets the parameter index.
* @return the parameter index or <code>-1</code>
* if this property is not injected using constructor
* parameter.
*/
public int getParameterIndex() {
return m_index;
}
/**
* Gets the object to inject as constructor parameter.
* @param index the constructor parameter index
* @return the object to inject, so the property value.
* @see org.apache.felix.ipojo.ConstructorInjector#getConstructorParameter(int)
*/
public Object getConstructorParameter(int index) {
if (m_index != index) {
return null;
}
if (m_value == NO_VALUE) {
return getNoValue(m_type);
}
return m_value;
}
/**
* Gets the type of the constructor parameter to inject.
* @param index the parameter index
* @return the Class of the property.
* @see org.apache.felix.ipojo.ConstructorInjector#getConstructorParameterType(int)
*/
public Class getConstructorParameterType(int index) {
if (m_index != index) {
return null;
}
return m_type;
}
/**
| 0 |
* @author <a href="mailto:[email protected]">Felix Project Team</a>
| 0 |
public boolean consistentWithEquals() {
return true;
| 0 |
*
*
*
*
*
| 0 |
catch (final IOException ignored)
/* ignore on close exception. */
// TODO: close os
| 0 |
package org.apache.commons.dbcp2.managed;
import org.apache.commons.dbcp2.AbandonedConfig;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.dbcp2.ConnectionFactory;
import org.apache.commons.dbcp2.PoolableConnectionFactory;
import org.apache.commons.dbcp2.PoolingDataSource;
| 1 |
public FileObject[] findFiles( final FileSelector selector ) throws FileSystemException
return (FileObject[])list.toArray( new FileObject[ list.size() ] );
| 0 |
import java.io.IOException;
import org.apache.hc.core5.http.HttpException;
void sendResponse(ResponseChannel channel) throws HttpException, IOException;
| 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.logsearch.view;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class VString {
/**
* Value
*/
protected String value;
/**
* Default constructor. This will set all the attributes to default value.
*/
public VString() {
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String toString() {
String str = "VString={";
str += super.toString();
str += "value={" + value + "} ";
str += "}";
return str;
}
}
| 0 |
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@Test
public void testAtMaxAttempts() throws Exception {
AttemptBoundedExponentialBackOff backOff = new AttemptBoundedExponentialBackOff(3, 500);
assertFalse(backOff.atMaxAttempts());
backOff.nextBackOffMillis();
assertFalse(backOff.atMaxAttempts());
backOff.nextBackOffMillis();
assertTrue(backOff.atMaxAttempts());
assertEquals(BackOff.STOP, backOff.nextBackOffMillis());
}
| 0 |
if (!super.equals(obj)) {
return false;
}
CSSAttributeCondition c = (CSSAttributeCondition)obj;
return (c.namespaceURI.equals(namespaceURI) &&
c.localName.equals(localName) &&
c.specified == specified);
| 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 |
* Copyright 2016-2017 Seznam.cz, a.s.
| 0 |
import java.util.List;
import javax.naming.Reference;
import javax.naming.StringRefAddr;
@Test
public void testValidateProperties() throws Exception {
try {
StackMessageLog.lock();
final Reference ref = new Reference("javax.sql.DataSource",
BasicDataSourceFactory.class.getName(), null);
ref.add(new StringRefAddr("foo", "bar")); // Unknown
ref.add(new StringRefAddr("maxWait", "100")); // Changed
ref.add(new StringRefAddr("driverClassName", "org.apache.commons.dbcp2.TesterDriver")); //OK
final BasicDataSourceFactory basicDataSourceFactory = new BasicDataSourceFactory();
basicDataSourceFactory.getObjectInstance(ref, null, null, null);
final List<String> messages = StackMessageLog.getAll();
assertEquals(2,messages.size());
for (String message : messages) {
if (message.contains("maxWait")) {
assertTrue(message.contains("use maxWaitMillis"));
} else {
assertTrue(message.contains("foo"));
assertTrue(message.contains("Ignoring unknown property"));
}
}
} finally {
StackMessageLog.clear();
StackMessageLog.unLock();
}
}
| 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.server.metric.system.impl;
import org.apache.ambari.server.metrics.system.MetricsService;
import org.apache.ambari.server.metrics.system.impl.AbstractMetricsSource;
import org.apache.ambari.server.metrics.system.impl.JvmMetricsSource;
import org.apache.ambari.server.metrics.system.impl.MetricsServiceImpl;
import org.junit.Test;
import junit.framework.Assert;
public class MetricsServiceTest {
@Test
public void testMetricsServiceStart() {
MetricsService metricsService = new MetricsServiceImpl();
metricsService.start();
Assert.assertTrue(metricsService.getSources().size() == 2);
for (AbstractMetricsSource source : metricsService.getSources()) {
Assert.assertTrue ( source instanceof JvmMetricsSource || source instanceof TestMetricsSource);
}
}
}
| 0 |
import java.io.OutputStream;
import jline.console.ConsoleReader;
protected OutputStream out;
public MockShell(InputStream in, OutputStream out) throws IOException {
this.out = out;
this.reader = new ConsoleReader(in, out);
this.reader.setHistoryEnabled(false);
this.reader.setPaginationEnabled(false);
reader.setPrompt(getDefaultPrompt());
reader.println();
* @param out
* the output stream to set
public void setConsoleWriter(OutputStream out) {
this.out = out;
| 0 |
* Creates a new SVGClipDescriptor.
* @param clipPathValue the clip path value
| 0 |
/** Expression[] of arguments */
protected Expression[] args;
/**
* Create a new Operation.
* @param args Expression[]
*/
public Operation(Expression[] args) {
/**
* Get the arguments.
* @return Expression[]
*/
/**
* {@inheritDoc}
*/
| 1 |
import org.apache.sshd.util.test.NoIoTestCase;
import org.junit.experimental.categories.Category;
@Category({ NoIoTestCase.class })
| 0 |
// Calling du not in a table context shouldn't throw an error
output.clear();
exec("du", true, "", true);
output.clear();
| 0 |
/**
* Returns a new {@link BoundedReader} that reads from this source.
*/
public abstract BoundedReader<T> createReader(PipelineOptions options) throws IOException;
| 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.
*/
public static void main(String[] args) {
if (args.length > 0) {
if (args[0].equals("success")) System.exit(0);
if (args[0].equals("throw")) throw new RuntimeException("This is an exception");
}
| 0 |
@JsonProperty("properties")
private List<String> properties;
public List<String> getProperties() {
return properties;
public void setProperties(List<String> properties) {
this.properties = properties;
if (null == properties && null != parentLink.properties) {
properties = parentLink.properties;
| 0 |
/**
* {@inheritDoc}
*/
/**
* {@inheritDoc}
*/
/**
* {@inheritDoc}
*/
/**
* {@inheritDoc}
*/
| 0 |
// Surprised we got away without pausing before.
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
public static void main(String args[]) throws Exception
{
FunctionalTest.main(args);
new TablePermissionsTest().run();
}
| 0 |
private static final long serialVersionUID = -2654603322338049674L;
| 0 |
* Returns the RenderableImage for this node. The returned
* RenderableImage this node before any of the filter operations
* have been applied.
*/
public Filter getGraphicsNodeRable() {
return image;
}
/**
| 0 |
package org.apache.beam.sdk.runners.inprocess;
import org.apache.beam.sdk.coders.CannotProvideCoderException;
import org.apache.beam.sdk.coders.Coder;
import org.apache.beam.sdk.coders.CoderException;
import org.apache.beam.sdk.io.BoundedSource;
import org.apache.beam.sdk.io.OffsetBasedSource;
import org.apache.beam.sdk.io.OffsetBasedSource.OffsetBasedReader;
import org.apache.beam.sdk.io.Read;
import org.apache.beam.sdk.options.PipelineOptions;
import org.apache.beam.sdk.transforms.Create;
import org.apache.beam.sdk.transforms.Create.Values;
import org.apache.beam.sdk.transforms.PTransform;
import org.apache.beam.sdk.util.CoderUtils;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.sdk.values.PInput;
import org.apache.beam.sdk.values.POutput;
| 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.
*/
/**
* Defines {@link org.apache.beam.sdk.transforms.display.HasDisplayData} for annotating components
* which provide {@link org.apache.beam.sdk.transforms.display.DisplayData display data} used
* within UIs and diagnostic tools.
*
* @see org.apache.beam.sdk.transforms.display.HasDisplayData
*/
package org.apache.beam.sdk.transforms.display;
| 0 |
try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
| 0 |
import org.apache.http.client.methods.CloseableHttpResponse;
final CloseableHttpResponse httpResponse = cachingExec.revalidateCacheEntry(route, request, context, execAware, cacheEntry);
try {
final int statusCode = httpResponse.getStatusLine().getStatusCode();
return isNotServerError(statusCode) && isNotStale(httpResponse);
} finally {
httpResponse.close();
}
| 0 |
import com.google.cloud.dataflow.sdk.util.common.worker.NativeReader;
public class PartitioningShuffleReader<K, V> extends NativeReader<WindowedValue<KV<K, V>>> {
public NativeReaderIterator<WindowedValue<KV<K, V>>> iterator() throws IOException {
PartitioningShuffleReaderIterator iterator(ShuffleEntryReader reader) {
| 0 |
* whatever delimits one entry from the next. This default implementation
| 0 |
/**
* Standard HTTP/2 frame types.
*
* @since 5.0
*/
| 0 |
import org.apache.cocoon.components.modules.input.InputModuleHelper;
* @version CVS $Id: VariableRewriterTransformer.java,v 1.8 2004/05/26 11:23:47 unico Exp $
private InputModuleHelper modHelper;
this.modHelper = new InputModuleHelper();
| 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 |
import java.nio.charset.Charset;
FileUtils.writeStringToFile(new File(requestDirectory, "hosts.json"), adjusted.hostsJSON,
Charset.defaultCharset());
FileUtils
.writeStringToFile(new File(requestDirectory, "services.json"), adjusted.servicesJSON,
Charset.defaultCharset());
String result = FileUtils.readFileToString(new File(requestDirectory, getResultFileName()),
Charset.defaultCharset());
| 0 |
* @version $Revision: 1.9 $ $Date$
setParam(opts, PASSIVE_MODE, passiveMode?Boolean.TRUE:Boolean.FALSE);
| 0 |
@Test
public void testDHG() throws Exception {
for (DHFactory expected : BuiltinDHFactories.VALUES) {
if (!expected.isGroupExchange()) {
if (expected.isSupported()) {
assertNotNull("Null DH created", expected.create());
}
}
}
}
@Test
public void testDHGRead() throws Exception {
assertArrayEquals(DHGroupData.getP1(), DHGroupData.readOakleyGroup("group2.prime"));
assertArrayEquals(DHGroupData.getP14(), DHGroupData.readOakleyGroup("group14.prime"));
}
| 0 |
*
@Parameter(names = "-m", description = "the maximum size of the key/value pair to shunt to the small file")
@Parameter(description = "<file.rf> { <file.rf> ... }")
| 0 |
package org.apache.commons.ognl.test;
import org.apache.commons.ognl.test.objects.Root;
| 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/FastArrayList.java,v 1.13 2004/01/05 22:46:33 scolebourne Exp $
* Copyright (c) 2001-2004 The Apache Software Foundation. All rights
* Double-Checked Locking Idiom Is Broken Declaration</a>.</p>
* @version $Revision: 1.13 $ $Date: 2004/01/05 22:46:33 $
| 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 java.util.List;
import java.util.Map;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.orm.entities.StackEntity;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.persist.PersistService;
private StackDAO stackDAO;
// required to load stack information into the DB
injector.getInstance(AmbariMetaInfo.class);
stackDAO = injector.getInstance(StackDAO.class);
StackEntity stackEntity = stackDAO.find("HDP", "0.1");
clusterEntity.setDesiredStack(stackEntity);
serviceConfigEntity.setStack(clusterEntity.getDesiredStack());
| 0 |
if (!shell.isAlive()) {
callback.onExit(shell.exitValue());
return;
}
| 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.
*/
/** TODO: complete javadoc. */
package cz.seznam.euphoria.core.executor.greduce;
| 0 |
elasticsearchIOTestCommon.testSplit(10_000);
| 0 |
public class Query0 extends NexmarkQueryTransform<Event> {
public Query0() {
super("Query0");
@Override
public PCollection<Event> expand(PCollection<Event> events) {
| 0 |
return getAnimatedStringAttribute(null, SVG_TARGET_ATTRIBUTE);
}
| 0 |
import java.util.Arrays;
import java.util.List;
@Test
public void testPublishCollectionOfRecords() {
List<SampleTestResult> results =
Arrays.asList(new SampleTestResult("a", "b"), new SampleTestResult("a", "b"));
publisher.publish(results, TABLE_NAME);
assertEquals(2, bigQueryClient.getRows(TABLE_NAME).size());
}
| 0 |
/**
* Adds alerts for the current cluster.
*/
public void addAlerts(Collection<Alert> alerts);
/**
* @return a collection of current known alerts.
*/
public Collection<Alert> getAlerts();
| 0 |
// Serializable /////////////////////////////////////////////////
| 0 |
assertNotNull(children);
assertNotNull(child);
assertNotNull(child);
assertNotNull(children);
assertNotNull(child);
assertNotNull(child);
| 0 |
ExecutorServiceConfigurer configurer = (ExecutorServiceConfigurer) factory;
BuiltinIoServiceFactoryFactories builtin = BuiltinIoServiceFactoryFactories.fromFactoryName(factory);
| 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
| 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/ReferenceMap.java,v 1.18 2003/12/05 20:23:57 scolebourne Exp $
import org.apache.commons.collections.keyvalue.DefaultMapEntry;
* @version $Revision: 1.18 $ $Date: 2003/12/05 20:23:57 $
| 0 |
import javax.ws.rs.WebApplicationException;
// don't try to handle jersey exceptions ourselves
if (e instanceof WebApplicationException) {
WebApplicationException ie =(WebApplicationException) e;
return ie.getResponse();
}
"Error processing request due to " + e
| 0 |
* @return count
| 0 |
import static org.apache.beam.vendor.guava.v20_0.com.google.common.base.MoreObjects.firstNonNull;
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.checkState;
import static org.apache.beam.vendor.guava.v20_0.com.google.common.base.Strings.isNullOrEmpty;
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.Joiner;
import org.apache.beam.vendor.guava.v20_0.com.google.common.base.Utf8;
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.ImmutableList;
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.batik.util.DoublyIndexedTable;
| 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//io/src/java/org/apache/commons/io/HexDump.java,v 1.6 2004/02/21 02:32:50 bayard Exp $
* $Revision: 1.6 $
* $Date: 2004/02/21 02:32:50 $
* @version $Revision: 1.6 $ $Date: 2004/02/21 02:32:50 $
* Instances should NOT be constructed in standard programming.
*/
public HexDump() { }
/**
| 1 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/LoopingIterator.java,v 1.6 2003/11/14 22:58:27 scolebourne Exp $
* @version $Revision: 1.6 $ $Date: 2003/11/14 22:58:27 $
public class LoopingIterator implements ResettableIterator {
| 0 |
public static final String SDI_DYNAMIC_FIELDS = "sdi_*";
| 0 |
private String contentEncoding = null;
public void setContentType(final String contentType) {
this.contentType = contentType;
}
public String getContentEncoding() {
return this.contentEncoding;
}
public void setContentEncoding(final String contentEncoding) {
this.contentEncoding = contentEncoding;
| 0 |
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.minicluster.MiniAccumuloConfig;
import org.apache.accumulo.minicluster.ProcessReference;
import org.apache.accumulo.minicluster.ServerType;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class CleanTmpIT extends ConfigurableMacIT {
@Override
public void configure(MiniAccumuloConfig cfg) {
Map<String, String> props = new HashMap<String, String>();
props.put(Property.INSTANCE_ZK_TIMEOUT.getKey(), "3s");
cfg.setSiteConfig(props);
cfg.setNumTservers(1);
cfg.useMiniDFS(true);
}
@Test(timeout = 4 * 60 * 1000)
FileSystem fs = getCluster().getFileSystem();
Path tmp = new Path(getCluster().getConfig().getAccumuloDir().getPath() + "/tables/" + id + "/default_tablet/junk.rf_tmp");
fs.create(tmp).close();
for (ProcessReference tserver: getCluster().getProcesses().get(ServerType.TABLET_SERVER)) {
getCluster().killProcess(ServerType.TABLET_SERVER, tserver);
}
getCluster().start();
Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);
for (@SuppressWarnings("unused") Entry<Key,Value> entry : scanner)
;
assertFalse(!fs.exists(tmp));
| 0 |
package org.apache.felix.ipojo;
import java.util.Set;
/**
* Instance Manager Fake.
* We're using a fake to avoid the cyclic build dependency:
* manipulator -> ipojo -> maven-ipojo-plugin -> manipulator
*/
public class InstanceManager {
public Set getRegistredFields() {
return null;
}
public Set getRegistredMethods() {
return null;
}
}
| 0 |
protected void doJoin(ProcessContext c, K key, CoGbkResult value, Iterable<LeftT> leftSideIter,
Iterable<RightT> rightSideIter) {
for (RightT rightValue : rightSideIter) {
| 0 |
//
// This test fails with the IBM JDK
//
if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
return;
}
| 0 |
* if the "dm.runtime.log" is not configured or it it is set to false, then we'll use
| 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 javax.xml.XMLConstants;
import javax.xml.xpath.XPathFactoryConfigurationException;
private XPathFactory xpf;
private String xpathStr;
private XPath xpath;
if (xpf == null) {
xpf = XPathFactory.newInstance();
try {
xpf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
} catch (XPathFactoryConfigurationException ex) {
throw new TransformerException("empty", ex);
}
}
if (xpf == null) {
xpf = XPathFactory.newInstance();
try {
xpf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
} catch (XPathFactoryConfigurationException ex) {
throw new TransformerException("empty", ex);
}
}
xpf = null;
| 0 |
import org.junit.BeforeClass;
private static AmbariMetaInfo ambariMetaInfo;
private static OrmTestHelper helper;
@BeforeClass
public static void classSetUp() {
@Before
public void setup() throws Exception {
cleanup();
}
}
private void cleanup() throws AmbariException {
Clusters clusters = injector.getInstance(Clusters.class);
Map<String, Cluster> clusterMap = clusters.getClusters();
for (String clusterName : clusterMap.keySet()) {
clusters.deleteCluster(clusterName);
}
for (Host host : clusters.getHosts()) {
clusters.deleteHost(host.getHostName());
}
public void testHeartbeatLoss() throws AmbariException, InterruptedException,
InvalidStateTransitionException {
Clusters fsm = injector.getInstance(Clusters.class);
String hostname = "host1";
fsm.addHost(hostname);
ActionQueue aq = new ActionQueue();
ActionManager am = mock(ActionManager.class);
HeartbeatMonitor hm = new HeartbeatMonitor(fsm, aq, am, 10, injector);
HeartBeatHandler handler = new HeartBeatHandler(fsm, aq, am, injector);
Register reg = new Register();
reg.setHostname(hostname);
reg.setResponseId(12);
reg.setTimestamp(System.currentTimeMillis() - 300);
reg.setAgentVersion(ambariMetaInfo.getServerVersion());
HostInfo hi = new HostInfo();
hi.setOS("Centos5");
reg.setHardwareProfile(hi);
handler.handleRegistration(reg);
HeartBeat hb = new HeartBeat();
hb.setHostname(hostname);
hb.setNodeStatus(new HostStatus(HostStatus.Status.HEALTHY, "cool"));
hb.setTimestamp(System.currentTimeMillis());
hb.setResponseId(12);
handler.handleHeartBeat(hb);
hm.start();
aq.enqueue(hostname, new ExecutionCommand());
//Heartbeat will expire and action queue will be flushed
while (aq.size(hostname) != 0) {
Thread.sleep(1);
}
assertEquals(fsm.getHost(hostname).getState(), HostState.HEARTBEAT_LOST);
classSetUp();
}
@Test
| 0 |
* @cocoon.sitemap.component.documentation
| 0 |
import org.apache.accumulo.server.security.SecurityUtil;
| 0 |
import org.apache.felix.moduleloader.IContent;
private final IContent m_archive;
public SignerMatcher(String root, long lastModified, IContent archive, BundleDNParser parser)
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.