-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISSUE-28 default value recognizing for kotlin. types (#30)
- Loading branch information
Showing
16 changed files
with
405 additions
and
54 deletions.
There are no files selected for viewing
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
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
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
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
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
73 changes: 73 additions & 0 deletions
73
e2e/core/src/pl/mk5/gdx/fireapp/e2e/tests/DatabaseTransactionDefaultDoubleValueTest.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright 2019 mk | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package pl.mk5.gdx.fireapp.e2e.tests; | ||
|
||
import com.badlogic.gdx.Gdx; | ||
import com.badlogic.gdx.graphics.g2d.Batch; | ||
|
||
import pl.mk5.gdx.fireapp.GdxFIRDatabase; | ||
import pl.mk5.gdx.fireapp.e2e.runner.E2ETest; | ||
import pl.mk5.gdx.fireapp.functional.BiConsumer; | ||
import pl.mk5.gdx.fireapp.functional.Consumer; | ||
import pl.mk5.gdx.fireapp.functional.Function; | ||
|
||
public class DatabaseTransactionDefaultDoubleValueTest extends E2ETest { | ||
|
||
@Override | ||
public void action() { | ||
final String reference = "/test-trans"; | ||
Consumer<Double> successConsumer = new Consumer<Double>() { | ||
@Override | ||
public void accept(Double i) { | ||
if (i == 1) { | ||
success(); | ||
} | ||
} | ||
}; | ||
|
||
GdxFIRDatabase.promise() | ||
.then(GdxFIRDatabase.inst().inReference(reference).removeValue()) | ||
.then(GdxFIRDatabase.inst().inReference(reference) | ||
.transaction(Double.class, new Function<Double, Double>() { | ||
@Override | ||
public Double apply(Double num) { | ||
return num + 1; | ||
} | ||
})) | ||
.then(GdxFIRDatabase.inst().inReference(reference).readValue(Double.class)) | ||
.then(successConsumer) | ||
.fail(new BiConsumer<String, Throwable>() { | ||
@Override | ||
public void accept(String s, Throwable throwable) { | ||
Gdx.app.log("Error", s); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public void draw(Batch batch) { | ||
} | ||
|
||
@Override | ||
public void update(float dt) { | ||
|
||
} | ||
|
||
@Override | ||
public void dispose() { | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
e2e/core/src/pl/mk5/gdx/fireapp/e2e/tests/DatabaseTransactionDefaultLongValueTest.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright 2019 mk | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package pl.mk5.gdx.fireapp.e2e.tests; | ||
|
||
import com.badlogic.gdx.graphics.g2d.Batch; | ||
|
||
import pl.mk5.gdx.fireapp.GdxFIRDatabase; | ||
import pl.mk5.gdx.fireapp.e2e.runner.E2ETest; | ||
import pl.mk5.gdx.fireapp.functional.Consumer; | ||
import pl.mk5.gdx.fireapp.functional.Function; | ||
|
||
public class DatabaseTransactionDefaultLongValueTest extends E2ETest { | ||
|
||
@Override | ||
public void action() { | ||
final String reference = "/test-trans"; | ||
|
||
GdxFIRDatabase.promise() | ||
.then(GdxFIRDatabase.inst().inReference(reference).removeValue()) | ||
.then(GdxFIRDatabase.inst().inReference(reference) | ||
.transaction(Long.class, new Function<Long, Long>() { | ||
@Override | ||
public Long apply(Long num) { | ||
return num + 1; | ||
} | ||
})) | ||
.then(GdxFIRDatabase.inst().inReference(reference).readValue(Long.class)) | ||
.then(new Consumer<Long>() { | ||
@Override | ||
public void accept(Long i) { | ||
if (i == 1) { | ||
success(); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public void draw(Batch batch) { | ||
} | ||
|
||
@Override | ||
public void update(float dt) { | ||
|
||
} | ||
|
||
@Override | ||
public void dispose() { | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
e2e/core/src/pl/mk5/gdx/fireapp/e2e/tests/DatabaseTransactionDefaultStringValueTest.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright 2019 mk | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package pl.mk5.gdx.fireapp.e2e.tests; | ||
|
||
import com.badlogic.gdx.graphics.g2d.Batch; | ||
|
||
import pl.mk5.gdx.fireapp.GdxFIRDatabase; | ||
import pl.mk5.gdx.fireapp.e2e.runner.E2ETest; | ||
import pl.mk5.gdx.fireapp.functional.Consumer; | ||
import pl.mk5.gdx.fireapp.functional.Function; | ||
|
||
public class DatabaseTransactionDefaultStringValueTest extends E2ETest { | ||
|
||
@Override | ||
public void action() { | ||
final String reference = "/test-trans"; | ||
|
||
GdxFIRDatabase.promise() | ||
.then(GdxFIRDatabase.inst().inReference(reference).removeValue()) | ||
.then(GdxFIRDatabase.inst().inReference(reference) | ||
.transaction(String.class, new Function<String, String>() { | ||
@Override | ||
public String apply(String str) { | ||
return str + "abc"; | ||
} | ||
})) | ||
.then(GdxFIRDatabase.inst().inReference(reference).readValue(String.class)) | ||
.then(new Consumer<String>() { | ||
@Override | ||
public void accept(String i) { | ||
if (i.equals("abc")) { | ||
success(); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public void draw(Batch batch) { | ||
} | ||
|
||
@Override | ||
public void update(float dt) { | ||
|
||
} | ||
|
||
@Override | ||
public void dispose() { | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.