This session will give attendees an overview of the new testing features in Spring 3.1 as well the new Spring MVC test support. Sam Brannen will demonstrate how to use the Spring TestContext Framework to write integration tests for Java-based Spring configuration using @Configuration classes. He'll then compare and contrast this approach with XML-based configuration and follow up with a discussion of the new testing support for bean definition profiles. Next, Rossen Stoyanchev will show attendees how testing server-side code with annotated controllers and client-side code with the RestTemplate just got a whole lot easier with the new Spring MVC test support. Come to this session to see these new Spring testing features in action and learn how you can get involved in the Spring MVC Test Support project.
Presented by Nikola Vasilev on SkopjeTechMeetup 7.
Representational state transfer (REST) can be thought of as the language of the Internet. Now with cloud usage on the rise, REST is a logical choice for building APIs that allow end users to connect and interact with cloud services. This talk will deliver more insight into the challenges on building and maintaining good and clean RESTful APIs.
Understanding REST APIs in 5 Simple StepsTessa Mero
This document summarizes the 5 steps to understanding REST APIs: 1) Understanding the purpose of APIs and their importance and growth, 2) Learning that REST defines functions to communicate via HTTP verbs and nouns, 3) Knowing that APIs use requests and responses, 4) Relying on documentation as the reference, and 5) Using debugging and testing tools to prevent issues. It provides examples of requests, responses, API documentation, and tools like Postman for working with REST APIs.
This document discusses building web APIs with ASP.NET Web API. It covers the objectives of seeing how REST and web services can access data, building a first Web API service, using routing conventions, and modifying services for CRUD operations. The agenda includes explaining what Web API is, creating a first service, routing, and creating a service for CRUD. It also defines REST concepts like HTTP methods GET, POST, PUT, and DELETE and their typical uses for selecting, adding, editing, and deleting data.
We start with an introduction to what Apache Camel is, and how you can use Camel to make integration much easier. Allowing you to focus on your business logic, rather than low level messaging protocols, and transports. You will also hear what other features Camel provides out of the box, which can make integration much easier for you.
We look into web console tooling that allows you to get insight into your running Apache Camel applications, which has among others visual route diagrams with tracing/debugging and profiling capabilities. In addition to the web tooling we will also show you other tools in the making.
The document discusses various best practices for writing JavaScript code, including placing scripts at the bottom of pages, using meaningful variable and function names, avoiding global variables, and optimizing loops to minimize DOM access. It also covers JavaScript language features like namespaces, data types, and self-executing functions. Finally, it mentions tools for linting, minifying, and bundling code as well as popular integrated development environments for JavaScript development.
This document contains an agenda and slides for a presentation on Spring Boot. The presentation introduces Spring Boot, which allows developers to rapidly build production-grade Spring applications with minimal configuration. It demonstrates how to quickly create a "Hello World" application using Spring Boot and discusses some of the features it provides out-of-the-box like embedded servers and externalized configuration. The presentation also shows how to add additional functionality like Thymeleaf templates and actuator endpoints to monitor and manage applications.
- REST (Representational State Transfer) uses HTTP requests to transfer representations of resources between clients and servers. The format of the representation is determined by the content-type header and the interaction with the resource is determined by the HTTP verb used.
- The four main HTTP verbs are GET, PUT, DELETE, and POST. GET retrieves a representation of the resource and is safe, while PUT, DELETE, and POST can modify the resource's state in atomic operations.
- Resources are abstract concepts acted upon by HTTP requests, while representations are the actual data transmitted in responses. The representation may or may not accurately reflect the resource's current state.
The document discusses Representational State Transfer (REST) and RESTful web services. It provides an overview of REST principles including treating everything as a resource with a uniform interface, using standard HTTP methods, supporting multiple representations, communicating statelessly through hypermedia, and linking resources together. It then provides examples of how to design a RESTful API for a bookmark management application, mapping operations to resources, URIs, and HTTP methods.
Nowadays traditional layered monolithic architecture in Java world is not so popular as 5-10 years ago. I remember how we wrote tons of code for each layer repeating almost the same parts for every application. Add unit and integration testing to understand how much time and efforts has been spent on repeatable work. All cool ideas around DDD (domain driven design) and Hexagonal Architecture was just a nice theory because reality hasn’t allow us to implement it easily. Even Dependency Injection with Spring framework was completely focused on traditional layered approach, not even talking about JavaEE platform.
Today we have Spring Boot ecosystem covering most of our needs for integration with almost all possible technologies and microservices architectural trend, enabling completely new approach to build Java applications around domain model. It is so natural to build Java domain-oriented services and connect them with external world using ports and adapters, that Hexagonal Architecture is almost enabled by default. You just need to switch your way of thinking…
Redis allows running Lua scripts via its embedded Lua engine. Lua scripts have full access to Redis data and commands. Scripts run atomically and block the server during execution. Redis caches compiled scripts to avoid recompilation. Scripts should be parameterized to avoid cache explosions. Lua provides powerful data types like tables and control structures that can be used to build complex logic in scripts.
The document discusses advanced topics in Spring MVC, including annotation driven controllers, arguments and return types, and validation. It provides details on annotations like @Controller, @RequestMapping, @PathVariable, @ModelAttribute, @CookieValue, @HeaderValue, @DateTimeFormat, @RequestBody, and @ResponseBody and how they can be used to configure controller methods. It also describes what types of arguments controller methods can accept and what return types are allowed.
Introduction to Spring WebFlux #jsug #sf_a1Toshiaki Maki
The document provides an introduction and overview of Spring WebFlux, a non-blocking web framework for Spring. It discusses the differences between blocking and non-blocking web stacks, and how Spring WebFlux uses reactive streams and programming. Code examples are provided showing how to build reactive controllers and streams in Spring WebFlux that support backpressure.
When does InnoDB lock a row? Multiple rows? Why would it lock a gap? How do transactions affect these scenarios? Locking is one of the more opaque features of MySQL, but it’s very important for both developers and DBA’s to understand if they want their applications to work with high performance and concurrency. This is a creative presentation to illustrate the scenarios for locking in InnoDB and make these scenarios easier to visualize. I'll cover: key locks, table locks, gap locks, shared locks, exclusive locks, intention locks, insert locks, auto-inc locks, and also conditions for deadlocks.
This document summarizes key abstractions that were important to the success of Comdb2, a highly available clustered relational database system developed at Bloomberg. The four main abstractions discussed are:
1. The relational model and use of SQL provided important abstraction that simplified application development and improved performance and reliability compared to a noSQL approach.
2. A goal of "perfect availability" where the database is always available and applications do not need error handling for failures.
3. Ensuring serializability so the database acts as if it has no concurrency to simplify application development.
4. Presenting the distributed database as a "single system image" so applications do not need to account
webpack is a powerful module bundler and it becomes an essential part of our JavaScript Ecosystem. This ppt comprises an overview on webpack, some of the core concepts of webpack and it's configurations with some working examples.
Spring Boot is a framework for creating stand-alone, production-grade Spring-based applications that can be started using java -jar without requiring any traditional application servers. It is designed to get developers up and running as quickly as possible with minimal configuration. Some key features of Spring Boot include automatic configuration, starter dependencies to simplify dependency management, embedded HTTP servers, security, metrics, health checks and externalized configuration. The document then provides examples of building a basic RESTful web service with Spring Boot using common HTTP methods like GET, POST, PUT, DELETE and handling requests and responses.
This document discusses Aspect Oriented Programming (AOP) using the Spring Framework. It defines AOP as a programming paradigm that extends OOP by enabling modularization of crosscutting concerns. It then discusses how AOP addresses common crosscutting concerns like logging, validation, caching, and transactions through aspects, pointcuts, and advice. It also compares Spring AOP and AspectJ, and shows how to implement AOP in Spring using annotations or XML.
Simple REST-API overview for developers. An newer version is here: https://www.slideshare.net/patricksavalle/super-simple-introduction-to-restapis-2nd-version-127968966
Building Workflow Applications Through the WebT. Kim Nguyen
This document discusses building workflow apps through Plone. It describes what workflow apps are, why they are useful, and how to create them using PloneFormGen, the Data to Content adapter, and the Workflow Manager without coding. It provides a walkthrough of building a sample travel expense form workflow app and discusses future plans to improve the process of creating workflow apps through Plone.
http://www.opitz-consulting.com/go/3-5-898
Smartphones haben unsere Welt im Schnellgang erobert. Die Tablets folgen nicht minder schnell nach. Was fasziniert uns so daran? Welche neuen Möglichkeiten bieten sich für das Business? Welchen Einfluss wird das allgegenwärtige HTML5 haben? Wie bekomme ich mobile Lösungen architektonisch optimal in meine SOA-Landschaft integriert, und welche Vorteile gewinne ich bei der Prozessautomatisierung? Diese Session liefert sowohl einen Überblick als auch Antworten für eine neue Klasse von Architekturfragen.
Die SOA-Experten Torsten Winterberg und Guido Schmutz hielten diesen Fachvortrag bei der DOAG Konferenz und Ausstellung am 20.11.2013 in Nürnberg.
--
Über uns:
Als führender Projektspezialist für ganzheitliche IT-Lösungen tragen wir zur Wertsteigerung der Organisationen unserer Kunden bei und bringen IT und Business in Einklang. Mit OPITZ CONSULTING als zuverlässigem Partner können sich unsere Kunden auf ihr Kerngeschäft konzentrieren und ihre Wettbewerbsvorteile nachhaltig absichern und ausbauen.
Über unsere IT-Beratung: http://www.opitz-consulting.com/go/3-8-10
Unser Leistungsangebot: http://www.opitz-consulting.com/go/3-8-874
Karriere bei OPITZ CONSULTING: http://www.opitz-consulting.com/go/3-8-5
The document discusses JRuby on Google App Engine, including key features of App Engine, quotas and billing, limitations, the current issues with JRuby on App Engine, App Engine gems, the development environment, deployment process, APIs, and milestones in the development of JRuby on App Engine. It also includes a short biography and discussion of learning experiences from building an iPhone app that uses App Engine and JRuby as a backend.
This tutorial teaches how to customize forms in PerfectForms by:
1. Creating and naming a new form, then setting its size, borders, and background color in the Form Properties panel.
2. Adding images to the form by selecting them from the assets menu in the toolbar and adjusting their size and position.
3. Creating accent borders using horizontal and vertical separators from the toolbar, then customizing their color, width, and position on the form.
4. Saving and previewing the customized form.
Lincs Business networking presentationMalcolm York
The document provides an agenda and details for a BizMidlands networking event on June 29th, 2011. The agenda includes introductions, presentations on marketing topics, and speed networking sessions. Additional details provide background on BizMidlands as a networking group for businesses across several Midlands regions in the UK. The document promotes upcoming events like a business conference and encourages attendees to get involved through the group's website and social media platforms.
This document provides an overview guide for newcomers to Fredericton, New Brunswick. It includes sections on living in Fredericton which discusses housing, transportation, healthcare, education and recreation. It also covers working and studying in Fredericton, immigrating to Fredericton, and includes useful contact information for various municipal services. The guide welcomes newcomers and provides concise information on essential topics to assist with relocating to and settling in Fredericton.
Participant driven professional development that is collaborative rather than competitive,
promotes sharing of best practices: grass-roots innovation, teacher to teacher, educator to educator, student to student, parent to parent, one to another, one to each other, inclusive rather than exclusive, and with everyone joined in a common endeavour. All of this can be enhanced through the use of technology, leveraged for maximum engagement across time, distance and space (but not the most critical element)..
There are those who say that education will only get better if teachers get better. The way to do that, across the globe, is for those of us whose minds, hearts, and souls are thusly engaged, is to share, and to care... The rest will take care of itself if we do this one thing: share & care... There will be no obstacle that is capable of resisting the force of millions, no billions of people, who have determined that in the end, changing the status quo is within our will to effect it, one by one and two by two, relentlessly.
That is the grass-roots power of EdCamps all over the world... Be the change you want to see in education, and it will be so, sooner rather than later...
Este documento apresenta um resumo sobre abelhas brasileiras, incluindo sua classificação, morfologia e identificação. O livro fornece chaves para a identificação de todos os gêneros de abelhas encontrados no Brasil, além de informações sobre sua sistemática, biologia, ecologia e distribuição geográfica.
The document discusses the Mexican Muralist movement, which emerged after the Mexican Revolution. It was characterized by large-scale fresco paintings on public buildings that captured Mexican history, culture, and social struggles. The three main exponents were José Clemente Orozco, David Alfaro Siqueiros, and Diego Rivera, who incorporated indigenous styles and socialist ideals into their monumental works depicting the Mexican people and landscape.
Apps for Office allow developers to create apps that integrate with Office applications like Word, Excel, PowerPoint, and Outlook, bringing SharePoint content and functionality into the Office experience. Developers can build task pane apps, which appear as panels in Office applications, and content apps, which are embedded directly into documents. These apps provide opportunities to enhance collaboration and workflows by supplementing documents with SharePoint features and third-party services.
The document provides information about the elected student body, called the Gymkhana Union Body, at the National Institute of Technology Silchar. It lists the office bearers for the 2015-2016 session, including the President, Vice President, General Secretary, Cultural Secretary, Sports Secretary, Literary Secretary, and others. The Gymkhana Union Body looks after various student activities and plans for the betterment of the college. NIT Silchar has a tradition of holding elections every year to elect representatives to the Gymkhana Union Body.
This document provides an overview of Arisu, Seoul's brand of tap water. It discusses the history of tap water in Seoul, from a time when water had to be transported into the city, to the current system that provides safe drinking water to over 10 million people daily. It outlines Seoul's policies and technologies to ensure water quality, including comprehensive management of water sources, advanced purification technologies, and optimization of the water supply system using IT. The document highlights how Seoul has strengthened its tap water management over time to provide residents with the safest and highest quality drinking water in the world.
Talk at LBi "What's next in UX design",February 2012
In the past designers made products useful, usable and delightful. If we adhered to these principles we believed products would sell. The business factors were mostly external to the product. Now the business model is an integral requirement that shapes digital design.
The consumer electronic products we used to own were the embodiment of access to entertainment, personal media and communication. The past decade witnessed the demise of products we own to the explosion of services, enabled by the internet, we use. Value perceptions are shifting from ownership towards seamless accessibility and habitual choice. Technology convergence affords ever new interactions between context, content and social relationships and consequently value perceptions are in perpetual flux. We've become aware, in retrospect, that business models driven by the internet and reacting to this flux seem to follow evolutionary tendencies.
- A look at a brief history of business models on the internet affected by evolutionary forces.
- Is it all about the survival of the fittest? And are there successful niche opportunities?
- Although evolution is inherently non-deterministic it doesn't harm to ask the question: what lies ahead and where are we going? Can products and services be designed to become more adaptive to evolutionary requirements?
IBM Connections Adminblast - Connect17 (DEV 1268)Nico Meisenzahl
Buckle up, join Christoph and Nico and get ready to learn 50 tips and tricks you can implement right away to improve your IBM Connections environment. Your users will thank you as they too benefit from this best practice list gathered from real-world projects while deploying and administering IBM Connections On-premises. Walk away with knowledge covering anything from Cognos integration, docs, CCM and Forms Experience Builder to the back end and DB2, TDI and SSO.
The document discusses using interactive emails to engage users by having them reply with simple responses, like how their day went, and saving those replies to their account without needing to visit the website. It provides tips for interactive emails, such as making the initial action very simple, breaking tasks into small steps, having a low threshold for success, keeping users interested with variety, and gathering feedback when users fail or disengage. The overall strategy is to gradually engage users in an easy way through familiar email interactions.
Hiromu Shioya gave a lightning talk about being born in and connected by the internet. He shared several links to book recommendations on his website about various technical topics such as PHP, web development, and computer networking. The talk concluded by providing a link to apply for jobs at his company.
The document contains details of 18 companies including their names, CEO/Director names and contact details like email, phone numbers and addresses. Some key details are:
- Hical Technologies Pvt. Ltd. and Hical Magnetics Pvt Ltd have the same CEO, Shashikiran Mallur.
- American Power Conversion (I) Pvt. Ltd. has two locations and the same CEO, Javed Ahmad.
- Kaynes Technology CEO is Ramesh Kannan and they are located in Mysore.
- Contact details provided include names, designations, email IDs and phone numbers of CEOs, CFOs and other contacts.
Testing Web Apps with Spring Framework 3.2Sam Brannen
This document provides an overview of the new testing features in the Spring Framework 3.2, including the Spring TestContext Framework and the new Spring MVC Test Framework. The Spring TestContext Framework allows for annotation-driven unit and integration testing of Spring-managed components. It supports loading application contexts, dependency injection of test instances, and transactional test management. The new Spring MVC Test Framework enables server-side testing of Spring MVC applications without requiring a servlet container. It provides a fluent API for building mock requests and asserting mock responses. The framework also supports testing client-side interactions using the RestTemplate.
S313352 optimizing java device testing with automatic feature discoveringromanovfedor
The document discusses optimizing Java device testing by using diagnostic tests to automatically discover a device's capabilities. Diagnostic tests check if optional features are supported and export the results. This reduces the time needed to configure tests from days to 30 minutes by avoiding tests that don't apply. The solution was implemented in the Java Device Test Framework (JDTF) by marking diagnostic tests, writing tests to check features and export results, and adjusting relevance filters. A demo showed how diagnostic tests streamline test configuration.
This document provides an introduction to Spring Boot, including its objectives, key principles, and features. It discusses how Spring Boot enables building standalone, production-grade Spring applications with minimal configuration. It demonstrates creating a "Hello World" REST app with one Java class. It also covers auto-configuration, application configuration, testing, supported technologies, case studies, and other features like production readiness and remote shell access.
The document discusses using annotations in Java, providing examples of annotations for servlets, EJBs, web services, CDI, and using frameworks like JUnit, Spring, Javassist, and ASM. It presents code samples to define servlets, session beans, RESTful and SOAP web services, and component injection using annotations instead of XML configurations. The document also demonstrates how to programmatically read annotation values and metadata using reflection, Javassist, and ASM.
Presented on Feb 21, 2013 as part of a springsource.org webinar. A video of the presentation will be available 2 weeks later at http://www.youtube.com/springsourcedev.
This document provides an overview of Spring Boot, a framework for creating stand-alone, production-grade Spring based applications. It discusses how Spring Boot aims to make it easy to create Spring applications with default configurations and minimal code. The key topics covered include: using Maven and Gradle build tools with Spring Boot, common features and conventions like auto-configuration and main application classes, Spring Data and JPA for database access, Spring MVC features for web applications, and testing Spring applications.
This document provides an overview and introduction to Spring Boot. It discusses:
- The goals of Spring Boot to provide a faster setup process and default configurations without needing XML.
- Key features like auto-configuration, embedded servlet containers, and the use of starters for common dependencies.
- Conventions for project structure, main application classes, and defining beans.
- How to configure databases, implement JPA repositories, and build REST APIs with Spring MVC and data REST.
- Tips for testing Spring applications and building executable JAR files for deployment.
This document provides an overview and introduction to Spring Boot. It discusses:
- The goals of Spring Boot to provide a faster setup process and default configurations without needing XML.
- Key features like auto-configuration, embedded servlet containers, and the use of starters for common dependencies.
- Conventions in Spring Boot for project structure, main classes, configuration properties, and more.
- How to set up a Spring Boot project using Maven, including using the spring-boot-starter-parent and starter POMs.
- Support in Spring Boot for Spring MVC, data access with JPA/Spring Data, REST services, and testing.
The document provides an introduction to JUnit testing in Java. It discusses how to set up a JUnit test with the AEM testing framework using the AemContextExtension. Key aspects covered include adding Sling models to the test context, loading mock JSON resources, and adapting requests to test Sling models. The anatomy of a JUnit test is explained with examples of setting up mocks, verifying expectations, and asserting results. Mocking and the Mockito framework are also introduced for simulating dependencies in tests.
This document discusses different approaches to dependency injection in Scala, especially for use with Play!. It evaluates Spring, Spring-Scala, CDI, Guice, SubCut and Cake based on criteria like idiomatic Scala usage, testing support, and fit with Play!. Spring-Scala is recommended for projects that need to integrate Java and Scala code. Guice and Cake are recommended for standalone Scala projects. Cake provides additional type safety while Guice and Cake are good options for Play! projects.
This document provides an overview of the Spring framework. Some key points:
- Spring promotes loose coupling and separation of concerns through its lightweight container and use of dependency injection.
- It simplifies configuration for aspects like transactions through declarative programming without needing full J2EE.
- The inversion of control container resolves and "injects" dependencies into components.
- Spring supports aspects through its aspect-oriented programming features which allow cross-cutting concerns to be implemented as aspects.
- It provides transaction management, DAO support, and metadata support to further simplify programming tasks.
Spring 3 emphasizes annotation configuration over XML. Key changes include support for JSR 250, 299/330, and 303 annotations as well as a simplified MVC framework with @Controller and @RequestMapping annotations. Validation is integrated using JSR 303 annotations and executed automatically by the framework. Configuration is also simplified through @Configuration classes and the @Bean annotation.
Automation testing involves recording user actions on an application and verifying its behavior. Quick Test Professional (QTP) is an automation testing tool that follows a 7 step process: 1) preparing the test environment; 2) recording user actions; 3) enhancing the test with checkpoints and parameters; 4) debugging the test; 5) running the test; 6) analyzing results; and 7) reporting defects. QTP allows dividing tests into logical units called actions to make tests more modular and reusable across multiple tests.
Quick Test Professional (QTP) is automation testing tool that allows testing of applications by automating common tasks like recording, playback, and validating results. The QTP testing process involves 7 main phases including preparing the test environment, recording tests, enhancing tests with parameters and checkpoints, running tests, and analyzing results. QTP uses objects, actions, checkpoints and other features to model tests at different levels of the application under test. Test results can be stored and reported using features like the object repository, test reports and integration with other tools.
This document provides instructions for using the TestLink Integrator tool to update test case statuses in TestLink from automated tests executed in TestNG. The tool listens for test results from TestNG tests, identifies the associated TestLink test case IDs, and updates the statuses in TestLink. It requires configuring a TestLink project with a test plan and build, marking test cases as automated, and setting the TestLink ID in each TestNG test method. The document outlines the setup and configuration needed to use the tool to integrate TestLink and TestNG test automation.
This document discusses Spring Framework's support for dependency injection and annotation-driven configuration. It explains how to define Spring components using annotations like @Component and qualify dependencies using @Autowired and @Qualifier. It also covers how to configure beans declaratively using Java configuration classes and factory methods annotated with @Bean. The document discusses how Spring scans for components, injects dependencies, and manages bean lifecycles using callbacks annotated with @PostConstruct and @PreDestroy. It also describes how to define profiles to conditionally enable beans and configure the environment.
Java annotations allow metadata to be added to Java code elements like classes, methods, and fields. This metadata can be read by tools and libraries to affect how the code is processed. Common built-in annotations include @Deprecated, @Override, and @SuppressWarnings. Annotations can also be applied to other annotations to specify how they function, such as their retention policy or valid targets. As an example, the document describes how to build a simple annotation-based test framework using the @Test annotation to mark test methods.
Testing with JUnit 5 and Spring - Spring I/O 2022Sam Brannen
This session will give you an overview of the latest and greatest in the world of testing using JUnit Jupiter (a.k.a. JUnit 5) and the Spring Framework.
The focus will be major new features in JUnit Jupiter 5.8 and 5.9 as well as recent and upcoming enhancements to Spring's integration testing support.
CDI (Contexts and Dependency Injection) is the Java standard for dependency injection and interception. It simplifies and standardizes the API for DI and AOP similar to how JPA did for ORM. CDI uses annotations like @Inject and @Produces to manage dependencies between classes and allows for features like interceptors and decorators. While part of Java EE, CDI can also be used outside of a Java EE container.
Similar to Spring 3.1 and MVC Testing Support (20)
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Sam Brannen
Attend this talk to learn about the latest and greatest in the world of testing using the Spring Framework and JUnit Jupiter (a.k.a. JUnit 5) including tips for testing with Spring AOT and GraalVM native images.
Join core JUnit 5 committer Sam Brannen to gain insight on the latest new features in JUnit 5 as well as what’s on the horizon.
In this presentation we will look at exciting new features that have been added in JUnit 5 over the past year, including temporary directories, custom display name generators, method ordering, timeouts, the Test Kit, and powerful new extension APIs. If you haven't yet made the switch from JUnit 4 to JUnit 5 you will definitely want to check out this presentation.
In closing, Sam will also provide a few tips on how to use JUnit Jupiter to test Spring and Spring Boot apps.
JUnit 5: What's New and What's Coming - Spring I/O 2019Sam Brannen
Join core JUnit 5 committer Sam Brannen to gain insight on the latest new features in JUnit 5 as well as what’s on the horizon.
Sam will also provide tips on how to best use JUnit Jupiter to test Spring and Spring Boot apps.
JUnit 5 - New Opportunities for Testing on the JVMSam Brannen
Take a Deep Dive into JUnit 5 with core committer Sam Brannen!
Over the last decade a lot has happened in the world of Java and testing, but JUnit 4 hasn't kept up. Now JUnit 5 is here to help shape the future of testing on the JVM with a focus on Java 8 language features, extensibility, and a modern programming API for testing in Java. Moreover, JUnit isn't just a Java testing framework anymore. Third parties are already developing test engines for Scala, Groovy, Kotlin, etc. that run on the new JUnit Platform.
This session starts off with an overview of the inspiration for & architecture of JUnit 5, from launchers to test engines. Sam will then take the audience on a live coding tour, highlighting support for tagging, custom display names, dependency injection, repeated tests, parameterized tests, conditional test execution, lambda expressions for assertions, assumptions, & dynamic tests, and implementing tests via interface default methods (a.k.a., testing traits).
Next, Sam will present the new extension model in JUnit Jupiter, discussing how to author and register extensions for conditional tests, parameter resolution (a.k.a., dependency injection), lifecycle callbacks, & more.
To round off the session, Sam will quickly showcase the new JUnit Jupiter support in Spring Framework 5.0.
Get the Most out of Testing with Spring 4.2Sam Brannen
Join Sam Brannen and Nicolas Fränkel to discover what's new in Spring Framework 4.2's testing support and learn tips and best practices for testing modern, Spring-based applications.
Sam Brannen is the Spring Test component lead and author of the Spring TestContext Framework, and Nicolas Fränkel is the author of the book "Integration Testing from the Trenches".
In this session, Sam and Nicolas will cover the latest testing features in Core Spring, Spring Boot, and Spring Security. In addition to new features, they will also present insider tips and best practices on integration testing with suites in TestNG, database transactions, SQL script execution, granularity of context configuration files, optimum use of the context cache, a discussion on TestNG vs. JUnit, and much more.
JUnit 5 - from Lambda to Alpha and beyondSam Brannen
Want to know what the hype surrounding JUnit 5 is all about? Then join this talk by JUnit 5 core committer Sam Brannen to find out!
Since JUnit 4.0 was first released, a lot has happened in the world of Java. Unfortunately, JUnit 4 hasn't kept up with the times. JUnit 5 therefore aims to help shape the future of testing on the JVM, with a focus on Java 8, modularity, extensibility, and a modern programming API for authoring tests in Java.
This presentation will start off by providing attendees an overview of the inspiration for and architecture of JUnit 5, from launchers to test engines. Sam will then take the audience on an example-driven tour of the new programming model, highlighting support for dependency injection via flexible method signatures, conditional test execution, using lambda expressions and method references in assertions and assumptions, and implementing test/before/after methods via interface default methods.
To round off the discussion, Sam will present an overview of the new extension model in JUnit 5, discussing how to author and register extensions for conditional tests, method parameter resolution, lifecycle callbacks, and more.
The Spring Framework has always embraced testing as a first class citizen. Spring-based components should be modular, easy to wire together via dependency injection, and therefore easy to test. In fact, when well designed following a POJO programming model, a component in a Spring application can be unit tested without using Spring at all. And when you take the step toward developing integration tests, Spring's testing support is there to make your job easy.
Join Spring Test component lead Sam Brannen in this talk to learn about the basics for Spring's unit and integration testing support. This talk will provide attendees an overview of the following topics: unit testing without Spring, integration testing with Spring, loading application contexts (with and without context hierarchies), injecting dependencies into tests, transaction management for tests, SQL script execution, testing Spring MVC and REST web applications, and more.
The Spring Framework has undergone a lot of innovation in the 4.0 and 4.1 releases, and so has its testing support. Join Spring Test component lead Sam Brannen in this talk to discover what's new in Spring's testing support in 4.0 through 4.1.
This talk will provide attendees an overview of what's been deprecated, what's changed, and what's been introduced in Spring's testing support over the last two years, with real life examples and tips for best practices. Highlights include using SocketUtils to scan for free TCP & UDP server ports, the ActiveProfilesResolver API, meta-annotation support for test annotations including attribute overrides, best practices with TestNG, using Groovy scripts to configure an ApplicationContext for integration tests, improvements to SQL script execution and embedded databases, the new TestContext framework bootstrap strategy, programmatic transaction management in tests, and more.
Spring Framework 4.1 is the latest release of the popular open source application framework for Java developers with continued innovation for Java SE 8 and enterprise Java. In this presentation core Spring committer Sam Brannen will provide attendees an overview of the new enterprise features in the framework as well as new programming models and testing features.
Specifically, this talk will cover support for annotation-driven JMS listeners, JMS 2.0's shared subscriptions, JCache (JSR-107) annotations, a compiler mode for the Spring Expression Language (SpEL), flexible resolution and transformation of static web resources, and Web MVC support for Groovy markup templates.
The presentation also provides an overview of Spring 4.1's refinements in other areas, for example: Java 8's Optional type for injection points, declarative MVC view resolution, Jackson's JsonView, WebSocket scope, SockJS client support, declarative SQL scripts and programmatic transactions in the TestContext framework, integration testing with Groovy scripts, and more.
Testing Spring MVC and REST Web ApplicationsSam Brannen
This document provides an overview of testing Spring MVC web applications. It discusses the Spring TestContext Framework and how it can be used to load a WebApplicationContext for testing. It also covers the Spring MVC Test Framework, which provides a fluent API for testing MVC controllers without requiring a servlet container. Both server-side testing of MVC controllers and client-side testing of REST services using RestTemplate are demonstrated. The presentation concludes with resources for learning more about testing Spring applications.
Composable Software Architecture with SpringSam Brannen
Sam Brannen gave a presentation on composable software architecture with Spring. He discussed how modern enterprise applications need to interact with multiple external systems and services. A composable architecture uses modular, stateless components that can be assembled in different combinations. Spring supports this through features like dependency injection, inversion of control, and its ecosystem of projects. The roadmap for Spring 4.0 includes better support for Java 8, configuring Spring with Groovy, and key Java EE 7 technologies.
Spring Framework 4.0 is the latest generation of the popular open source framework for Enterprise Java developers, focusing on the future with support for Java SE 8 and Java EE 7. In this presentation core Spring committer Sam Brannen will provide attendees an overview of the new enterprise features in the framework as well as new programming models made possible with the adoption of JDK 8 language features and APIs.
Specifically, this talk will cover support for lambda expressions and method references against Spring callback interfaces, JSR-310 Date-Time value types for Spring data binding and formatting, Spring's new @Conditional mechanism for activation of bean definitions, and a new WebSocket endpoint model. The presentation also provides an overview of Spring 4.0's updated support for enterprise APIs such as JMS 2.0, JPA 2.1, Bean Validation 1.1, Servlet 3.1, and JCache. Last but not least, Sam will highlight some of the major themes for the upcoming Spring Framework 4.1 release such as support for JCache 1.0 annotations, annotation-driven JMS listeners, and testing improvements.
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013Sam Brannen
Spring Framework 4.0 is the next generation of the popular open source framework for Enterprise Java developers, focusing on the future with support for Java SE 8 and Java EE 7. In this presentation core Spring committer Sam Brannen will provide attendees an overview of the new enterprise features in the framework as well as new programming models made possible with the adoption of JDK 8 language features and APIs.
Specifically, this talk will cover support for lambda expressions and method references against Spring callback interfaces, JSR-310 Date-Time value types for Spring data binding and formatting, Spring's new @Conditional mechanism for activation of bean definitions, and a new WebSocket endpoint model. Regarding enterprise APIs, the presentation will cover Spring 4.0's new support for JMS 2.0, JPA 2.1, Bean Validation 1.1, Servlet 3.1, JCache, and JSR-236 concurrency. Last but not least, Sam will discuss improvements to Spring's testing support and point out which deprecated APIs have been pruned from the framework.
As the leading full-stack application framework for Java SE and EE, the Spring Framework continues to deliver significant benefits to Java developers, increasing development productivity and runtime performance while improving test coverage and application quality.
In this talk, core Spring Framework committer Sam Brannen will provide attendees an overview of the new features in Spring 3.2 as well as a sneak peak at the roadmap for 4.0.
Spring Framework 3.2 builds on several themes delivered in 3.1 with a continued focus on asynchronous MVC processing with Servlet 3.0, support for using @Autowired and @Value as meta-annotations, support for custom @Bean definition annotations, and early support for JCache 0.5. Regarding the internals, CGLIB 3.0 and ASM 4.0 have been inlined, and the framework is now built with Gradle and hosted on GitHub. For those interested in testing their Spring-based web applications, Spring 3.2 offers new support for loading WebApplicationContexts in the TestContext framework, and the formerly standalone Spring MVC Test project is now included in the spring-test module, allowing for first-class testing of Spring MVC applications.
Spring 3.1 and MVC Testing Support - 4DevelopersSam Brannen
Please note that this presentation is an abridged version of the one given by Rossen Stoyanchev and me at SpringOne 2GX 2012.
This session will give attendees an overview of the new testing features in Spring 3.1 as well the new Spring MVC test support. Sam Brannen will demonstrate how to use the Spring TestContext Framework to write integration tests for Java-based Spring configuration using @Configuration classes. He'll then compare and contrast this approach with XML-based configuration and follow up with a discussion of the new testing support for bean definition profiles. Next, attendees will see how testing server-side code with annotated controllers and client-side code with the RestTemplate just got a whole lot easier with the new Spring MVC test support. Come to this session to see these new Spring testing features in action.
Modern application frameworks promote a POJO-based programming model, and POJOs are inherently easy to unit test. But how can we effectively integration test our application outside the container while still getting as close to a production-like environment as possible? This session will show attendees how to approximate a target production environment using JUnit and the Spring TestContext Framework to drive fast, repeatable, "out-of-container" integration tests. To simulate a live system, the session will cover open source integration testing techniques such as the use of in-memory databases, JMS providers, and Servlet containers as well as mock SMTP and FTP servers. These techniques are not limited to Spring based applications and can be applied to help integration test any modern Java application.
Spring 3.1 to 3.2 in a Nutshell - SDC2012Sam Brannen
Spring 3.1 introduced several eagerly awaited features including bean definition profiles (a.k.a., environment-specific configuration), enhanced Java-based application and infrastructure configuration (a la XML namespaces), and a new cache abstraction. This session will provide attendees a high-level overview of these major new features plus a quick look at additional enhancements to the framework such as the new c: namespace for constructor arguments, support for Servlet 3.0, improvements to Spring MVC and REST, and Spring's new integration testing support for profiles and configuration classes. In addition, this talk will cover new features under development in the Spring 3.2 road map.
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012Sam Brannen
Spring 3.1 introduced several eagerly awaited features including bean definition profiles (a.k.a., environment-specific configuration), enhanced Java-based application and infrastructure configuration (a la XML namespaces), and a new cache abstraction. This session will provide attendees a high-level overview of these major new features plus a quick look at additional enhancements to the framework such as the new c: namespace for constructor arguments, support for Servlet 3.0, improvements to Spring MVC and REST, and Spring's new integration testing support for profiles and configuration classes. In addition, this talk will introduce new features under development in the Spring 3.2 roadmap.
Spring 3.1 in a Nutshell - JAX London 2011Sam Brannen
Spring 3.1 in a Nutshell focused on major new features including the environment and profile abstraction, Java-based configuration with @Enable annotations, improved testing support using @Configuration classes and profiles, a high-level caching API, enhancements to MVC and REST support, explicit Servlet 3.0 integration, and miscellaneous improvements like the "c:" namespace. The presentation provided examples and explanations of how to use these new features in Spring applications.
Spring 3.1 introduces several eagerly awaited features including bean definition profiles (a.k.a., environment-specific beans), enhanced Java-based application and infrastructure configuration (a la XML namespaces), a new cache abstraction, and MVC improvements. This session will provide attendees an in-depth look at these major new features as well as an overview of additional enhancements to the framework such as the new c: namespace for constructor arguments, updates regarding Servlet 3.0, and improvements to Spring's integration testing support.
In this follow-up session on knowledge and prompt engineering, we will explore structured prompting, chain of thought prompting, iterative prompting, prompt optimization, emotional language prompts, and the inclusion of user signals and industry-specific data to enhance LLM performance.
Join EIS Founder & CEO Seth Earley and special guest Nick Usborne, Copywriter, Trainer, and Speaker, as they delve into these methodologies to improve AI-driven knowledge processes for employees and customers alike.
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Erasmo Purificato
Slide of the tutorial entitled "Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Emerging Trends" held at UMAP'24: 32nd ACM Conference on User Modeling, Adaptation and Personalization (July 1, 2024 | Cagliari, Italy)
Details of description part II: Describing images in practice - Tech Forum 2024BookNet Canada
This presentation explores the practical application of image description techniques. Familiar guidelines will be demonstrated in practice, and descriptions will be developed “live”! If you have learned a lot about the theory of image description techniques but want to feel more confident putting them into practice, this is the presentation for you. There will be useful, actionable information for everyone, whether you are working with authors, colleagues, alone, or leveraging AI as a collaborator.
Link to presentation recording and transcript: https://bnctechforum.ca/sessions/details-of-description-part-ii-describing-images-in-practice/
Presented by BookNet Canada on June 25, 2024, with support from the Department of Canadian Heritage.
How Netflix Builds High Performance Applications at Global ScaleScyllaDB
We all want to build applications that are blazingly fast. We also want to scale them to users all over the world. Can the two happen together? Can users in the slowest of environments also get a fast experience? Learn how we do this at Netflix: how we understand every user's needs and preferences and build high performance applications that work for every user, every time.
UiPath Community Day Kraków: Devs4Devs ConferenceUiPathCommunity
We are honored to launch and host this event for our UiPath Polish Community, with the help of our partners - Proservartner!
We certainly hope we have managed to spike your interest in the subjects to be presented and the incredible networking opportunities at hand, too!
Check out our proposed agenda below 👇👇
08:30 ☕ Welcome coffee (30')
09:00 Opening note/ Intro to UiPath Community (10')
Cristina Vidu, Global Manager, Marketing Community @UiPath
Dawid Kot, Digital Transformation Lead @Proservartner
09:10 Cloud migration - Proservartner & DOVISTA case study (30')
Marcin Drozdowski, Automation CoE Manager @DOVISTA
Pawel Kamiński, RPA developer @DOVISTA
Mikolaj Zielinski, UiPath MVP, Senior Solutions Engineer @Proservartner
09:40 From bottlenecks to breakthroughs: Citizen Development in action (25')
Pawel Poplawski, Director, Improvement and Automation @McCormick & Company
Michał Cieślak, Senior Manager, Automation Programs @McCormick & Company
10:05 Next-level bots: API integration in UiPath Studio (30')
Mikolaj Zielinski, UiPath MVP, Senior Solutions Engineer @Proservartner
10:35 ☕ Coffee Break (15')
10:50 Document Understanding with my RPA Companion (45')
Ewa Gruszka, Enterprise Sales Specialist, AI & ML @UiPath
11:35 Power up your Robots: GenAI and GPT in REFramework (45')
Krzysztof Karaszewski, Global RPA Product Manager
12:20 🍕 Lunch Break (1hr)
13:20 From Concept to Quality: UiPath Test Suite for AI-powered Knowledge Bots (30')
Kamil Miśko, UiPath MVP, Senior RPA Developer @Zurich Insurance
13:50 Communications Mining - focus on AI capabilities (30')
Thomasz Wierzbicki, Business Analyst @Office Samurai
14:20 Polish MVP panel: Insights on MVP award achievements and career profiling
An invited talk given by Mark Billinghurst on Research Directions for Cross Reality Interfaces. This was given on July 2nd 2024 as part of the 2024 Summer School on Cross Reality in Hagenberg, Austria (July 1st - 7th)
Navigating Post-Quantum Blockchain: Resilient Cryptography in Quantum Threatsanupriti
In the rapidly evolving landscape of blockchain technology, the advent of quantum computing poses unprecedented challenges to traditional cryptographic methods. As quantum computing capabilities advance, the vulnerabilities of current cryptographic standards become increasingly apparent.
This presentation, "Navigating Post-Quantum Blockchain: Resilient Cryptography in Quantum Threats," explores the intersection of blockchain technology and quantum computing. It delves into the urgent need for resilient cryptographic solutions that can withstand the computational power of quantum adversaries.
Key topics covered include:
An overview of quantum computing and its implications for blockchain security.
Current cryptographic standards and their vulnerabilities in the face of quantum threats.
Emerging post-quantum cryptographic algorithms and their applicability to blockchain systems.
Case studies and real-world implications of quantum-resistant blockchain implementations.
Strategies for integrating post-quantum cryptography into existing blockchain frameworks.
Join us as we navigate the complexities of securing blockchain networks in a quantum-enabled future. Gain insights into the latest advancements and best practices for safeguarding data integrity and privacy in the era of quantum threats.
How RPA Help in the Transportation and Logistics Industry.pptxSynapseIndia
Revolutionize your transportation processes with our cutting-edge RPA software. Automate repetitive tasks, reduce costs, and enhance efficiency in the logistics sector with our advanced solutions.
MYIR Product Brochure - A Global Provider of Embedded SOMs & SolutionsLinda Zhang
This brochure gives introduction of MYIR Electronics company and MYIR's products and services.
MYIR Electronics Limited (MYIR for short), established in 2011, is a global provider of embedded System-On-Modules (SOMs) and
comprehensive solutions based on various architectures such as ARM, FPGA, RISC-V, and AI. We cater to customers' needs for large-scale production, offering customized design, industry-specific application solutions, and one-stop OEM services.
MYIR, recognized as a national high-tech enterprise, is also listed among the "Specialized
and Special new" Enterprises in Shenzhen, China. Our core belief is that "Our success stems from our customers' success" and embraces the philosophy
of "Make Your Idea Real, then My Idea Realizing!"
The DealBook is our annual overview of the Ukrainian tech investment industry. This edition comprehensively covers the full year 2023 and the first deals of 2024.
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Chris Swan
Have you noticed the OpenSSF Scorecard badges on the official Dart and Flutter repos? It's Google's way of showing that they care about security. Practices such as pinning dependencies, branch protection, required reviews, continuous integration tests etc. are measured to provide a score and accompanying badge.
You can do the same for your projects, and this presentation will show you how, with an emphasis on the unique challenges that come up when working with Dart and Flutter.
The session will provide a walkthrough of the steps involved in securing a first repository, and then what it takes to repeat that process across an organization with multiple repos. It will also look at the ongoing maintenance involved once scorecards have been implemented, and how aspects of that maintenance can be better automated to minimize toil.
Are you interested in learning about creating an attractive website? Here it is! Take part in the challenge that will broaden your knowledge about creating cool websites! Don't miss this opportunity, only in "Redesign Challenge"!
Data Protection in a Connected World: Sovereignty and Cyber Securityanupriti
Delve into the critical intersection of data sovereignty and cyber security in this presentation. Explore unconventional cyber threat vectors and strategies to safeguard data integrity and sovereignty in an increasingly interconnected world. Gain insights into emerging threats and proactive defense measures essential for modern digital ecosystems.
Video traffic on the Internet is constantly growing; networked multimedia applications consume a predominant share of the available Internet bandwidth. A major technical breakthrough and enabler in multimedia systems research and of industrial networked multimedia services certainly was the HTTP Adaptive Streaming (HAS) technique. This resulted in the standardization of MPEG Dynamic Adaptive Streaming over HTTP (MPEG-DASH) which, together with HTTP Live Streaming (HLS), is widely used for multimedia delivery in today’s networks. Existing challenges in multimedia systems research deal with the trade-off between (i) the ever-increasing content complexity, (ii) various requirements with respect to time (most importantly, latency), and (iii) quality of experience (QoE). Optimizing towards one aspect usually negatively impacts at least one of the other two aspects if not both. This situation sets the stage for our research work in the ATHENA Christian Doppler (CD) Laboratory (Adaptive Streaming over HTTP and Emerging Networked Multimedia Services; https://athena.itec.aau.at/), jointly funded by public sources and industry. In this talk, we will present selected novel approaches and research results of the first year of the ATHENA CD Lab’s operation. We will highlight HAS-related research on (i) multimedia content provisioning (machine learning for video encoding); (ii) multimedia content delivery (support of edge processing and virtualized network functions for video networking); (iii) multimedia content consumption and end-to-end aspects (player-triggered segment retransmissions to improve video playout quality); and (iv) novel QoE investigations (adaptive point cloud streaming). We will also put the work into the context of international multimedia systems research.
1. Spring 3.1 and MVC
Testing Support
Sam Brannen
Swiftmind
Rossen Stoyanchev
SpringSource, VMware
SpringOne 2GX
October 28, 2011
2. Sam Brannen
Senior Software Consultant @ Swiftmind
Java developer with 13+ years' experience
Spring Framework Core Developer
Lead author of Spring in a Nutshell
Previous SpringSource dm Server™ developer
Presenter on Spring, Java, OSGi, and testing
3. Rossen Stoyanchev
Staff Engineer SpringSource, VMware
Spring MVC, Spring Web Flow committer
Teach and consult, Spring Projects
Spring Web course author
NYC area
4. Goals of the
Presentation
Gain an overview of testing features
in Spring 3.1
Learn about the new Spring MVC
Test Support project
6. Show of Hands...
JUnit / TestNG
Spring 2.5 / 3.0 / 3.1
Integration testing with Spring
Spring TestContext Framework
Spring MVC
Spring MVC Test Support
14. Spring & Unit Testing
POJO-based programming model
Program to interfaces
IoC / Dependency Injection
Out-of-container testability
Testing mocks/stubs for various APIs: Servlet,
Portlet, JNDI
General purpose testing utilities
ReflectionTestUtils
ModelAndViewAssert
15. Spring & Integration Testing
ApplicationContext management & caching
Dependency injection of test instances
Transactional test management
with default rollback semantics
SimpleJdbcTestUtils
JUnit 3.8 support classes are deprecated as of
Spring 3.0/3.1
17. Spring JUnit Annotations
Testing Profiles
groups, not bean definition
profiles
@IfProfileValue,
@ProfileValueSourceConfiguration
JUnit extensions
@Timed, @Repeat
18. Using the TestContext
Framework
Use the SpringJUnit4ClassRunner for
JUnit 4.5+
Instrument test class with
TestContextManager for TestNG
Extend one of the base classes
Abstract(Transactional)[JUnit4|TestNG]Spri
19. Example: @POJO Test Class
public class OrderServiceTests {
@Test
public void testOrderService() { … }
}
20. Example: @POJO Test Class
@RunWith(SpringJUnit4ClassRunner.class)
public class OrderServiceTests {
@Test
public void testOrderService() { … }
}
21. Example: @POJO Test Class
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class OrderServiceTests {
@Test
public void testOrderService() { … }
}
22. Example: @POJO Test Class
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration // defaults to
// OrderServiceTests-context.xml in same package
public class OrderServiceTests {
@Test
public void testOrderService() { … }
}
23. Example: @POJO Test Class
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration // defaults to
// OrderServiceTests-context.xml in same package
public class OrderServiceTests {
@Autowired
private OrderService orderService;
@Test
public void testOrderService() { … }
}
24. Example: @POJO Test Class
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration // defaults to
// OrderServiceTests-context.xml in same package
@Transactional
public class OrderServiceTests {
@Autowired
private OrderService orderService;
@Test
public void testOrderService() { … }
}
25. Example: @POJO Test Class
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration // defaults to
// OrderServiceTests-context.xml in same package
@Transactional
public class OrderServiceTests {
@Autowired
private OrderService orderService;
@BeforeTransaction
public void verifyInitialDatabaseState() { … }
@Test
public void testOrderService() { … }
}
26. Example: @POJO Test Class
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration // defaults to
// OrderServiceTests-context.xml in same package
@Transactional
public class OrderServiceTests {
@Autowired
private OrderService orderService;
@BeforeTransaction
public void verifyInitialDatabaseState() { … }
@Before
public void setUpTestDataWithinTransaction() { … }
@Test
public void testOrderService() { … }
}
30. TestExecutionListener SPI
Reacts to test execution events
Receives reference to current TestContext
Out of the box:
DependencyInjectionTestExecutionListener
DirtiesContextTestExecutionListener
TransactionalTestExecutionListener
34. ContextLoader SPI
Strategy for loading application contexts
from resource locations
Out of the box:
GenericXmlContextLoader
GenericPropertiesContextLoader
69. @Configuration + XML
Q: How can we combine
@Configuration classes with XML
config?
A: Choose one as the entry point.
That's how it works in production
anyway
70. Importing Configuration
In XML:
include @Configuration classes via
component scanning
or define them as normal Spring
beans
In an @Configuration class:
use @ImportResource to import XML
config files
72. @ActiveProfiles
To activate bean definition profiles in tests...
Annotate a test class with
@ActiveProfiles
Supply a list of profiles to be
activated for the test
Can be used with @Configuration
classes and XML config
81. And now an example with
@Configuration classes
82. TransferServiceConfig.java
@Configuration
public class TransferServiceConfig {
@Autowired DataSource dataSource;
@Bean
public TransferService transferService() {
return new DefaultTransferService(accountRepository(),
feePolicy());
}
@Bean
public AccountRepository accountRepository() {
return new JdbcAccountRepository(dataSource);
}
@Bean
public FeePolicy feePolicy() {
return new ZeroFeePolicy();
}
}
83. }
JndiDataConfig.java
@Configuration
@Profile("production")
public class JndiDataConfig {
@Bean
public DataSource dataSource() throws Exception {
Context ctx = new InitialContext();
return (DataSource)
ctx.lookup("java:comp/env/jdbc/datasource");
}
}
95. New Key Generation Algorithm
The context cache key generation algorithm has been updated to include...
locations (from @ContextConfiguration)
classes (from @ContextConfiguration)
contextLoader (from @ContextConfiguration)
activeProfiles (from @ActiveProfiles)
96. Summary
The Spring TestContext Framework simplifies
integration testing of Spring-based
applications
Spring 3.1 provides first-class testing support
for:
@Configuration classes
Environment profiles
See the Testing with @Configuration Classes
and Profiles blog for further insight
99. @Controller
@RequestMapping("/accounts")
public class AccountController {
// ...
@ModelAttribute
public Account getAccount(String number) {
return this.accountManager.getAccount(number);
}
@RequestMapping(method = RequestMethod.POST)
public String save(@Valid Account account,
BindingResult result) {
if (result.hasErrors()) {
return "accounts/edit";
}
this.accountManager.saveOrUpdate(account);
return "redirect:accounts";
}
}
100. Unit Test?
Create controller instance
Mock or stub services & repositories
101. Example
@Test
public void testSave() {
Account account = new Account();
BindingResult result =
new BeanPropertyBindingResult(account, "account");
}
102. Example
@Test
public void testSave() {
Account account = new Account();
BindingResult result =
new BeanPropertyBindingResult(account, "account");
AccountManager mgr = createMock(AccountManager.class);
mgr.saveOrUpdate(account);
replay(mgr);
}
103. Example
@Test
public void testSave() {
Account account = new Account();
BindingResult result =
new BeanPropertyBindingResult(account, "account");
AccountManager mgr = createMock(AccountManager.class);
mgr.saveOrUpdate(account);
replay(mgr);
AccountController contrlr = new AccountController(mgr);
String view = contrlr.save(account, result);
}
104. Example
@Test
public void testSave() {
Account account = new Account();
BindingResult result =
new BeanPropertyBindingResult(account, "account");
AccountManager mgr = createMock(AccountManager.class);
mgr.saveOrUpdate(account);
replay(mgr);
AccountController contrlr = new AccountController(mgr);
String view = contrlr.save(account, result);
assertEquals("redirect:accounts", view);
verify(mgr);
}
105. Example With Failure
@Test
public void testSave() {
Account account = new Account();
BindingResult result =
new BeanPropertyBindingResult(account, "account");
result.reject("error.code", "default message")
}
106. Example With Failure
@Test
public void testSave() {
Account account = new Account();
BindingResult result =
new BeanPropertyBindingResult(account, "account");
result.reject("error.code", "default message")
AccountManager mgr = createMock(AccountManager.class);
replay(mgr);
}
107. Example With Failure
@Test
public void testSave() {
Account account = new Account();
BindingResult result =
new BeanPropertyBindingResult(account, "account");
result.reject("error.code", "default message")
AccountManager mgr = createMock(AccountManager.class);
replay(mgr);
AccountController contrlr = new AccountController(mgr);
String view = contrlr.save(account, result);
assertEquals("accounts/edit", view);
verify(mgr);
}
108. Not Fully Tested
Request mappings
Binding errors
Type conversion
Etc.
113. the only way to verify...
Client-side behavior
Interaction with other server instances
Redis, Rabbit, etc.
114. We'd also like to...
Test controllers once!
Fully & quickly
Execute tests often
115. In summary...
We can't replace the need for end-to-
end tests
But we can minimize errors
Have confidence in @MVC code
During end-to-end tests
116. Spring MVC Test
Built on spring-test
No Servlet container
Drives Spring MVC infrastructure
Both server & client-side test support
(i.e. RestTemplate code)
Inspired by spring-ws-test
117. The Approach
Re-use controller test fixtures
I.e. mocked services & repositories
Invoke @Controller classes through
@MVC infrastructure
119. Under the Covers
Mock request/response from spring-test
DispatcherServlet replacement
Multiple ways to initialize MVC
infrastructure
Save results for expectations
124. About Manual Setup
MVC components instantiated directly
Not looked up in Spring context
Focused, readable tests
But must verify MVC config separately
125. TestContext Framework Example
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
locations={"/org/example/servlet-context.xml"})
public class TestContextTests {
@Autowired
private WebApplicationContext wac;
@Before
public void setup() {
MockMvc mockMvc =
MockMvcBuilders.webApplicationContextSetup(this.wac)
.build();
}
}
126. TestContext Framework
Caches loaded Spring configuration
Potentially across all tests!
142. Resources for Spring MVC Test
Project Home:
https://github.com/SpringSource/spring-test-mvc
Sample Tests:
org.springframework.test.web.server.samples
143. Resources for Core Spring
Spring Framework:
http://www.springsource.org/spring-core
Reference Manual: Spring 3.1 RC1
Forums: http://forum.springframework.org
JIRA: https://jira.springsource.org
Spring in a Nutshell … available in 2012