-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Implement APIs - Tests #19912
Implement APIs - Tests #19912
Conversation
This pull request is protected by Check Enforcer. What is Check Enforcer?Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass. Why am I getting this message?You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged. What should I do now?If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows: What if I am onboarding a new service?Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment: |
...sitory/src/main/java/com/azure/iot/modelsrepository/implementation/ModelsRepositoryImpl.java
Outdated
Show resolved
Hide resolved
...c/main/java/com/azure/iot/modelsrepository/implementation/models/ErrorResponseException.java
Outdated
Show resolved
Hide resolved
...azure-iot-modelsrepository/src/main/java/com/azure/iot/modelsrepository/DtmiConventions.java
Outdated
Show resolved
Hide resolved
...azure-iot-modelsrepository/src/main/java/com/azure/iot/modelsrepository/DtmiConventions.java
Show resolved
Hide resolved
...azure-iot-modelsrepository/src/main/java/com/azure/iot/modelsrepository/DtmiConventions.java
Outdated
Show resolved
Hide resolved
...odelsrepository/src/main/java/com/azure/iot/modelsrepository/ModelsDependencyResolution.java
Outdated
Show resolved
Hide resolved
...odelsrepository/src/main/java/com/azure/iot/modelsrepository/ModelsDependencyResolution.java
Outdated
Show resolved
Hide resolved
...delsrepository/src/main/java/com/azure/iot/modelsrepository/ModelsRepositoryAsyncClient.java
Outdated
Show resolved
Hide resolved
...lsrepository/src/main/java/com/azure/iot/modelsrepository/ModelsRepositoryClientBuilder.java
Show resolved
Hide resolved
...delsrepository/src/main/java/com/azure/iot/modelsrepository/ModelsRepositoryAsyncClient.java
Outdated
Show resolved
Hide resolved
...ot-modelsrepository/src/main/java/com/azure/iot/modelsrepository/ModelsRepositoryClient.java
Show resolved
Hide resolved
...lsrepository/src/main/java/com/azure/iot/modelsrepository/ModelsRepositoryClientBuilder.java
Outdated
Show resolved
Hide resolved
...azure-iot-modelsrepository/src/main/java/com/azure/iot/modelsrepository/DtmiConventions.java
Outdated
Show resolved
Hide resolved
...he/src/test/java/com/azure/core/serializer/avro/apache/generatedtestsources/HandOfCards.java
Outdated
Show resolved
Hide resolved
...he/src/test/java/com/azure/core/serializer/avro/apache/generatedtestsources/PlayingCard.java
Outdated
Show resolved
Hide resolved
...azure-iot-modelsrepository/src/main/java/com/azure/iot/modelsrepository/DtmiConventions.java
Outdated
Show resolved
Hide resolved
while (work.size() != 0) { | ||
String tryContentPath = work.poll(); | ||
|
||
Path path = Path.of(new File(tryContentPath).getPath()); | ||
|
||
logger.info(String.format(StandardStrings.FetchingModelContent, path.toString())); | ||
|
||
if (Files.exists(path)) { | ||
try { | ||
return Mono.just( | ||
new FetchResult() | ||
.setDefinition(new String(Files.readAllBytes(path))) | ||
.setPath(tryContentPath)); | ||
} catch (IOException e) { | ||
return Mono.error(new AzureException(e)); | ||
} | ||
} | ||
|
||
logger.error(String.format(StandardStrings.ErrorFetchingModelContent, path.toString())); | ||
|
||
fnfError = String.format(StandardStrings.ErrorFetchingModelContent, tryContentPath); | ||
} |
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.
This is not async. The method returns async publisher so this should be done asynchronously.
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.
This just reads stuff off of the file system, can you elaborate how that can be done async?
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.
fixed.
...repository/src/main/java/com/azure/iot/modelsrepository/implementation/HttpModelFetcher.java
Outdated
Show resolved
Hide resolved
try { | ||
if (resolutionOption == ModelsDependencyResolution.TRY_FROM_EXPANDED) { | ||
work.add(getPath(dtmi, repositoryUri, true)); | ||
} | ||
work.add(getPath(dtmi, repositoryUri, false)); | ||
} catch (Exception e) { | ||
return Mono.error(new AzureException(e)); | ||
} | ||
|
||
String tryContentPath = work.poll(); | ||
|
||
logger.info(String.format(StandardStrings.FetchingModelContent, tryContentPath)); | ||
|
||
return evaluatePath(tryContentPath, context) | ||
.onErrorResume(error -> { | ||
if (work.size() != 0) { | ||
return evaluatePath(work.poll(), context); | ||
} else { | ||
return Mono.error(error); | ||
} | ||
}) | ||
.map(s -> new FetchResult().setPath(tryContentPath).setDefinition(s)); |
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.
all of this has to be wrapped in Mono.defer()
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.
I will have to sync up with you on that.
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.
fixed.
...repository/src/main/java/com/azure/iot/modelsrepository/implementation/FileModelFetcher.java
Outdated
Show resolved
Hide resolved
...lsrepository/src/main/java/com/azure/iot/modelsrepository/implementation/TempCustomType.java
Outdated
Show resolved
Hide resolved
...ot-modelsrepository/src/main/java/com/azure/iot/modelsrepository/ModelsRepositoryClient.java
Outdated
Show resolved
Hide resolved
...delsrepository/src/main/java/com/azure/iot/modelsrepository/ModelsRepositoryAsyncClient.java
Outdated
Show resolved
Hide resolved
...odelsrepository/src/main/java/com/azure/iot/modelsrepository/implementation/ModelsQuery.java
Show resolved
Hide resolved
...azure-iot-modelsrepository/src/main/java/com/azure/iot/modelsrepository/DtmiConventions.java
Outdated
Show resolved
Hide resolved
* @return True if dtmi has a valid format. False otherwise. | ||
*/ | ||
public static boolean isValidDtmi(String dtmi) { | ||
if (dtmi == null || dtmi.isEmpty()) { |
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.
To go along with null or empty, is there a minimum length requirement for the DTMI being valid that could be used as an early out?
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.
not that I know of, it has to have at least 3 parts, so I think a minimum length can be inferred
...azure-iot-modelsrepository/src/main/java/com/azure/iot/modelsrepository/DtmiConventions.java
Show resolved
Hide resolved
} | ||
|
||
return dtmi | ||
.toLowerCase(Locale.getDefault()) |
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.
Is the DTMI going to have different handling per locale or is it going to be ASCII based?
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.
it will be ASCII based.
No description provided.