-
Notifications
You must be signed in to change notification settings - Fork 48
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
Implements InMemory AASX file server #84
Implements InMemory AASX file server #84
Conversation
- Adds core - Adds backend-inmemory - Adds component Signed-off-by: Chaithra Kandur Bhagavanthaiah <[email protected]>
Signed-off-by: Chaithra Kandur Bhagavanthaiah <[email protected]>
Signed-off-by: Chaithra Kandur Bhagavanthaiah <[email protected]>
Signed-off-by: Chaithra Kandur Bhagavanthaiah <[email protected]>
Signed-off-by: Chaithra Kandur Bhagavanthaiah <[email protected]>
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.
Following are the review remarks.
/** | ||
* Retrieves all AASXPackageIds from the repository | ||
* | ||
* @return a list of available AASX packages at the server |
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.
Please improve this, as it is not returning the AASX packages.
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.
done
public interface AasxFileServer { | ||
|
||
/** | ||
* Retrieves all AASXPackageIds from the repository |
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.
AASX package ids
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.
done
* @param packageId | ||
* @throws ElementDoesNotExistException | ||
*/ | ||
public void deleteAASXPackageById(String packageId) throws ElementDoesNotExistException; |
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.
Please rename it to deleteAASXByPackageId
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.
done
public PackageDescription createAASXPackage(List<String> aasIds, InputStream file, String fileName) throws CollidingIdentifierException; | ||
|
||
/** | ||
* Deletes a AASXPackage |
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.
AASX Package
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.
done
public void updateAASXByPackageId(String packageId, List<String> aasIds, InputStream file, String filename) throws ElementDoesNotExistException; | ||
|
||
/** | ||
* Creates a new AASXPackage |
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.
AASX Package
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.
done
packageMap.remove(packageId); | ||
} | ||
|
||
public Integer increment(Integer n) { |
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.
No usage of this method, please remove this.
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.
done
return n++; | ||
} | ||
|
||
private PackageDescription createPackageDescription(List<String> aasIds, String newpackageId) { |
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.
newPackageId
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.
done
return packagesBody; | ||
} | ||
|
||
private void createPackage(List<String> aasIds, InputStream file, String fileName, String newpackageId, PackageDescription packageDescription) { |
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.
newPackageId
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.
done
public Collection<PackageDescription> getAllAASXPackageIds() { | ||
|
||
return packageMap.values().stream() | ||
.map(aasxPackage -> aasxPackage.getPackageDescription()) |
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.
Please use Package::getPackageDescription
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.
done
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* AasxFileServer factory returning an in-memory backend AasxFileServer |
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.
Please use @link to mention the class
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.
done
…m data Signed-off-by: Chaithra Kandur Bhagavanthaiah <[email protected]>
PackageDescription expectedFirstPackage = iterator.next(); | ||
PackageDescription expectedSecondPackage = iterator.next(); | ||
|
||
assertTrue(packageDescriptions.containsAll(Arrays.asList(expectedFirstPackage, expectedSecondPackage))); |
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 wrong, actual is same as the expected.
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.
changes done
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.
Following are the review remarks.
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.
Inconsistent naming of class.
Please either use AASX* or Aasx* everywhere.
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.
done
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.
Inconsistent naming of class.
Please either use AASX* or Aasx* everywhere.
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.
done
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.
Please put this inside a new package named "model".
Also, put PackDesc and PackBody classes in the same package.
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.
done
package org.eclipse.digitaltwin.basyx.aasxfileserver; | ||
|
||
/** | ||
* Specifies the Package for AasxFileServer |
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.
Please use @_link to reference classes
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.
done
import org.eclipse.digitaltwin.basyx.core.exceptions.ElementDoesNotExistException; | ||
|
||
/** | ||
* Specifies the overall AasxFileServer API |
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.
Please use @_link to reference classes
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.
done
* @param filename | ||
* @throws CollidingIdentifierException | ||
*/ | ||
public PackageDescription createAASXPackage(List<String> aasIds, InputStream file, String fileName) throws CollidingIdentifierException; |
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.
As identifier is generated automatically at runtime, there is no chance of collision.
Please remove this throws declaration.
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.
done
} | ||
|
||
@Override | ||
public PackageDescription createAASXPackage(List<String> aasIds, InputStream file, String fileName) |
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.
As identifier is generated automatically at runtime, there is no chance of collision.
Please remove this throws declaration.
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.
done
import org.eclipse.digitaltwin.basyx.core.exceptions.ElementDoesNotExistException; | ||
|
||
/** | ||
* In-memory implementation of the AASXFileServer |
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.
Please use @_link
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.
done
...rc/main/java/org/eclipse/digitaltwin/basyx/aasxfileserver/InMemoryAASXFileServerFactory.java
Outdated
Show resolved
Hide resolved
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.
Please check and add all other missing properties.
Refer other repositories component.
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.
done
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.
The createAASXPackage test is missing, please add it.
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.
added the test case
…r-sdk into feature/aasx-fs-inmem
Signed-off-by: Chaithra Kandur Bhagavanthaiah <[email protected]>
…/basyx-java-server-sdk into feature/aasx-fs-inmem
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
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.
Please resolve the review remarks
* | ||
* @return a list of available AASX Package Descriptions at the server | ||
*/ | ||
public Collection<PackageDescription> getAllAASXPackageIds(); |
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.
Missing param aasId
(see SPOTAAS Part2, 5.5.2 Operation GetAllAASXPackageIds, p. 45)
e.g. overload method
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.
(according to our naming guide lines the param should be named shellId
)
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.
Updated this method
protected abstract AASXFileServer getAASXFileServer(); | ||
|
||
@Test | ||
public void getAllAASXPackageIds() { |
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.
Please add a test case for getAASXFileServer(String shellId)
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.
Added a test case.
public AASXFileServerFeaturePrinter(List<AASXFileServerFeature> features) { | ||
logger.info("-------------------- AASX File Server Features: --------------------"); | ||
for (AASXFileServerFeature feature : features) { | ||
logger.info("BaSyxFeature " + feature.getName() + " is enabled: " + feature.isEnabled()); |
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.
logger Strings can be formatted like
logger.info("BaSyxFeature '{}' is enabled: {}", feature.getName(), feature.isEnabled())
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.
Formatted the logger
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
Signed-off-by: Chaithra Kandur Bhagavanthaiah [email protected]