-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-security-scanning/43
- Loading branch information
Showing
10 changed files
with
688 additions
and
51 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
36 changes: 36 additions & 0 deletions
36
...src/test/java/org/smartregister/extension/rest/LocationHierarchyResourceProviderTest.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,36 @@ | ||
/* | ||
* Copyright 2023 Ona Systems, Inc | ||
* | ||
* 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 org.smartregister.extension.rest; | ||
|
||
import ca.uhn.fhir.rest.param.TokenParam; | ||
import org.junit.Test; | ||
import org.smartregister.extension.rest.utils.TestLocationIFhirResourceDao; | ||
|
||
public class LocationHierarchyResourceProviderTest { | ||
|
||
@Test | ||
public void testGetLocationHierarchy() { | ||
LocationHierarchyResourceProvider locationHierarchyResourceProvider = | ||
new LocationHierarchyResourceProvider(); | ||
locationHierarchyResourceProvider.setLocationIFhirResourceDao( | ||
new TestLocationIFhirResourceDao()); | ||
|
||
TokenParam tokenParam = new TokenParam(); | ||
tokenParam.setValue("location-id-1"); | ||
locationHierarchyResourceProvider.getLocationHierarchy(tokenParam); | ||
} | ||
} |
108 changes: 108 additions & 0 deletions
108
location/src/test/java/org/smartregister/extension/rest/utils/TestBundleProvider.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,108 @@ | ||
/* | ||
* Copyright 2023 Ona Systems, Inc | ||
* | ||
* 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 org.smartregister.extension.rest.utils; | ||
|
||
import ca.uhn.fhir.rest.api.server.IBundleProvider; | ||
import java.util.ArrayList; | ||
import java.util.Date; | ||
import java.util.List; | ||
import org.hl7.fhir.instance.model.api.IBaseResource; | ||
import org.hl7.fhir.instance.model.api.IPrimitiveType; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class TestBundleProvider implements IBundleProvider { | ||
private List<IBaseResource> resources = new ArrayList<>(); | ||
|
||
@Override | ||
public IPrimitiveType<Date> getPublished() { | ||
return null; | ||
} | ||
|
||
public void setResources(List<IBaseResource> resources) { | ||
this.resources = resources; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public List<IBaseResource> getResources(int startIndex, int endIndex) { | ||
return resources != null ? resources.subList(startIndex, endIndex) : new ArrayList<>(); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public String getUuid() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Integer preferredPageSize() { | ||
return null; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public Integer size() { | ||
return resources != null ? resources.size() : 0; | ||
} | ||
|
||
@Override | ||
public String getCurrentPageId() { | ||
return IBundleProvider.super.getCurrentPageId(); | ||
} | ||
|
||
@Override | ||
public String getNextPageId() { | ||
return IBundleProvider.super.getNextPageId(); | ||
} | ||
|
||
@Override | ||
public String getPreviousPageId() { | ||
return IBundleProvider.super.getPreviousPageId(); | ||
} | ||
|
||
@Override | ||
public Integer getCurrentPageOffset() { | ||
return IBundleProvider.super.getCurrentPageOffset(); | ||
} | ||
|
||
@Override | ||
public Integer getCurrentPageSize() { | ||
return IBundleProvider.super.getCurrentPageSize(); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public List<IBaseResource> getAllResources() { | ||
return IBundleProvider.super.getAllResources(); | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return IBundleProvider.super.isEmpty(); | ||
} | ||
|
||
@Override | ||
public int sizeOrThrowNpe() { | ||
return IBundleProvider.super.sizeOrThrowNpe(); | ||
} | ||
|
||
@Override | ||
public List<String> getAllResourceIds() { | ||
return IBundleProvider.super.getAllResourceIds(); | ||
} | ||
} |
Oops, something went wrong.