Page MenuHomePhabricator

Moving the user package to Kotlin
AcceptedPublic

Authored by CLOVIS on Jan 30 2019, 12:05 AM.

Details

Summary
  • Rename .java to .kt
  • Moving User to Kotlin
  • Moving Users from Java to Kotlin

Fixes T269

Test Plan

Run the tests

Diff Detail

Repository
rLIBWFJVA WildFyre Java Libary
Branch
T269-kotlin-users
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 684
Build 684: arc lint + arc unit

Event Timeline

CLOVIS created this revision.Jan 30 2019, 12:05 AM
Harbormaster completed remote builds in B550: Diff 748.
CLOVIS planned changes to this revision.Jan 30 2019, 12:06 AM

TODO;

  • Fix unit tests
  • Convert LoggedUser
CLOVIS updated this revision to Diff 750.Jan 31 2019, 10:17 PM
  • Explaining why the let is ?.let and not !!.let & fixing broken Dokka link
  • Rename .java to .kt
  • Converting LoggedUser to Kotlin
  • TEMPORARY, TO BE REMOVED BEFORE LANDING
CLOVIS added inline comments.Jan 31 2019, 10:20 PM
src/test/java/net/wildfyre/http/RequestTest.kt
90

@Info-Screen This is the request that breaks because of wrong captcha

CLOVIS planned changes to this revision.Jan 31 2019, 10:20 PM
CLOVIS added a comment.Feb 9 2019, 9:00 PM

@Info-Screen this was thrown by the API during testing for this diff:

Internal Server Error: /areas/sample/drafts/
Traceback (most recent call last):
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 303, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: database is locked

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
    response = get_response(request)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/rest_framework/views.py", line 494, in dispatch
    response = self.handle_exception(exc)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/rest_framework/views.py", line 454, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/rest_framework/views.py", line 491, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/ivan/Projets/wildfyre/java/api/api/areas/views.py", line 279, in post
    return self.create(request)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/rest_framework/mixins.py", line 21, in create
    self.perform_create(serializer)
  File "/home/ivan/Projets/wildfyre/java/api/api/areas/views.py", line 282, in perform_create
    serializer.save(author=self.request.user, area=self.area, draft=True)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/rest_framework/serializers.py", line 214, in save
    self.instance = self.create(validated_data)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/rest_framework/serializers.py", line 917, in create
    instance = ModelClass.objects.create(**validated_data)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/query.py", line 417, in create
    obj.save(force_insert=True, using=self.db)
  File "/home/ivan/Projets/wildfyre/java/api/api/areas/models.py", line 68, in save
    self.subscriber.add(self.author)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py", line 898, in add
    self._add_items(self.source_field_name, self.target_field_name, *objs)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py", line 1065, in _add_items
    for obj_id in new_ids
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/query.py", line 466, in bulk_create
    ids = self._batched_insert(objs_without_pk, fields, batch_size)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/query.py", line 1148, in _batched_insert
    self._insert(item, fields=fields, using=self.db)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/query.py", line 1125, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1281, in execute_sql
    cursor.execute(sql, params)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/utils.py", line 100, in execute
    return super().execute(sql, params)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "/home/ivan/Projets/wildfyre/java/api/api/env/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 303, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: database is locked
