generated from hossain-khan/android-compose-app-template
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADDED] New common module for data model used across different modules #153
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 8 changed files in this pull request and generated no comments.
Files not reviewed (7)
- data-model/.gitignore: Language not supported
- data-model/build.gradle.kts: Language not supported
- data-model/proguard-rules.pro: Language not supported
- data-model/src/androidTest/java/dev/hossain/weatheralert/datamodel/ExampleInstrumentedTest.kt: Language not supported
- data-model/src/main/AndroidManifest.xml: Language not supported
- data-model/src/test/java/dev/hossain/weatheralert/datamodel/ExampleUnitTest.kt: Language not supported
- settings.gradle.kts: Language not supported
``` > Task :service:openweather:testDebugUnitTest OpenWeatherServiceTest > given weather forecast response for oshawa city - parses data FAILED java.net.BindException: Address already in use at java.base/sun.nio.ch.Net.bind0(Native Method) at java.base/sun.nio.ch.Net.bind(Net.java:555) at java.base/sun.nio.ch.Net.bind(Net.java:544) at java.base/sun.nio.ch.NioSocketImpl.bind(NioSocketImpl.java:648) at java.base/java.net.ServerSocket.bind(ServerSocket.java:388) at okhttp3.mockwebserver.MockWebServer.start(MockWebServer.kt:390) at okhttp3.mockwebserver.MockWebServer.start(MockWebServer.kt:372) at okhttp3.mockwebserver.MockWebServer.start(MockWebServer.kt:362) at org.openweathermap.api.OpenWeatherServiceTest.setUp(OpenWeatherServiceTest.kt:28) ``` ### Error Analysis: The error in the GitHub Actions logs shows that two tests are failing in `OpenWeatherServiceTest` due to a `java.net.BindException: Address already in use`. ### Relevant Code: The `setUp` method in `OpenWeatherServiceTest` initializes a `MockWebServer` and starts it on port 60000: ```kotlin @before fun setUp() { mockWebServer = MockWebServer() mockWebServer.start(60000) } ``` ### Suggested Fix: The `java.net.BindException` occurs because the port 60000 is already in use. To fix this, you can start `MockWebServer` on a random available port by calling `mockWebServer.start()` without specifying a port. #### Updated `setUp` Method: ```kotlin @before fun setUp() { mockWebServer = MockWebServer() mockWebServer.start() // Start on a random available port } ``` ### Next Steps: 1. Update the `setUp` method in `OpenWeatherServiceTest`. 2. Commit the changes. 3. Re-run the GitHub Actions workflow to verify the fix.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes to the
app
module, focusing on database schema updates, data model adjustments, and refactoring of theWeatherRepository
interface and implementation. The key changes are summarized below:Database Schema Updates:
4.json
which includes the creation of tablescities
,alerts
, andcity_forecasts
with their respective fields, indices, and foreign keys.Dependency and Import Updates:
implementation(project(":data-model"))
to thedependencies
block inapp/build.gradle.kts
.Models.kt
andWeatherRepository.kt
to use classes from thedatamodel
package. [1] [2] [3]Data Model Adjustments:
alertId
type fromInt
toLong
inAlertTileData
andcityId
type fromInt
toLong
inWeatherRepository
and related classes. [1] [2] [3]WeatherAlertCategory
enum andForecastData
data classes fromModels.kt
, replacing them withAppForecastData
from thedatamodel
package. [1] [2]Weather Repository Refactoring:
WeatherRepository
interface andWeatherRepositoryImpl
class to useAppForecastData
instead ofForecastData
. This includes changing method signatures and updating the implementation to handle the new data model. [1] [2] [3] [4] [5] [6] [7]Code Cleanup:
Models.kt
andWeatherRepository.kt
. [1] [2]