This file contains 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
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |
http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<parent> | |
<groupId>sh.app.sample-projects</groupId> | |
<artifactId>sample-projects</artifactId> | |
<version>SNAPSHOT</version> |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns="http://java.sun.com/xml/ns/javaee" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee | |
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | |
version="2.5"> | |
<listener> | |
<listener-class>com.sun.faces.config.ConfigureListener</listener-class> | |
</listener> |
This file contains 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
<beans xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:s="urn:java:ee" | |
xmlns:in="urn:java:javax.inject" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> | |
</beans> |
This file contains 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
<faces-config xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" | |
version="2.0" metadata-complete="false"> | |
</faces-config> |
This file contains 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
package sh.app.sample_projects.jsf2_cdi_jetty_maven; | |
import javax.inject.Named; | |
import javax.annotation.PostConstruct; | |
import javax.enterprise.context.SessionScoped; | |
import java.io.Serializable; | |
@Named | |
@SessionScoped |
This file contains 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 User { | |
@Id @GeneratedValue | |
private Integer id; | |
@Column | |
private String firstname; | |
@Column | |
private String lastname; | |
public Integer getId() { |
This file contains 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 interface UserRepository extends CrudRepository<User, Integer> { | |
List<User> findByLastnameIgnoreCase(String lastname); | |
} |
This file contains 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 Main { | |
private static final Logger log = LoggerFactory.getLogger(Main.class); | |
public static void main(String[] args) { | |
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationConfiguration.xml"); | |
UserRepository repository = context.getBean(UserRepository.class); | |
User user = new User(); | |
user.setFirstname("Bon"); | |
user.setLastname("Jovi"); |
This file contains 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
@RunWith(SpringJUnit4ClassRunner.class) | |
@ContextConfiguration("classpath:applicationConfiguration.xml") | |
@Transactional | |
@TestExecutionListeners({ | |
DependencyInjectionTestExecutionListener.class, | |
DirtiesContextTestExecutionListener.class, | |
TransactionDbUnitTestExecutionListener.class}) | |
public class BaseIntegrationTest {} |
This file contains 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
@DatabaseSetup("userRepository.dbxml") | |
public class UserRepositoryTest extends BaseIntegrationTest { | |
@Autowired | |
UserRepository userRepository; | |
@Test | |
public void findByLastnameIgnoreCase_noSuchUser() throws Exception { | |
assertThat(userRepository.findByLastnameIgnoreCase("Lastname").size(), is(0)); | |
} |
OlderNewer