com.io7m.idstore.tests.arbitraries.IdArbAMessageProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.io7m.idstore.tests.arbitraries Show documentation
Show all versions of com.io7m.idstore.tests.arbitraries Show documentation
Identity server (Arbitrary instances)
/*
* Copyright © 2023 Mark Raynsford https://www.io7m.com
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package com.io7m.idstore.tests.arbitraries;
import com.io7m.idstore.error_codes.IdErrorCode;
import com.io7m.idstore.model.IdAdmin;
import com.io7m.idstore.model.IdAdminPermission;
import com.io7m.idstore.model.IdAdminSearchByEmailParameters;
import com.io7m.idstore.model.IdAdminSearchParameters;
import com.io7m.idstore.model.IdAdminSummary;
import com.io7m.idstore.model.IdAuditEvent;
import com.io7m.idstore.model.IdAuditSearchParameters;
import com.io7m.idstore.model.IdBan;
import com.io7m.idstore.model.IdEmail;
import com.io7m.idstore.model.IdLogin;
import com.io7m.idstore.model.IdName;
import com.io7m.idstore.model.IdPage;
import com.io7m.idstore.model.IdShortHumanToken;
import com.io7m.idstore.model.IdUser;
import com.io7m.idstore.model.IdUserSearchByEmailParameters;
import com.io7m.idstore.model.IdUserSearchParameters;
import com.io7m.idstore.model.IdUserSummary;
import com.io7m.idstore.protocol.admin.IdACommandAdminBanCreate;
import com.io7m.idstore.protocol.admin.IdACommandAdminBanDelete;
import com.io7m.idstore.protocol.admin.IdACommandAdminBanGet;
import com.io7m.idstore.protocol.admin.IdACommandAdminCreate;
import com.io7m.idstore.protocol.admin.IdACommandAdminDelete;
import com.io7m.idstore.protocol.admin.IdACommandAdminEmailAdd;
import com.io7m.idstore.protocol.admin.IdACommandAdminEmailRemove;
import com.io7m.idstore.protocol.admin.IdACommandAdminGet;
import com.io7m.idstore.protocol.admin.IdACommandAdminGetByEmail;
import com.io7m.idstore.protocol.admin.IdACommandAdminPermissionGrant;
import com.io7m.idstore.protocol.admin.IdACommandAdminPermissionRevoke;
import com.io7m.idstore.protocol.admin.IdACommandAdminSearchBegin;
import com.io7m.idstore.protocol.admin.IdACommandAdminSearchByEmailBegin;
import com.io7m.idstore.protocol.admin.IdACommandAdminSearchByEmailNext;
import com.io7m.idstore.protocol.admin.IdACommandAdminSearchByEmailPrevious;
import com.io7m.idstore.protocol.admin.IdACommandAdminSearchNext;
import com.io7m.idstore.protocol.admin.IdACommandAdminSearchPrevious;
import com.io7m.idstore.protocol.admin.IdACommandAdminSelf;
import com.io7m.idstore.protocol.admin.IdACommandAdminUpdateCredentials;
import com.io7m.idstore.protocol.admin.IdACommandAdminUpdatePasswordExpiration;
import com.io7m.idstore.protocol.admin.IdACommandAuditSearchBegin;
import com.io7m.idstore.protocol.admin.IdACommandAuditSearchNext;
import com.io7m.idstore.protocol.admin.IdACommandAuditSearchPrevious;
import com.io7m.idstore.protocol.admin.IdACommandLogin;
import com.io7m.idstore.protocol.admin.IdACommandMailTest;
import com.io7m.idstore.protocol.admin.IdACommandMaintenanceModeSet;
import com.io7m.idstore.protocol.admin.IdACommandUserBanCreate;
import com.io7m.idstore.protocol.admin.IdACommandUserBanDelete;
import com.io7m.idstore.protocol.admin.IdACommandUserBanGet;
import com.io7m.idstore.protocol.admin.IdACommandUserCreate;
import com.io7m.idstore.protocol.admin.IdACommandUserDelete;
import com.io7m.idstore.protocol.admin.IdACommandUserEmailAdd;
import com.io7m.idstore.protocol.admin.IdACommandUserEmailRemove;
import com.io7m.idstore.protocol.admin.IdACommandUserGet;
import com.io7m.idstore.protocol.admin.IdACommandUserGetByEmail;
import com.io7m.idstore.protocol.admin.IdACommandUserLoginHistory;
import com.io7m.idstore.protocol.admin.IdACommandUserSearchBegin;
import com.io7m.idstore.protocol.admin.IdACommandUserSearchByEmailBegin;
import com.io7m.idstore.protocol.admin.IdACommandUserSearchByEmailNext;
import com.io7m.idstore.protocol.admin.IdACommandUserSearchByEmailPrevious;
import com.io7m.idstore.protocol.admin.IdACommandUserSearchNext;
import com.io7m.idstore.protocol.admin.IdACommandUserSearchPrevious;
import com.io7m.idstore.protocol.admin.IdACommandUserUpdateCredentials;
import com.io7m.idstore.protocol.admin.IdACommandUserUpdatePasswordExpiration;
import com.io7m.idstore.protocol.admin.IdAMessageType;
import com.io7m.idstore.protocol.admin.IdAPasswordExpirationSetNever;
import com.io7m.idstore.protocol.admin.IdAPasswordExpirationSetRefresh;
import com.io7m.idstore.protocol.admin.IdAPasswordExpirationSetSpecific;
import com.io7m.idstore.protocol.admin.IdAPasswordExpirationSetType;
import com.io7m.idstore.protocol.admin.IdAResponseAdminBanCreate;
import com.io7m.idstore.protocol.admin.IdAResponseAdminBanDelete;
import com.io7m.idstore.protocol.admin.IdAResponseAdminBanGet;
import com.io7m.idstore.protocol.admin.IdAResponseAdminCreate;
import com.io7m.idstore.protocol.admin.IdAResponseAdminDelete;
import com.io7m.idstore.protocol.admin.IdAResponseAdminGet;
import com.io7m.idstore.protocol.admin.IdAResponseAdminSearchBegin;
import com.io7m.idstore.protocol.admin.IdAResponseAdminSearchByEmailBegin;
import com.io7m.idstore.protocol.admin.IdAResponseAdminSearchByEmailNext;
import com.io7m.idstore.protocol.admin.IdAResponseAdminSearchByEmailPrevious;
import com.io7m.idstore.protocol.admin.IdAResponseAdminSearchNext;
import com.io7m.idstore.protocol.admin.IdAResponseAdminSearchPrevious;
import com.io7m.idstore.protocol.admin.IdAResponseAdminSelf;
import com.io7m.idstore.protocol.admin.IdAResponseAdminUpdate;
import com.io7m.idstore.protocol.admin.IdAResponseAuditSearchBegin;
import com.io7m.idstore.protocol.admin.IdAResponseAuditSearchNext;
import com.io7m.idstore.protocol.admin.IdAResponseAuditSearchPrevious;
import com.io7m.idstore.protocol.admin.IdAResponseBlame;
import com.io7m.idstore.protocol.admin.IdAResponseError;
import com.io7m.idstore.protocol.admin.IdAResponseLogin;
import com.io7m.idstore.protocol.admin.IdAResponseMailTest;
import com.io7m.idstore.protocol.admin.IdAResponseMaintenanceModeSet;
import com.io7m.idstore.protocol.admin.IdAResponseUserBanCreate;
import com.io7m.idstore.protocol.admin.IdAResponseUserBanDelete;
import com.io7m.idstore.protocol.admin.IdAResponseUserBanGet;
import com.io7m.idstore.protocol.admin.IdAResponseUserCreate;
import com.io7m.idstore.protocol.admin.IdAResponseUserDelete;
import com.io7m.idstore.protocol.admin.IdAResponseUserGet;
import com.io7m.idstore.protocol.admin.IdAResponseUserLoginHistory;
import com.io7m.idstore.protocol.admin.IdAResponseUserSearchBegin;
import com.io7m.idstore.protocol.admin.IdAResponseUserSearchByEmailBegin;
import com.io7m.idstore.protocol.admin.IdAResponseUserSearchByEmailNext;
import com.io7m.idstore.protocol.admin.IdAResponseUserSearchByEmailPrevious;
import com.io7m.idstore.protocol.admin.IdAResponseUserSearchNext;
import com.io7m.idstore.protocol.admin.IdAResponseUserSearchPrevious;
import com.io7m.idstore.protocol.admin.IdAResponseUserUpdate;
import net.jqwik.api.Arbitraries;
import net.jqwik.api.Arbitrary;
import net.jqwik.api.Combinators;
import net.jqwik.api.providers.TypeUsage;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* A provider of {@link IdAMessageType} values.
*/
public final class IdArbAMessageProvider extends IdArbAbstractProvider
{
/**
* A provider of values.
*/
public IdArbAMessageProvider()
{
}
@Override
public boolean canProvideFor(
final TypeUsage targetType)
{
return targetType.isOfType(IdAMessageType.class);
}
@Override
public Set> provideFor(
final TypeUsage targetType,
final SubtypeProvider subtypeProvider)
{
return Set.of(
commandAdminBanCreate(),
commandAdminBanDelete(),
commandAdminBanGet(),
commandAdminCreate(),
commandAdminDelete(),
commandAdminEmailAdd(),
commandAdminEmailRemove(),
commandAdminGet(),
commandAdminGetByEmail(),
commandAdminPermissionGrant(),
commandAdminPermissionRevoke(),
commandAdminSearchBegin(),
commandAdminSearchByEmailBegin(),
commandAdminSearchByEmailNext(),
commandAdminSearchByEmailPrevious(),
commandAdminSearchNext(),
commandAdminSearchPrevious(),
commandAdminSelf(),
commandAdminUpdate(),
commandAdminUpdatePasswordExpiration(),
commandAuditSearchBegin(),
commandAuditSearchNext(),
commandAuditSearchPrevious(),
commandLogin(),
commandMailTest(),
commandMaintenanceModeSet(),
commandUserBanCreate(),
commandUserBanDelete(),
commandUserBanGet(),
commandUserCreate(),
commandUserDelete(),
commandUserEmailAdd(),
commandUserEmailRemove(),
commandUserGet(),
commandUserGetByEmail(),
commandUserLoginHistory(),
commandUserSearchBegin(),
commandUserSearchByEmailBegin(),
commandUserSearchByEmailNext(),
commandUserSearchByEmailPrevious(),
commandUserSearchNext(),
commandUserSearchPrevious(),
commandUserUpdate(),
commandUserUpdatePasswordExpiration(),
responseAdminBanCreate(),
responseAdminBanDelete(),
responseAdminBanGet(),
responseAdminCreate(),
responseAdminDelete(),
responseAdminGet(),
responseAdminSearchBegin(),
responseAdminSearchByEmailBegin(),
responseAdminSearchByEmailNext(),
responseAdminSearchByEmailPrevious(),
responseAdminSearchNext(),
responseAdminSearchPrevious(),
responseAdminSelf(),
responseAdminUpdate(),
responseAuditSearchBegin(),
responseAuditSearchNext(),
responseAuditSearchPrevious(),
responseError(),
responseLogin(),
responseMailTest(),
responseMaintenanceModeSet(),
responseUserBanCreate(),
responseUserBanDelete(),
responseUserBanGet(),
responseUserCreate(),
responseUserDelete(),
responseUserGet(),
responseUserLoginHistory(),
responseUserSearchBegin(),
responseUserSearchByEmailBegin(),
responseUserSearchByEmailNext(),
responseUserSearchByEmailPrevious(),
responseUserSearchNext(),
responseUserSearchPrevious(),
responseUserUpdate()
);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseMaintenanceModeSet()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.strings();
return Combinators.combine(a_id, a_s)
.as(IdAResponseMaintenanceModeSet::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandMaintenanceModeSet()
{
return Arbitraries.strings()
.optional()
.map(IdACommandMaintenanceModeSet::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary passwordExpirationSet()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_i =
Arbitraries.integers()
.between(0, 2);
return Combinators.combine(a_id, a_i)
.as((uuid, integer) -> {
return switch (integer.intValue()) {
case 0 -> new IdAPasswordExpirationSetNever();
case 1 -> new IdAPasswordExpirationSetRefresh();
case 2 -> new IdAPasswordExpirationSetSpecific(OffsetDateTime.now());
default -> throw new IllegalStateException();
};
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserUpdatePasswordExpiration()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
return Combinators.combine(a_id, passwordExpirationSet())
.as(IdACommandUserUpdatePasswordExpiration::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminUpdatePasswordExpiration()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
return Combinators.combine(a_id, passwordExpirationSet())
.as(IdACommandAdminUpdatePasswordExpiration::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseUserSearchBegin()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdUserSummary.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseUserSearchBegin(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseUserSearchPrevious()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdUserSummary.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseUserSearchPrevious(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseUserSearchNext()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdUserSummary.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseUserSearchNext(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAdminSelf()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var a =
Arbitraries.defaultFor(IdAdmin.class);
return Combinators.combine(id, a).as(IdAResponseAdminSelf::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseError()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var s0 =
Arbitraries.strings();
final var s1 =
Arbitraries.defaultFor(IdErrorCode.class);
final var b =
Arbitraries.defaultFor(IdAResponseBlame.class);
final var s2 =
Arbitraries.strings();
final var s3 =
Arbitraries.strings();
final var ms =
Arbitraries.maps(s2, s3);
final var os =
Arbitraries.strings()
.optional();
return Combinators.combine(id, s0, s1, ms, os, b).as(IdAResponseError::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseLogin()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var admins =
Arbitraries.defaultFor(IdAdmin.class);
return Combinators.combine(id, admins).as(IdAResponseLogin::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseUserGet()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var users =
Arbitraries.defaultFor(IdUser.class);
return Combinators.combine(id, users).as((req, user) -> {
return new IdAResponseUserGet(
req,
Optional.of(user)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseUserCreate()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var users =
Arbitraries.defaultFor(IdUser.class);
return Combinators.combine(id, users).as(IdAResponseUserCreate::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseUserUpdate()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var users =
Arbitraries.defaultFor(IdUser.class);
return Combinators.combine(id, users).as(IdAResponseUserUpdate::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminSelf()
{
return Arbitraries.integers().map(i -> new IdACommandAdminSelf());
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserGet()
{
final var id = Arbitraries.defaultFor(UUID.class);
return id.map(IdACommandUserGet::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserGetByEmail()
{
final var id = Arbitraries.defaultFor(IdEmail.class);
return id.map(IdACommandUserGetByEmail::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandLogin()
{
final var s0 =
Arbitraries.defaultFor(IdName.class);
final var s1 =
Arbitraries.strings();
final var s2 =
Arbitraries.defaultFor(String.class)
.tuple2()
.list()
.map(tuple2s -> {
final var map = new HashMap();
for (final var t : tuple2s) {
map.put(t.get1(), t.get2());
}
return map;
});
return Combinators.combine(s0, s1, s2).as(IdACommandLogin::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserSearchBegin()
{
return Arbitraries.defaultFor(IdUserSearchParameters.class)
.map(IdACommandUserSearchBegin::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserSearchNext()
{
return Arbitraries.of(new IdACommandUserSearchNext());
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserSearchPrevious()
{
return Arbitraries.of(new IdACommandUserSearchPrevious());
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserSearchByEmailBegin()
{
return Arbitraries.defaultFor(IdUserSearchByEmailParameters.class)
.map(IdACommandUserSearchByEmailBegin::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserSearchByEmailNext()
{
return Arbitraries.of(new IdACommandUserSearchByEmailNext());
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserSearchByEmailPrevious()
{
return Arbitraries.of(new IdACommandUserSearchByEmailPrevious());
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserCreate()
{
final var users =
Arbitraries.defaultFor(IdUser.class);
return users.map(user -> {
return new IdACommandUserCreate(
Optional.of(user.id()),
user.idName(),
user.realName(),
user.emails().first(),
user.password()
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserUpdate()
{
final var users =
Arbitraries.defaultFor(IdUser.class);
return users.map((user) -> {
return new IdACommandUserUpdateCredentials(
user.id(),
Optional.of(user.idName()),
Optional.of(user.realName()),
Optional.of(user.password())
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAuditSearchBegin()
{
return Arbitraries.defaultFor(IdAuditSearchParameters.class)
.map(IdACommandAuditSearchBegin::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAuditSearchNext()
{
return Arbitraries.of(new IdACommandAuditSearchNext());
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAuditSearchPrevious()
{
return Arbitraries.of(new IdACommandAuditSearchPrevious());
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandMailTest()
{
final var e =
Arbitraries.defaultFor(IdEmail.class);
final var t =
Arbitraries.defaultFor(IdShortHumanToken.class);
return Combinators.combine(e, t).as(IdACommandMailTest::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseMailTest()
{
final var e =
Arbitraries.defaultFor(UUID.class);
final var t =
Arbitraries.defaultFor(IdShortHumanToken.class);
return Combinators.combine(e, t)
.as(IdAResponseMailTest::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAuditSearchBegin()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdAuditEvent.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseAuditSearchBegin(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAuditSearchPrevious()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdAuditEvent.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseAuditSearchPrevious(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAuditSearchNext()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdAuditEvent.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseAuditSearchNext(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseUserSearchByEmailBegin()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdUserSummary.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseUserSearchByEmailBegin(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseUserSearchByEmailPrevious()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdUserSummary.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseUserSearchByEmailPrevious(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseUserSearchByEmailNext()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdUserSummary.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseUserSearchByEmailNext(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminSearchBegin()
{
return Arbitraries.defaultFor(IdAdminSearchParameters.class)
.map(IdACommandAdminSearchBegin::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminSearchNext()
{
return Arbitraries.of(new IdACommandAdminSearchNext());
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminSearchPrevious()
{
return Arbitraries.of(new IdACommandAdminSearchPrevious());
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminSearchByEmailBegin()
{
return Arbitraries.defaultFor(IdAdminSearchByEmailParameters.class)
.map(IdACommandAdminSearchByEmailBegin::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminSearchByEmailNext()
{
return Arbitraries.of(new IdACommandAdminSearchByEmailNext());
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminSearchByEmailPrevious()
{
return Arbitraries.of(new IdACommandAdminSearchByEmailPrevious());
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAdminSearchByEmailBegin()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdAdminSummary.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseAdminSearchByEmailBegin(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAdminSearchByEmailPrevious()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdAdminSummary.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseAdminSearchByEmailPrevious(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAdminSearchByEmailNext()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdAdminSummary.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseAdminSearchByEmailNext(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAdminSearchBegin()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdAdminSummary.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseAdminSearchBegin(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAdminSearchPrevious()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdAdminSummary.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseAdminSearchPrevious(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAdminSearchNext()
{
final var a_id =
Arbitraries.defaultFor(UUID.class);
final var a_s =
Arbitraries.defaultFor(IdAdminSummary.class)
.list();
final var a_i =
Arbitraries.integers();
return Combinators.combine(a_id, a_s, a_i, a_i, a_i)
.as((id, summaries, x0, x1, x2) -> {
return new IdAResponseAdminSearchNext(
id,
new IdPage<>(
summaries,
x0.intValue(),
x1.intValue(),
x2.intValue()
)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminCreate()
{
final var users =
Arbitraries.defaultFor(IdAdmin.class);
return users.map(user -> {
return new IdACommandAdminCreate(
Optional.of(user.id()),
user.idName(),
user.realName(),
user.emails().first(),
user.password(),
user.permissions()
.impliedPermissions()
.stream()
.collect(Collectors.toUnmodifiableSet())
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAdminCreate()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var users =
Arbitraries.defaultFor(IdAdmin.class);
return Combinators.combine(id, users).as(IdAResponseAdminCreate::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAdminGet()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var users =
Arbitraries.defaultFor(IdAdmin.class);
return Combinators.combine(id, users).as((req, user) -> {
return new IdAResponseAdminGet(
req,
Optional.of(user)
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminGet()
{
final var id = Arbitraries.defaultFor(UUID.class);
return id.map(IdACommandAdminGet::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminGetByEmail()
{
final var id = Arbitraries.defaultFor(IdEmail.class);
return id.map(IdACommandAdminGetByEmail::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminUpdate()
{
final var users =
Arbitraries.defaultFor(IdAdmin.class);
return users.map((admin) -> {
return new IdACommandAdminUpdateCredentials(
admin.id(),
Optional.of(admin.idName()),
Optional.of(admin.realName()),
Optional.of(admin.password())
);
});
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminPermissionGrant()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var permissions =
Arbitraries.defaultFor(IdAdminPermission.class);
return Combinators.combine(id, permissions)
.as(IdACommandAdminPermissionGrant::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminPermissionRevoke()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var permissions =
Arbitraries.defaultFor(IdAdminPermission.class);
return Combinators.combine(id, permissions)
.as(IdACommandAdminPermissionRevoke::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminEmailAdd()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var mails =
Arbitraries.defaultFor(IdEmail.class);
return Combinators.combine(id, mails)
.as(IdACommandAdminEmailAdd::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminEmailRemove()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var mails =
Arbitraries.defaultFor(IdEmail.class);
return Combinators.combine(id, mails)
.as(IdACommandAdminEmailRemove::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserEmailAdd()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var mails =
Arbitraries.defaultFor(IdEmail.class);
return Combinators.combine(id, mails)
.as(IdACommandUserEmailAdd::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserEmailRemove()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var mails =
Arbitraries.defaultFor(IdEmail.class);
return Combinators.combine(id, mails)
.as(IdACommandUserEmailRemove::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAdminUpdate()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var users =
Arbitraries.defaultFor(IdAdmin.class);
return Combinators.combine(id, users).as(IdAResponseAdminUpdate::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserDelete()
{
final var id = Arbitraries.defaultFor(UUID.class);
return id.map(IdACommandUserDelete::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminDelete()
{
final var id = Arbitraries.defaultFor(UUID.class);
return id.map(IdACommandAdminDelete::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseUserDelete()
{
final var id = Arbitraries.defaultFor(UUID.class);
return id.map(IdAResponseUserDelete::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAdminDelete()
{
final var id = Arbitraries.defaultFor(UUID.class);
return id.map(IdAResponseAdminDelete::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminBanCreate()
{
final var id = Arbitraries.defaultFor(IdBan.class);
return id.map(IdACommandAdminBanCreate::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminBanDelete()
{
final var id = Arbitraries.defaultFor(UUID.class);
return id.map(IdACommandAdminBanDelete::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandAdminBanGet()
{
final var id = Arbitraries.defaultFor(UUID.class);
return id.map(IdACommandAdminBanGet::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserBanCreate()
{
final var id = Arbitraries.defaultFor(IdBan.class);
return id.map(IdACommandUserBanCreate::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserBanDelete()
{
final var id = Arbitraries.defaultFor(UUID.class);
return id.map(IdACommandUserBanDelete::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserBanGet()
{
final var id = Arbitraries.defaultFor(UUID.class);
return id.map(IdACommandUserBanGet::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAdminBanCreate()
{
final var i =
Arbitraries.defaultFor(UUID.class);
final var b =
Arbitraries.defaultFor(IdBan.class);
return Combinators.combine(i, b).as(IdAResponseAdminBanCreate::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAdminBanDelete()
{
final var i = Arbitraries.defaultFor(UUID.class);
return i.map(IdAResponseAdminBanDelete::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseAdminBanGet()
{
final var i =
Arbitraries.defaultFor(UUID.class);
final var b =
Arbitraries.defaultFor(IdBan.class)
.optional();
return Combinators.combine(i, b).as(IdAResponseAdminBanGet::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseUserBanCreate()
{
final var i =
Arbitraries.defaultFor(UUID.class);
final var b =
Arbitraries.defaultFor(IdBan.class);
return Combinators.combine(i, b).as(IdAResponseUserBanCreate::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseUserBanDelete()
{
final var i = Arbitraries.defaultFor(UUID.class);
return i.map(IdAResponseUserBanDelete::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseUserBanGet()
{
final var i =
Arbitraries.defaultFor(UUID.class);
final var b =
Arbitraries.defaultFor(IdBan.class)
.optional();
return Combinators.combine(i, b).as(IdAResponseUserBanGet::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary commandUserLoginHistory()
{
final var id =
Arbitraries.defaultFor(UUID.class);
return id.map(IdACommandUserLoginHistory::new);
}
/**
* @return A message arbitrary
*/
public static Arbitrary responseUserLoginHistory()
{
final var id =
Arbitraries.defaultFor(UUID.class);
final var hist =
Arbitraries.defaultFor(IdLogin.class)
.list();
return Combinators.combine(id, hist).as(IdAResponseUserLoginHistory::new);
}
}