This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementing application call endpoint sets.
- Loading branch information
1 parent
9a1adb3
commit d7c8a19
Showing
17 changed files
with
923 additions
and
19 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
75 changes: 75 additions & 0 deletions
75
api/src/main/java/io/mifos/identity/api/v1/domain/CallEndpointSet.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,75 @@ | ||
/* | ||
* Copyright 2017 The Mifos Initiative. | ||
* | ||
* 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 io.mifos.identity.api.v1.domain; | ||
|
||
import io.mifos.core.lang.validation.constraints.ValidIdentifier; | ||
|
||
import javax.validation.constraints.NotNull; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
/** | ||
* @author Myrle Krantz | ||
*/ | ||
@SuppressWarnings({"unused", "WeakerAccess"}) | ||
public class CallEndpointSet { | ||
@ValidIdentifier | ||
private String identifier; | ||
|
||
@NotNull | ||
private List<String> permittableEndpointGroupIdentifiers; | ||
|
||
public CallEndpointSet() { | ||
} | ||
|
||
public String getIdentifier() { | ||
return identifier; | ||
} | ||
|
||
public void setIdentifier(String identifier) { | ||
this.identifier = identifier; | ||
} | ||
|
||
public List<String> getPermittableEndpointGroupIdentifiers() { | ||
return permittableEndpointGroupIdentifiers; | ||
} | ||
|
||
public void setPermittableEndpointGroupIdentifiers(List<String> permittableEndpointGroupIdentifiers) { | ||
this.permittableEndpointGroupIdentifiers = permittableEndpointGroupIdentifiers; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
CallEndpointSet that = (CallEndpointSet) o; | ||
return Objects.equals(identifier, that.identifier) && | ||
Objects.equals(permittableEndpointGroupIdentifiers, that.permittableEndpointGroupIdentifiers); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(identifier, permittableEndpointGroupIdentifiers); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CallEndpointSet{" + | ||
"identifier='" + identifier + '\'' + | ||
", permittableEndpointGroupIdentifiers=" + permittableEndpointGroupIdentifiers + | ||
'}'; | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
api/src/main/java/io/mifos/identity/api/v1/events/ApplicationCallEndpointSetEvent.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,73 @@ | ||
/* | ||
* Copyright 2017 The Mifos Initiative. | ||
* | ||
* 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 io.mifos.identity.api.v1.events; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* @author Myrle Krantz | ||
*/ | ||
@SuppressWarnings({"WeakerAccess", "unused"}) | ||
public class ApplicationCallEndpointSetEvent { | ||
private String applicationIdentifier; | ||
private String callEndpointSetIdentifier; | ||
|
||
public ApplicationCallEndpointSetEvent() { | ||
} | ||
|
||
public ApplicationCallEndpointSetEvent(String applicationIdentifier, String callEndpointSetIdentifier) { | ||
this.applicationIdentifier = applicationIdentifier; | ||
this.callEndpointSetIdentifier = callEndpointSetIdentifier; | ||
} | ||
|
||
public String getApplicationIdentifier() { | ||
return applicationIdentifier; | ||
} | ||
|
||
public void setApplicationIdentifier(String applicationIdentifier) { | ||
this.applicationIdentifier = applicationIdentifier; | ||
} | ||
|
||
public String getCallEndpointSetIdentifier() { | ||
return callEndpointSetIdentifier; | ||
} | ||
|
||
public void setCallEndpointSetIdentifier(String callEndpointSetIdentifier) { | ||
this.callEndpointSetIdentifier = callEndpointSetIdentifier; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
ApplicationCallEndpointSetEvent that = (ApplicationCallEndpointSetEvent) o; | ||
return Objects.equals(applicationIdentifier, that.applicationIdentifier) && | ||
Objects.equals(callEndpointSetIdentifier, that.callEndpointSetIdentifier); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(applicationIdentifier, callEndpointSetIdentifier); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ApplicationCallEndpointSetEvent{" + | ||
"applicationIdentifier='" + applicationIdentifier + '\'' + | ||
", callEndpointSetIdentifier='" + callEndpointSetIdentifier + '\'' + | ||
'}'; | ||
} | ||
} |
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
62 changes: 62 additions & 0 deletions
62
api/src/test/java/io/mifos/identity/api/v1/domain/CallEndpointSetTest.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,62 @@ | ||
/* | ||
* Copyright 2017 The Mifos Initiative. | ||
* | ||
* 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 io.mifos.identity.api.v1.domain; | ||
|
||
import io.mifos.core.test.domain.ValidationTest; | ||
import io.mifos.core.test.domain.ValidationTestCase; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
/** | ||
* @author Myrle Krantz | ||
*/ | ||
@RunWith(Parameterized.class) | ||
public class CallEndpointSetTest extends ValidationTest<CallEndpointSet> { | ||
|
||
public CallEndpointSetTest(final ValidationTestCase<CallEndpointSet> testCase) { | ||
super(testCase); | ||
} | ||
|
||
@Parameterized.Parameters | ||
public static Collection testCases() { | ||
final Collection<ValidationTestCase> ret = new ArrayList<>(); | ||
|
||
ret.add(new ValidationTestCase<CallEndpointSet>("validCase") | ||
.adjustment(x -> {}) | ||
.valid(true)); | ||
ret.add(new ValidationTestCase<CallEndpointSet>("invalid identifier") | ||
.adjustment(x -> x.setIdentifier(null)) | ||
.valid(false)); | ||
ret.add(new ValidationTestCase<CallEndpointSet>("null list") | ||
.adjustment(x -> x.setPermittableEndpointGroupIdentifiers(null)) | ||
.valid(false)); | ||
|
||
return ret; | ||
} | ||
|
||
@Override | ||
protected CallEndpointSet createValidTestSubject() { | ||
final CallEndpointSet ret = new CallEndpointSet(); | ||
ret.setIdentifier("blah"); | ||
ret.setPermittableEndpointGroupIdentifiers(Collections.emptyList()); | ||
return ret; | ||
} | ||
|
||
} |
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
Oops, something went wrong.