1*8a52c783SCole Faust## Working on the SDK 2*8a52c783SCole Faust 3*8a52c783SCole Faust### Things to Know 4*8a52c783SCole Faust* The SDK is built on Java 8 5*8a52c783SCole Faust* [Maven][maven] is used as the build and dependency management system 6*8a52c783SCole Faust* The majority of the service client code is auto-generated using the [code 7*8a52c783SCole Faust generator][codegen] 8*8a52c783SCole Faust 9*8a52c783SCole Faust### Development Environment Setup Tips 10*8a52c783SCole FaustIf you use IntelliJ IDEA, the following config files will be used by default for your project-level settings: 11*8a52c783SCole Faust 12*8a52c783SCole Faust- [Copyright](https://raw.githubusercontent.com/aws/aws-sdk-java-v2/master/.idea/copyright/AWS_Java_SDK_2_0.xml) 13*8a52c783SCole Faust 14*8a52c783SCole Faust This automatically inserts the license header to the top of source files that you create. 15*8a52c783SCole Faust 16*8a52c783SCole Faust- [Code style](https://raw.githubusercontent.com/aws/aws-sdk-java-v2/master/.idea/codeStyles/Project.xml) 17*8a52c783SCole Faust 18*8a52c783SCole Faust This will help ensure your code follows our code style guidelines. 19*8a52c783SCole Faust 20*8a52c783SCole Faust- [Inspections](https://raw.githubusercontent.com/aws/aws-sdk-java-v2/master/.idea/inspectionProfiles/AWS_Java_SDK_2_0.xml) 21*8a52c783SCole Faust 22*8a52c783SCole Faust This will help ensure your code is correct and follows our best practices. Please ensure your changes do not generate any new inspection warnings. 23*8a52c783SCole Faust 24*8a52c783SCole FaustIf you have Checkstyle integrated with your IDE, we also recommend 25*8a52c783SCole Faustconfiguring it with our 26*8a52c783SCole Faust[Checkstyle config](https://raw.githubusercontent.com/aws/aws-sdk-java-v2/master/build-tools/src/main/resources/software/amazon/awssdk/checkstyle.xml) 27*8a52c783SCole Faustso you can see any violations in line with the code. 28*8a52c783SCole Faust 29*8a52c783SCole Faust### Building 30*8a52c783SCole FaustSince the SDK is a normal Maven project, the usual `mvn package` and `mvn 31*8a52c783SCole Faustinstall` commands are all you need to build the SDK. 32*8a52c783SCole Faust 33*8a52c783SCole FaustOne important thing to note is that if you're working on the [code 34*8a52c783SCole Faustgenerator][codegen], be sure to do a `mvn install` rather than a phase that 35*8a52c783SCole Faustcomes earlier such as `compile` or `test` so that the build uses the 36*8a52c783SCole Faustcorrect code generator JAR (i.e. the one including your changes). When in 37*8a52c783SCole Faustdoubt, just use `mvn package`. 38*8a52c783SCole Faust 39*8a52c783SCole Faust#### Disabling Checkstyle/FindBugs 40*8a52c783SCole FaustNormally Checkstyle and FindBugs scans run as part of the build process. 41*8a52c783SCole FaustHowever, this slows down the build significantly so if you need to be able to 42*8a52c783SCole Faustiterate quickly locally, you can turn either of them off by setting the 43*8a52c783SCole Faustappropriate properties: 44*8a52c783SCole Faust 45*8a52c783SCole Faust```sh 46*8a52c783SCole Faust# skips both Checkstyle and FindBugs 47*8a52c783SCole Faust$ mvn install -Dfindbugs.skip=true -Dcheckstyle.skip=true 48*8a52c783SCole Faust``` 49*8a52c783SCole Faust 50*8a52c783SCole Faust### Testing 51*8a52c783SCole Faust#### Unit Tests 52*8a52c783SCole FaustAs described in the project structure, tests are split between unit and 53*8a52c783SCole Faustintegration tests. During the normal `test` lifecycle phase, only the unit 54*8a52c783SCole Fausttests are run. 55*8a52c783SCole Faust 56*8a52c783SCole Faust```sh 57*8a52c783SCole Faust# runs the unit tests 58*8a52c783SCole Faustmvn install 59*8a52c783SCole Faust``` 60*8a52c783SCole Faust 61*8a52c783SCole Faust### Integration Tests 62*8a52c783SCole Faust__Before running the integration tests, be aware that they require active AWS 63*8a52c783SCole FaustIAM credentials, and because they will make actual calls to AWS, will incur a 64*8a52c783SCole Faustcost to the owner of the account.__ 65*8a52c783SCole Faust 66*8a52c783SCole FaustIf you're writing an integration test, try to see if it's possible to write it 67*8a52c783SCole Faustas a set of unit tests with mocked responses instead. 68*8a52c783SCole Faust 69*8a52c783SCole Faust#### Test Credentials 70*8a52c783SCole Faust 71*8a52c783SCole FaustAs mentioned above, you will need to have active IAM credentials that the tests 72*8a52c783SCole Faustwill use to authenticate with AWS, and it will need to have an attached IAM 73*8a52c783SCole Faustpolicy that is allowed to perform the actions the tests will be running. 74*8a52c783SCole Faust 75*8a52c783SCole FaustAll integration tests are written to locate these credentials in 76*8a52c783SCole Faust`$HOME/.aws/awsTestAccount.properties`: 77*8a52c783SCole Faust 78*8a52c783SCole Faust``` 79*8a52c783SCole Faust$ cat $HOME/.aws/awsTestAccount.properties 80*8a52c783SCole Faust 81*8a52c783SCole FaustaccessKey = ... 82*8a52c783SCole FaustsecretKey = ... 83*8a52c783SCole Faust``` 84*8a52c783SCole Faust 85*8a52c783SCole Faust#### Running the Integration Tests 86*8a52c783SCole Faust 87*8a52c783SCole FaustIn order to run the integration tests along with the unit tests, you must 88*8a52c783SCole Faustactivate the `integration-tests` profile 89*8a52c783SCole Faust 90*8a52c783SCole Faust```sh 91*8a52c783SCole Faust# runs both unit and integration tests 92*8a52c783SCole Faustmvn install -P integration-tests 93*8a52c783SCole Faust``` 94*8a52c783SCole Faust 95*8a52c783SCole Faust[maven]: https://maven.apache.org/ 96*8a52c783SCole Faust[codegen]: https://github.com/aws/aws-sdk-java-v2/blob/master/codegen 97