Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion samples/xapi-server/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.nonnull=org.springframework.lang.NonNull
org.eclipse.jdt.core.compiler.annotation.nullable=org.springframework.lang.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
Expand Down
10 changes: 9 additions & 1 deletion xapi-client/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.nonnull=org.springframework.lang.NonNull
org.eclipse.jdt.core.compiler.annotation.nullable=org.springframework.lang.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.processAnnotations=enabled
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2016-2023 Berry Cloud Ltd. All rights reserved.
*/

package dev.learning.xapi.client;

/**
* <p>
* MissingResponseBodyException class.
* </p>
*
* @author István Rátkai (Selindek)
*/
public class MissingResponseBodyException extends RuntimeException {

private static final long serialVersionUID = -5731953477307546047L;

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.stream.Stream;
Expand Down Expand Up @@ -123,6 +124,8 @@ public Mono<ResponseEntity<Statement>> getStatement(
* </p>
*
* @return the ResponseEntity
*
* @throws MissingResponseBodyException if the response body is missing
*/
public Mono<ResponseEntity<UUID>> postStatement(PostStatementRequest request) {

Expand All @@ -140,7 +143,8 @@ public Mono<ResponseEntity<UUID>> postStatement(PostStatementRequest request) {

.toEntity(LIST_UUID_TYPE)

.map(i -> ResponseEntity.ok().headers(i.getHeaders()).body(i.getBody().get(0)));
.map(i -> ResponseEntity.ok().headers(i.getHeaders()).body(Optional.ofNullable(i.getBody())
.map(l -> l.get(0)).orElseThrow(MissingResponseBodyException::new)));

}

Expand Down Expand Up @@ -1432,6 +1436,9 @@ public Stream<Statement> toStream() {

private void init(ResponseEntity<StatementResult> response) {
final var statementResult = response.getBody();
if (statementResult == null) {
throw new MissingResponseBodyException();
}
more = statementResult.hasMore() ? statementResult.getMore() : null;
final var s = statementResult.getStatements();
statements = s == null ? Collections.emptyIterator() : s.iterator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ void whenPostingStatementsWithTimestampAndAttachmentThenNoExceptionIsThrown()

}

@SuppressWarnings("null")
@Test
void whenGettingStatementWithAttachmentThenResponseIsExpected() throws InterruptedException {

Expand Down Expand Up @@ -367,6 +368,7 @@ void whenGettingStatementWithAttachmentThenResponseIsExpected() throws Interrupt
"Statement(id=183aabbe-ef9e-49c9-82a3-16ce5135b25b, actor=Agent(super=Actor(name=A N Other, mbox=mailto:another@example.com, mboxSha1sum=null, openid=null, account=null)), verb=Verb(id=http://adlnet.gov/expapi/verbs/attempted, display={und=attempted}), object=Activity(id=https://example.com/activity/simplestatement, definition=ActivityDefinition(name={en=Simple Statement}, description=null, type=null, moreInfo=null, interactionType=null, correctResponsesPattern=null, choices=null, scale=null, source=null, target=null, steps=null, extensions=null)), result=null, context=null, timestamp=2023-03-29T12:42:27.923571Z, stored=2023-03-29T12:42:27.923571Z, authority=Agent(super=Actor(name=null, mbox=null, mboxSha1sum=null, openid=null, account=Account(homePage=http://localhost, name=admin))), version=null, attachments=[Attachment(usageType=http://adlnet.gov/expapi/attachments/code, display={en=binary attachment}, description=null, contentType=application/octet-stream, length=6, sha2=0ff3c6749b3eeaae17254fdf0e2de1f32b21c592f474bf39b62b398e8a787eef, fileUrl=null, content=[64, 65, 66, 67, 68, 69]), Attachment(usageType=http://adlnet.gov/expapi/attachments/text, display={en=text attachment}, description=null, contentType=text/plain, length=17, sha2=b154d3fd46a5068da42ba05a8b9c971688ab5a57eb5c3a0e50a23c42a86786e5, fileUrl=null, content=[83, 105, 109, 112, 108, 101, 32, 97, 116, 116, 97, 99, 104, 109, 101, 110, 116])])"));
}

@SuppressWarnings("null")
@Test
void whenGettingStatementsWithAttachmentsThenResponseIsExpected() throws InterruptedException {

Expand Down
3 changes: 2 additions & 1 deletion xapi-model/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.processAnnotations=enabled
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static class StrictObjectTypePropertyDeserializer extends AsPropertyTypeD

public StrictObjectTypePropertyDeserializer(JavaType baseType, TypeIdResolver idRes,
String typeProperty, boolean typeIdVisible, JavaType defaultImpl, As includeAs) {
super(baseType, idRes, typeProperty, typeIdVisible, defaultImpl, includeAs);
super(baseType, idRes, typeProperty, typeIdVisible, defaultImpl, includeAs, true);
}

public StrictObjectTypePropertyDeserializer(AsPropertyTypeDeserializer src,
Expand Down