INTSAMPLES-143: Fix Package Tangles
JIRA: https://jira.spring.io/browse/INTSAMPLES-143 Add Sonar support to build.gradle. Fix critical violations.
This commit is contained in:
committed by
Artem Bilan
parent
70b4d12870
commit
61603c2437
@@ -22,6 +22,7 @@ import java.util.Scanner;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.samples.enricher.domain.User;
|
||||
import org.springframework.integration.samples.enricher.service.UserService;
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
@@ -10,31 +10,34 @@
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.enricher;
|
||||
package org.springframework.integration.samples.enricher.domain;
|
||||
|
||||
public class User {
|
||||
private String username;
|
||||
private String password;
|
||||
private String email;
|
||||
|
||||
public User(String username, String password, String email) {
|
||||
super();
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.email = email;
|
||||
}
|
||||
private String username;
|
||||
|
||||
public String getUsername() {
|
||||
return this.username;
|
||||
}
|
||||
private String password;
|
||||
|
||||
public String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
private String email;
|
||||
|
||||
public String getEmail() {
|
||||
return this.email;
|
||||
}
|
||||
public User(String username, String password, String email) {
|
||||
super();
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return this.username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return this.email;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
@@ -51,12 +54,8 @@ public class User {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("User [username=")
|
||||
.append(this.username)
|
||||
.append(", password=")
|
||||
.append(this.password)
|
||||
.append(", email=")
|
||||
.append(this.email).append("]");
|
||||
builder.append("User [username=").append(this.username).append(", password=").append(this.password)
|
||||
.append(", email=").append(this.email).append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ package org.springframework.integration.samples.enricher.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.integration.samples.enricher.User;
|
||||
import org.springframework.integration.samples.enricher.domain.User;
|
||||
|
||||
/**
|
||||
* Provides user services.
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
package org.springframework.integration.samples.enricher.service.impl;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.integration.samples.enricher.User;
|
||||
|
||||
import org.springframework.integration.samples.enricher.domain.User;
|
||||
|
||||
/**
|
||||
* Simple Service class for retrieving user information.
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.samples.enricher.User;
|
||||
import org.springframework.integration.samples.enricher.domain.User;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,8 @@ import java.util.Scanner;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.samples.jdbc.domain.Gender;
|
||||
import org.springframework.integration.samples.jdbc.domain.Person;
|
||||
import org.springframework.integration.samples.jdbc.service.PersonService;
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.jdbc;
|
||||
package org.springframework.integration.samples.jdbc.domain;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.jdbc;
|
||||
package org.springframework.integration.samples.jdbc.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.jdbc;
|
||||
package org.springframework.integration.samples.jdbc.domain;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@@ -10,7 +10,7 @@
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.jdbc;
|
||||
package org.springframework.integration.samples.jdbc.domain;
|
||||
|
||||
public class User {
|
||||
private String username;
|
||||
@@ -10,7 +10,7 @@
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.jdbc;
|
||||
package org.springframework.integration.samples.jdbc.domain;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@@ -18,7 +18,7 @@ package org.springframework.integration.samples.jdbc.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.integration.samples.jdbc.Person;
|
||||
import org.springframework.integration.samples.jdbc.domain.Person;
|
||||
|
||||
/**
|
||||
* The Service used to create Person instance in database
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<bean id="personResultMapper" class="org.springframework.integration.samples.jdbc.PersonMapper"/>
|
||||
<bean id="personResultMapper" class="org.springframework.integration.samples.jdbc.domain.PersonMapper"/>
|
||||
<int-jdbc:outbound-gateway data-source="datasource"
|
||||
request-channel="createPersonRequestChannel"
|
||||
reply-channel="createPersonReplyChannel"
|
||||
|
||||
@@ -22,6 +22,8 @@ import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.samples.jdbc.domain.Gender;
|
||||
import org.springframework.integration.samples.jdbc.domain.Person;
|
||||
import org.springframework.integration.samples.jdbc.service.PersonService;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
import org.springframework.integration.samples.jpa.domain.Person;
|
||||
import org.springframework.integration.samples.jpa.service.PersonService;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -28,6 +29,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Gunnar Hillert
|
||||
* @author Amol Nayak
|
||||
* @author Gary Russell
|
||||
* @version 1.0
|
||||
*
|
||||
*/
|
||||
@@ -104,13 +106,16 @@ public final class Main {
|
||||
while (true) {
|
||||
final String input = scanner.nextLine();
|
||||
|
||||
if("1".equals(input.trim())) {
|
||||
if ("1".equals(input.trim())) {
|
||||
findPeople(personService);
|
||||
} else if("2".equals(input.trim())) {
|
||||
createPersonDetails(scanner,personService);
|
||||
} else if("q".equals(input.trim())) {
|
||||
}
|
||||
else if ("2".equals(input.trim())) {
|
||||
createPersonDetails(scanner, personService);
|
||||
}
|
||||
else if ("q".equals(input.trim())) {
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
System.out.println("Invalid choice\n\n");
|
||||
}
|
||||
|
||||
@@ -122,6 +127,7 @@ public final class Main {
|
||||
}
|
||||
|
||||
System.out.println("Exiting application...bye.");
|
||||
context.close();
|
||||
System.exit(0);
|
||||
|
||||
}
|
||||
@@ -169,7 +175,7 @@ public final class Main {
|
||||
if(people != null && !people.isEmpty()) {
|
||||
for(Person person : people) {
|
||||
System.out.print(String.format("%d, %s, ", person.getId(), person.getName()));
|
||||
System.out.println(DATE_FORMAT.format(person.getCreatedDateTime()));
|
||||
System.out.println(DATE_FORMAT.format(person.getCreatedDateTime()));//NOSONAR
|
||||
}
|
||||
} else {
|
||||
System.out.println(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.jpa;
|
||||
package org.springframework.integration.samples.jpa.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.integration.samples.jpa.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.integration.samples.jpa.Person;
|
||||
import org.springframework.integration.samples.jpa.domain.Person;
|
||||
import org.springframework.messaging.handler.annotation.Payload;
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.samples.jpa.domain.Person;
|
||||
import org.springframework.integration.samples.jpa.service.PersonService;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,14 +25,15 @@ import org.springframework.integration.annotation.ServiceActivator;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Gary Russell
|
||||
*/
|
||||
@MessageEndpoint
|
||||
public class QuoteService {
|
||||
|
||||
@ServiceActivator(inputChannel="tickers", outputChannel="quotes")
|
||||
public Quote lookupQuote(String ticker) {
|
||||
BigDecimal price = new BigDecimal(new Random().nextDouble() * 100);
|
||||
return new Quote(ticker, price.setScale(2, RoundingMode.HALF_EVEN));
|
||||
BigDecimal price = new BigDecimal(new Random().nextDouble() * 100);//NOSONAR
|
||||
return new Quote(ticker, price.setScale(2, RoundingMode.HALF_EVEN));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,14 +31,20 @@ public class Main {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
AbstractApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"META-INF/spring/integration/04-externalgateway/*.xml");
|
||||
"META-INF/spring/integration/04-externalgateway/*.xml");
|
||||
System.out.println("Please enter zip");
|
||||
|
||||
|
||||
BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
|
||||
String zip = console.readLine().trim();
|
||||
WeatherAndTraffic weatherAndTraffic = context.getBean("wat", WeatherAndTraffic.class);
|
||||
List<String> result = weatherAndTraffic.getByZip(zip);
|
||||
System.out.println(result.get(0) + "\r\n" + result.get(1) + "\r\n");
|
||||
String line = console.readLine();
|
||||
if (line != null) {
|
||||
String zip = line.trim();
|
||||
WeatherAndTraffic weatherAndTraffic = context.getBean("wat", WeatherAndTraffic.class);
|
||||
List<String> result = weatherAndTraffic.getByZip(zip);
|
||||
System.out.println(result.get(0) + "\r\n" + result.get(1) + "\r\n");
|
||||
}
|
||||
else {
|
||||
System.out.println("Console closed");
|
||||
}
|
||||
context.close();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user