-
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
fix: add a check for / suffix for basyx external url in registry integration #333
Changes from 15 commits
82a79d2
4a7a8aa
62d44d1
13868a9
94923af
bb3e3e9
437ac16
9bdb684
c410c6a
245bae2
dae87d7
ba08cbd
99a47de
9d86f9e
c75b166
9272437
ad5b8a1
27e19d4
da4b87b
3306f65
2be64c0
7b303c4
b4afd85
bcdef6e
d30b228
37bc55e
a29ab5a
66b6354
581e641
dedc173
3ccbec3
9c118a4
27bdb45
ec7e126
c7f3d55
5bd2f77
09f00d0
493f177
d0ba025
2b5163f
0de2d33
b1babf6
ec123aa
ae3c928
d15ef4d
f03d036
a9f4ad2
ed11d33
4913629
1119feb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.eclipse.digitaltwin.basyx.aasrepository.feature.registry.integration; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
public class TestAasDescriptorFactory { | ||
|
||
private static final String AAS_REPO_URL = "http://localhost:8081"; | ||
|
||
private static final String AAS_REPOSITORY_PATH_WITH_SLASH = "/shells"; | ||
private static final String AAS_REPOSITORY_PATH_WITHOUT_SLASH = "shells"; | ||
|
||
@Test | ||
public void testUrlWithTrailingSlashAndPathWithoutLeadingSlash() { | ||
String baseURLWithSlash = AAS_REPO_URL + "/"; | ||
|
||
assertEquals(baseURLWithSlash + AAS_REPOSITORY_PATH_WITHOUT_SLASH, AasDescriptorFactory.createAasRepositoryUrl(baseURLWithSlash)); | ||
} | ||
|
||
@Test | ||
public void testUrlWithTrailingSlashAndPathWithLeadingSlash() { | ||
String baseURLWithSlash = AAS_REPO_URL + "/"; | ||
|
||
assertEquals(baseURLWithSlash + AAS_REPOSITORY_PATH_WITHOUT_SLASH, AasDescriptorFactory.createAasRepositoryUrl(baseURLWithSlash)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The assertion is wrongly defined |
||
} | ||
|
||
@Test | ||
public void testUrlWithoutTrailingSlashAndPathWithoutLeadingSlash() { | ||
String baseURLWithoutSlash = AAS_REPO_URL; | ||
|
||
assertEquals(baseURLWithoutSlash + AAS_REPOSITORY_PATH_WITH_SLASH , AasDescriptorFactory.createAasRepositoryUrl(baseURLWithoutSlash)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The assertion is wrongly defined |
||
} | ||
|
||
@Test | ||
public void testUrlWithoutTrailingSlashAndPathWithLeadingSlash() { | ||
String baseURLWithoutSlash = AAS_REPO_URL; | ||
|
||
assertEquals(baseURLWithoutSlash + AAS_REPOSITORY_PATH_WITH_SLASH , AasDescriptorFactory.createAasRepositoryUrl(baseURLWithoutSlash)); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.eclipse.digitaltwin.basyx.submodelrepository.feature.registry.integration; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
public class TestSubmodelDescriptorFactory { | ||
|
||
private static final String SUBMODEL_REPO_URL = "http://localhost:8081"; | ||
|
||
|
||
private static final String SUBMODEL_REPOSITORY_PATH_WITH_SLASH = "/submodels"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same issue as in the TestAasDescriptorFactory |
||
private static final String SUBMODEL_REPOSITORY_PATH_WITHOUT_SLASH = "submodels"; | ||
|
||
@Test | ||
public void testUrlWithTrailingSlashAndPathWithoutLeadingSlash() { | ||
String baseURLWithSlash = SUBMODEL_REPO_URL + "/"; | ||
|
||
assertEquals(baseURLWithSlash + SUBMODEL_REPOSITORY_PATH_WITHOUT_SLASH, SubmodelDescriptorFactory.createSubmodelRepositoryUrl(baseURLWithSlash)); | ||
} | ||
|
||
@Test | ||
public void testUrlWithTrailingSlashAndPathWithLeadingSlash() { | ||
String baseURLWithSlash = SUBMODEL_REPO_URL + "/"; | ||
|
||
assertEquals(baseURLWithSlash + SUBMODEL_REPOSITORY_PATH_WITHOUT_SLASH, SubmodelDescriptorFactory.createSubmodelRepositoryUrl(baseURLWithSlash)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The assertion is wrongly defined |
||
} | ||
|
||
@Test | ||
public void testUrlWithoutTrailingSlashAndPathWithoutLeadingSlash() { | ||
String baseURLWithoutSlash = SUBMODEL_REPO_URL; | ||
|
||
assertEquals(baseURLWithoutSlash + SUBMODEL_REPOSITORY_PATH_WITH_SLASH , SubmodelDescriptorFactory.createSubmodelRepositoryUrl(baseURLWithoutSlash)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The assertion is wrongly defined |
||
} | ||
|
||
@Test | ||
public void testUrlWithoutTrailingSlashAndPathWithLeadingSlash() { | ||
String baseURLWithoutSlash = SUBMODEL_REPO_URL; | ||
|
||
assertEquals(baseURLWithoutSlash + SUBMODEL_REPOSITORY_PATH_WITH_SLASH , SubmodelDescriptorFactory.createSubmodelRepositoryUrl(baseURLWithoutSlash)); | ||
} | ||
} |
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.
Either stick to building the withSlash/withoutSlash for both path and repo_url in the test or define them consistenly as final vars; but don't mix both approaches.