private static synchronized void initCaCertificate() { if (caCertificate == null) { caCertificate = new Resource( EngineLocalConfig.getInstance().getPKICACert(), Format.X509_PEM_CA, null); } }
@Override public Void call() { ISingleAsyncOperation operation = factory.createSingleAsyncOperation(); operation.execute(currentEventId); return null; } }
public String toString(Format format, String alias) { return (format != null ? format : defaultFormat).toString( cert, alias != null ? alias : defaultAlias ); }
@SuppressWarnings("unchecked") private static ActionReturnValue deserializeReturnValue(String payload, String className) { if (className == null) { return null; } Class<Serializable> retValueClass = (Class<Serializable>) ReflectionUtils.getClassFor(className); return (ActionReturnValue) SerializationFactory.getDeserializer().deserialize(payload, retValueClass); }
@Test public void replaceWithMoreThanMaxItems() { List<Object> items = createItems(); Collection<String> replacements = ReplacementUtils.replaceWith(PROPERTY_NAME, items); validateReplacementsContainsExpectedProperties(replacements, items); validateReplacementsDoNotContainUnexpectedItems(replacements, items); }
/** * Randomizes a {@code byte} value. */ public byte nextByte() { return (byte) nextInt(); }
private <T> void mockConfigValue(MockConfigDescriptor<T> mcd) { mockConfigValue(mcd.getValue(), mcd.getVersion(), mcd.getReturnValue()); }
/** * Returns the absolute path name of the directory that contains the API explorer application. */ public String getExplorerDirectory() { return config.getProperty(EXPLORER_DIRECTORY); } }
/** * Gets the port number where the engine can be contacted using HTTP from * external hosts. This will usually be the proxy HTTP port if the proxy is * enabled or the engine HTTP port otherwise. */ public int getExternalHttpPort () { return isProxyEnabled()? getProxyHttpPort(): getHttpPort(); }
/** * @return ranges in this mac pool which overlap each other */ public static Collection<LongRange> filterOverlappingRanges(org.ovirt.engine.core.common.businessentities.MacPool macPool) { Collection<LongRange> longRanges = toRanges(macPool); return filterOverlappingRangeSets(longRanges, longRanges); }
@Override public void afterAll(ExtensionContext extensionContext) { EngineLocalConfig.clearInstance(); } }
public SynchronizeNumberOfAsyncOperations(int numberOfOperations, ArrayList<?> parameters, ISingleAsyncOperationFactory factory) { this.numberOfOperations = numberOfOperations; this.factory = factory; this.factory.initialize(parameters); }
/** * Returns the single(ton) instance set with the given seed. */ public static RandomUtils instance(long seed) { instance.setSeed(seed); return instance; }
private static String buildNestedXml (int count, String s) { if (count == 0) { return s; } return "<Level" + count + '>' + buildNestedXml(count - 1, s) + "</Level" + count + '>'; } }
private NetworkInSyncWithVdsNetworkInterface createTestedInstance(boolean isDefaultRouteNetwork, DnsResolverConfiguration reportedDnsResolverConfiguration) { return new NetworkInSyncWithVdsNetworkInterface(iface, network, networkQos, testedNetworkAttachment, reportedDnsResolverConfiguration, cluster, isDefaultRouteNetwork); }
/** * Creates a {@code byte} array of the specified size, initialized with random values. */ public byte[] nextBytes(int size) { byte[] data = new byte[size]; nextBytes(data); return data; }
@SuppressWarnings("unchecked") private static ActionParametersBase deserializeParameters(String payload, String className) { if (className == null) { return null; } Class<Serializable> actionParamsClass = (Class<Serializable>) ReflectionUtils.getClassFor(className); return (ActionParametersBase) SerializationFactory.getDeserializer().deserialize(payload, actionParamsClass); }
/** * Randomize a {@code short} value between 0 (inclusive) and the specified value (exclusive). */ public short nextShort(short s) { return (short) nextInt(s); }
/** * Randomizes a {@code short} value. */ public short nextShort() { return (short) nextInt(); }