Skip to content

Instantly share code, notes, and snippets.

View przodownikR1's full-sized avatar

przodownikR1 przodownikR1

View GitHub Profile
public class FromFtpDoNotDeleteFileIfProcessFailsTest extends FtpServerTestSupport {
private String getFtpUrl() {
return "ftp://admin@localhost:" + getPort() + "/deletefile/?password=admin&delete=true";
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
I. Codebase
Docker : (Jedno repozytorium ze śledzeniem zmian w systemie kontroli wersji.)
One codebase tracked in revision control, many deploys (gradle-git-properties)
II. Dependencies
Docker: (Jawne deklarowanie i izolowanie zależności.)
Explicitly declare and isolate dependencies
III. Config (spring-cloud-config , bus)
Docker: Zapisywanie konfiguracji w zmiennych środowiskowych, a nie w plikach zapisanych w repozytorium.
scalatech/zipkin-dashboard 0.1 b9fc22750e5e 13 seconds ago 687 MB
scalatech/user-service 0.1 80a5b1951626 14 seconds ago 709 MB
scalatech/discovery-service 0.1 2f08d3884163 16 seconds ago 694 MB
scalatech/nbp-service 0.1 10c001927b14 16 seconds ago 723 MB
scalatech/config-server 0.1 2cd98a381805 16 seconds ago 727 MB
scalatech/car-service 0.1 892bc520ad5d 16 seconds ago 709 MB
scalatech/microservices-dashboard 0.1 bdb00c47d672 16 seconds ago 696 MB
scalatech/gateway-api 0.1 592ada297bc6 16 seconds ago 710 MB
scalatech/admin-dashboard 0.1 957f6200de93 17 seconds ago 691 MB
scalatech/hystrix-dashboard 0.1 67f41586782a 19 seconds ago 6
@Controller
@Description("A controller for handling requests for hello messages")
public class SampleController {
@Autowired
private HelloWorldService helloWorldService;
@Autowired
private GaugeService gauges;
Session session = getSession();
Transaction tx = null;
tx = session.beginTransaction();
Book book = (Book)session.get(Book.class, new Long(1));
String name = (String) session.createQuery("select b.name from bkch b where b.isbn = :isbn").setParameter("isbn", book.getIsbn()).uniqueResult();
System.out.println("book Name- "+name);
tx.commit();
session.close();
curl -u user:9e6da1f6-35d6-4b0d-95d6-7c3df4a538f3 http://localhost:8080/simple/slawek 11:57
Hello : slawek⏎ przodownik ~/b/securityBasicCamp (default_form|✚1)$ curl -u user:9e6da1f6-35d6-4b0d-95d6-7c3df4a538f4 http://localhost:8080/simple/slawek 12:11
{"timestamp":1449400277841,"status":401,"error":"Unauthorized","message":"Bad credentials","path":"/simple/slawek"}⏎ przodownik ~/b/securityBasicCamp (default_form|✚1)$ curl -u user:9e6da1f6-35d6-4b0d-95d6-7c3df4a538f3 http://localhost:8080/simple/slawek 12:11
Hello : slawek⏎
przodownik ~/b/s/openSSL (x509|✚7)$ openssl req -new -newkey rsa -nodes -out ca.csr -keyout ca.key
Generating a 2048 bit RSA private key
.........................................+++
......................................+++
writing new private key to 'ca.key'
Country Name (2 letter code) [AU]:PL
State or Province Name (full name) [Some-State]:mazowieckie
Locality Name (eg, city) []:Warsaw
Organization Name (eg, company) [Internet Widgits Pty Ltd]:scalatech
public class WebConfig extends WebMvcConfigurationSupport {
@Bean
public AuthenticationPrincipalArgumentResolver authPrincipalArgResolver(){
return new AuthenticationPrincipalArgumentResolver();
}
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(authPrincipalArgResolver());
}
@przodownikR1
przodownikR1 / db_config_full.java
Created July 21, 2015 09:04
example create datasource in javaConfig with full desc and params
@Bean
public DataSource dataSource() {
final DataSource dataSource = new DataSource();
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
dataSource.setUrl(env.getProperty("jdbc.url"));
dataSource.setUsername(env.getProperty("jdbc.username"));
dataSource.setPassword(env.getProperty("jdbc.password"));
dataSource.setTestOnBorrow(true);
dataSource.setTestWhileIdle(true);
dataSource.setTestOnReturn(false);
def testResultsDir = "$buildDir/test-results/"
apply plugin: "sonar-runner"
sonarRunner {
sonarProperties {
property "sonar.projectKey", "${projectName}"
property "sonar.projectName", "${projectName}"
property "sonar.junit.reportsPath", testResultsDir
logger.info("${sonarJdbcUrl} ${sonarJdbcDriverClassName} ${sonarJdbcUsername} ${sonarJdbcPassword} ")
// Address of SonarQube server