Comments (12)
Looks good.
You asked on Twitter how others approach IT when using webservices. We have a fairly complex IT setup (3 WARs participating including SOLR) which is all orchestrated by standard maven plugins. We let Jenkins assign the random port using -Djetty.port=XXX. We keep the IT as a separate module in the multi-module project so can run it on a separate schedule as it takes quite some minutes to complete.
See the comments in the POM to understand how it works:
http://code.google.com/p/gbif-registry/source/browse/registry/trunk/registry-it/pom.xml
I'm not proposing you adopt the maven approach, but you asked.
from dropwizard.
Thanks! It makes sense to use maven for orchestration but it's also useful to be able to run them easily just from the IDE. I think there is no right answer but it's good to have options.
from dropwizard.
Andrei, using ResourceTest is lighter on resources and it allows you to skip on loading resources you don't want.
In my opinion full integration testing are less useful for well-grown apps that have proper functional tests and real time monitoring, being more useful when tests are added after the application was built.
from dropwizard.
@alexandru I agree! I wrote this class because I needed a way to start the application with all the components registered (including filters, assets, custom servlets etc.). I can't use ResourceTest because the in-memory is not opening a server socket at all.
from dropwizard.
@alexandru I also totally agree.
We use it mainly for system wide IT, rather than single app testing, where we really want to verify things like authentication checking etc (such as CAS cache redirections). Sometimes it is useful as well to verify upgrades on HTTP libraries are working as expected - you end up writing so much mock stuff otherwise.
from dropwizard.
I needed a real server so that I can test methods requiring HttpServletRequest injection (which is not supported by the in-memory container). What I ended up doing was using the GrizzlyWebTestContainer: https://gist.github.com/3016987
Unfortunately I had to copy/paste and modify the code in ResourceTest because it currently does now allow one to configure the test container factory. I could probably adjust ResourceTest and open a pull request for that, but I'm busy with a few other projects right now.
from dropwizard.
One thing I do not understand here is writing of the config file -- couldn't one just work with Config objects? Or maybe this was due to earlier inability to change values (properties were private, no setters). So approach can probably be simplified in this part.
from dropwizard.
Where can I find an example of how to use Config objects? I had to write the config file because that was my only choice at that time.
from dropwizard.
I wish I had better example code available, but sub-module "ts-test-cluster" of
https://github.com/FasterXML/TransiStore
has full setup that spins up 4 instances of the store server.
The relevant section for starting up is this (in StoreForTests
)
public static StoreForTests createTestService(BasicTSServiceConfigForDW config,
TimeMasterForClusterTesting timeMaster, boolean fullInit)
throws Exception
{
StoreForTests service = new StoreForTests(timeMaster, fullInit);
Bootstrap<BasicTSServiceConfigForDW> bootstrap = new Bootstrap<BasicTSServiceConfigForDW>(service);
final Environment environment = new Environment("TestService", config,
new ObjectMapperFactory(), new Validator());
bootstrap.runWithBundles(config, environment);
service.run(config, environment);
final Server server = new ServerFactory(config.getHttpConfiguration(),
"StoreForTests").buildServer(environment);
service._jettyServer = server;
return service;
}
where BasicTSServiceConfigForDW
extends basic DropWizard Configuration
.
Caller than just does something like:
BasicTSServiceConfigForDW config = new BasicTSServiceConfigForDW();
config.getHttpConfiguration().setPort(9090); // override http port
// and so on
from dropwizard.
I've done something similar and would find this extremely useful as well if it was built in, but having the option to either create the config obj or to use an existing configure file would be helpful.
from dropwizard.
I don't have any interest in maintaining this, sorry.
from dropwizard.
@codahale No offense but this is the type of remark that lead me to switch to Spring Boot. I respect the great work you've done with DW but I'm getting the sense that what you deem useful and what the community deems useful are generally quite different.
from dropwizard.
Related Issues (20)
- Vulnerability issues with dependencies in dropwizard 4.0.1 HOT 1
- IlligalAccesException : module com.fasterxml.jackson.module.blackbird does not read module *** HOT 12
- Incorrect javadocs for io.dropwizard.logging.common.AppenderFactory
- Dropwizard 4.0.3 not logging request logs HOT 2
- AWS Serverless Example HOT 1
- Dropwizard 4.0.2 + Hibernate + ContainerResponseFilter with NameBinding HOT 3
- Jersey client 2.21 doesnt support Transfer-encoding: chunked, is there any workaround?
- Breaking change in a version between 4.0.1 and 4.0.4 HOT 3
- DropwizardJettyServerAdapter in DropWizard3 causing exception when there are multiple HttpHeaders HOT 9
- Update Logback to fix CVE-2023-6378? HOT 4
- NPE in tests when a factory is used to inject a value to a resource method parameter HOT 2
- Managed virtual thread pool HOT 2
- Deserialization failures due to Afterburner HOT 1
- Server starts and stops immediately when both enableVirtualThreads and enableAdminVirtualThreads are set to true HOT 5
- delay between tests that use DropwizardExtensionsSupport HOT 2
- Logging request and response body with RequestLogFactory HOT 2
- Dependency Injection issue in AuthFilter HOT 4
- Add cache support for stale-while-revalidate HOT 1
- Redirect log output for commands other than "server" HOT 2
- Enhancement: Make Cli ArgumentParsers locale configurable HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dropwizard.