This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public String greet(String name) { | |
initReporter(); | |
Supplier<String> oldSupplier = () -> this.oldService.greet(name); | |
Supplier<String> newSupplier = () -> this.newService.greet(name); | |
String greetingMessage = null; | |
try { | |
greetingMessage = this.serviceExperiment.run(oldSupplier, newSupplier); | |
} catch (Exception e) { | |
LOGGER.error("Exception occurred while running the experiment", e); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!groovy | |
import hudson.security.* | |
import jenkins.model.* | |
def instance = Jenkins.getInstance() | |
def username = 'admin_groovy' | |
def hudsonRealm = new HudsonPrivateSecurityRealm(false) | |
hudsonRealm.createAccount(username,'123456') | |
instance.setSecurityRealm(hudsonRealm) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!groovy | |
import jenkins.model.* | |
import hudson.util.*; | |
import jenkins.install.*; | |
def instance = Jenkins.getInstance() | |
instance.setInstallState(InstallState.INITIAL_SETUP_COMPLETED) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mysql:8.0 | |
LABEL description="My Custom Mysql Docker Image" | |
# Add a database | |
ENV MYSQL_DATABASE CARDS | |
#Check out docker entry point for further configuration : | |
# https://github.com/docker-library/mysql | |
COPY ./init-scripts/ /docker-entrypoint-initdb.d/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Note { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
private Long id; | |
private String title; | |
private String details; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<SomeComparableObject> objects = Arrays.asList( o1, o2, o3, ...); | |
ojbects.sort((SomeComparableObject o1, SomeComparableObject o2) -> o1.compareTo(o2)); // or with method reference | |
objects.sort(SomeComparableObject::compareTo); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Loop { | |
public static void main(String[] args) { | |
int[][] tests = {{6, 5, 4, 3, 2, 1}, {1, 2}, | |
{1, 2, 3}, {1, 2, 3, 4}, {1}}; | |
int successCount = 0; | |
try { | |
int i = 0; | |
while (true) { | |
if (thirdElementIsThree(tests[i++])) | |
successCount++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean(name = JPA_PROPERTIES_BEAN_NAME) | |
public Properties jpaPropertiesUnitTest() { | |
Properties properties = new Properties(); | |
properties.put(PROPERTY_HIBERNATE_DIALECT, "org.hibernate.dialect.H2Dialect"); | |
properties.put(PROPERTY_HIBERNATE_SHOW_SQL, true); | |
properties.put(PROPERTY_HIBERNATE_FROMAT_SQL, true); | |
properties.put(PROPERTY_HIBERNATE_DDL, VALUE_HIBERNATE_DDL_UPDATE); | |
properties.put(PROPERTY_HIBERNATE_NAMING_STRATEGY, VALUE_HIBERNATE_DEFAULT_NAMING_STRATEGY); | |
properties.put(PROPERTY_HIBERNATE_CONNECTION_CHARSET, DEFAULT_CHARSET); |
NewerOlder