Unnamed: 0
int64
0
637
label
int64
0
1
code
stringlengths
24
8.83k
300
0
private void debug(String msg) { if ( logger.isDebugEnabled() ) { logger.debug(Logger.EVENT_SUCCESS, msg); } }
301
0
private static DocumentBuilderFactory createDocumentBuilderFactory() throws ParserConfigurationException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING , true); dbf.setValidating(false); dbf.setIgnoringComments(false); dbf.setIgnoringElementContentWhitespace(true); dbf.setNamespaceAware(true); // dbf.setCoalescing(true); // dbf.setExpandEntityReferences(true); return dbf; } /** * Read XML as DOM. */
302
0
public void changePassword_Resets_All_Sessions() throws Exception { ScimUser user = createUser(); MockHttpSession session = new MockHttpSession(); MockHttpSession afterLoginSessionA = (MockHttpSession) getMockMvc().perform(post("/login.do") .session(session) .accept(TEXT_HTML_VALUE) .param("username", user.getUserName()) .param("password", "secr3T")) .andExpect(status().isFound()) .andExpect(redirectedUrl("/")) .andReturn().getRequest().getSession(false); session = new MockHttpSession(); MockHttpSession afterLoginSessionB = (MockHttpSession) getMockMvc().perform(post("/login.do") .session(session) .accept(TEXT_HTML_VALUE) .param("username", user.getUserName()) .param("password", "secr3T")) .andExpect(status().isFound()) .andExpect(redirectedUrl("/")) .andReturn().getRequest().getSession(false); assertNotNull(afterLoginSessionA.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY)); assertNotNull(afterLoginSessionB.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY)); getMockMvc().perform(get("/profile").session(afterLoginSessionB)) .andExpect(status().isOk()); Thread.sleep(1000 - (System.currentTimeMillis() % 1000) + 1); MockHttpSession afterPasswordChange = (MockHttpSession) getMockMvc().perform(post("/change_password.do") .session(afterLoginSessionA) .with(csrf()) .accept(TEXT_HTML_VALUE) .param("current_password", "secr3T") .param("new_password", "secr3T1") .param("confirm_password", "secr3T1")) .andExpect(status().isFound()) .andExpect(redirectedUrl("profile")) .andReturn().getRequest().getSession(false); assertTrue(afterLoginSessionA.isInvalid()); assertNotNull(afterPasswordChange); assertNotNull(afterPasswordChange.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY)); assertNotSame(afterLoginSessionA, afterPasswordChange); getMockMvc().perform( get("/profile") .session(afterLoginSessionB) .accept(TEXT_HTML)) .andExpect(status().isFound()) .andExpect(redirectedUrl("/login")); }
303
0
public void setValueStackFactory(ValueStackFactory valueStackFactory) { this.valueStackFactory = valueStackFactory; } @Inject("devMode")
304
0
private List<AuthInfo> createAuthInfo(SolrZkClient zkClient) { List<AuthInfo> ret = new LinkedList<AuthInfo>(); // In theory the credentials to add could change here if zookeeper hasn't been initialized ZkCredentialsProvider credentialsProvider = zkClient.getZkClientConnectionStrategy().getZkCredentialsToAddAutomatically(); for (ZkCredentialsProvider.ZkCredentials zkCredentials : credentialsProvider.getCredentials()) { ret.add(new AuthInfo(zkCredentials.getScheme(), zkCredentials.getAuth())); } return ret; } } }
305
0
public String changePassword( Model model, @RequestParam("current_password") String currentPassword, @RequestParam("new_password") String newPassword, @RequestParam("confirm_password") String confirmPassword, HttpServletResponse response, HttpServletRequest request) { PasswordConfirmationValidation validation = new PasswordConfirmationValidation(newPassword, confirmPassword); if (!validation.valid()) { model.addAttribute("message_code", validation.getMessageCode()); response.setStatus(HttpStatus.UNPROCESSABLE_ENTITY.value()); return "change_password"; } SecurityContext securityContext = SecurityContextHolder.getContext(); Authentication authentication = securityContext.getAuthentication(); String username = authentication.getName(); try { changePasswordService.changePassword(username, currentPassword, newPassword); request.getSession().invalidate(); request.getSession(true); if (authentication instanceof UaaAuthentication) { UaaAuthentication uaaAuthentication = (UaaAuthentication)authentication; authentication = new UaaAuthentication( uaaAuthentication.getPrincipal(), new LinkedList<>(uaaAuthentication.getAuthorities()), new UaaAuthenticationDetails(request) ); } securityContext.setAuthentication(authentication); return "redirect:profile"; } catch (BadCredentialsException e) { model.addAttribute("message_code", "unauthorized"); } catch (InvalidPasswordException e) { model.addAttribute("message", e.getMessagesAsOneString()); } response.setStatus(HttpStatus.UNPROCESSABLE_ENTITY.value()); return "change_password"; }
306
0
public void testSnapshotMoreThanOnce() throws ExecutionException, InterruptedException, IOException { Client client = client(); final File tempDir = randomRepoPath().getAbsoluteFile(); logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") .setType("fs").setSettings(ImmutableSettings.settingsBuilder() .put("location", tempDir) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000)))); // only one shard assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) )); ensureYellow(); logger.info("--> indexing"); final int numDocs = randomIntBetween(10, 100); IndexRequestBuilder[] builders = new IndexRequestBuilder[numDocs]; for (int i = 0; i < builders.length; i++) { builders[i] = client().prepareIndex("test", "doc", Integer.toString(i)).setSource("foo", "bar" + i); } indexRandom(true, builders); flushAndRefresh(); assertNoFailures(client().admin().indices().prepareOptimize("test").setFlush(true).setMaxNumSegments(1).get()); CreateSnapshotResponse createSnapshotResponseFirst = client.admin().cluster().prepareCreateSnapshot("test-repo", "test").setWaitForCompletion(true).setIndices("test").get(); assertThat(createSnapshotResponseFirst.getSnapshotInfo().successfulShards(), greaterThan(0)); assertThat(createSnapshotResponseFirst.getSnapshotInfo().successfulShards(), equalTo(createSnapshotResponseFirst.getSnapshotInfo().totalShards())); assertThat(client.admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test").get().getSnapshots().get(0).state(), equalTo(SnapshotState.SUCCESS)); { SnapshotStatus snapshotStatus = client.admin().cluster().prepareSnapshotStatus("test-repo").setSnapshots("test").get().getSnapshots().get(0); List<SnapshotIndexShardStatus> shards = snapshotStatus.getShards(); for (SnapshotIndexShardStatus status : shards) { assertThat(status.getStats().getProcessedFiles(), greaterThan(1)); } } if (frequently()) { logger.info("--> upgrade"); client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "none")).get(); backwardsCluster().allowOnAllNodes("test"); logClusterState(); boolean upgraded; do { logClusterState(); CountResponse countResponse = client().prepareCount().get(); assertHitCount(countResponse, numDocs); upgraded = backwardsCluster().upgradeOneNode(); ensureYellow(); countResponse = client().prepareCount().get(); assertHitCount(countResponse, numDocs); } while (upgraded); client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "all")).get(); } if (cluster().numDataNodes() > 1 && randomBoolean()) { // only bump the replicas if we have enough nodes logger.info("--> move from 0 to 1 replica"); client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)).get(); } logger.debug("---> repo exists: " + new File(tempDir, "indices/test/0").exists() + " files: " + Arrays.toString(new File(tempDir, "indices/test/0").list())); // it's only one shard! CreateSnapshotResponse createSnapshotResponseSecond = client.admin().cluster().prepareCreateSnapshot("test-repo", "test-1").setWaitForCompletion(true).setIndices("test").get(); assertThat(createSnapshotResponseSecond.getSnapshotInfo().successfulShards(), greaterThan(0)); assertThat(createSnapshotResponseSecond.getSnapshotInfo().successfulShards(), equalTo(createSnapshotResponseSecond.getSnapshotInfo().totalShards())); assertThat(client.admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test-1").get().getSnapshots().get(0).state(), equalTo(SnapshotState.SUCCESS)); { SnapshotStatus snapshotStatus = client.admin().cluster().prepareSnapshotStatus("test-repo").setSnapshots("test-1").get().getSnapshots().get(0); List<SnapshotIndexShardStatus> shards = snapshotStatus.getShards(); for (SnapshotIndexShardStatus status : shards) { assertThat(status.getStats().getProcessedFiles(), equalTo(1)); // we flush before the snapshot such that we have to process the segments_N files } } client().prepareDelete("test", "doc", "1").get(); CreateSnapshotResponse createSnapshotResponseThird = client.admin().cluster().prepareCreateSnapshot("test-repo", "test-2").setWaitForCompletion(true).setIndices("test").get(); assertThat(createSnapshotResponseThird.getSnapshotInfo().successfulShards(), greaterThan(0)); assertThat(createSnapshotResponseThird.getSnapshotInfo().successfulShards(), equalTo(createSnapshotResponseThird.getSnapshotInfo().totalShards())); assertThat(client.admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test-2").get().getSnapshots().get(0).state(), equalTo(SnapshotState.SUCCESS)); { SnapshotStatus snapshotStatus = client.admin().cluster().prepareSnapshotStatus("test-repo").setSnapshots("test-2").get().getSnapshots().get(0); List<SnapshotIndexShardStatus> shards = snapshotStatus.getShards(); for (SnapshotIndexShardStatus status : shards) { assertThat(status.getStats().getProcessedFiles(), equalTo(2)); // we flush before the snapshot such that we have to process the segments_N files plus the .del file } } }
307
0
protected static void setupFeatures(DocumentBuilderFactory factory) { Properties properties = System.getProperties(); List<String> features = new ArrayList<String>(); for (Map.Entry<Object, Object> prop : properties.entrySet()) { String key = (String) prop.getKey(); if (key.startsWith(DOCUMENT_BUILDER_FACTORY_FEATURE)) { String uri = key.split(DOCUMENT_BUILDER_FACTORY_FEATURE + ":")[1]; Boolean value = Boolean.valueOf((String)prop.getValue()); try { factory.setFeature(uri, value); features.add("feature " + uri + " value " + value); } catch (ParserConfigurationException e) { LOG.warn("DocumentBuilderFactory doesn't support the feature {} with value {}, due to {}.", new Object[]{uri, value, e}); } } } if (features.size() > 0) { StringBuffer featureString = new StringBuffer(); // just log the configured feature for (String feature : features) { if (featureString.length() != 0) { featureString.append(", "); } featureString.append(feature); } } }
308
0
public void testSaveAndLoad() throws IOException { assumeTrue(AppleNativeIntegrationTestUtils.isApplePlatformAvailable(ApplePlatform.MACOSX)); ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "parser_with_cell", tmp); workspace.setUp(); // Warm the parser cache. TestContext context = new TestContext(); ProcessResult runBuckResult = workspace.runBuckdCommand(context, "query", "deps(//Apps:TestAppsLibrary)"); runBuckResult.assertSuccess(); assertThat( runBuckResult.getStdout(), Matchers.containsString( "//Apps:TestAppsLibrary\n" + "//Libraries/Dep1:Dep1_1\n" + "//Libraries/Dep1:Dep1_2\n" + "bar//Dep2:Dep2")); // Save the parser cache to a file. NamedTemporaryFile tempFile = new NamedTemporaryFile("parser_data", null); runBuckResult = workspace.runBuckdCommand(context, "parser-cache", "--save", tempFile.get().toString()); runBuckResult.assertSuccess(); // Write an empty content to Apps/BUCK. Path path = tmp.getRoot().resolve("Apps/BUCK"); byte[] data = {}; Files.write(path, data); context = new TestContext(); // Load the parser cache to a new buckd context. runBuckResult = workspace.runBuckdCommand(context, "parser-cache", "--load", tempFile.get().toString()); runBuckResult.assertSuccess(); // Perform the query again. If we didn't load the parser cache, this call would fail because // Apps/BUCK is empty. runBuckResult = workspace.runBuckdCommand(context, "query", "deps(//Apps:TestAppsLibrary)"); runBuckResult.assertSuccess(); assertThat( runBuckResult.getStdout(), Matchers.containsString( "//Apps:TestAppsLibrary\n" + "//Libraries/Dep1:Dep1_1\n" + "//Libraries/Dep1:Dep1_2\n" + "bar//Dep2:Dep2")); } @Test
309
0
public void setEnforceAssertionsSigned(boolean enforceAssertionsSigned) { this.enforceAssertionsSigned = enforceAssertionsSigned; } /** * Enforce that the Issuer of the received Response/Assertion is known. The default is true. */
310
0
public void setUp() throws Exception { SecurityContextHolder.clearContext(); scimUserProvisioning = mock(ScimUserProvisioning.class); codeStore = mock(ExpiringCodeStore.class); passwordValidator = mock(PasswordValidator.class); clientDetailsService = mock(ClientDetailsService.class); emailResetPasswordService = new UaaResetPasswordService(scimUserProvisioning, codeStore, passwordValidator, clientDetailsService); } @After
311
0
public static final void main(String args[]) { System.out.println("Supported pseudo-random functions for KDF (version: " + kdfVersion + ")"); System.out.println("Enum Name\tAlgorithm\t# bits"); for (PRF_ALGORITHMS prf : PRF_ALGORITHMS.values()) { System.out.println(prf + "\t" + prf.getAlgName() + "\t" + prf.getBits()); } }
312
0
private void doTestExtensionSizeLimit(int len, boolean ok) throws Exception { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); tomcat.getConnector().setProperty( "maxExtensionSize", Integer.toString(EXT_SIZE_LIMIT)); // Must have a real docBase - just use temp Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir")); Tomcat.addServlet(ctx, "servlet", new EchoHeaderServlet()); ctx.addServletMapping("/", "servlet"); tomcat.start(); String extName = ";foo="; StringBuilder extValue = new StringBuilder(len); for (int i = 0; i < (len - extName.length()); i++) { extValue.append("x"); } String[] request = new String[]{ "POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF + "Host: any" + SimpleHttpClient.CRLF + "Transfer-encoding: chunked" + SimpleHttpClient.CRLF + "Content-Type: application/x-www-form-urlencoded" + SimpleHttpClient.CRLF + "Connection: close" + SimpleHttpClient.CRLF + SimpleHttpClient.CRLF + "3" + extName + extValue.toString() + SimpleHttpClient.CRLF + "a=0" + SimpleHttpClient.CRLF + "4" + SimpleHttpClient.CRLF + "&b=1" + SimpleHttpClient.CRLF + "0" + SimpleHttpClient.CRLF + SimpleHttpClient.CRLF }; TrailerClient client = new TrailerClient(tomcat.getConnector().getLocalPort()); client.setRequest(request); client.connect(); client.processRequest(); if (ok) { assertTrue(client.isResponse200()); } else { assertTrue(client.isResponse500()); } } @Test
313
0
void sendPluginResult(PluginResult pluginResult) { synchronized (this) { if (!aborted) { callbackContext.sendPluginResult(pluginResult); } } } } /** * Adds an interface method to an InputStream to return the number of bytes * read from the raw stream. This is used to track total progress against * the HTTP Content-Length header value from the server. */
314
0
public void setHttpClient(HttpClient httpClient) { this.httpClient = httpClient; }
315
0
protected Log getLog() { return log; } // ------------------------------------------------------------ Constructor
316
0
public void doStart() throws Exception { URI rootURI; if (serverInfo != null) { rootURI = serverInfo.resolveServer(configuredDir); } else { rootURI = configuredDir; } if (!rootURI.getScheme().equals("file")) { throw new IllegalStateException("FileKeystoreManager must have a root that's a local directory (not " + rootURI + ")"); } directory = new File(rootURI); if (!directory.exists() || !directory.isDirectory() || !directory.canRead()) { throw new IllegalStateException("FileKeystoreManager must have a root that's a valid readable directory (not " + directory.getAbsolutePath() + ")"); } log.debug("Keystore directory is " + directory.getAbsolutePath()); }
317
0
public void setMaxSize(String maxSize) { this.maxSize = Long.parseLong(maxSize); } /** * Sets the buffer size to be used. * * @param bufferSize */ @Inject(value = StrutsConstants.STRUTS_MULTIPART_BUFFERSIZE, required = false)
318
0
public void execute(FunctionContext context) { // Verify that the cache exists before continuing. // When this function is executed by a remote membership listener, it is // being invoked before the cache is started. Cache cache = verifyCacheExists(); // Register as membership listener registerAsMembershipListener(cache); // Register functions registerFunctions(); // Return status context.getResultSender().lastResult(Boolean.TRUE); }
319
0
public void setSocketBuffer(int socketBuffer) { super.setSocketBuffer(socketBuffer); outputBuffer.setSocketBuffer(socketBuffer); }
320
0
public void waitForAllNodes(int timeout) throws IOException, InterruptedException { waitForAllNodes(jettys.size(), timeout); }
321
0
static MatcherType fromElement(Element elt) { if (StringUtils.hasText(elt.getAttribute(ATT_MATCHER_TYPE))) { return valueOf(elt.getAttribute(ATT_MATCHER_TYPE)); } return ant; }
322
0
public int realReadBytes(byte cbuf[], int off, int len) throws IOException; } /** Same as java.nio.channel.WrittableByteChannel. */
323
0
public void complete() { if (log.isDebugEnabled()) { logDebug("complete "); } check(); request.getCoyoteRequest().action(ActionCode.ASYNC_COMPLETE, null); } @Override
324
0
public void testContainsExpressionIsFalse() throws Exception { // given String anExpression = "foo"; // when boolean actual = ComponentUtils.containsExpression(anExpression); // then assertFalse(actual); } } class MockConfigurationProvider implements ConfigurationProvider { public void destroy() { } public void init(Configuration configuration) throws ConfigurationException { } public boolean needsReload() { return false; } public void loadPackages() throws ConfigurationException { } public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException { builder.constant(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "false"); }
325
0
@Test(timeout = 1000L) public void testCeilLongMonths() throws Exception { Calendar cal = Calendar.getInstance(); cal.set(Calendar.MONTH, Calendar.NOVEMBER); new CronTab("0 0 31 * *").ceil(cal); // would infinite loop }
326
0
public static File unzip(File zip, File toDir, Predicate<ZipEntry> filter) throws IOException { if (!toDir.exists()) { FileUtils.forceMkdir(toDir); } Path targetDirNormalizedPath = toDir.toPath().normalize(); ZipFile zipFile = new ZipFile(zip); try { Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); if (filter.test(entry)) { File target = new File(toDir, entry.getName()); verifyInsideTargetDirectory(entry, target.toPath(), targetDirNormalizedPath); if (entry.isDirectory()) { throwExceptionIfDirectoryIsNotCreatable(target); } else { File parent = target.getParentFile(); throwExceptionIfDirectoryIsNotCreatable(parent); copy(zipFile, entry, target); } } } return toDir; } finally { zipFile.close(); } }
327
0
public Authentication authenticate(Authentication req) throws AuthenticationException { logger.debug("Processing authentication request for " + req.getName()); if (req.getCredentials() == null) { BadCredentialsException e = new BadCredentialsException("No password supplied"); publish(new AuthenticationFailureBadCredentialsEvent(req, e)); throw e; } UaaUser user; boolean passwordMatches = false; user = getUaaUser(req); if (user!=null) { passwordMatches = ((CharSequence) req.getCredentials()).length() != 0 && encoder.matches((CharSequence) req.getCredentials(), user.getPassword()); } else { user = dummyUser; } if (!accountLoginPolicy.isAllowed(user, req)) { logger.warn("Login policy rejected authentication for " + user.getUsername() + ", " + user.getId() + ". Ignoring login request."); AuthenticationPolicyRejectionException e = new AuthenticationPolicyRejectionException("Login policy rejected authentication"); publish(new AuthenticationFailureLockedEvent(req, e)); throw e; } if (passwordMatches) { logger.debug("Password successfully matched for userId["+user.getUsername()+"]:"+user.getId()); if (!allowUnverifiedUsers && !user.isVerified()) { publish(new UnverifiedUserAuthenticationEvent(user, req)); logger.debug("Account not verified: " + user.getId()); throw new AccountNotVerifiedException("Account not verified"); } int expiringPassword = getPasswordExpiresInMonths(); if (expiringPassword>0) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(user.getPasswordLastModified().getTime()); cal.add(Calendar.MONTH, expiringPassword); if (cal.getTimeInMillis() < System.currentTimeMillis()) { throw new PasswordExpiredException("Your current password has expired. Please reset your password."); } } Authentication success = new UaaAuthentication( new UaaPrincipal(user), user.getAuthorities(), (UaaAuthenticationDetails) req.getDetails()); publish(new UserAuthenticationSuccessEvent(user, success)); return success; } if (user == dummyUser || user == null) { logger.debug("No user named '" + req.getName() + "' was found for origin:"+ origin); publish(new UserNotFoundEvent(req)); } else { logger.debug("Password did not match for user " + req.getName()); publish(new UserAuthenticationFailureEvent(user, req)); } BadCredentialsException e = new BadCredentialsException("Bad credentials"); publish(new AuthenticationFailureBadCredentialsEvent(req, e)); throw e; }
328
0
public void test_SignedWithoutSignature() throws Exception { JWT inputJwt = new JWT() .setSubject("123456789") .setIssuedAt(ZonedDateTime.now(ZoneOffset.UTC)) .setExpiration(ZonedDateTime.now(ZoneOffset.UTC).plusHours(2)); String encodedJWT = JWT.getEncoder().encode(inputJwt, HMACSigner.newSHA256Signer("secret")); String encodedJWTNoSignature = encodedJWT.substring(0, encodedJWT.lastIndexOf('.') + 1); expectException(InvalidJWTSignatureException.class, () -> JWT.getDecoder().decode(encodedJWTNoSignature, HMACVerifier.newVerifier("secret"))); // Also cannot be decoded even if the caller calls decode w/out a signature because the header still indicates a signature algorithm. expectException(InvalidJWTSignatureException.class, () -> JWT.getDecoder().decode(encodedJWTNoSignature)); } @Test
329
0
public void initJdbcScimUserProvisioningTests() throws Exception { db = new JdbcScimUserProvisioning(jdbcTemplate, new JdbcPagingListFactory(jdbcTemplate, limitSqlAdapter)); zoneDb = new JdbcIdentityZoneProvisioning(jdbcTemplate); providerDb = new JdbcIdentityProviderProvisioning(jdbcTemplate); ScimSearchQueryConverter filterConverter = new ScimSearchQueryConverter(); Map<String, String> replaceWith = new HashMap<String, String>(); replaceWith.put("emails\\.value", "email"); replaceWith.put("groups\\.display", "authorities"); replaceWith.put("phoneNumbers\\.value", "phoneNumber"); filterConverter.setAttributeNameMapper(new SimpleAttributeNameMapper(replaceWith)); db.setQueryConverter(filterConverter); BCryptPasswordEncoder pe = new BCryptPasswordEncoder(4); existingUserCount = jdbcTemplate.queryForInt("select count(id) from users"); defaultIdentityProviderId = jdbcTemplate.queryForObject("select id from identity_provider where origin_key = ? and identity_zone_id = ?", String.class, Origin.UAA, "uaa"); addUser(JOE_ID, "joe", pe.encode("joespassword"), "[email protected]", "Joe", "User", "+1-222-1234567", defaultIdentityProviderId, "uaa"); addUser(MABEL_ID, "mabel", pe.encode("mabelspassword"), "[email protected]", "Mabel", "User", "", defaultIdentityProviderId, "uaa"); }
330
0
public void setUp() throws Exception { lc = new LoggerContext(); lc.setName("testContext"); logger = lc.getLogger(LoggerSerializationTest.class); // create the byte output stream bos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(bos); whitelist = LogbackClassicSerializationHelper.getWhilelist(); whitelist.add(Foo.class.getName()); } @After
331
0
public void withFieldsAndXpath() throws Exception { File tmpdir = File.createTempFile("test", "tmp", TEMP_DIR); tmpdir.delete(); tmpdir.mkdir(); tmpdir.deleteOnExit(); createFile(tmpdir, "x.xsl", xsl.getBytes("UTF-8"), false); Map entityAttrs = createMap("name", "e", "url", "cd.xml", XPathEntityProcessor.FOR_EACH, "/catalog/cd"); List fields = new ArrayList(); fields.add(createMap("column", "title", "xpath", "/catalog/cd/title")); fields.add(createMap("column", "artist", "xpath", "/catalog/cd/artist")); fields.add(createMap("column", "year", "xpath", "/catalog/cd/year")); Context c = getContext(null, new VariableResolverImpl(), getDataSource(cdData), Context.FULL_DUMP, fields, entityAttrs); XPathEntityProcessor xPathEntityProcessor = new XPathEntityProcessor(); xPathEntityProcessor.init(c); List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(); while (true) { Map<String, Object> row = xPathEntityProcessor.nextRow(); if (row == null) break; result.add(row); } assertEquals(3, result.size()); assertEquals("Empire Burlesque", result.get(0).get("title")); assertEquals("Bonnie Tyler", result.get(1).get("artist")); assertEquals("1982", result.get(2).get("year")); } @Test
332
0
public void handle(Map<String, Object> record, String xpath); }
333
0
public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ( ( getLocation().getMember() == null ) ? 0 : getLocation().getMember().hashCode() ); return result; } @Override
334
0
public int getTransportGuaranteeRedirectStatus() { return transportGuaranteeRedirectStatus; } /** * Set the HTTP status code used when the container needs to issue an HTTP * redirect to meet the requirements of a configured transport guarantee. * * @param transportGuaranteeRedirectStatus The status to use. This value is * not validated */
335
0
public void setFireRequestListenersOnForwards(boolean enable) { fireRequestListenersOnForwards = enable; } @Override
336
0
public void cleanUp() { if (multi != null) { multi.cleanUp(); } }
337
0
public final int getDegree() { return mDegree; } /** * Returns the fieldpolynomial as a new Bitstring. * * @return a copy of the fieldpolynomial as a new Bitstring */
338
0
public void setXWorkConverter(XWorkConverter conv) { this.defaultConverter = new OgnlTypeConverterWrapper(conv); } @Inject(XWorkConstants.DEV_MODE)
339
0
public void testJvmDecoder1() { // This should trigger an error but currently passes. Once the JVM is // fixed, s/false/true/ and s/20/13/ doJvmDecoder(SRC_BYTES_1, false, 20); } @Test
340
0
protected void doStop() throws Exception { super.doStop(); // ensure client is closed when stopping if (client != null && !client.isClosed()) { client.close(); } client = null; }
341
0
public O transform(final Object input) { if (input == null) { return null; } try { final Class<?> cls = input.getClass(); final Method method = cls.getMethod(iMethodName, iParamTypes); return (O) method.invoke(input, iArgs); } catch (final NoSuchMethodException ex) { throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' does not exist"); } catch (final IllegalAccessException ex) { throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' cannot be accessed"); } catch (final InvocationTargetException ex) { throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' threw an exception", ex); } }
342
0
public String getCompression() { switch (compressionLevel) { case 0: return "off"; case 1: return "on"; case 2: return "force"; } return "off"; } /** * Set compression level. */
343
0
public Reader getData(String query) { return new StringReader(xml); } }; }
344
0
public String getInfo() { return (info); }
345
0
public void setMethods(Set<String> methods) { this.methods = new HashSet<>(); for (String method : methods) { this.methods.add(method.toUpperCase()); } } /** * @param authenticationEntryPoint the authenticationEntryPoint to set */
346
0
public void run() { synchronized (context) { File file = context.targetFile; if (file != null) { file.delete(); } // Trigger the abort callback immediately to minimize latency between it and abort() being called. JSONObject error = createFileTransferError(ABORTED_ERR, context.source, context.target, null, -1, null); context.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, error)); context.aborted = true; if (context.connection != null) { context.connection.disconnect(); } } } }); } } }
347
0
public Iterator<Group> getGroups() { synchronized (groups) { return (groups.iterator()); } } /** * Return the set of {@link Role}s assigned specifically to this user. */ @Override
348
0
public static Encryptor getInstance() throws EncryptionException { if ( singletonInstance == null ) { synchronized ( JavaEncryptor.class ) { if ( singletonInstance == null ) { singletonInstance = new JavaEncryptor(); } } } return singletonInstance; }
349
0
private ApplicationContext getContext() { return getSharedObject(ApplicationContext.class); } /** * Allows configuring OpenID based authentication. * * <h2>Example Configurations</h2> * * A basic example accepting the defaults and not using attribute exchange: * * <pre> * &#064;Configuration * &#064;EnableWebSecurity * public class OpenIDLoginConfig extends WebSecurityConfigurerAdapter { * * &#064;Override * protected void configure(HttpSecurity http) { * http.authorizeRequests().antMatchers(&quot;/**&quot;).hasRole(&quot;USER&quot;).and().openidLogin() * .permitAll(); * } * * &#064;Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication() * // the username must match the OpenID of the user you are * // logging in with * .withUser( * &quot;https://www.google.com/accounts/o8/id?id=lmkCn9xzPdsxVwG7pjYMuDgNNdASFmobNkcRPaWU&quot;) * .password(&quot;password&quot;).roles(&quot;USER&quot;); * } * } * </pre> * * A more advanced example demonstrating using attribute exchange and providing a * custom AuthenticationUserDetailsService that will make any user that authenticates * a valid user. * * <pre> * &#064;Configuration * &#064;EnableWebSecurity * public class OpenIDLoginConfig extends WebSecurityConfigurerAdapter { * * &#064;Override * protected void configure(HttpSecurity http) { * http.authorizeRequests() * .antMatchers(&quot;/**&quot;) * .hasRole(&quot;USER&quot;) * .and() * .openidLogin() * .loginPage(&quot;/login&quot;) * .permitAll() * .authenticationUserDetailsService( * new AutoProvisioningUserDetailsService()) * .attributeExchange(&quot;https://www.google.com/.*&quot;).attribute(&quot;email&quot;) * .type(&quot;http://axschema.org/contact/email&quot;).required(true).and() * .attribute(&quot;firstname&quot;).type(&quot;http://axschema.org/namePerson/first&quot;) * .required(true).and().attribute(&quot;lastname&quot;) * .type(&quot;http://axschema.org/namePerson/last&quot;).required(true).and().and() * .attributeExchange(&quot;.*yahoo.com.*&quot;).attribute(&quot;email&quot;) * .type(&quot;http://schema.openid.net/contact/email&quot;).required(true).and() * .attribute(&quot;fullname&quot;).type(&quot;http://axschema.org/namePerson&quot;) * .required(true).and().and().attributeExchange(&quot;.*myopenid.com.*&quot;) * .attribute(&quot;email&quot;).type(&quot;http://schema.openid.net/contact/email&quot;) * .required(true).and().attribute(&quot;fullname&quot;) * .type(&quot;http://schema.openid.net/namePerson&quot;).required(true); * } * } * * public class AutoProvisioningUserDetailsService implements * AuthenticationUserDetailsService&lt;OpenIDAuthenticationToken&gt; { * public UserDetails loadUserDetails(OpenIDAuthenticationToken token) * throws UsernameNotFoundException { * return new User(token.getName(), &quot;NOTUSED&quot;, * AuthorityUtils.createAuthorityList(&quot;ROLE_USER&quot;)); * } * } * </pre> * * @return the {@link OpenIDLoginConfigurer} for further customizations. * * @throws Exception * @see OpenIDLoginConfigurer */
350
0
public URL getConfigFile() { return configFile; } @Override
351
0
void version(String version); @LogMessage(level = INFO) @Message(id = 2, value = "Ignoring XML configuration.")
352
0
public void copyToRepository(InputStream source, int size, Artifact destination, FileWriteMonitor monitor) throws IOException { if(!destination.isResolved()) { throw new IllegalArgumentException("Artifact "+destination+" is not fully resolved"); } // is this a writable repository if (!rootFile.canWrite()) { throw new IllegalStateException("This repository is not writable: " + rootFile.getAbsolutePath() + ")"); } // where are we going to install the file File location = getLocation(destination); // assure that there isn't already a file installed at the specified location if (location.exists()) { throw new IllegalArgumentException("Destination " + location.getAbsolutePath() + " already exists!"); } ArtifactTypeHandler typeHandler = typeHandlers.get(destination.getType()); if (typeHandler == null) typeHandler = DEFAULT_TYPE_HANDLER; typeHandler.install(source, size, destination, monitor, location); if (destination.getType().equalsIgnoreCase("car")) { log.debug("Installed module configuration; id={}; location={}", destination, location); } }
353
0
public void testRead7ZipMultiVolumeArchiveForFile() throws IOException { final File file = getFile("apache-maven-2.2.1.zip.001"); ZipFile zf = new ZipFile(file); zf.close(); }
354
0
public boolean getMapperDirectoryRedirectEnabled();
355
0
public void testFloatInHeader() { Response response = WebClient.create(endPoint + TIKA_PATH) .type("application/pdf") .accept("text/plain") .header(TikaResource.X_TIKA_PDF_HEADER_PREFIX + "averageCharTolerance", "2.0") .put(ClassLoader.getSystemResourceAsStream("testOCR.pdf")); assertEquals(200, response.getStatus()); }
356
0
private void testKeyGenerationAll() throws Exception { testKeyGeneration(1024); testKeyGeneration(2048); testKeyGeneration(3072); }
357
0
public static String normalizeChildProjectValue(String actualValue){ actualValue = actualValue.replaceAll("(,[ ]*,)", ", "); actualValue = actualValue.replaceAll("(^,|,$)", ""); return actualValue.trim(); }
358
0
public void sendRequest(DiscoveryNode node, long requestId, String action, TransportRequest request, TransportRequestOptions options) throws IOException, TransportException { if (recoveryActionToBlock.equals(action) || requestBlocked.getCount() == 0) { logger.info("--> preventing {} request", action); requestBlocked.countDown(); if (dropRequests) { return; } throw new ConnectTransportException(node, "DISCONNECT: prevented " + action + " request"); } transport.sendRequest(node, requestId, action, request, options); } } }
359
0
protected void stopInternal() throws LifecycleException { super.stopInternal(); // Close any open DB connection close(this.dbConnection); }
360
0
public static String getPathWithinApplication(HttpServletRequest request) { String contextPath = getContextPath(request); String requestUri = getRequestUri(request); if (StringUtils.startsWithIgnoreCase(requestUri, contextPath)) { // Normal case: URI contains context path. String path = requestUri.substring(contextPath.length()); return (StringUtils.hasText(path) ? path : "/"); } else { // Special case: rather unusual. return requestUri; } } /** * Return the request URI for the given request, detecting an include request * URL if called within a RequestDispatcher include. * <p>As the value returned by <code>request.getRequestURI()</code> is <i>not</i> * decoded by the servlet container, this method will decode it. * <p>The URI that the web container resolves <i>should</i> be correct, but some * containers like JBoss/Jetty incorrectly include ";" strings like ";jsessionid" * in the URI. This method cuts off such incorrect appendices. * * @param request current HTTP request * @return the request URI */
361
0
public boolean getAllowCasualMultipartParsing(); /** * Set to <code>true</code> to allow requests mapped to servlets that * do not explicitly declare @MultipartConfig or have * &lt;multipart-config&gt; specified in web.xml to parse * multipart/form-data requests. * * @param allowCasualMultipartParsing <code>true</code> to allow such * casual parsing, <code>false</code> otherwise. */
362
0
public void setCharset(Charset charset) { if( !byteC.isNull() ) { // if the encoding changes we need to reset the conversion results charC.recycle(); hasStrValue=false; } byteC.setCharset(charset); } /** * Sets the content to be a char[] * * @param c the bytes * @param off the start offset of the bytes * @param len the length of the bytes */
363
0
public final GF2nElement convert(GF2nElement elem, GF2nField basis) throws RuntimeException { if (basis == this) { return (GF2nElement)elem.clone(); } if (fieldPolynomial.equals(basis.fieldPolynomial)) { return (GF2nElement)elem.clone(); } if (mDegree != basis.mDegree) { throw new RuntimeException("GF2nField.convert: B1 has a" + " different degree and thus cannot be coverted to!"); } int i; GF2Polynomial[] COBMatrix; i = fields.indexOf(basis); if (i == -1) { computeCOBMatrix(basis); i = fields.indexOf(basis); } COBMatrix = (GF2Polynomial[])matrices.elementAt(i); GF2nElement elemCopy = (GF2nElement)elem.clone(); if (elemCopy instanceof GF2nONBElement) { // remember: ONB treats its bits in reverse order ((GF2nONBElement)elemCopy).reverseOrder(); } GF2Polynomial bs = new GF2Polynomial(mDegree, elemCopy.toFlexiBigInt()); bs.expandN(mDegree); GF2Polynomial result = new GF2Polynomial(mDegree); for (i = 0; i < mDegree; i++) { if (bs.vectorMult(COBMatrix[i])) { result.setBit(mDegree - 1 - i); } } if (basis instanceof GF2nPolynomialField) { return new GF2nPolynomialElement((GF2nPolynomialField)basis, result); } else if (basis instanceof GF2nONBField) { GF2nONBElement res = new GF2nONBElement((GF2nONBField)basis, result.toFlexiBigInt()); // TODO Remember: ONB treats its Bits in reverse order !!! res.reverseOrder(); return res; } else { throw new RuntimeException( "GF2nField.convert: B1 must be an instance of " + "GF2nPolynomialField or GF2nONBField!"); } }
364
0
public CsrfConfigurer<H> csrfTokenRepository( CsrfTokenRepository csrfTokenRepository) { Assert.notNull(csrfTokenRepository, "csrfTokenRepository cannot be null"); this.csrfTokenRepository = csrfTokenRepository; return this; } /** * Specify the {@link RequestMatcher} to use for determining when CSRF should be * applied. The default is to ignore GET, HEAD, TRACE, OPTIONS and process all other * requests. * * @param requireCsrfProtectionMatcher the {@link RequestMatcher} to use * @return the {@link CsrfConfigurer} for further customizations */
365
0
private BigInteger[] derDecode( byte[] encoding) throws IOException { ASN1Sequence s = (ASN1Sequence)ASN1Primitive.fromByteArray(encoding); if (s.size() != 2) { throw new IOException("malformed signature"); } if (!Arrays.areEqual(encoding, s.getEncoded(ASN1Encoding.DER))) { throw new IOException("malformed signature"); } return new BigInteger[]{ ((ASN1Integer)s.getObjectAt(0)).getValue(), ((ASN1Integer)s.getObjectAt(1)).getValue() }; }
366
0
protected UserDetailsContextMapper getUserDetailsContextMapper() { return userDetailsContextMapper; }
367
0
public abstract void perform() throws IOException;
368
0
public long getFailureCount() { return failureCounter.get(); }
369
0
public long getTimestamp() { return timestamp; } } }
370
0
public int getTransportGuaranteeRedirectStatus() { return transportGuaranteeRedirectStatus; } /** * Set the HTTP status code used when the container needs to issue an HTTP * redirect to meet the requirements of a configured transport guarantee. * * @param transportGuaranteeRedirectStatus The status to use. This value is * not validated */
371
0
public void setRedirectUri(String redirectUri) { this.redirectUri = redirectUri; }
372
0
public boolean isDoLoop() { return iDoLoop; }
373
0
public void testCompatibilityWith_v1_0_12() throws IOException, ClassNotFoundException { FileInputStream fis = new FileInputStream(SERIALIZATION_PREFIX + "logger_v1.0.12.ser"); ObjectInputStream ois = new ObjectInputStream(fis); Logger a = (Logger) ois.readObject(); ois.close(); assertEquals("a", a.getName()); }
374
0
public Tomcat getTomcatInstance() { return tomcat; } /** * Make the Tomcat instance preconfigured with test/webapp available to * sub-classes. * @param addJstl Should JSTL support be added to the test webapp * @param start Should the Tomcat instance be started * * @return A Tomcat instance pre-configured with the web application located * at test/webapp * * @throws LifecycleException If a problem occurs while starting the * instance */
375
0
@CheckForNull public TimeZone getTimeZone() { if (this.specTimezone == null) { return null; } return TimeZone.getTimeZone(this.specTimezone); }
376
0
public int getCacheSize() { return cacheSize; } /** * @param cacheSize The cacheSize to set. */
377
0
protected Log getLog() { return log; } @Override
378
0
public X509Certificate generateCert(PublicKey publicKey, PrivateKey privateKey, String sigalg, int validity, String cn, String ou, String o, String l, String st, String c) throws java.security.SignatureException, java.security.InvalidKeyException { X509V1CertificateGenerator certgen = new X509V1CertificateGenerator(); // issuer dn Vector order = new Vector(); Hashtable attrmap = new Hashtable(); if (cn != null) { attrmap.put(X509Principal.CN, cn); order.add(X509Principal.CN); } if (ou != null) { attrmap.put(X509Principal.OU, ou); order.add(X509Principal.OU); } if (o != null) { attrmap.put(X509Principal.O, o); order.add(X509Principal.O); } if (l != null) { attrmap.put(X509Principal.L, l); order.add(X509Principal.L); } if (st != null) { attrmap.put(X509Principal.ST, st); order.add(X509Principal.ST); } if (c != null) { attrmap.put(X509Principal.C, c); order.add(X509Principal.C); } X509Principal issuerDN = new X509Principal(order, attrmap); certgen.setIssuerDN(issuerDN); // validity long curr = System.currentTimeMillis(); long untill = curr + (long) validity * 24 * 60 * 60 * 1000; certgen.setNotBefore(new Date(curr)); certgen.setNotAfter(new Date(untill)); // subject dn certgen.setSubjectDN(issuerDN); // public key certgen.setPublicKey(publicKey); // signature alg certgen.setSignatureAlgorithm(sigalg); // serial number certgen.setSerialNumber(new BigInteger(String.valueOf(curr))); // make certificate return certgen.generateX509Certificate(privateKey); }
379
0
public String getRmiBindAddress() { return rmiBindAddress; } /** * Set the inet address on which the Platform RMI server is exported. * @param theRmiBindAddress The textual representation of inet address */
380
0
public ClientLockoutPolicyRetriever setEnabled(boolean enabled) { isEnabled = enabled; return this; }
381
0
private Page createPage() { if (pageCreator == null) { return null; } else { return pageCreator.createPage(); } } /** * @see org.apache.wicket.Component#onBeforeRender() */ @Override
382
0
public Object getTarget() { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); return this; } @Override
383
0
public void testSpecifiedIndexUnavailable_multipleIndices() throws Exception { createIndex("test1"); ensureYellow(); // Verify defaults verify(search("test1", "test2"), true); verify(msearch(null, "test1", "test2"), true); verify(count("test1", "test2"), true); verify(clearCache("test1", "test2"), true); verify(_flush("test1", "test2"),true); verify(segments("test1", "test2"), true); verify(stats("test1", "test2"), true); verify(status("test1", "test2"), true); verify(optimize("test1", "test2"), true); verify(refresh("test1", "test2"), true); verify(validateQuery("test1", "test2"), true); verify(aliasExists("test1", "test2"), true); verify(typesExists("test1", "test2"), true); verify(deleteByQuery("test1", "test2"), true); verify(percolate("test1", "test2"), true); verify(mpercolate(null, "test1", "test2"), false); verify(suggest("test1", "test2"), true); verify(getAliases("test1", "test2"), true); verify(getFieldMapping("test1", "test2"), true); verify(getMapping("test1", "test2"), true); verify(getWarmer("test1", "test2"), true); verify(getSettings("test1", "test2"), true); IndicesOptions options = IndicesOptions.strictExpandOpen(); verify(search("test1", "test2").setIndicesOptions(options), true); verify(msearch(options, "test1", "test2"), true); verify(count("test1", "test2").setIndicesOptions(options), true); verify(clearCache("test1", "test2").setIndicesOptions(options), true); verify(_flush("test1", "test2").setIndicesOptions(options),true); verify(segments("test1", "test2").setIndicesOptions(options), true); verify(stats("test1", "test2").setIndicesOptions(options), true); verify(status("test1", "test2").setIndicesOptions(options), true); verify(optimize("test1", "test2").setIndicesOptions(options), true); verify(refresh("test1", "test2").setIndicesOptions(options), true); verify(validateQuery("test1", "test2").setIndicesOptions(options), true); verify(aliasExists("test1", "test2").setIndicesOptions(options), true); verify(typesExists("test1", "test2").setIndicesOptions(options), true); verify(deleteByQuery("test1", "test2").setIndicesOptions(options), true); verify(percolate("test1", "test2").setIndicesOptions(options), true); verify(mpercolate(options, "test1", "test2").setIndicesOptions(options), false); verify(suggest("test1", "test2").setIndicesOptions(options), true); verify(getAliases("test1", "test2").setIndicesOptions(options), true); verify(getFieldMapping("test1", "test2").setIndicesOptions(options), true); verify(getMapping("test1", "test2").setIndicesOptions(options), true); verify(getWarmer("test1", "test2").setIndicesOptions(options), true); verify(getSettings("test1", "test2").setIndicesOptions(options), true); options = IndicesOptions.lenientExpandOpen(); verify(search("test1", "test2").setIndicesOptions(options), false); verify(msearch(options, "test1", "test2").setIndicesOptions(options), false); verify(count("test1", "test2").setIndicesOptions(options), false); verify(clearCache("test1", "test2").setIndicesOptions(options), false); verify(_flush("test1", "test2").setIndicesOptions(options), false); verify(segments("test1", "test2").setIndicesOptions(options), false); verify(stats("test1", "test2").setIndicesOptions(options), false); verify(status("test1", "test2").setIndicesOptions(options), false); verify(optimize("test1", "test2").setIndicesOptions(options), false); verify(refresh("test1", "test2").setIndicesOptions(options), false); verify(validateQuery("test1", "test2").setIndicesOptions(options), false); verify(aliasExists("test1", "test2").setIndicesOptions(options), false); verify(typesExists("test1", "test2").setIndicesOptions(options), false); verify(deleteByQuery("test1", "test2").setIndicesOptions(options), false); verify(percolate("test1", "test2").setIndicesOptions(options), false); verify(mpercolate(options, "test1", "test2").setIndicesOptions(options), false); verify(suggest("test1", "test2").setIndicesOptions(options), false); verify(getAliases("test1", "test2").setIndicesOptions(options), false); verify(getFieldMapping("test1", "test2").setIndicesOptions(options), false); verify(getMapping("test1", "test2").setIndicesOptions(options), false); verify(getWarmer("test1", "test2").setIndicesOptions(options), false); verify(getSettings("test1", "test2").setIndicesOptions(options), false); options = IndicesOptions.strictExpandOpen(); assertAcked(prepareCreate("test2")); ensureYellow(); verify(search("test1", "test2").setIndicesOptions(options), false); verify(msearch(options, "test1", "test2").setIndicesOptions(options), false); verify(count("test1", "test2").setIndicesOptions(options), false); verify(clearCache("test1", "test2").setIndicesOptions(options), false); verify(_flush("test1", "test2").setIndicesOptions(options),false); verify(segments("test1", "test2").setIndicesOptions(options), false); verify(stats("test1", "test2").setIndicesOptions(options), false); verify(status("test1", "test2").setIndicesOptions(options), false); verify(optimize("test1", "test2").setIndicesOptions(options), false); verify(refresh("test1", "test2").setIndicesOptions(options), false); verify(validateQuery("test1", "test2").setIndicesOptions(options), false); verify(aliasExists("test1", "test2").setIndicesOptions(options), false); verify(typesExists("test1", "test2").setIndicesOptions(options), false); verify(deleteByQuery("test1", "test2").setIndicesOptions(options), false); verify(percolate("test1", "test2").setIndicesOptions(options), false); verify(mpercolate(options, "test1", "test2").setIndicesOptions(options), false); verify(suggest("test1", "test2").setIndicesOptions(options), false); verify(getAliases("test1", "test2").setIndicesOptions(options), false); verify(getFieldMapping("test1", "test2").setIndicesOptions(options), false); verify(getMapping("test1", "test2").setIndicesOptions(options), false); verify(getWarmer("test1", "test2").setIndicesOptions(options), false); verify(getSettings("test1", "test2").setIndicesOptions(options), false); } @Test
384
0
public boolean isEraseCredentialsAfterAuthentication() { return false; }
385
0
public void copyToRepository(InputStream source, int size, Artifact destination, FileWriteMonitor monitor) throws IOException { if(!destination.isResolved()) { throw new IllegalArgumentException("Artifact "+destination+" is not fully resolved"); } // is this a writable repository if (!rootFile.canWrite()) { throw new IllegalStateException("This repository is not writable: " + rootFile.getAbsolutePath() + ")"); } // where are we going to install the file File location = getLocation(destination); // assure that there isn't already a file installed at the specified location if (location.exists()) { throw new IllegalArgumentException("Destination " + location.getAbsolutePath() + " already exists!"); } ArtifactTypeHandler typeHandler = typeHandlers.get(destination.getType()); if (typeHandler == null) typeHandler = DEFAULT_TYPE_HANDLER; typeHandler.install(source, size, destination, monitor, location); if (destination.getType().equalsIgnoreCase("car")) { log.debug("Installed module configuration; id=" + destination + "; location=" + location); } }
386
0
public void setAllowJavaSerializedObject(boolean allowJavaSerializedObject) { // need to override and call super for component docs super.setAllowJavaSerializedObject(allowJavaSerializedObject); }
387
0
public void testChunkHeaderCRLF() throws Exception { doTestChunkingCRLF(true, true, true, true, true, true); } @Test
388
0
protected Log getLog() { return log; } // ----------------------------------------------------------- Constructors
389
0
void readRequest(HttpServletRequest request, HttpMessage message); /** * Parses the body from a {@link org.apache.camel.http.common.HttpMessage} * * @param httpMessage the http message * @return the parsed body returned as either a {@link java.io.InputStream} or a {@link java.io.Reader} * depending on the {@link #setUseReaderForPayload(boolean)} property. * @throws java.io.IOException can be thrown */
390
0
public void setUp() throws Exception { provider = new ActiveDirectoryLdapAuthenticationProvider("mydomain.eu", "ldap://192.168.1.200/"); } @Test
391
0
public Collection<ResourcePermission> getRequiredPermissions(String regionName) { return Collections.singletonList(new ResourcePermission(ResourcePermission.Resource.DATA, ResourcePermission.Operation.READ, regionName)); }
392
0
public void testConstructor1() throws Exception { SimpleBindRequest bindRequest = new SimpleBindRequest(); bindRequest = bindRequest.duplicate(); assertNotNull(bindRequest.getBindDN()); assertEquals(bindRequest.getBindDN(), ""); assertNotNull(bindRequest.getPassword()); assertEquals(bindRequest.getPassword().stringValue(), ""); assertNotNull(bindRequest.getControls()); assertEquals(bindRequest.getControls().length, 0); assertEquals(bindRequest.getBindType(), "SIMPLE"); SimpleBindRequest rebindRequest = bindRequest.getRebindRequest(getTestHost(), getTestPort()); assertNotNull(bindRequest.getRebindRequest(getTestHost(), getTestPort())); assertEquals(rebindRequest.getBindDN(), bindRequest.getBindDN()); assertEquals(rebindRequest.getPassword(), bindRequest.getPassword()); assertEquals(bindRequest.getProtocolOpType(), LDAPMessage.PROTOCOL_OP_TYPE_BIND_REQUEST); bindRequest.getLastMessageID(); assertNotNull(bindRequest.encodeProtocolOp()); assertNotNull(bindRequest.toString()); final ArrayList<String> toCodeLines = new ArrayList<String>(10); bindRequest.toCode(toCodeLines, "foo", 0, false); assertFalse(toCodeLines.isEmpty()); toCodeLines.clear(); bindRequest.toCode(toCodeLines, "bar", 4, true); assertFalse(toCodeLines.isEmpty()); } /** * Tests the second constructor, which takes a bind DN and password, using * non-null, non-empty values. * * @throws Exception If an unexpected problem occurs. */ @Test()
393
0
public PackageConfig getPackageConfig(String name) { return packageContexts.get(name); }
394
0
public String[] getRoles(Principal principal) { if (principal instanceof GenericPrincipal) { return ((GenericPrincipal) principal).getRoles(); } String className = principal.getClass().getSimpleName(); throw new IllegalStateException(sm.getString("realmBase.cannotGetRoles", className)); }
395
0
public void destroy() { normalView = null; viewViews = null; viewServers = null; viewGraphs = null; pageView = null; editView = null; addView = null; addGraph = null; editGraph = null; viewServer = null; editServer = null; addServer = null; helpView = null; editNormalView = null; super.destroy(); }
396
0
public ParameterMetaData build() { return new ParameterMetaData( parameterIndex, name, parameterType, adaptOriginsAndImplicitGroups( getConstraints() ), isCascading(), getGroupConversions(), requiresUnwrapping() ); } } }
397
0
public String createDB(String dbName) { // ensure there are no illegal chars in DB name InputUtils.validateSafeInput(dbName); String result = DB_CREATED_MSG + ": " + dbName; Connection conn = null; try { conn = DerbyConnectionUtil.getDerbyConnection(dbName, DerbyConnectionUtil.CREATE_DB_PROP); } catch (Throwable e) { if (e instanceof SQLException) { result = getSQLError((SQLException) e); } else { result = e.getMessage(); } } finally { // close DB connection try { if (conn != null) { conn.close(); } } catch (SQLException e) { result = "Problem closing DB connection"; } } return result; }
398
0
protected void onUnsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, AuthenticationException failed) throws IOException { super.onUnsuccessfulAuthentication(request, response, failed); LOGGER.log(Level.INFO, "Login attempt failed", failed); }
399
0
public static File resolve(File[] roots, String path) { for (File root : roots) { File file = new File(path); final File normalizedPath; try { if (file.isAbsolute()) { normalizedPath = file.getCanonicalFile(); } else { normalizedPath = new File(root, path).getCanonicalFile(); } } catch (IOException ex) { continue; } if(normalizedPath.getAbsolutePath().startsWith(root.getAbsolutePath())) { return normalizedPath; } } return null; }