Project 1

Due date: February 2 (FIRM)

This is an individual project.

To start:

Objectives

Installation of required course software, through IntelliJ IDEA, and creation of a Bitbucket account:

  • Ensure you have a functioning IntelliJ IDEA development environment, version 2021.3.1 or later. 
  • Ensure you can access the course examples from GitHub (found at https://github.com/LoyolaChicagoCode.
  • Ensure you understand the basics of Java programs and Test-Driven Development (TDD)

An initial understanding of Bitbucket and IntelliJ IDEA plus Test-Driven Development (TDD)

  • Installing required course software: the first two items from this link.
  • Using course software
    • Using Bitbucket to “import” (copy) an existing Java Git project from GitHub
    • Sharing the imported Bitbucket project with the instructor and TA
    • Cloning the imported Bitbucket project in IntelliJ IDEA (Get from VCS or Git => Clone)
    • Using IntelliJ IDEA to update the cloned project
    • Updating the cloned project by Committing it and Pushing it to Bitbucket
  • Using TDD
    • Running the project tests in IntelliJ IDEA and understanding the results
      • Running in a Java SDK by entering "./gradle Test" in a Terminal window or right-clicking the project name and choosing Run 'Tests ...
      • Running on an emulated or real Android device (not for Project 1)
    • Applying TDD by modifying the project source code so the tests pass and fixing any bad tests
    • Adding a doc folder containing a screenshot showing that all tests pass (before Committing and Pushing)
  • Java coding
    • Understanding why the project tests fail and how to modify the program and the tests to fix that

Description

In this project, you will import an existing Java Git project from GitHub into Bitbucket, download it / clone it into IntelliJ IDEA by "Getting from VCS" on your PC, run its failing tests, update the project source and tests to fix the program and the bad tests, and Commit and Push your changes to your project Bitbucket. Your imported project will be shared with the instructor and TA for grading.

For more details, please review this Panopto video about Configuring IntelliJ IDEA and Creating Project 1:
https://luc.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=ad809a78-939f-42bc-8724-ae150118216a

Importing the base version of Project 1 into Bitbucket

Start with this code skeleton: https://github.com/LoyolaChicagoCode/hello-java. See below for detailed instructions about how to import this into Bitbucket.

Cloning the base version of Project 1 from your Bitbucket repository into IntelliJ IDEA on your PC

To clone your hello-java project into IntelliJ IDEA, open IntelliJ IDEA and click Get from VCS on the welcome page, then copy the HTTPS URL for your repository into the first field of the window that comes up. Select a parent directory or folder on your PC that will contain your course Projects (you can just use IntelliJ's default folder), and change the name of the checked-out project to cs313413sp22p1, then click Clone. You may have to enter your Bitbucket password to get the Clone to complete. If you have any problems cloning your repo into IntelliJ on your PC, you can use Git or SourceTree instead.

  • Once you have Cloned Project 1 and it is open in IntelliJ, click on File => Project Structure and select Project
    • To the right of SDK: click the down arrow and select Add SDK => Download JDK... and select openjdk-17; once that has downloaded, select it for the Project
  • Now select Platform Settings => SDKs - if there is an entry for Java 11, click on it and click the minus sign to remove it, then click on openjdk-17 and click OK to select it
  • Doing these things should make Java 17 available for all projects
    • Current 313/413 projects do not use Java 17  features, only features through Java 11, but the projects may use Java 17 features in the future
    • Note that there may be warnings about Java 17 Experimental Features, but you can ignore those warnings for now

Functional requirements for Project 1

The functional requirements for this Project are embodied in the JUnit tests in the test folder; instructions for running the tests are detailed below. When your code passes all the tests, you will have fulfilled the functional requirements for grading purposes. If some of the tests do not pass, you will receive partial credit.

Nonfunctional requirements

Specifically, fix the code in the Java source file within the src folder, using the test cases as your guide. In addition, there are two of the test cases that are not correct, and those also need to be fixed. Be sure to Push your changes continually (use Push under VCS in IntelliJ (or do a push by using Git or SourceTree)! 

Create a new doc folder within your local project root folder. Include your screenshot called project1.png inside the doc folder (see details below).

Notify the instructor and TA when the project is ready to be graded by Submitting a note on Sakai in the Project 1 Assignment or in Piazza.

Grading

  • 1 point – submission via Bitbucket repo (should still show the history before clone)
  • 1 point – fix the getYear method and two of the tests to make all the tests pass 
  • 1 point – screenshot showing the fixed getYear method and all the tests passing 

3 points total

Detailed Instructions

To do Project 1, follow these steps carefully; note that they may be updated as we get feedback about any problems that students encounter:

  1. Install the first 2 sets of "Required Software” here: https://sites.google.com/a/cs.luc.edu/laufer/teaching/313/software-spring-2022-and-later, Git and IntelliJ IDEA. Note that the only required software for this course is Git and IntelliJ IDEA; the other software may be helpful.

    Note: after you install IntelliJ IDEA, you may want to check for updates and install any that are available.
    • Ask if you need help with any installation.

2. Now go to http://bitbucket.org and create an account using your Loyola email (if you already have such an account using your Loyola email, just use it). Bitbucket is a cloud-based system that hosts so-called repositories or repos in Version Control Systems (VCSs) Git and Mercurial. We'll be using Git in this class. Using your Loyola email allows you to create an unlimited number of Bitbucket repositories.

    • Click on Create at the top of the Bitbucket web page.You'll be asked if you want to create a repository or import one - choose import and then change Source to Git and Language to Java
    • Set the URL field in the Import existing code window to: https://github.com/LoyolaChicagoCode/hello-java/
      This is the GitHub location of the IntelliJ IDEA repository for Project 1. Bitbucket may fill in the name hello-java in the Name field. Instead, change that name to cs313413sp22p1 (this is the required name for the repository – the p1 part refers to Project 1).
    • Next, click Import repository and open your cs313413sp22p1 repository by clicking on that name if it is not already open. When your repository is open, click in the browser address bar and select everything from HTTPS up to /src/master (through "p1") and copy that - that is the Bitbucket URL to your copy of the hello-java IntelliJ project; you will provide that to IntelliJ when you check out your repo from Bitbucket (see the Cloning section above).
    • Now click the three dots toward the top, next to Clone, and click Share repository, or else click Invite, and share your repository with me at ryacobellis313@msn.com with admin access. Note that this is not my standard Loyola email address, it is a special Bitbucket account I use only for COMP 313 and 413 repository grading.
    • Also share your repository with admin access with our TA, Haris Qazi, at this Bitbucket ID: hqazi2@luc.edu.

3. Once you have installed everything and created a Bitbucket account, use IntelliJ to download a Console project hosted in Bitbucket from a Git repository as described above in the Cloning section. To get the Project 1 tests to run in IntelliJ, you will perform the following steps:

    • Click on cs313413sp22p1 on the Welcome page, and after IntelliJ opens its project page, press Alt-1 to open the project window on the left, then select the Project view at the top left of that window - that will show the "directory" structure of the cs313413sp22p1 project and all its components (you should be able to open all the right-facing arrows under src to see files in the main and test directories).
    • Click the Terminal tab at the bottom of the Android Studio project window and enter the command ./gradlew test to run the project tests - there should be three failures that you will have to fix, one a source code failure, and the others problems in two of the tests. You can see the test that failed by copying the URL following the words See the report at: into a browser address bar and looking at the information about the failing tests; notice that the TestHelloWorld test "fixture" creates a HelloWorld object (from HelloWorld in the src section of the project window) and runs several tests using that object.
    • Alternatively, right-click on the project name and choose Run 'Tests in ... to execute the tests and see exactly why each failing test failed.

4. To finish Project 1 you must change file HelloWorld.java and the two incorrect tests in the project so that the tests all pass, then Commit your changes in Git using the IntelliJ VCS menu. You will also need to upload a screenshot of the successfully-run tests from the project into a new doc directory/folder that you create in your project on your PC, Add that screenshot and directory to your local Git repository (right click the screen shot file, and use the Git => Add menu item), Commit that change as well, and finally Push both changes to your Bitbucket repository in the cloud. You should be able to find Push in IntelliJ by doing a VCS => Open VCS Popup (it was choice 8 in the version on my PC). If you have any problems doing those steps in IntelliJ you can use Git or SourceTree instead. You can put the doc directory at either the cs313413sp22p1 level or under src - in either case, right-click where you want to put it in the project window and select New then Directory and name it doc, then right-click its name, choose Open in Explorer, and copy the screenshot there before you do the Add and Push.

Note: there are instructions for connecting to Git on Bitbucket using SSH so that you don’t have to enter your Bitbucket password every time you do a commit – follow this URL: https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git for more information. Some students have had problems using those instructions in the past, so you may have to fall back on entering your password each time …

How to submit

To finish Project 1 you must change file HelloWorld.java in hello-java plus two of the failing tests so that the tests all pass and then Commit that change in Git. You will also need to upload a screenshot of the successfully-run tests from that project into the project’s new doc directory/folder on your PC, add it to your local Git repository, Commit that change as well, and finally Push both changes to your Bitbucket repository in the cloud.

As the first step in working on this project, you will import the code skeleton into a private Bitbucket repository shared with your instructor. The name of the repository is cs313413sp22p1, where the p1 part refers to Project 1. When your work is ready to be graded, please notify your instructor and TA via both Piazza and by Submitting the assignment in Sakai, and add a completion note in the Sakai comments box.

Comments