CLOVIS edited the summary of this revision. (Show Details)Feb 16 2019, 10:53 AM
CLOVIS updated this revision to Diff 792.Feb 16 2019, 10:59 AM
  • Moving User from Java to Kotlin
  • Rename .java to .kt
  • Moving Users from Java to Kotlin
  • Explaining why the let is ?.let and not !!.let & fixing broken Dokka link
  • Rename .java to .kt
  • Converting LoggedUser to Kotlin
  • Added JsonValue.minimalString & JsonValue.prettyString
  • Adding LoggedUser.postsList so that Java code can access the posts
  • No more parallel unit tests (the testing server can't handle them)
  • IssueInTransferException is now able to report on messages that do not parse to JSON
  • Better Kotlin integration
WyldBot requested changes to this revision.Mar 27 2019, 3:35 PM

Build status is failing

This revision now requires changes to proceed.Mar 27 2019, 3:35 PM
CLOVIS updated this revision to Diff 880.Apr 24 2019, 9:33 AM
  • Updating copyrights
  • Moving User from Java to Kotlin
  • Rename .java to .kt
  • Moving Users from Java to Kotlin
  • Explaining why the let is ?.let and not !!.let & fixing broken Dokka link
  • Rename .java to .kt
  • Converting LoggedUser to Kotlin
  • Added JsonValue.minimalString & JsonValue.prettyString
  • Adding LoggedUser.postsList so that Java code can access the posts
  • No more parallel unit tests (the testing server can't handle them)
  • IssueInTransferException is now able to report on messages that do not parse to JSON
  • Better Kotlin integration
CLOVIS updated this revision to Diff 881.Apr 24 2019, 9:36 AM
  • Prototype of .gitlab-ci.yml
  • Clone the submodule with HTTPS instead of SSH (no keys on CI servers)
  • Fix parallel tests when there's only 1 available core
  • Dockerfile with Java & Python
  • What is running on port 8000 in the container?
  • Removed after_script
  • Cache Gradle dependencies
  • Remove pointless lsof
  • Cache wheels
  • Add virtualenv, PostGresQL, Git, OpenJDK sources, GCC to the container
  • Assume API is not running when lsof is missing
  • Do not run tests with static analysis
  • Cleaning the Dockerfile
  • # Ceci est la combinaison de 2 commits.
  • Better cache for CI
  • Reordering dependencies for clarity
  • Pip cache, reports as artifacts, Gradle without daemon
  • Run Dokka alongside the unit tests, to speed up builds
  • Gradle cache
  • Fix query order (posts are not always in the same order)
  • Update the API
  • Upload JUnit results as artifacts
  • Test the Gradle cache before running the scripts
  • Documentation in .gitlab-ci.yml
  • Upload the JUnit results
  • Do not delete the file db.sqlite3 if it doesn't exists (to have a cleaner log output)
  • Moving User from Java to Kotlin
  • Rename .java to .kt
  • Moving Users from Java to Kotlin
  • Explaining why the let is ?.let and not !!.let & fixing broken Dokka link
  • Rename .java to .kt
  • Converting LoggedUser to Kotlin
  • Added JsonValue.minimalString & JsonValue.prettyString
  • Adding LoggedUser.postsList so that Java code can access the posts
  • IssueInTransferException is now able to report on messages that do not parse to JSON
  • Better Kotlin integration
WyldBot accepted this revision.May 12 2019, 2:24 PM
This revision is now accepted and ready to land.May 12 2019, 2:24 PM
CLOVIS planned changes to this revision.May 13 2019, 9:12 PM

This diff is based on D246, which was modified. This will need to be updated when D246 is landed.

CLOVIS updated this revision to Diff 924.May 15 2019, 8:51 PM
  • Moving User from Java to Kotlin
  • Rename .java to .kt
  • Moving Users from Java to Kotlin
  • Explaining why the let is ?.let and not !!.let & fixing broken Dokka link
  • Rename .java to .kt
  • Converting LoggedUser to Kotlin
  • Added JsonValue.minimalString & JsonValue.prettyString
  • Adding LoggedUser.postsList so that Java code can access the posts
  • IssueInTransferException is now able to report on messages that do not parse to JSON
  • Better Kotlin integration
WyldBot accepted this revision.May 19 2019, 1:45 PM

May need rebase again though

This revision is now accepted and ready to land.May 19 2019, 1:45 PM
In D210#6427, @WyldBot wrote:

May need rebase again though

It does

CLOVIS updated this revision to Diff 938.May 20 2019, 4:13 PM
  • Moving User from Java to Kotlin
  • Rename .java to .kt
  • Moving Users from Java to Kotlin
  • Explaining why the let is ?.let and not !!.let & fixing broken Dokka link
  • Rename .java to .kt
  • Converting LoggedUser to Kotlin
  • Added JsonValue.minimalString & JsonValue.prettyString
  • Adding LoggedUser.postsList so that Java code can access the posts
  • IssueInTransferException is now able to report on messages that do not parse to JSON
  • Better Kotlin integration
This revision now requires review to proceed.May 20 2019, 4:13 PM
WyldBot accepted this revision.May 20 2019, 4:14 PM
This revision is now accepted and ready to land.May 20 2019, 4:14 PM