Skip to content

Instantly share code, notes, and snippets.

View ksurendra's full-sized avatar

Suren K ksurendra

View GitHub Profile
@ksurendra
ksurendra / ManipulateContentOnNodes.java
Last active January 17, 2022 20:05
Java Servlet to bulk update nodes
package com.web.core.servlets;
import com.day.cq.commons.jcr.JcrConstants;
import com.day.cq.search.PredicateGroup;
import com.day.cq.search.Query;
import com.day.cq.search.QueryBuilder;
import com.day.cq.search.result.Hit;
import com.day.cq.search.result.SearchResult;
import org.apache.commons.collections.CollectionUtils;
import org.apache.sling.api.SlingHttpServletRequest;
@ksurendra
ksurendra / AemTag.java
Created October 21, 2021 22:45
AEM - Read Tags and Children
import org.apache.sling.api.resource.NonExistingResource;
..
public class AemTag {
..
@Expose
private final String id;
@Expose
private final String title;
@ksurendra
ksurendra / TestController.java
Created March 26, 2020 21:36
Sample controller to print API values in browser
package com.engg.java.reactive;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;
@RestController
public class TestController {
@GetMapping
public String sample() {
ReqResWebClient webClient = new ReqResWebClient();
@ksurendra
ksurendra / ReactiveApplication.java
Created March 26, 2020 21:22
SpringBoot Application primary file
package com.engg.java.reactive;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ReactiveApplication {
public static void main(String[] args) {
@ksurendra
ksurendra / WebClient.java
Created March 26, 2020 21:18
WebClient for the REST API
package com.engg.java.reactive;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.client.ClientResponse;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
import reactor.core.publisher.Flux;
import com.engg.java.reactive.reqres.User;
public class ReqResWebClient {
@ksurendra
ksurendra / AddTasksToRunCucumberFromPom.xml
Created April 27, 2019 00:25
Adding tasks to run cucumber tests from pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>integration-test</id>
<phase>verify</phase>
<goals>
<goal>exec</goal>
@ksurendra
ksurendra / TestsInPom.xml
Created April 27, 2019 00:20
Including Cucumber tests in pom.xml files
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>install-tester</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
@ksurendra
ksurendra / Swagger2Config.java
Created April 26, 2019 18:12
Swagger configuration file
package com.weathertracker;
import static springfox.documentation.builders.PathSelectors.regex;
import java.util.Collections;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
@ksurendra
ksurendra / sample.feature
Created April 26, 2019 18:08
Sample Cucumber Test Feature
Feature: Add a measurement
In order to have source information to examine later
I want to be able to capture a measurement of several metrics at a specific time
Scenario: Add a measurement with valid (numeric) values
# POST /measurements
When I submit a new measurement as follows:
| timestamp | temperature | dewPoint | precipitation |
| "2015-09-01T16:00:00.000Z" | 27.1 | 16.7 | 0 |
Then the response has a status code of 201
@ksurendra
ksurendra / bitbucket-pipeline-angular-production-build-deploy.yml
Created March 19, 2019 14:30
Example Angular Production Build and Deploy To External Server Using Bitbucket Pipelines
# Sample build file
# @author Suren Konathala
# -----
image: node:8
pipelines:
default:
- step:
caches:
- node