target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testPrepareGraphQueryClose() throws Exception { String query = "DESCRIBE <http: GraphQuery queryObj = conn.prepareGraphQuery(query); try (GraphQueryResult result = queryObj.evaluate()) { while (result.hasNext()) { result.next(); } } } | @Override public GraphQueryResult evaluate() throws QueryEvaluationException { try { sync(); return getMarkLogicClient().sendGraphQuery(getQueryString(),getBindings(),getIncludeInferred(),getBaseURI()); } catch (IOException e) { throw new QueryEvaluationException(e); } catch (MarkLogicRdf4jException e) { throw new Quer... | MarkLogicGraphQuery extends MarkLogicQuery implements GraphQuery,MarkLogicQueryDependent { @Override public GraphQueryResult evaluate() throws QueryEvaluationException { try { sync(); return getMarkLogicClient().sendGraphQuery(getQueryString(),getBindings(),getIncludeInferred(),getBaseURI()); } catch (IOException e) { ... | MarkLogicGraphQuery extends MarkLogicQuery implements GraphQuery,MarkLogicQueryDependent { @Override public GraphQueryResult evaluate() throws QueryEvaluationException { try { sync(); return getMarkLogicClient().sendGraphQuery(getQueryString(),getBindings(),getIncludeInferred(),getBaseURI()); } catch (IOException e) { ... | MarkLogicGraphQuery extends MarkLogicQuery implements GraphQuery,MarkLogicQueryDependent { @Override public GraphQueryResult evaluate() throws QueryEvaluationException { try { sync(); return getMarkLogicClient().sendGraphQuery(getQueryString(),getBindings(),getIncludeInferred(),getBaseURI()); } catch (IOException e) { ... | MarkLogicGraphQuery extends MarkLogicQuery implements GraphQuery,MarkLogicQueryDependent { @Override public GraphQueryResult evaluate() throws QueryEvaluationException { try { sync(); return getMarkLogicClient().sendGraphQuery(getQueryString(),getBindings(),getIncludeInferred(),getBaseURI()); } catch (IOException e) { ... |
@Test public void testHelloWorld() { assertEquals("Hello from Java!", HelloWorld.getHelloWorld()); } | public static String getHelloWorld() { return "Hello from Java!"; } | HelloWorld { public static String getHelloWorld() { return "Hello from Java!"; } } | HelloWorld { public static String getHelloWorld() { return "Hello from Java!"; } } | HelloWorld { public static String getHelloWorld() { return "Hello from Java!"; } static String getHelloWorld(); } | HelloWorld { public static String getHelloWorld() { return "Hello from Java!"; } static String getHelloWorld(); } |
@Test public void checkNotNullNoNull() { assertThat(checkNotNull(5, "should never be")).isEqualTo(5); assertThat(checkNotNull("5", "should never be")).isEqualTo("5"); assertThat(checkNotNull(3f, "should never be")).isEqualTo(3f); } | @NonNull static <T> T checkNotNull(@Nullable final T reference, final String message) { if (reference == null) { throw new IllegalArgumentException(message); } return reference; } | Utils { @NonNull static <T> T checkNotNull(@Nullable final T reference, final String message) { if (reference == null) { throw new IllegalArgumentException(message); } return reference; } } | Utils { @NonNull static <T> T checkNotNull(@Nullable final T reference, final String message) { if (reference == null) { throw new IllegalArgumentException(message); } return reference; } private Utils(); } | Utils { @NonNull static <T> T checkNotNull(@Nullable final T reference, final String message) { if (reference == null) { throw new IllegalArgumentException(message); } return reference; } private Utils(); } | Utils { @NonNull static <T> T checkNotNull(@Nullable final T reference, final String message) { if (reference == null) { throw new IllegalArgumentException(message); } return reference; } private Utils(); } |
@Test public void checkNotNullNull() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("null == null"); checkNotNull(null, "null == null"); } | @NonNull static <T> T checkNotNull(@Nullable final T reference, final String message) { if (reference == null) { throw new IllegalArgumentException(message); } return reference; } | Utils { @NonNull static <T> T checkNotNull(@Nullable final T reference, final String message) { if (reference == null) { throw new IllegalArgumentException(message); } return reference; } } | Utils { @NonNull static <T> T checkNotNull(@Nullable final T reference, final String message) { if (reference == null) { throw new IllegalArgumentException(message); } return reference; } private Utils(); } | Utils { @NonNull static <T> T checkNotNull(@Nullable final T reference, final String message) { if (reference == null) { throw new IllegalArgumentException(message); } return reference; } private Utils(); } | Utils { @NonNull static <T> T checkNotNull(@Nullable final T reference, final String message) { if (reference == null) { throw new IllegalArgumentException(message); } return reference; } private Utils(); } |
@Test public void testConcatenate(){ String[] mStrings = new String[]{"Test 1","Test 2"}; String[] mStrings2 = new String[]{"Test 3","Test 4"}; String[] concat = concatenate(mStrings,mStrings2); assertArrayEquals(new String[]{"Test 1","Test 2","Test 3","Test 4"},concat); assertNotSame(mStrings,concatenate(mStrings,null... | public static <T> T[] concatenate(T[] firstArray, T[] secondArray) { if (firstArray == null) { return secondArray.clone(); } if (secondArray == null) { return firstArray.clone(); } T[] result = Arrays.copyOf(firstArray, firstArray.length + secondArray.length); System.arraycopy(secondArray, 0, result, firstArray.length,... | ArrayUtils { public static <T> T[] concatenate(T[] firstArray, T[] secondArray) { if (firstArray == null) { return secondArray.clone(); } if (secondArray == null) { return firstArray.clone(); } T[] result = Arrays.copyOf(firstArray, firstArray.length + secondArray.length); System.arraycopy(secondArray, 0, result, first... | ArrayUtils { public static <T> T[] concatenate(T[] firstArray, T[] secondArray) { if (firstArray == null) { return secondArray.clone(); } if (secondArray == null) { return firstArray.clone(); } T[] result = Arrays.copyOf(firstArray, firstArray.length + secondArray.length); System.arraycopy(secondArray, 0, result, first... | ArrayUtils { public static <T> T[] concatenate(T[] firstArray, T[] secondArray) { if (firstArray == null) { return secondArray.clone(); } if (secondArray == null) { return firstArray.clone(); } T[] result = Arrays.copyOf(firstArray, firstArray.length + secondArray.length); System.arraycopy(secondArray, 0, result, first... | ArrayUtils { public static <T> T[] concatenate(T[] firstArray, T[] secondArray) { if (firstArray == null) { return secondArray.clone(); } if (secondArray == null) { return firstArray.clone(); } T[] result = Arrays.copyOf(firstArray, firstArray.length + secondArray.length); System.arraycopy(secondArray, 0, result, first... |
@Test void getSearchTime_shouldReturnCorrectValue() { DateTime mDateTime = DateTime.now(); StopLocation station = Mockito.mock(StopLocation.class); Mockito.when(station.getHafasId()).thenReturn("008814001"); VehicleStop stop = Mockito.mock(VehicleStop.class); VehicleStop[] stops = new VehicleStop[]{stop}; Liveboard ins... | public DateTime getSearchTime() { return mSearchTime; } | LiveboardImpl extends StopLocationImpl implements Liveboard, Serializable { public DateTime getSearchTime() { return mSearchTime; } } | LiveboardImpl extends StopLocationImpl implements Liveboard, Serializable { public DateTime getSearchTime() { return mSearchTime; } LiveboardImpl(StopLocation station, VehicleStop[] stops, DateTime searchTime, LiveboardType type, QueryTimeDefinition timeDefinition); } | LiveboardImpl extends StopLocationImpl implements Liveboard, Serializable { public DateTime getSearchTime() { return mSearchTime; } LiveboardImpl(StopLocation station, VehicleStop[] stops, DateTime searchTime, LiveboardType type, QueryTimeDefinition timeDefinition); VehicleStop[] getStops(); DateTime getSearchTime(); Q... | LiveboardImpl extends StopLocationImpl implements Liveboard, Serializable { public DateTime getSearchTime() { return mSearchTime; } LiveboardImpl(StopLocation station, VehicleStop[] stops, DateTime searchTime, LiveboardType type, QueryTimeDefinition timeDefinition); VehicleStop[] getStops(); DateTime getSearchTime(); Q... |
@Test void getTimeDefinition_shouldReturnCorrectValue() { DateTime mDateTime = DateTime.now(); StopLocation station = Mockito.mock(StopLocation.class); Mockito.when(station.getHafasId()).thenReturn("008814001"); VehicleStop stop = Mockito.mock(VehicleStop.class); VehicleStop[] stops = new VehicleStop[]{stop}; Liveboard... | public QueryTimeDefinition getTimeDefinition() { return mTimeDefinition; } | LiveboardImpl extends StopLocationImpl implements Liveboard, Serializable { public QueryTimeDefinition getTimeDefinition() { return mTimeDefinition; } } | LiveboardImpl extends StopLocationImpl implements Liveboard, Serializable { public QueryTimeDefinition getTimeDefinition() { return mTimeDefinition; } LiveboardImpl(StopLocation station, VehicleStop[] stops, DateTime searchTime, LiveboardType type, QueryTimeDefinition timeDefinition); } | LiveboardImpl extends StopLocationImpl implements Liveboard, Serializable { public QueryTimeDefinition getTimeDefinition() { return mTimeDefinition; } LiveboardImpl(StopLocation station, VehicleStop[] stops, DateTime searchTime, LiveboardType type, QueryTimeDefinition timeDefinition); VehicleStop[] getStops(); DateTime... | LiveboardImpl extends StopLocationImpl implements Liveboard, Serializable { public QueryTimeDefinition getTimeDefinition() { return mTimeDefinition; } LiveboardImpl(StopLocation station, VehicleStop[] stops, DateTime searchTime, LiveboardType type, QueryTimeDefinition timeDefinition); VehicleStop[] getStops(); DateTime... |
@Test void getLiveboardType_shouldReturnCorrectValue() { DateTime mDateTime = DateTime.now(); StopLocation station = Mockito.mock(StopLocation.class); Mockito.when(station.getHafasId()).thenReturn("008814001"); VehicleStop stop = Mockito.mock(VehicleStop.class); VehicleStop[] stops = new VehicleStop[]{stop}; Liveboard ... | public LiveboardType getLiveboardType() { return mType; } | LiveboardImpl extends StopLocationImpl implements Liveboard, Serializable { public LiveboardType getLiveboardType() { return mType; } } | LiveboardImpl extends StopLocationImpl implements Liveboard, Serializable { public LiveboardType getLiveboardType() { return mType; } LiveboardImpl(StopLocation station, VehicleStop[] stops, DateTime searchTime, LiveboardType type, QueryTimeDefinition timeDefinition); } | LiveboardImpl extends StopLocationImpl implements Liveboard, Serializable { public LiveboardType getLiveboardType() { return mType; } LiveboardImpl(StopLocation station, VehicleStop[] stops, DateTime searchTime, LiveboardType type, QueryTimeDefinition timeDefinition); VehicleStop[] getStops(); DateTime getSearchTime();... | LiveboardImpl extends StopLocationImpl implements Liveboard, Serializable { public LiveboardType getLiveboardType() { return mType; } LiveboardImpl(StopLocation station, VehicleStop[] stops, DateTime searchTime, LiveboardType type, QueryTimeDefinition timeDefinition); VehicleStop[] getStops(); DateTime getSearchTime();... |
@Test public void test() { assertEquals("MY", Base32Utils.encode("f".getBytes())); assertEquals("MZXQ", Base32Utils.encode("fo".getBytes())); assertEquals("MZXW6", Base32Utils.encode("foo".getBytes())); assertEquals("MZXW6YQ", Base32Utils.encode("foob".getBytes())); assertEquals("MZXW6YTB", Base32Utils.encode("fooba".g... | public static String encode(byte[] input) { byte b; int symbol; int carry = 0; int shift = 3; StringBuilder sb = new StringBuilder(); for (byte value : input) { b = value; symbol = carry | (b >> shift); sb.append(BASE32_CHARS[symbol & 0x1f]); if (shift > 5) { shift -= 5; symbol = b >> shift; sb.append(BASE32_CHARS[symb... | Base32Utils { public static String encode(byte[] input) { byte b; int symbol; int carry = 0; int shift = 3; StringBuilder sb = new StringBuilder(); for (byte value : input) { b = value; symbol = carry | (b >> shift); sb.append(BASE32_CHARS[symbol & 0x1f]); if (shift > 5) { shift -= 5; symbol = b >> shift; sb.append(BAS... | Base32Utils { public static String encode(byte[] input) { byte b; int symbol; int carry = 0; int shift = 3; StringBuilder sb = new StringBuilder(); for (byte value : input) { b = value; symbol = carry | (b >> shift); sb.append(BASE32_CHARS[symbol & 0x1f]); if (shift > 5) { shift -= 5; symbol = b >> shift; sb.append(BAS... | Base32Utils { public static String encode(byte[] input) { byte b; int symbol; int carry = 0; int shift = 3; StringBuilder sb = new StringBuilder(); for (byte value : input) { b = value; symbol = carry | (b >> shift); sb.append(BASE32_CHARS[symbol & 0x1f]); if (shift > 5) { shift -= 5; symbol = b >> shift; sb.append(BAS... | Base32Utils { public static String encode(byte[] input) { byte b; int symbol; int carry = 0; int shift = 3; StringBuilder sb = new StringBuilder(); for (byte value : input) { b = value; symbol = carry | (b >> shift); sb.append(BASE32_CHARS[symbol & 0x1f]); if (shift > 5) { shift -= 5; symbol = b >> shift; sb.append(BAS... |
@Test void findDefaultUsers() { CriteriaQuery query = mock(CriteriaQuery.class); TypedQuery typedQuery = mock(TypedQuery.class); EntityGraph graph = mock(EntityGraph.class); EntityManager em = MockFactory.createEntityManagerMock(typedQuery, graph, query); UsersResource resource = new UsersResource(); UserSearchParams p... | @Decision(HANDLE_OK) public List<User> handleOk(UserSearchParams params, UserPermissionPrincipal principal, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); query.distinct(true); Root<User> userRoot = query.from(User.class); userRoot.fetch("userPr... | UsersResource { @Decision(HANDLE_OK) public List<User> handleOk(UserSearchParams params, UserPermissionPrincipal principal, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); query.distinct(true); Root<User> userRoot = query.from(User.class); userRo... | UsersResource { @Decision(HANDLE_OK) public List<User> handleOk(UserSearchParams params, UserPermissionPrincipal principal, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); query.distinct(true); Root<User> userRoot = query.from(User.class); userRo... | UsersResource { @Decision(HANDLE_OK) public List<User> handleOk(UserSearchParams params, UserPermissionPrincipal principal, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); query.distinct(true); Root<User> userRoot = query.from(User.class); userRo... | UsersResource { @Decision(HANDLE_OK) public List<User> handleOk(UserSearchParams params, UserPermissionPrincipal principal, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); query.distinct(true); Root<User> userRoot = query.from(User.class); userRo... |
@Test void findByNoSuchGroupId() { CriteriaQuery query = mock(CriteriaQuery.class); TypedQuery typedQuery = mock(TypedQuery.class); EntityGraph graph = mock(EntityGraph.class); Root<User> userRoot = mock(Root.class); EntityManager em = MockFactory.createEntityManagerMock(typedQuery, graph, query, userRoot); UsersResour... | @Decision(HANDLE_OK) public List<User> handleOk(UserSearchParams params, UserPermissionPrincipal principal, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); query.distinct(true); Root<User> userRoot = query.from(User.class); userRoot.fetch("userPr... | UsersResource { @Decision(HANDLE_OK) public List<User> handleOk(UserSearchParams params, UserPermissionPrincipal principal, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); query.distinct(true); Root<User> userRoot = query.from(User.class); userRo... | UsersResource { @Decision(HANDLE_OK) public List<User> handleOk(UserSearchParams params, UserPermissionPrincipal principal, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); query.distinct(true); Root<User> userRoot = query.from(User.class); userRo... | UsersResource { @Decision(HANDLE_OK) public List<User> handleOk(UserSearchParams params, UserPermissionPrincipal principal, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); query.distinct(true); Root<User> userRoot = query.from(User.class); userRo... | UsersResource { @Decision(HANDLE_OK) public List<User> handleOk(UserSearchParams params, UserPermissionPrincipal principal, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); query.distinct(true); Root<User> userRoot = query.from(User.class); userRo... |
@Test void post() { UsersResource resource = new UsersResource(); ComponentInjector injector = new ComponentInjector( Map.of("converter", system.getComponent("converter"), "config", system.getComponent("config"))); injector.inject(resource); HttpRequest request = builder(new DefaultHttpRequest()) .set(HttpRequest::setR... | @Decision(POST) public User doPost(UserCreateRequest createRequest, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { User user = converter.createFrom(createRequest, User.class); UserProfileService userProfileService = new UserProfileService(em); List<UserProfileValu... | UsersResource { @Decision(POST) public User doPost(UserCreateRequest createRequest, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { User user = converter.createFrom(createRequest, User.class); UserProfileService userProfileService = new UserProfileService(em); List... | UsersResource { @Decision(POST) public User doPost(UserCreateRequest createRequest, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { User user = converter.createFrom(createRequest, User.class); UserProfileService userProfileService = new UserProfileService(em); List... | UsersResource { @Decision(POST) public User doPost(UserCreateRequest createRequest, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { User user = converter.createFrom(createRequest, User.class); UserProfileService userProfileService = new UserProfileService(em); List... | UsersResource { @Decision(POST) public User doPost(UserCreateRequest createRequest, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { User user = converter.createFrom(createRequest, User.class); UserProfileService userProfileService = new UserProfileService(em); List... |
@Test void validate() { ComponentInjector injector = new ComponentInjector( Map.of("converter", system.getComponent("converter"), "validator", system.getComponent("validator"), "config", system.getComponent("config"))); UsersResource resource = injector.inject(new UsersResource()); UserCreateRequest createRequest = bui... | @Decision(value = MALFORMED, method = "POST") public Problem validateUserCreateRequest(UserCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProblem.MALFORMED.problemUri()) .build(); } ... | UsersResource { @Decision(value = MALFORMED, method = "POST") public Problem validateUserCreateRequest(UserCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProblem.MALFORMED.problemUri... | UsersResource { @Decision(value = MALFORMED, method = "POST") public Problem validateUserCreateRequest(UserCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProblem.MALFORMED.problemUri... | UsersResource { @Decision(value = MALFORMED, method = "POST") public Problem validateUserCreateRequest(UserCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProblem.MALFORMED.problemUri... | UsersResource { @Decision(value = MALFORMED, method = "POST") public Problem validateUserCreateRequest(UserCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProblem.MALFORMED.problemUri... |
@Test void create() { TypedQuery query = mock(TypedQuery.class); Mockito.when(query.getResultList()).thenReturn( List.of( builder(new Permission()) .set(Permission::setId, 2L) .set(Permission::setName, "test2").build(), builder(new Permission()) .set(Permission::setId, 3L) .set(Permission::setName, "test3").build() ) )... | @Decision(POST) public RolePermissionsRequest create(RolePermissionsRequest createRequest, Role role, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Permission> query = cb.createQuery(Permission.class); Root<Permission> permissionRoot = query.from(Permission.class); query.where(permissi... | RolePermissionsResource { @Decision(POST) public RolePermissionsRequest create(RolePermissionsRequest createRequest, Role role, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Permission> query = cb.createQuery(Permission.class); Root<Permission> permissionRoot = query.from(Permission.cl... | RolePermissionsResource { @Decision(POST) public RolePermissionsRequest create(RolePermissionsRequest createRequest, Role role, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Permission> query = cb.createQuery(Permission.class); Root<Permission> permissionRoot = query.from(Permission.cl... | RolePermissionsResource { @Decision(POST) public RolePermissionsRequest create(RolePermissionsRequest createRequest, Role role, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Permission> query = cb.createQuery(Permission.class); Root<Permission> permissionRoot = query.from(Permission.cl... | RolePermissionsResource { @Decision(POST) public RolePermissionsRequest create(RolePermissionsRequest createRequest, Role role, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Permission> query = cb.createQuery(Permission.class); Root<Permission> permissionRoot = query.from(Permission.cl... |
@Test void delete() { TypedQuery query = mock(TypedQuery.class); Mockito.when(query.getResultList()).thenReturn( List.of( builder(new Permission()).set(Permission::setId, 1L).set(Permission::setName, "test1").build(), builder(new Permission()).set(Permission::setId, 3L).set(Permission::setName, "test3").build() ) ); fi... | @Decision(DELETE) public RolePermissionsRequest delete(RolePermissionsRequest deleteRequest, Role role, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Permission> query = cb.createQuery(Permission.class); Root<Permission> permissionRoot = query.from(Permission.class); query.where(permis... | RolePermissionsResource { @Decision(DELETE) public RolePermissionsRequest delete(RolePermissionsRequest deleteRequest, Role role, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Permission> query = cb.createQuery(Permission.class); Root<Permission> permissionRoot = query.from(Permission.... | RolePermissionsResource { @Decision(DELETE) public RolePermissionsRequest delete(RolePermissionsRequest deleteRequest, Role role, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Permission> query = cb.createQuery(Permission.class); Root<Permission> permissionRoot = query.from(Permission.... | RolePermissionsResource { @Decision(DELETE) public RolePermissionsRequest delete(RolePermissionsRequest deleteRequest, Role role, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Permission> query = cb.createQuery(Permission.class); Root<Permission> permissionRoot = query.from(Permission.... | RolePermissionsResource { @Decision(DELETE) public RolePermissionsRequest delete(RolePermissionsRequest deleteRequest, Role role, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Permission> query = cb.createQuery(Permission.class); Root<Permission> permissionRoot = query.from(Permission.... |
@Test void create() { TypedQuery query = mock(TypedQuery.class); Mockito.when(query.getResultList()).thenReturn( List.of( builder(new User()).set(User::setId, 2L).set(User::setAccount, "test2").build(), builder(new User()).set(User::setId, 3L).set(User::setAccount, "test3").build() ) ); final EntityManager em = MockFac... | @Decision(POST) public GroupUsersRequest create(GroupUsersRequest createRequest, Group group, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); Root<User> userRoot = query.from(User.class); query.where(userRoot.get("account").in(createRequest)); Li... | GroupUsersResource { @Decision(POST) public GroupUsersRequest create(GroupUsersRequest createRequest, Group group, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); Root<User> userRoot = query.from(User.class); query.where(userRoot.get("account").i... | GroupUsersResource { @Decision(POST) public GroupUsersRequest create(GroupUsersRequest createRequest, Group group, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); Root<User> userRoot = query.from(User.class); query.where(userRoot.get("account").i... | GroupUsersResource { @Decision(POST) public GroupUsersRequest create(GroupUsersRequest createRequest, Group group, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); Root<User> userRoot = query.from(User.class); query.where(userRoot.get("account").i... | GroupUsersResource { @Decision(POST) public GroupUsersRequest create(GroupUsersRequest createRequest, Group group, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); Root<User> userRoot = query.from(User.class); query.where(userRoot.get("account").i... |
@Test void delete() { TypedQuery query = mock(TypedQuery.class); Mockito.when(query.getResultList()).thenReturn( List.of( builder(new User()).set(User::setId, 1L).set(User::setAccount, "test1").build(), builder(new User()).set(User::setId, 3L).set(User::setAccount, "test3").build() ) ); final EntityManager em = MockFac... | @Decision(DELETE) public GroupUsersRequest delete(GroupUsersRequest createRequest, Group group, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); Root<User> userRoot = query.from(User.class); query.where(userRoot.get("account").in(createRequest)); ... | GroupUsersResource { @Decision(DELETE) public GroupUsersRequest delete(GroupUsersRequest createRequest, Group group, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); Root<User> userRoot = query.from(User.class); query.where(userRoot.get("account")... | GroupUsersResource { @Decision(DELETE) public GroupUsersRequest delete(GroupUsersRequest createRequest, Group group, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); Root<User> userRoot = query.from(User.class); query.where(userRoot.get("account")... | GroupUsersResource { @Decision(DELETE) public GroupUsersRequest delete(GroupUsersRequest createRequest, Group group, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); Root<User> userRoot = query.from(User.class); query.where(userRoot.get("account")... | GroupUsersResource { @Decision(DELETE) public GroupUsersRequest delete(GroupUsersRequest createRequest, Group group, EntityManager em) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<User> query = cb.createQuery(User.class); Root<User> userRoot = query.from(User.class); query.where(userRoot.get("account")... |
@Test void authenticationSuccessful() { ComponentInjector injector = new ComponentInjector( Map.of("converter", system.getComponent("converter"), "validator", system.getComponent("validator"), "config", system.getComponent("config"))); final PasswordSignInResource resource = injector.inject(new PasswordSignInResource()... | @Decision(AUTHORIZED) public boolean authenticate(PasswordSignInRequest passwordSignInRequest, ActionRecord actionRecord, RestContext context, final EntityManager em) { config.getHookRepo().runHook(HookPoint.BEFORE_SIGN_IN, context); if (context.getMessage().filter(Problem.class::isInstance).isPresent()) { return false... | PasswordSignInResource { @Decision(AUTHORIZED) public boolean authenticate(PasswordSignInRequest passwordSignInRequest, ActionRecord actionRecord, RestContext context, final EntityManager em) { config.getHookRepo().runHook(HookPoint.BEFORE_SIGN_IN, context); if (context.getMessage().filter(Problem.class::isInstance).is... | PasswordSignInResource { @Decision(AUTHORIZED) public boolean authenticate(PasswordSignInRequest passwordSignInRequest, ActionRecord actionRecord, RestContext context, final EntityManager em) { config.getHookRepo().runHook(HookPoint.BEFORE_SIGN_IN, context); if (context.getMessage().filter(Problem.class::isInstance).is... | PasswordSignInResource { @Decision(AUTHORIZED) public boolean authenticate(PasswordSignInRequest passwordSignInRequest, ActionRecord actionRecord, RestContext context, final EntityManager em) { config.getHookRepo().runHook(HookPoint.BEFORE_SIGN_IN, context); if (context.getMessage().filter(Problem.class::isInstance).is... | PasswordSignInResource { @Decision(AUTHORIZED) public boolean authenticate(PasswordSignInRequest passwordSignInRequest, ActionRecord actionRecord, RestContext context, final EntityManager em) { config.getHookRepo().runHook(HookPoint.BEFORE_SIGN_IN, context); if (context.getMessage().filter(Problem.class::isInstance).is... |
@Test void updateUserWithEmail() { CriteriaQuery query = mock(CriteriaQuery.class); TypedQuery typedQuery = mock(TypedQuery.class); EntityGraph graph = mock(EntityGraph.class); EntityManager em = MockFactory.createEntityManagerMock(typedQuery, graph, query); UserResource sat = new UserResource(); ComponentInjector inje... | @Decision(PUT) public User update(UserUpdateRequest updateRequest, User user, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { UserProfileService userProfileService = new UserProfileService(em); List<UserProfileValue> newValues = new ArrayList<>(userProfileService .... | UserResource { @Decision(PUT) public User update(UserUpdateRequest updateRequest, User user, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { UserProfileService userProfileService = new UserProfileService(em); List<UserProfileValue> newValues = new ArrayList<>(userP... | UserResource { @Decision(PUT) public User update(UserUpdateRequest updateRequest, User user, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { UserProfileService userProfileService = new UserProfileService(em); List<UserProfileValue> newValues = new ArrayList<>(userP... | UserResource { @Decision(PUT) public User update(UserUpdateRequest updateRequest, User user, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { UserProfileService userProfileService = new UserProfileService(em); List<UserProfileValue> newValues = new ArrayList<>(userP... | UserResource { @Decision(PUT) public User update(UserUpdateRequest updateRequest, User user, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { UserProfileService userProfileService = new UserProfileService(em); List<UserProfileValue> newValues = new ArrayList<>(userP... |
@Test public void test() { byte[] hash = PasswordUtils.pbkdf2("password", "salt", 100); System.out.println(hash.length); } | public static byte[] pbkdf2(String password, String salt, int iterations) { PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt.getBytes(), iterations, 2048); try { SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA384"); SecretKey secretKey = keyFactory.generateSecret(keySpec); ... | PasswordUtils { public static byte[] pbkdf2(String password, String salt, int iterations) { PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt.getBytes(), iterations, 2048); try { SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA384"); SecretKey secretKey = keyFactory.generateS... | PasswordUtils { public static byte[] pbkdf2(String password, String salt, int iterations) { PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt.getBytes(), iterations, 2048); try { SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA384"); SecretKey secretKey = keyFactory.generateS... | PasswordUtils { public static byte[] pbkdf2(String password, String salt, int iterations) { PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt.getBytes(), iterations, 2048); try { SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA384"); SecretKey secretKey = keyFactory.generateS... | PasswordUtils { public static byte[] pbkdf2(String password, String salt, int iterations) { PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt.getBytes(), iterations, 2048); try { SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA384"); SecretKey secretKey = keyFactory.generateS... |
@Test void updateUserWithoutEmail() { CriteriaQuery query = mock(CriteriaQuery.class); TypedQuery typedQuery = mock(TypedQuery.class); EntityGraph graph = mock(EntityGraph.class); EntityManager em = MockFactory.createEntityManagerMock(typedQuery, graph, query); UserResource sat = new UserResource(); ComponentInjector i... | @Decision(PUT) public User update(UserUpdateRequest updateRequest, User user, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { UserProfileService userProfileService = new UserProfileService(em); List<UserProfileValue> newValues = new ArrayList<>(userProfileService .... | UserResource { @Decision(PUT) public User update(UserUpdateRequest updateRequest, User user, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { UserProfileService userProfileService = new UserProfileService(em); List<UserProfileValue> newValues = new ArrayList<>(userP... | UserResource { @Decision(PUT) public User update(UserUpdateRequest updateRequest, User user, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { UserProfileService userProfileService = new UserProfileService(em); List<UserProfileValue> newValues = new ArrayList<>(userP... | UserResource { @Decision(PUT) public User update(UserUpdateRequest updateRequest, User user, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { UserProfileService userProfileService = new UserProfileService(em); List<UserProfileValue> newValues = new ArrayList<>(userP... | UserResource { @Decision(PUT) public User update(UserUpdateRequest updateRequest, User user, ActionRecord actionRecord, UserPermissionPrincipal principal, RestContext context, EntityManager em) { UserProfileService userProfileService = new UserProfileService(em); List<UserProfileValue> newValues = new ArrayList<>(userP... |
@Test void cyclicSerialize() { ObjectMapper mapper = new ObjectMapper(); User user = builder(new User()) .set(User::setId, 1L) .set(User::setAccount, "test") .set(User::setGroups, new IndirectList<>()) .build(); UserLock userLock = builder(new UserLock()) .set(UserLock::setUser, user) .set(UserLock::setLockedAt, LocalD... | public void setUserLock(UserLock userLock) { this.userLock = userLock; } | User implements Serializable { public void setUserLock(UserLock userLock) { this.userLock = userLock; } } | User implements Serializable { public void setUserLock(UserLock userLock) { this.userLock = userLock; } } | User implements Serializable { public void setUserLock(UserLock userLock) { this.userLock = userLock; } Long getId(); void setId(Long id); String getAccount(); void setAccount(String account); String getAccountLower(); void setAccountLower(String accountLower); Boolean getWriteProtected(); void setWriteProtected(Boole... | User implements Serializable { public void setUserLock(UserLock userLock) { this.userLock = userLock; } Long getId(); void setId(Long id); String getAccount(); void setAccount(String account); String getAccountLower(); void setAccountLower(String accountLower); Boolean getWriteProtected(); void setWriteProtected(Boole... |
@Test void test() { StoreProvider provider = system.getComponent("storeProvider", StoreProvider.class); KeyValueStore store = provider.getStore(StoreProvider.StoreType.BOUNCR_TOKEN); store.write("A", "B"); } | public KeyValueStore getStore(StoreType storeType) { switch(storeType) { case BOUNCR_TOKEN: return bouncrTokenStore; case AUTHORIZATION_CODE: return authorizationCodeStore; case ACCESS_TOKEN: return accessTokenStore; case OIDC_SESSION: return oidcSessionStore; default: throw new IllegalArgumentException(storeType + " i... | StoreProvider extends SystemComponent<StoreProvider> { public KeyValueStore getStore(StoreType storeType) { switch(storeType) { case BOUNCR_TOKEN: return bouncrTokenStore; case AUTHORIZATION_CODE: return authorizationCodeStore; case ACCESS_TOKEN: return accessTokenStore; case OIDC_SESSION: return oidcSessionStore; defa... | StoreProvider extends SystemComponent<StoreProvider> { public KeyValueStore getStore(StoreType storeType) { switch(storeType) { case BOUNCR_TOKEN: return bouncrTokenStore; case AUTHORIZATION_CODE: return authorizationCodeStore; case ACCESS_TOKEN: return accessTokenStore; case OIDC_SESSION: return oidcSessionStore; defa... | StoreProvider extends SystemComponent<StoreProvider> { public KeyValueStore getStore(StoreType storeType) { switch(storeType) { case BOUNCR_TOKEN: return bouncrTokenStore; case AUTHORIZATION_CODE: return authorizationCodeStore; case ACCESS_TOKEN: return accessTokenStore; case OIDC_SESSION: return oidcSessionStore; defa... | StoreProvider extends SystemComponent<StoreProvider> { public KeyValueStore getStore(StoreType storeType) { switch(storeType) { case BOUNCR_TOKEN: return bouncrTokenStore; case AUTHORIZATION_CODE: return authorizationCodeStore; case ACCESS_TOKEN: return accessTokenStore; case OIDC_SESSION: return oidcSessionStore; defa... |
@Test void sortedOrder() { Flake flake = system.getComponent("flake"); BigInteger[] ids = new BigInteger[100]; for (int i=0; i<100; i++) { ids[i] = flake.generateId(); } for (int i=0; i<99; i++) { assertThat(ids[i]).isLessThan(ids[i+1]); } } | public synchronized BigInteger generateId() { ByteBuffer buf = ByteBuffer.allocate(16); long current = clock.millis(); if (current != lastTime) { lastTime = current; sequence = 0; } else { sequence++; } return new BigInteger(buf.putLong(lastTime).put(macAddress).putShort((short)sequence) .array()); } | Flake extends SystemComponent { public synchronized BigInteger generateId() { ByteBuffer buf = ByteBuffer.allocate(16); long current = clock.millis(); if (current != lastTime) { lastTime = current; sequence = 0; } else { sequence++; } return new BigInteger(buf.putLong(lastTime).put(macAddress).putShort((short)sequence)... | Flake extends SystemComponent { public synchronized BigInteger generateId() { ByteBuffer buf = ByteBuffer.allocate(16); long current = clock.millis(); if (current != lastTime) { lastTime = current; sequence = 0; } else { sequence++; } return new BigInteger(buf.putLong(lastTime).put(macAddress).putShort((short)sequence)... | Flake extends SystemComponent { public synchronized BigInteger generateId() { ByteBuffer buf = ByteBuffer.allocate(16); long current = clock.millis(); if (current != lastTime) { lastTime = current; sequence = 0; } else { sequence++; } return new BigInteger(buf.putLong(lastTime).put(macAddress).putShort((short)sequence)... | Flake extends SystemComponent { public synchronized BigInteger generateId() { ByteBuffer buf = ByteBuffer.allocate(16); long current = clock.millis(); if (current != lastTime) { lastTime = current; sequence = 0; } else { sequence++; } return new BigInteger(buf.putLong(lastTime).put(macAddress).putShort((short)sequence)... |
@Test void healthCheck_Normal() throws Exception { HttpServerExchange exchange = mock(HttpServerExchange.class); Sender sender = mock(Sender.class); given(exchange.getResponseSender()).willReturn(sender); HealthCheckHandler handler = new HealthCheckHandler(); handler.handleRequest(exchange); verify(sender).send(anyStri... | @Override public void handleRequest(HttpServerExchange exchange) throws Exception { if (exchange.isInIoThread()) { exchange.dispatch(this); return; } HealthCheckResponse response = HealthCheckResponse.builder() .name("bouncr-proxy") .up() .build(); exchange.setStatusCode(200); exchange.getResponseSender().send(mapper.w... | HealthCheckHandler implements HttpHandler { @Override public void handleRequest(HttpServerExchange exchange) throws Exception { if (exchange.isInIoThread()) { exchange.dispatch(this); return; } HealthCheckResponse response = HealthCheckResponse.builder() .name("bouncr-proxy") .up() .build(); exchange.setStatusCode(200)... | HealthCheckHandler implements HttpHandler { @Override public void handleRequest(HttpServerExchange exchange) throws Exception { if (exchange.isInIoThread()) { exchange.dispatch(this); return; } HealthCheckResponse response = HealthCheckResponse.builder() .name("bouncr-proxy") .up() .build(); exchange.setStatusCode(200)... | HealthCheckHandler implements HttpHandler { @Override public void handleRequest(HttpServerExchange exchange) throws Exception { if (exchange.isInIoThread()) { exchange.dispatch(this); return; } HealthCheckResponse response = HealthCheckResponse.builder() .name("bouncr-proxy") .up() .build(); exchange.setStatusCode(200)... | HealthCheckHandler implements HttpHandler { @Override public void handleRequest(HttpServerExchange exchange) throws Exception { if (exchange.isInIoThread()) { exchange.dispatch(this); return; } HealthCheckResponse response = HealthCheckResponse.builder() .name("bouncr-proxy") .up() .build(); exchange.setStatusCode(200)... |
@Test void validateCreateRequest_Error() { TypedQuery query = mock(TypedQuery.class); final EntityManager em = MockFactory.createEntityManagerMock(query); HttpRequest request = builder(new DefaultHttpRequest()) .set(HttpRequest::setRequestMethod, "POST") .build(); RestContext context = new RestContext(new DefaultResour... | @Decision(value = MALFORMED, method = "POST") public Problem validateCreateRequest(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProblem.MALFORMED.problemUri()) .b... | PasswordCredentialResource { @Decision(value = MALFORMED, method = "POST") public Problem validateCreateRequest(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProbl... | PasswordCredentialResource { @Decision(value = MALFORMED, method = "POST") public Problem validateCreateRequest(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProbl... | PasswordCredentialResource { @Decision(value = MALFORMED, method = "POST") public Problem validateCreateRequest(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProbl... | PasswordCredentialResource { @Decision(value = MALFORMED, method = "POST") public Problem validateCreateRequest(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProbl... |
@Test void validateCreateRequest_Success() { TypedQuery query = mock(TypedQuery.class); final EntityManager em = MockFactory.createEntityManagerMock(query); HttpRequest request = builder(new DefaultHttpRequest()) .set(HttpRequest::setRequestMethod, "POST") .build(); RestContext context = new RestContext(new DefaultReso... | @Decision(value = MALFORMED, method = "POST") public Problem validateCreateRequest(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProblem.MALFORMED.problemUri()) .b... | PasswordCredentialResource { @Decision(value = MALFORMED, method = "POST") public Problem validateCreateRequest(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProbl... | PasswordCredentialResource { @Decision(value = MALFORMED, method = "POST") public Problem validateCreateRequest(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProbl... | PasswordCredentialResource { @Decision(value = MALFORMED, method = "POST") public Problem validateCreateRequest(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProbl... | PasswordCredentialResource { @Decision(value = MALFORMED, method = "POST") public Problem validateCreateRequest(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { if (createRequest == null) { return builder(Problem.valueOf(400, "request is empty")) .set(Problem::setType, BouncrProbl... |
@Test void userProcessableInPost_Successful() { TypedQuery query = mock(TypedQuery.class); User user = builder(new User()) .set(User::setId, 1L) .set(User::setAccount, "test_user") .build(); when(query.getResultStream()).thenReturn(Stream.of(user)); final EntityManager em = MockFactory.createEntityManagerMock(query); H... | @Decision(value=PROCESSABLE, method="POST") public boolean userProcessableInPost(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { return findUserByAccount(createRequest.getAccount(), em) .map(user -> { context.putValue(user); return user; }).isPresent(); } | PasswordCredentialResource { @Decision(value=PROCESSABLE, method="POST") public boolean userProcessableInPost(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { return findUserByAccount(createRequest.getAccount(), em) .map(user -> { context.putValue(user); return user; }).isPresent(... | PasswordCredentialResource { @Decision(value=PROCESSABLE, method="POST") public boolean userProcessableInPost(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { return findUserByAccount(createRequest.getAccount(), em) .map(user -> { context.putValue(user); return user; }).isPresent(... | PasswordCredentialResource { @Decision(value=PROCESSABLE, method="POST") public boolean userProcessableInPost(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { return findUserByAccount(createRequest.getAccount(), em) .map(user -> { context.putValue(user); return user; }).isPresent(... | PasswordCredentialResource { @Decision(value=PROCESSABLE, method="POST") public boolean userProcessableInPost(PasswordCredentialCreateRequest createRequest, RestContext context, EntityManager em) { return findUserByAccount(createRequest.getAccount(), em) .map(user -> { context.putValue(user); return user; }).isPresent(... |
@Test void userProcessableInPut_Successful() { TypedQuery query = mock(TypedQuery.class); PasswordCredential credential = builder(new PasswordCredential()) .set(PasswordCredential::setPassword, PasswordUtils.pbkdf2("pass1234", "saltsalt", 100)) .set(PasswordCredential::setSalt, "saltsalt") .build(); User user = builder... | @Decision(value=PROCESSABLE, method="PUT") public boolean userProcessableInPut(PasswordCredentialUpdateRequest updateRequest, RestContext context, EntityManager em) { return findUserByAccount(updateRequest.getAccount(), em) .map(user -> { context.putValue(user); return user; }) .filter(user -> user.getPasswordCredentia... | PasswordCredentialResource { @Decision(value=PROCESSABLE, method="PUT") public boolean userProcessableInPut(PasswordCredentialUpdateRequest updateRequest, RestContext context, EntityManager em) { return findUserByAccount(updateRequest.getAccount(), em) .map(user -> { context.putValue(user); return user; }) .filter(user... | PasswordCredentialResource { @Decision(value=PROCESSABLE, method="PUT") public boolean userProcessableInPut(PasswordCredentialUpdateRequest updateRequest, RestContext context, EntityManager em) { return findUserByAccount(updateRequest.getAccount(), em) .map(user -> { context.putValue(user); return user; }) .filter(user... | PasswordCredentialResource { @Decision(value=PROCESSABLE, method="PUT") public boolean userProcessableInPut(PasswordCredentialUpdateRequest updateRequest, RestContext context, EntityManager em) { return findUserByAccount(updateRequest.getAccount(), em) .map(user -> { context.putValue(user); return user; }) .filter(user... | PasswordCredentialResource { @Decision(value=PROCESSABLE, method="PUT") public boolean userProcessableInPut(PasswordCredentialUpdateRequest updateRequest, RestContext context, EntityManager em) { return findUserByAccount(updateRequest.getAccount(), em) .map(user -> { context.putValue(user); return user; }) .filter(user... |
@Test public void reportCurrentTime() { await().atMost(Duration.TEN_SECONDS).untilAsserted(() -> { verify(tasks, atLeast(2)).reportCurrentTime(); }); } | @Scheduled(fixedRate = 5000) public void reportCurrentTime() { log.info("The time is now {}", dateFormat.format(new Date())); } | ScheduledTasks { @Scheduled(fixedRate = 5000) public void reportCurrentTime() { log.info("The time is now {}", dateFormat.format(new Date())); } } | ScheduledTasks { @Scheduled(fixedRate = 5000) public void reportCurrentTime() { log.info("The time is now {}", dateFormat.format(new Date())); } } | ScheduledTasks { @Scheduled(fixedRate = 5000) public void reportCurrentTime() { log.info("The time is now {}", dateFormat.format(new Date())); } @Scheduled(fixedRate = 5000) void reportCurrentTime(); } | ScheduledTasks { @Scheduled(fixedRate = 5000) public void reportCurrentTime() { log.info("The time is now {}", dateFormat.format(new Date())); } @Scheduled(fixedRate = 5000) void reportCurrentTime(); } |
@Test public void testOverNexus() throws Exception { @SuppressWarnings("resource") final TopicLogger logger = new TopicLogger().withExcludeTopics(Topic.of("t")); edge = EdgeNode.builder() .withServerConfig(new XServerConfig().withPort(SocketUtils.getAvailablePort(PORT))) .withPlugins(logger) .build(); remote = RemoteNo... | public TopicLogger withExcludeTopics(Topic... excludeTopics) { this.excludeTopics = excludeTopics; return this; } | TopicLogger implements Plugin, TopicListener { public TopicLogger withExcludeTopics(Topic... excludeTopics) { this.excludeTopics = excludeTopics; return this; } } | TopicLogger implements Plugin, TopicListener { public TopicLogger withExcludeTopics(Topic... excludeTopics) { this.excludeTopics = excludeTopics; return this; } } | TopicLogger implements Plugin, TopicListener { public TopicLogger withExcludeTopics(Topic... excludeTopics) { this.excludeTopics = excludeTopics; return this; } TopicLogger withLogger(Logger logger); TopicLogger withExcludeTopics(Topic... excludeTopics); @Override void onBuild(EdgeNodeBuilder builder); @Override void ... | TopicLogger implements Plugin, TopicListener { public TopicLogger withExcludeTopics(Topic... excludeTopics) { this.excludeTopics = excludeTopics; return this; } TopicLogger withLogger(Logger logger); TopicLogger withExcludeTopics(Topic... excludeTopics); @Override void onBuild(EdgeNodeBuilder builder); @Override void ... |
@Test public void testToString() { assertNotNull(backplane.toString()); } | @Override public String toString() { return "KafkaBackplane [config: " + config + ", clusterId: " + clusterId + ", brokerId: " + brokerId + "]"; } | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public String toString() { return "KafkaBackplane [config: " + config + ", clusterId: " + clusterId + ", brokerId: " + brokerId + "]"; } } | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public String toString() { return "KafkaBackplane [config: " + config + ", clusterId: " + clusterId + ", brokerId: " + brokerId + "]"; } KafkaBackplane(@YInject(name="backplaneConfig") KafkaBackplaneConfig config,
... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public String toString() { return "KafkaBackplane [config: " + config + ", clusterId: " + clusterId + ", brokerId: " + brokerId + "]"; } KafkaBackplane(@YInject(name="backplaneConfig") KafkaBackplaneConfig config,
... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public String toString() { return "KafkaBackplane [config: " + config + ", clusterId: " + clusterId + ", brokerId: " + brokerId + "]"; } KafkaBackplane(@YInject(name="backplaneConfig") KafkaBackplaneConfig config,
... |
@Test public void testObjectPayload() { test(new ScramjetMessage(UUID.randomUUID().toString(), "TestMessage", newTestObject(), "junit", new Date())); } | @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... |
@Test public void testMapPayload() { test(new ScramjetMessage(UUID.randomUUID().toString(), "TestMessage", newTestObject().getAttributes(), "junit", new Date())); } | @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... |
@Test public void testStringPayload() { test(new ScramjetMessage(UUID.randomUUID().toString(), "TestMessage", "payload", "junit", new Date())); } | @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... |
@Test public void testDoublePayload() { test(new ScramjetMessage(UUID.randomUUID().toString(), "TestMessage", 12.34, "junit", new Date())); } | @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... |
@Test public void testBooleanPayload() { test(new ScramjetMessage(UUID.randomUUID().toString(), "TestMessage", true, "junit", new Date())); } | @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... |
@Test public void testArrayPayload() { test(new ScramjetMessage(UUID.randomUUID().toString(), "TestMessage", Arrays.asList("eenie", "meenie", "minie"), "junit", new Date())); } | @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... |
@Test public void testNullPayload() { test(new ScramjetMessage(UUID.randomUUID().toString(), "TestMessage", null, "junit", new Date())); } | @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... |
@Test public void testPushUpdateString() { final ScramjetPushUpdate push = new ScramjetPushUpdate("test/topic", 30, "testPayload"); test(new ScramjetMessage(UUID.randomUUID().toString(), "TestMessage", push, "junit", new Date())); } | @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... |
@Test public void testPushUpdateMap() { final ScramjetPushUpdate push = new ScramjetPushUpdate("test/topic", 30, newTestObject().getAttributes()); test(new ScramjetMessage(UUID.randomUUID().toString(), "TestMessage", push, "junit", new Date())); } | @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); } | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... | ScramjetMessage { @Override public String toString() { return "ScramjetMessage [id=" + id + ", messageType=" + messageType + ", payload=" + payload + ", publisher=" + publisher + ", sentAt=" + sentAt + "]"; } ScramjetMessage(String id, String messageType, Object payload, String publisher, Date sentAt); String getId(); ... |
@Test public void testLoadConfig() throws IOException { final KafkaBackplaneConfig config = new MappingContext() .withParser(new SnakeyamlParser()) .fromStream(KafkaBackplaneConfigTest.class.getClassLoader().getResourceAsStream("kafka-backplane-config.yaml")) .map(KafkaBackplaneConfig.class); assertNotNull(config.toStr... | @Override public String toString() { return "KafkaBackplaneConfig [kafka: " + kafka + ", topic: " + topic + ", serializer: " + serializer + ", deserializer: " + deserializer + ", pollTimeoutMillis: " + pollTimeoutMillis + ", ttlMillis: " + ttlMillis + "]"; } | KafkaBackplaneConfig { @Override public String toString() { return "KafkaBackplaneConfig [kafka: " + kafka + ", topic: " + topic + ", serializer: " + serializer + ", deserializer: " + deserializer + ", pollTimeoutMillis: " + pollTimeoutMillis + ", ttlMillis: " + ttlMillis + "]"; } } | KafkaBackplaneConfig { @Override public String toString() { return "KafkaBackplaneConfig [kafka: " + kafka + ", topic: " + topic + ", serializer: " + serializer + ", deserializer: " + deserializer + ", pollTimeoutMillis: " + pollTimeoutMillis + ", ttlMillis: " + ttlMillis + "]"; } } | KafkaBackplaneConfig { @Override public String toString() { return "KafkaBackplaneConfig [kafka: " + kafka + ", topic: " + topic + ", serializer: " + serializer + ", deserializer: " + deserializer + ", pollTimeoutMillis: " + pollTimeoutMillis + ", ttlMillis: " + ttlMillis + "]"; } @Override String toString(); } | KafkaBackplaneConfig { @Override public String toString() { return "KafkaBackplaneConfig [kafka: " + kafka + ", topic: " + topic + ", serializer: " + serializer + ", deserializer: " + deserializer + ", pollTimeoutMillis: " + pollTimeoutMillis + ", ttlMillis: " + ttlMillis + "]"; } @Override String toString(); @YInject... |
@Test public void testReadNoDefault() { assertEquals("bar", reader.read("foo")); assertNull(reader.read("baz")); } | <T> T read(String key) { return read(key, () -> null); } | AttributeReader { <T> T read(String key) { return read(key, () -> null); } } | AttributeReader { <T> T read(String key) { return read(key, () -> null); } AttributeReader(Map<String, Object> atts); } | AttributeReader { <T> T read(String key) { return read(key, () -> null); } AttributeReader(Map<String, Object> atts); } | AttributeReader { <T> T read(String key) { return read(key, () -> null); } AttributeReader(Map<String, Object> atts); } |
@Test public void testReadDefault() { assertEquals("default", reader.read("baz", () -> "default")); } | <T> T read(String key) { return read(key, () -> null); } | AttributeReader { <T> T read(String key) { return read(key, () -> null); } } | AttributeReader { <T> T read(String key) { return read(key, () -> null); } AttributeReader(Map<String, Object> atts); } | AttributeReader { <T> T read(String key) { return read(key, () -> null); } AttributeReader(Map<String, Object> atts); } | AttributeReader { <T> T read(String key) { return read(key, () -> null); } AttributeReader(Map<String, Object> atts); } |
@Test public void testGetTypeName() { assertEquals("type", reader.getTypeName()); } | String getTypeName() { return (String) atts.get(ScramjetMessage.TYPE_ATT); } | AttributeReader { String getTypeName() { return (String) atts.get(ScramjetMessage.TYPE_ATT); } } | AttributeReader { String getTypeName() { return (String) atts.get(ScramjetMessage.TYPE_ATT); } AttributeReader(Map<String, Object> atts); } | AttributeReader { String getTypeName() { return (String) atts.get(ScramjetMessage.TYPE_ATT); } AttributeReader(Map<String, Object> atts); } | AttributeReader { String getTypeName() { return (String) atts.get(ScramjetMessage.TYPE_ATT); } AttributeReader(Map<String, Object> atts); } |
@Test public void testGetAttributes() { assertEquals("bar", reader.getAttributes().get("foo")); } | Map<String, Object> getAttributes() { return atts; } | AttributeReader { Map<String, Object> getAttributes() { return atts; } } | AttributeReader { Map<String, Object> getAttributes() { return atts; } AttributeReader(Map<String, Object> atts); } | AttributeReader { Map<String, Object> getAttributes() { return atts; } AttributeReader(Map<String, Object> atts); } | AttributeReader { Map<String, Object> getAttributes() { return atts; } AttributeReader(Map<String, Object> atts); } |
@Test public void testGetProfilePathProperty() { System.setProperty("flywheel.launchpad.profile", "conf/test-good"); final File path = Launchpad.getProfilePath(new HashMap<>()); assertNotNull(path); assertEquals("conf/test-good", path.getPath()); } | static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } else { final S... | Launchpad { static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } el... | Launchpad { static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } el... | Launchpad { static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } el... | Launchpad { static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } el... |
@Test public void testGetProfilePathEnvDefault() { final File path = Launchpad.getProfilePath(new HashMap<>()); assertNotNull(path); assertEquals("conf/default", path.getPath()); } | static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } else { final S... | Launchpad { static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } el... | Launchpad { static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } el... | Launchpad { static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } el... | Launchpad { static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } el... |
@Test public void testGetProfilePathEnvSupplied() { final Map<String, String> env = new HashMap<>(); env.put("FLYWHEEL_PROFILE", "conf/test-good"); final File path = Launchpad.getProfilePath(env); assertNotNull(path); assertEquals("conf/test-good", path.getPath()); } | static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } else { final S... | Launchpad { static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } el... | Launchpad { static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } el... | Launchpad { static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } el... | Launchpad { static File getProfilePath(Map<String, String> env) { final String propertyName = "flywheel.launchpad.profile"; final String envName = "FLYWHEEL_PROFILE"; final String profileProp = System.getProperty(propertyName); final File profilePath; if (profileProp != null) { profilePath = new File(profileProp); } el... |
@Test public void testMain() { System.setProperty("flywheel.launchpad.profile", "conf/test-good"); Launchpad.main(); } | public static void main(String... args) { bootstrap(args, System::exit); } | Launchpad { public static void main(String... args) { bootstrap(args, System::exit); } } | Launchpad { public static void main(String... args) { bootstrap(args, System::exit); } Launchpad(File profilePath); } | Launchpad { public static void main(String... args) { bootstrap(args, System::exit); } Launchpad(File profilePath); void launch(String[] args); Profile getProfile(); static void main(String... args); } | Launchpad { public static void main(String... args) { bootstrap(args, System::exit); } Launchpad(File profilePath); void launch(String[] args); Profile getProfile(); static void main(String... args); } |
@Test public void testBootstrap() { final IntConsumer exitHandler = mock(IntConsumer.class); System.setProperty("flywheel.launchpad.profile", "conf/test-bad"); Launchpad.bootstrap(new String[0], exitHandler); verify(exitHandler).accept(eq(1)); } | static void bootstrap(String[] args, IntConsumer exitHandler) { try { new Launchpad(getProfilePath(System.getenv())).launch(args); } catch (LaunchpadException e) { err.format("Error:\n"); e.printStackTrace(err); exitHandler.accept(1); } } | Launchpad { static void bootstrap(String[] args, IntConsumer exitHandler) { try { new Launchpad(getProfilePath(System.getenv())).launch(args); } catch (LaunchpadException e) { err.format("Error:\n"); e.printStackTrace(err); exitHandler.accept(1); } } } | Launchpad { static void bootstrap(String[] args, IntConsumer exitHandler) { try { new Launchpad(getProfilePath(System.getenv())).launch(args); } catch (LaunchpadException e) { err.format("Error:\n"); e.printStackTrace(err); exitHandler.accept(1); } } Launchpad(File profilePath); } | Launchpad { static void bootstrap(String[] args, IntConsumer exitHandler) { try { new Launchpad(getProfilePath(System.getenv())).launch(args); } catch (LaunchpadException e) { err.format("Error:\n"); e.printStackTrace(err); exitHandler.accept(1); } } Launchpad(File profilePath); void launch(String[] args); Profile getP... | Launchpad { static void bootstrap(String[] args, IntConsumer exitHandler) { try { new Launchpad(getProfilePath(System.getenv())).launch(args); } catch (LaunchpadException e) { err.format("Error:\n"); e.printStackTrace(err); exitHandler.accept(1); } } Launchpad(File profilePath); void launch(String[] args); Profile getP... |
@Test public void test() throws IOException, URISyntaxException { try (HttpStubAuthenticator auth = new MappingContext() .withParser(new SnakeyamlParser()) .fromStream(HttpStubAuthenticatorConfigTest.class.getClassLoader().getResourceAsStream("http-stub-auth-config.yaml")) .map(HttpStubAuthenticator.class)) { assertEqu... | @Override public String toString() { return "HttpStubAuthenticatorConfig [uri: " + uri + ", poolSize: " + poolSize + ", timeoutMillis: " + timeoutMillis + "]"; } | HttpStubAuthenticatorConfig { @Override public String toString() { return "HttpStubAuthenticatorConfig [uri: " + uri + ", poolSize: " + poolSize + ", timeoutMillis: " + timeoutMillis + "]"; } } | HttpStubAuthenticatorConfig { @Override public String toString() { return "HttpStubAuthenticatorConfig [uri: " + uri + ", poolSize: " + poolSize + ", timeoutMillis: " + timeoutMillis + "]"; } } | HttpStubAuthenticatorConfig { @Override public String toString() { return "HttpStubAuthenticatorConfig [uri: " + uri + ", poolSize: " + poolSize + ", timeoutMillis: " + timeoutMillis + "]"; } HttpStubAuthenticatorConfig withURI(URI uri); HttpStubAuthenticatorConfig withPoolSize(int poolSize); HttpStubAuthenticatorConf... | HttpStubAuthenticatorConfig { @Override public String toString() { return "HttpStubAuthenticatorConfig [uri: " + uri + ", poolSize: " + poolSize + ", timeoutMillis: " + timeoutMillis + "]"; } HttpStubAuthenticatorConfig withURI(URI uri); HttpStubAuthenticatorConfig withPoolSize(int poolSize); HttpStubAuthenticatorConf... |
@Test public void testReceive() { final Map<TopicPartition, List<ConsumerRecord<String, String>>> recordsMap = Collections.singletonMap(new TopicPartition("test", 0), Arrays.asList(new ConsumerRecord<>("test", 0, 0, "key", "value"))); final ConsumerRecords<String, String> records = new ConsumerRecords<>(recordsMap); wh... | public void await() throws InterruptedException { join(); } | KafkaReceiver extends Thread implements AutoCloseable { public void await() throws InterruptedException { join(); } } | KafkaReceiver extends Thread implements AutoCloseable { public void await() throws InterruptedException { join(); } KafkaReceiver(Consumer<K, V> consumer, long pollTimeoutMillis, String threadName,
RecordHandler<K, V> handler, ErrorHandler errorHandler); } | KafkaReceiver extends Thread implements AutoCloseable { public void await() throws InterruptedException { join(); } KafkaReceiver(Consumer<K, V> consumer, long pollTimeoutMillis, String threadName,
RecordHandler<K, V> handler, ErrorHandler errorHandler); static ErrorHandler genericErrorLogger(Lo... | KafkaReceiver extends Thread implements AutoCloseable { public void await() throws InterruptedException { join(); } KafkaReceiver(Consumer<K, V> consumer, long pollTimeoutMillis, String threadName,
RecordHandler<K, V> handler, ErrorHandler errorHandler); static ErrorHandler genericErrorLogger(Lo... |
@Test public void testInterrupt() throws InterruptedException { when(consumer.poll(notNull())).then(split(() -> { throw createInterruptException(); })); receiver = new KafkaReceiver<String, String>(consumer, 1, "TestThread", recordHandler, errorHandler); verify(recordHandler, never()).onReceive(any()); verify(errorHand... | public void await() throws InterruptedException { join(); } | KafkaReceiver extends Thread implements AutoCloseable { public void await() throws InterruptedException { join(); } } | KafkaReceiver extends Thread implements AutoCloseable { public void await() throws InterruptedException { join(); } KafkaReceiver(Consumer<K, V> consumer, long pollTimeoutMillis, String threadName,
RecordHandler<K, V> handler, ErrorHandler errorHandler); } | KafkaReceiver extends Thread implements AutoCloseable { public void await() throws InterruptedException { join(); } KafkaReceiver(Consumer<K, V> consumer, long pollTimeoutMillis, String threadName,
RecordHandler<K, V> handler, ErrorHandler errorHandler); static ErrorHandler genericErrorLogger(Lo... | KafkaReceiver extends Thread implements AutoCloseable { public void await() throws InterruptedException { join(); } KafkaReceiver(Consumer<K, V> consumer, long pollTimeoutMillis, String threadName,
RecordHandler<K, V> handler, ErrorHandler errorHandler); static ErrorHandler genericErrorLogger(Lo... |
@Test public void testGenericErrorLogger() { when(consumer.poll(notNull())).then(split(() -> { throw new RuntimeException("boom"); })); final Logger logger = mock(Logger.class); receiver = new KafkaReceiver<String, String>(consumer, 1, "TestThread", recordHandler, KafkaReceiver.genericErrorLogger(logger)); SocketUtils.... | public static ErrorHandler genericErrorLogger(Logger logger) { return cause -> logger.warn("Error processing Kafka record", cause); } | KafkaReceiver extends Thread implements AutoCloseable { public static ErrorHandler genericErrorLogger(Logger logger) { return cause -> logger.warn("Error processing Kafka record", cause); } } | KafkaReceiver extends Thread implements AutoCloseable { public static ErrorHandler genericErrorLogger(Logger logger) { return cause -> logger.warn("Error processing Kafka record", cause); } KafkaReceiver(Consumer<K, V> consumer, long pollTimeoutMillis, String threadName,
RecordHandler<K, V> hand... | KafkaReceiver extends Thread implements AutoCloseable { public static ErrorHandler genericErrorLogger(Logger logger) { return cause -> logger.warn("Error processing Kafka record", cause); } KafkaReceiver(Consumer<K, V> consumer, long pollTimeoutMillis, String threadName,
RecordHandler<K, V> hand... | KafkaReceiver extends Thread implements AutoCloseable { public static ErrorHandler genericErrorLogger(Logger logger) { return cause -> logger.warn("Error processing Kafka record", cause); } KafkaReceiver(Consumer<K, V> consumer, long pollTimeoutMillis, String threadName,
RecordHandler<K, V> hand... |
@Test(expected=IllegalArgumentException.class) public void testSerializeError() { final KafkaData d = new KafkaData(new RuntimeException()); serializer.serialize("test", d); } | @Override public byte[] serialize(String topic, KafkaData data) { if (data.isError()) throw new IllegalArgumentException("Cannot serialize an error"); final ScramjetMessage msg = toScramjet(data); final String json = msg.toJson(gson); return s.serialize(topic, json); } | ScramjetSerializer implements Serializer<KafkaData> { @Override public byte[] serialize(String topic, KafkaData data) { if (data.isError()) throw new IllegalArgumentException("Cannot serialize an error"); final ScramjetMessage msg = toScramjet(data); final String json = msg.toJson(gson); return s.serialize(topic, json)... | ScramjetSerializer implements Serializer<KafkaData> { @Override public byte[] serialize(String topic, KafkaData data) { if (data.isError()) throw new IllegalArgumentException("Cannot serialize an error"); final ScramjetMessage msg = toScramjet(data); final String json = msg.toJson(gson); return s.serialize(topic, json)... | ScramjetSerializer implements Serializer<KafkaData> { @Override public byte[] serialize(String topic, KafkaData data) { if (data.isError()) throw new IllegalArgumentException("Cannot serialize an error"); final ScramjetMessage msg = toScramjet(data); final String json = msg.toJson(gson); return s.serialize(topic, json)... | ScramjetSerializer implements Serializer<KafkaData> { @Override public byte[] serialize(String topic, KafkaData data) { if (data.isError()) throw new IllegalArgumentException("Cannot serialize an error"); final ScramjetMessage msg = toScramjet(data); final String json = msg.toJson(gson); return s.serialize(topic, json)... |
@Test public void testAttach() { attach(); } | @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, config.topic); final String threadName = "KafkaReceiver-" + clusterId + "-" +... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... |
@Test public void testOnReceiveText() { final BackplaneConnector connector = attach(); final KafkaData d = new KafkaData("id", "source", "topic", null, "hello", System.currentTimeMillis(), System.currentTimeMillis() + 10_000); getProducer().send(new ProducerRecord<>(config.topic, d)); SocketUtils.await().until(() -> { ... | @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, config.topic); final String threadName = "KafkaReceiver-" + clusterId + "-" +... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... |
@Test public void testOnReceiveBinary() { final BackplaneConnector connector = attach(); final byte[] bytes = "hello".getBytes(); final KafkaData d = new KafkaData("id", "source", "topic", bytes, null, System.currentTimeMillis(), System.currentTimeMillis() + 10_000); getProducer().send(new ProducerRecord<>(config.topic... | @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, config.topic); final String threadName = "KafkaReceiver-" + clusterId + "-" +... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... |
@Test public void testOnReceiveError() { final BackplaneConnector connector = attach(); final KafkaData d = new KafkaData(new RuntimeException("boom")); getProducer().send(new ProducerRecord<>(config.topic, d)); SocketUtils.await().until(() -> { Mockito.verify(connector, Mockito.never()).publish(Mockito.anyString(), Mo... | @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, config.topic); final String threadName = "KafkaReceiver-" + clusterId + "-" +... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... | KafkaBackplane implements Backplane, RecordHandler<String, KafkaData> { @Override public void attach(BackplaneConnector connector) { LOG.debug("Attaching Kafka backplane..."); this.connector = connector; final Consumer<String, KafkaData> consumer = config.kafka.getConsumer(getConsumerProps()); seekToEnd(consumer, confi... |
@Test public void testGetHandledExceptionList() throws Exception { String result; String expected; expect( pathResolver.getIdentifier( LogicalPath.getInstance(Path.SRC_MAIN_WEBAPP, ""), WEB_XML_PATH)).andReturn(EXC_WEB_XML); expect(fileManager.exists(EXC_WEB_XML)).andReturn(true); expect(fileManager.updateFile(EXC_WEB_... | public String getHandledExceptionList() { String webXmlPath = pathResolver.getIdentifier( LogicalPath.getInstance(Path.SRC_MAIN_WEBAPP, ""), WEB_MVC_CONFIG); Validate.isTrue(fileManager.exists(webXmlPath), WEB_MVC_CONFIG_NOT_FOUND); MutableFile webXmlMutableFile = null; Document webXml; try { webXmlMutableFile = fileMa... | WebExceptionHandlerOperationsImpl implements
WebExceptionHandlerOperations { public String getHandledExceptionList() { String webXmlPath = pathResolver.getIdentifier( LogicalPath.getInstance(Path.SRC_MAIN_WEBAPP, ""), WEB_MVC_CONFIG); Validate.isTrue(fileManager.exists(webXmlPath), WEB_MVC_CONFIG_NOT_FOUND); Mu... | WebExceptionHandlerOperationsImpl implements
WebExceptionHandlerOperations { public String getHandledExceptionList() { String webXmlPath = pathResolver.getIdentifier( LogicalPath.getInstance(Path.SRC_MAIN_WEBAPP, ""), WEB_MVC_CONFIG); Validate.isTrue(fileManager.exists(webXmlPath), WEB_MVC_CONFIG_NOT_FOUND); Mu... | WebExceptionHandlerOperationsImpl implements
WebExceptionHandlerOperations { public String getHandledExceptionList() { String webXmlPath = pathResolver.getIdentifier( LogicalPath.getInstance(Path.SRC_MAIN_WEBAPP, ""), WEB_MVC_CONFIG); Validate.isTrue(fileManager.exists(webXmlPath), WEB_MVC_CONFIG_NOT_FOUND); Mu... | WebExceptionHandlerOperationsImpl implements
WebExceptionHandlerOperations { public String getHandledExceptionList() { String webXmlPath = pathResolver.getIdentifier( LogicalPath.getInstance(Path.SRC_MAIN_WEBAPP, ""), WEB_MVC_CONFIG); Validate.isTrue(fileManager.exists(webXmlPath), WEB_MVC_CONFIG_NOT_FOUND); Mu... |
@Test public void testUpdateWebMvcConfig() throws Exception { String result; String expected; String exceptionName; String exceptionJspxPath; exceptionName = "java.lang.Exception"; expected = "Exception"; exceptionJspxPath = EXC_JSPX_PATH.concat( StringUtils.uncapitalize(expected)).concat(".jspx"); expect( pathResolver... | protected String updateWebMvcConfig(String exceptionName) { String webXmlPath = pathResolver.getIdentifier( LogicalPath.getInstance(Path.SRC_MAIN_WEBAPP, ""), WEB_MVC_CONFIG); Validate.isTrue(fileManager.exists(webXmlPath), WEB_MVC_CONFIG_NOT_FOUND); MutableFile webXmlMutableFile = null; Document webXml; try { webXmlMu... | WebExceptionHandlerOperationsImpl implements
WebExceptionHandlerOperations { protected String updateWebMvcConfig(String exceptionName) { String webXmlPath = pathResolver.getIdentifier( LogicalPath.getInstance(Path.SRC_MAIN_WEBAPP, ""), WEB_MVC_CONFIG); Validate.isTrue(fileManager.exists(webXmlPath), WEB_MVC_CON... | WebExceptionHandlerOperationsImpl implements
WebExceptionHandlerOperations { protected String updateWebMvcConfig(String exceptionName) { String webXmlPath = pathResolver.getIdentifier( LogicalPath.getInstance(Path.SRC_MAIN_WEBAPP, ""), WEB_MVC_CONFIG); Validate.isTrue(fileManager.exists(webXmlPath), WEB_MVC_CON... | WebExceptionHandlerOperationsImpl implements
WebExceptionHandlerOperations { protected String updateWebMvcConfig(String exceptionName) { String webXmlPath = pathResolver.getIdentifier( LogicalPath.getInstance(Path.SRC_MAIN_WEBAPP, ""), WEB_MVC_CONFIG); Validate.isTrue(fileManager.exists(webXmlPath), WEB_MVC_CON... | WebExceptionHandlerOperationsImpl implements
WebExceptionHandlerOperations { protected String updateWebMvcConfig(String exceptionName) { String webXmlPath = pathResolver.getIdentifier( LogicalPath.getInstance(Path.SRC_MAIN_WEBAPP, ""), WEB_MVC_CONFIG); Validate.isTrue(fileManager.exists(webXmlPath), WEB_MVC_CON... |
@Test public void testGetLocalName() throws Exception { assertEquals("address", WsdlParserUtils.getLocalName("soap:address")); } | protected static String getLocalName(String elementName) { Validate.notNull(elementName, "Element name required"); return elementName.replaceFirst(getNamespace(elementName) + NAMESPACE_SEPARATOR, ""); } | WsdlParserUtils { protected static String getLocalName(String elementName) { Validate.notNull(elementName, "Element name required"); return elementName.replaceFirst(getNamespace(elementName) + NAMESPACE_SEPARATOR, ""); } } | WsdlParserUtils { protected static String getLocalName(String elementName) { Validate.notNull(elementName, "Element name required"); return elementName.replaceFirst(getNamespace(elementName) + NAMESPACE_SEPARATOR, ""); } } | WsdlParserUtils { protected static String getLocalName(String elementName) { Validate.notNull(elementName, "Element name required"); return elementName.replaceFirst(getNamespace(elementName) + NAMESPACE_SEPARATOR, ""); } static String getTargetNamespace(Element root); static String getTargetNamespaceRelatedPackage(Ele... | WsdlParserUtils { protected static String getLocalName(String elementName) { Validate.notNull(elementName, "Element name required"); return elementName.replaceFirst(getNamespace(elementName) + NAMESPACE_SEPARATOR, ""); } static String getTargetNamespace(Element root); static String getTargetNamespaceRelatedPackage(Ele... |
@Test public void testGetNamespace() throws Exception { assertEquals("soap", WsdlParserUtils.getNamespace("soap:address")); } | protected static String getNamespace(String elementName) { Validate.notNull(elementName, "Element name required"); String prefix = ""; int index = elementName.indexOf(NAMESPACE_SEPARATOR); if (index != -1) { prefix = elementName.substring(0, index); } return prefix; } | WsdlParserUtils { protected static String getNamespace(String elementName) { Validate.notNull(elementName, "Element name required"); String prefix = ""; int index = elementName.indexOf(NAMESPACE_SEPARATOR); if (index != -1) { prefix = elementName.substring(0, index); } return prefix; } } | WsdlParserUtils { protected static String getNamespace(String elementName) { Validate.notNull(elementName, "Element name required"); String prefix = ""; int index = elementName.indexOf(NAMESPACE_SEPARATOR); if (index != -1) { prefix = elementName.substring(0, index); } return prefix; } } | WsdlParserUtils { protected static String getNamespace(String elementName) { Validate.notNull(elementName, "Element name required"); String prefix = ""; int index = elementName.indexOf(NAMESPACE_SEPARATOR); if (index != -1) { prefix = elementName.substring(0, index); } return prefix; } static String getTargetNamespace... | WsdlParserUtils { protected static String getNamespace(String elementName) { Validate.notNull(elementName, "Element name required"); String prefix = ""; int index = elementName.indexOf(NAMESPACE_SEPARATOR); if (index != -1) { prefix = elementName.substring(0, index); } return prefix; } static String getTargetNamespace... |
@Test public void testGetTargetNamespaceRelatedPackage() throws Exception { Document wsdl = XmlUtils.getDocumentBuilder().parse(TEMP_CONVERT_WSDL); Element root = wsdl.getDocumentElement(); assertEquals("com.w3schools.www.webservices.", WsdlParserUtils.getTargetNamespaceRelatedPackage(root)); File file = new File(SRC_T... | public static String getTargetNamespaceRelatedPackage(Element root) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String namespace = getTargetNamespace(root); String pkg = getTargetNamespaceRelatedPackage(namespace, root) .toLowerCase(); pkg = pkg.replace('_', 'u'); return pkg.concat("."); } | WsdlParserUtils { public static String getTargetNamespaceRelatedPackage(Element root) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String namespace = getTargetNamespace(root); String pkg = getTargetNamespaceRelatedPackage(namespace, root) .toLowerCase(); pkg = pkg.replace('_', 'u'); return pkg.concat("."); } } | WsdlParserUtils { public static String getTargetNamespaceRelatedPackage(Element root) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String namespace = getTargetNamespace(root); String pkg = getTargetNamespaceRelatedPackage(namespace, root) .toLowerCase(); pkg = pkg.replace('_', 'u'); return pkg.concat("."); } } | WsdlParserUtils { public static String getTargetNamespaceRelatedPackage(Element root) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String namespace = getTargetNamespace(root); String pkg = getTargetNamespaceRelatedPackage(namespace, root) .toLowerCase(); pkg = pkg.replace('_', 'u'); return pkg.concat("."); } stati... | WsdlParserUtils { public static String getTargetNamespaceRelatedPackage(Element root) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String namespace = getTargetNamespace(root); String pkg = getTargetNamespaceRelatedPackage(namespace, root) .toLowerCase(); pkg = pkg.replace('_', 'u'); return pkg.concat("."); } stati... |
@Test public void testGetServiceClassPath() throws Exception { Document wsdl = XmlUtils.getDocumentBuilder().parse(TEMP_CONVERT_WSDL); Element root = wsdl.getDocumentElement(); assertEquals("com.w3schools.www.webservices.TempConvert", WsdlParserUtils.getServiceClassPath(root, WsType.IMPORT)); File file = new File(SRC_T... | public static String getServiceClassPath(Element root, WsType sense) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String path = getTargetNamespaceRelatedPackage(root); String name = findFirstCompatibleServiceClassName(root, sense); if (sense.equals(WsType.IMPORT_RPC_ENCODED)) { name = name.concat("Locator"); } retu... | WsdlParserUtils { public static String getServiceClassPath(Element root, WsType sense) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String path = getTargetNamespaceRelatedPackage(root); String name = findFirstCompatibleServiceClassName(root, sense); if (sense.equals(WsType.IMPORT_RPC_ENCODED)) { name = name.concat(... | WsdlParserUtils { public static String getServiceClassPath(Element root, WsType sense) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String path = getTargetNamespaceRelatedPackage(root); String name = findFirstCompatibleServiceClassName(root, sense); if (sense.equals(WsType.IMPORT_RPC_ENCODED)) { name = name.concat(... | WsdlParserUtils { public static String getServiceClassPath(Element root, WsType sense) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String path = getTargetNamespaceRelatedPackage(root); String name = findFirstCompatibleServiceClassName(root, sense); if (sense.equals(WsType.IMPORT_RPC_ENCODED)) { name = name.concat(... | WsdlParserUtils { public static String getServiceClassPath(Element root, WsType sense) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String path = getTargetNamespaceRelatedPackage(root); String name = findFirstCompatibleServiceClassName(root, sense); if (sense.equals(WsType.IMPORT_RPC_ENCODED)) { name = name.concat(... |
@Test public void testGetPortTypeClassPath() throws Exception { Document wsdl = XmlUtils.getDocumentBuilder().parse(TEMP_CONVERT_WSDL); Element root = wsdl.getDocumentElement(); assertEquals("com.w3schools.www.webservices.TempConvertSoap", WsdlParserUtils.getPortTypeClassPath(root, WsType.IMPORT)); wsdl = XmlUtils.getD... | public static String getPortTypeClassPath(Element root, WsType sense) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String path = getTargetNamespaceRelatedPackage(root); String portType = findFirstCompatiblePortTypeClassName(root, sense); String port = findFirstCompatiblePortClassName(root, sense); if (WsType.IMPORT... | WsdlParserUtils { public static String getPortTypeClassPath(Element root, WsType sense) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String path = getTargetNamespaceRelatedPackage(root); String portType = findFirstCompatiblePortTypeClassName(root, sense); String port = findFirstCompatiblePortClassName(root, sense);... | WsdlParserUtils { public static String getPortTypeClassPath(Element root, WsType sense) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String path = getTargetNamespaceRelatedPackage(root); String portType = findFirstCompatiblePortTypeClassName(root, sense); String port = findFirstCompatiblePortClassName(root, sense);... | WsdlParserUtils { public static String getPortTypeClassPath(Element root, WsType sense) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String path = getTargetNamespaceRelatedPackage(root); String portType = findFirstCompatiblePortTypeClassName(root, sense); String port = findFirstCompatiblePortClassName(root, sense);... | WsdlParserUtils { public static String getPortTypeClassPath(Element root, WsType sense) { Validate.notNull(root, ROOT_ELEMENT_REQUIRED); String path = getTargetNamespaceRelatedPackage(root); String portType = findFirstCompatiblePortTypeClassName(root, sense); String port = findFirstCompatiblePortClassName(root, sense);... |
@Test public void testConvertPackageToTargetNamespace() throws Exception { String packageName = "org.gvnix.service.roo.addon"; String targetNamespaceExpected = "http: String targetNamespaceResult; targetNamespaceResult = wSConfigServiceImpl .convertPackageToTargetNamespace(packageName); Validate.isTrue( targetNamespace... | public String convertPackageToTargetNamespace(String packageName) { if (!StringUtils.isNotBlank(packageName)) { return ""; } String[] delimitedString = StringUtils.split(packageName, "."); List<String> revertedList = new ArrayList<String>(); String revertedString; for (int i = delimitedString.length - 1; i >= 0; i--) {... | WSConfigServiceImpl implements WSConfigService { public String convertPackageToTargetNamespace(String packageName) { if (!StringUtils.isNotBlank(packageName)) { return ""; } String[] delimitedString = StringUtils.split(packageName, "."); List<String> revertedList = new ArrayList<String>(); String revertedString; for (i... | WSConfigServiceImpl implements WSConfigService { public String convertPackageToTargetNamespace(String packageName) { if (!StringUtils.isNotBlank(packageName)) { return ""; } String[] delimitedString = StringUtils.split(packageName, "."); List<String> revertedList = new ArrayList<String>(); String revertedString; for (i... | WSConfigServiceImpl implements WSConfigService { public String convertPackageToTargetNamespace(String packageName) { if (!StringUtils.isNotBlank(packageName)) { return ""; } String[] delimitedString = StringUtils.split(packageName, "."); List<String> revertedList = new ArrayList<String>(); String revertedString; for (i... | WSConfigServiceImpl implements WSConfigService { public String convertPackageToTargetNamespace(String packageName) { if (!StringUtils.isNotBlank(packageName)) { return ""; } String[] delimitedString = StringUtils.split(packageName, "."); List<String> revertedList = new ArrayList<String>(); String revertedString; for (i... |
@Test public void swiftTest() { String withoutReplacement = "a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, " + "J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.,:'+-/()?"; String replaceSwift = Iso20022Util.replaceSwift(withoutRe... | @Nullable @Contract("!null->!null; null->null;") public static String replaceSwift(@Nullable String text) { if (null == text) { return null; } String result = text; for (String[] swiftReplacement : SWIFT_REPLACEMENTS) { result = result.replace(swiftReplacement[0], swiftReplacement[1]); } result = SWIFT_EXCLUDE_PATTERN.... | Iso20022Util { @Nullable @Contract("!null->!null; null->null;") public static String replaceSwift(@Nullable String text) { if (null == text) { return null; } String result = text; for (String[] swiftReplacement : SWIFT_REPLACEMENTS) { result = result.replace(swiftReplacement[0], swiftReplacement[1]); } result = SWIFT_E... | Iso20022Util { @Nullable @Contract("!null->!null; null->null;") public static String replaceSwift(@Nullable String text) { if (null == text) { return null; } String result = text; for (String[] swiftReplacement : SWIFT_REPLACEMENTS) { result = result.replace(swiftReplacement[0], swiftReplacement[1]); } result = SWIFT_E... | Iso20022Util { @Nullable @Contract("!null->!null; null->null;") public static String replaceSwift(@Nullable String text) { if (null == text) { return null; } String result = text; for (String[] swiftReplacement : SWIFT_REPLACEMENTS) { result = result.replace(swiftReplacement[0], swiftReplacement[1]); } result = SWIFT_E... | Iso20022Util { @Nullable @Contract("!null->!null; null->null;") public static String replaceSwift(@Nullable String text) { if (null == text) { return null; } String result = text; for (String[] swiftReplacement : SWIFT_REPLACEMENTS) { result = result.replace(swiftReplacement[0], swiftReplacement[1]); } result = SWIFT_E... |
@Test public void validateXmlWithXsdSuccessTest() { assertTrue(CamtUtil.isMatchingXsdSchema(readXml(VALID_CAMT53_XML), CAMT053V00104.getXsdPath())); assertTrue(CamtUtil.isMatchingXsdSchema(readXml(VALID_CAMT54_XML), CAMT054V00104.getXsdPath())); } | public static boolean isMatchingXsdSchema(byte[] xmlAsBytes, @Nonnull String pathToXsd) { try (ByteArrayInputStream xmlAsStream = new ByteArrayInputStream(xmlAsBytes); InputStream xsdAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(pathToXsd)) { SchemaFactory factory = SchemaFactory.newInst... | CamtUtil { public static boolean isMatchingXsdSchema(byte[] xmlAsBytes, @Nonnull String pathToXsd) { try (ByteArrayInputStream xmlAsStream = new ByteArrayInputStream(xmlAsBytes); InputStream xsdAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(pathToXsd)) { SchemaFactory factory = SchemaFact... | CamtUtil { public static boolean isMatchingXsdSchema(byte[] xmlAsBytes, @Nonnull String pathToXsd) { try (ByteArrayInputStream xmlAsStream = new ByteArrayInputStream(xmlAsBytes); InputStream xsdAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(pathToXsd)) { SchemaFactory factory = SchemaFact... | CamtUtil { public static boolean isMatchingXsdSchema(byte[] xmlAsBytes, @Nonnull String pathToXsd) { try (ByteArrayInputStream xmlAsStream = new ByteArrayInputStream(xmlAsBytes); InputStream xsdAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(pathToXsd)) { SchemaFactory factory = SchemaFact... | CamtUtil { public static boolean isMatchingXsdSchema(byte[] xmlAsBytes, @Nonnull String pathToXsd) { try (ByteArrayInputStream xmlAsStream = new ByteArrayInputStream(xmlAsBytes); InputStream xsdAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(pathToXsd)) { SchemaFactory factory = SchemaFact... |
@Test public void validateXmlWithXsdFailureTest() { byte[] bytes = readXml(INVALID_XML); assertFalse(CamtUtil.isMatchingXsdSchema(bytes, CAMT054V00104.getXsdPath())); assertFalse(CamtUtil.isMatchingXsdSchema(readXml(VALID_CAMT53_XML), CAMT054V00104.getXsdPath())); assertFalse(CamtUtil.isMatchingXsdSchema(readXml(VALID_... | public static boolean isMatchingXsdSchema(byte[] xmlAsBytes, @Nonnull String pathToXsd) { try (ByteArrayInputStream xmlAsStream = new ByteArrayInputStream(xmlAsBytes); InputStream xsdAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(pathToXsd)) { SchemaFactory factory = SchemaFactory.newInst... | CamtUtil { public static boolean isMatchingXsdSchema(byte[] xmlAsBytes, @Nonnull String pathToXsd) { try (ByteArrayInputStream xmlAsStream = new ByteArrayInputStream(xmlAsBytes); InputStream xsdAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(pathToXsd)) { SchemaFactory factory = SchemaFact... | CamtUtil { public static boolean isMatchingXsdSchema(byte[] xmlAsBytes, @Nonnull String pathToXsd) { try (ByteArrayInputStream xmlAsStream = new ByteArrayInputStream(xmlAsBytes); InputStream xsdAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(pathToXsd)) { SchemaFactory factory = SchemaFact... | CamtUtil { public static boolean isMatchingXsdSchema(byte[] xmlAsBytes, @Nonnull String pathToXsd) { try (ByteArrayInputStream xmlAsStream = new ByteArrayInputStream(xmlAsBytes); InputStream xsdAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(pathToXsd)) { SchemaFactory factory = SchemaFact... | CamtUtil { public static boolean isMatchingXsdSchema(byte[] xmlAsBytes, @Nonnull String pathToXsd) { try (ByteArrayInputStream xmlAsStream = new ByteArrayInputStream(xmlAsBytes); InputStream xsdAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(pathToXsd)) { SchemaFactory factory = SchemaFact... |
@Test public void detectDetectCamtTypeVersionTest() { assertEquals(CAMT053V00104, CamtUtil.detectCamtTypeVersion(readXml(VALID_CAMT53_XML))); assertEquals(CAMT054V00104, CamtUtil.detectCamtTypeVersion(readXml(VALID_CAMT54_XML))); } | @Nonnull public static CamtTypeVersion detectCamtTypeVersion(@Nonnull byte[] xmlAsBytes) throws Iso20022RuntimeException { return Arrays.stream(CamtTypeVersion.values()) .filter(type -> isMatchingXsdSchema(xmlAsBytes, type.getXsdPath())) .findAny() .orElseThrow(() -> new Iso20022RuntimeException("Cannot process input. ... | CamtUtil { @Nonnull public static CamtTypeVersion detectCamtTypeVersion(@Nonnull byte[] xmlAsBytes) throws Iso20022RuntimeException { return Arrays.stream(CamtTypeVersion.values()) .filter(type -> isMatchingXsdSchema(xmlAsBytes, type.getXsdPath())) .findAny() .orElseThrow(() -> new Iso20022RuntimeException("Cannot proc... | CamtUtil { @Nonnull public static CamtTypeVersion detectCamtTypeVersion(@Nonnull byte[] xmlAsBytes) throws Iso20022RuntimeException { return Arrays.stream(CamtTypeVersion.values()) .filter(type -> isMatchingXsdSchema(xmlAsBytes, type.getXsdPath())) .findAny() .orElseThrow(() -> new Iso20022RuntimeException("Cannot proc... | CamtUtil { @Nonnull public static CamtTypeVersion detectCamtTypeVersion(@Nonnull byte[] xmlAsBytes) throws Iso20022RuntimeException { return Arrays.stream(CamtTypeVersion.values()) .filter(type -> isMatchingXsdSchema(xmlAsBytes, type.getXsdPath())) .findAny() .orElseThrow(() -> new Iso20022RuntimeException("Cannot proc... | CamtUtil { @Nonnull public static CamtTypeVersion detectCamtTypeVersion(@Nonnull byte[] xmlAsBytes) throws Iso20022RuntimeException { return Arrays.stream(CamtTypeVersion.values()) .filter(type -> isMatchingXsdSchema(xmlAsBytes, type.getXsdPath())) .findAny() .orElseThrow(() -> new Iso20022RuntimeException("Cannot proc... |
@Test public void testNumberOfDigits() { assertThat(FormatUtil.numberOfDigits(0)).isEqualTo(1); assertThat(FormatUtil.numberOfDigits(1)).isEqualTo(1); assertThat(FormatUtil.numberOfDigits(5)).isEqualTo(1); assertThat(FormatUtil.numberOfDigits(10)).isEqualTo(2); assertThat(FormatUtil.numberOfDigits(99)).isEqualTo(2); as... | static int numberOfDigits(long l) { if (l == 0) { return 1; } return ((int) Math.ceil(Math.log10(l + 0.5))); } | FormatUtil { static int numberOfDigits(long l) { if (l == 0) { return 1; } return ((int) Math.ceil(Math.log10(l + 0.5))); } } | FormatUtil { static int numberOfDigits(long l) { if (l == 0) { return 1; } return ((int) Math.ceil(Math.log10(l + 0.5))); } private FormatUtil(); } | FormatUtil { static int numberOfDigits(long l) { if (l == 0) { return 1; } return ((int) Math.ceil(Math.log10(l + 0.5))); } private FormatUtil(); static void padRight(StringBuilder buf, char c, int count); } | FormatUtil { static int numberOfDigits(long l) { if (l == 0) { return 1; } return ((int) Math.ceil(Math.log10(l + 0.5))); } private FormatUtil(); static void padRight(StringBuilder buf, char c, int count); } |
@Test public void testRunWithUserNameFilter() { SmallFilesReportCommand command = new SmallFilesReportCommand(); command.mainCommand = new HdfsFSImageTool.MainCommand(); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (PrintStream printStream = new PrintStream(byteArrayOutputStream)... | @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.debug("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageData, dir); log.info("Visiting directory {} finished [{}ms]... | SmallFilesReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.debug("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageDat... | SmallFilesReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.debug("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageDat... | SmallFilesReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.debug("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageDat... | SmallFilesReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.debug("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageDat... |
@Test public void testComputeBucketUpperBorders() { SizeBucket sizeBucket = new SizeBucket(); assertThat(sizeBucket.computeBucketUpperBorders()).isEqualTo(new long[]{0 }); sizeBucket.add(1024L); assertThat(sizeBucket.computeBucketUpperBorders()).isEqualTo(new long[]{0, 1024L * 1024L }); } | public long[] computeBucketUpperBorders() { return getBucketModel().computeBucketUpperBorders(findMaxNumBucket()); } | SizeBucket { public long[] computeBucketUpperBorders() { return getBucketModel().computeBucketUpperBorders(findMaxNumBucket()); } } | SizeBucket { public long[] computeBucketUpperBorders() { return getBucketModel().computeBucketUpperBorders(findMaxNumBucket()); } SizeBucket(); SizeBucket(BucketModel bucketModel); } | SizeBucket { public long[] computeBucketUpperBorders() { return getBucketModel().computeBucketUpperBorders(findMaxNumBucket()); } SizeBucket(); SizeBucket(BucketModel bucketModel); void add(long size); long[] computeBucketUpperBorders(); int findMaxNumBucket(); long getBucketCounter(int bucket); long[] get(); int size... | SizeBucket { public long[] computeBucketUpperBorders() { return getBucketModel().computeBucketUpperBorders(findMaxNumBucket()); } SizeBucket(); SizeBucket(BucketModel bucketModel); void add(long size); long[] computeBucketUpperBorders(); int findMaxNumBucket(); long getBucketCounter(int bucket); long[] get(); int size... |
@Test public void testParse() { for (int i = 0; i < formattedValues.length; i++) { assertThat(IECBinary.parse(formattedValues[i])).isEqualTo(rawValues[i]); } assertThat(IECBinary.parse("0")).isEqualTo(0); assertThat(IECBinary.parse("0B")).isEqualTo(0); assertThat(IECBinary.parse("1 KiB")).isEqualTo(1024); for (String v... | public static long parse(String formattedValue) { final Matcher matcher = PATTERN_VALUE_WITH_STORAGE_UNIT.matcher(formattedValue); if (!matcher.matches()) { throw new IllegalArgumentException("Expected pattern " + PATTERN_VALUE_WITH_STORAGE_UNIT.pattern() + " but got value <" + formattedValue + ">"); } long number = Lo... | IECBinary { public static long parse(String formattedValue) { final Matcher matcher = PATTERN_VALUE_WITH_STORAGE_UNIT.matcher(formattedValue); if (!matcher.matches()) { throw new IllegalArgumentException("Expected pattern " + PATTERN_VALUE_WITH_STORAGE_UNIT.pattern() + " but got value <" + formattedValue + ">"); } long... | IECBinary { public static long parse(String formattedValue) { final Matcher matcher = PATTERN_VALUE_WITH_STORAGE_UNIT.matcher(formattedValue); if (!matcher.matches()) { throw new IllegalArgumentException("Expected pattern " + PATTERN_VALUE_WITH_STORAGE_UNIT.pattern() + " but got value <" + formattedValue + ">"); } long... | IECBinary { public static long parse(String formattedValue) { final Matcher matcher = PATTERN_VALUE_WITH_STORAGE_UNIT.matcher(formattedValue); if (!matcher.matches()) { throw new IllegalArgumentException("Expected pattern " + PATTERN_VALUE_WITH_STORAGE_UNIT.pattern() + " but got value <" + formattedValue + ">"); } long... | IECBinary { public static long parse(String formattedValue) { final Matcher matcher = PATTERN_VALUE_WITH_STORAGE_UNIT.matcher(formattedValue); if (!matcher.matches()) { throw new IllegalArgumentException("Expected pattern " + PATTERN_VALUE_WITH_STORAGE_UNIT.pattern() + " but got value <" + formattedValue + ">"); } long... |
@Test public void testFormat() { for (int i = 0; i < formattedValues.length; i++) { assertThat(IECBinary.format(rawValues[i])).isEqualTo(formattedValues[i]); } assertThat(IECBinary.format(1024 + 512 - 1)).isEqualTo("1 KiB"); assertThat(IECBinary.format(1024 + 512)).isEqualTo("2 KiB"); } | public static String format(long numericalValue) { if (numericalValue < 1024) { return numericalValue + " B"; } int exp = (int) (Math.log(numericalValue) / Math.log(1024)); String pre = "KMGTPE".charAt(exp - 1) + "i"; return String.format("%.0f %sB", numericalValue / Math.pow(1024, exp), pre); } | IECBinary { public static String format(long numericalValue) { if (numericalValue < 1024) { return numericalValue + " B"; } int exp = (int) (Math.log(numericalValue) / Math.log(1024)); String pre = "KMGTPE".charAt(exp - 1) + "i"; return String.format("%.0f %sB", numericalValue / Math.pow(1024, exp), pre); } } | IECBinary { public static String format(long numericalValue) { if (numericalValue < 1024) { return numericalValue + " B"; } int exp = (int) (Math.log(numericalValue) / Math.log(1024)); String pre = "KMGTPE".charAt(exp - 1) + "i"; return String.format("%.0f %sB", numericalValue / Math.pow(1024, exp), pre); } private IE... | IECBinary { public static String format(long numericalValue) { if (numericalValue < 1024) { return numericalValue + " B"; } int exp = (int) (Math.log(numericalValue) / Math.log(1024)); String pre = "KMGTPE".charAt(exp - 1) + "i"; return String.format("%.0f %sB", numericalValue / Math.pow(1024, exp), pre); } private IE... | IECBinary { public static String format(long numericalValue) { if (numericalValue < 1024) { return numericalValue + " B"; } int exp = (int) (Math.log(numericalValue) / Math.log(1024)); String pre = "KMGTPE".charAt(exp - 1) + "i"; return String.format("%.0f %sB", numericalValue / Math.pow(1024, exp), pre); } private IE... |
@Test public void testLoadHadoop27xFsImage() throws IOException { try (RandomAccessFile file = new RandomAccessFile("src/test/resources/fsi_small_h2x.img", "r")) { final FsImageData hadoopV2xImage = new FsImageLoader.Builder().parallel().build().load(file); loadAndVisit(hadoopV2xImage, new FsVisitor.Builder()); } } | public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new FileInputStream(... | FsImageLoader { public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new ... | FsImageLoader { public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new ... | FsImageLoader { public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new ... | FsImageLoader { public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new ... |
@Test public void testLoadHadoop33xCompressedFsImage() throws IOException { try (RandomAccessFile file = new RandomAccessFile("src/test/resources/fsimage_d800_f210k_compressed.img", "r")) { final FsImageData hadoopV3xCompressedImage = new FsImageLoader.Builder().parallel().build().load(file); final CountingVisitor visi... | public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new FileInputStream(... | FsImageLoader { public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new ... | FsImageLoader { public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new ... | FsImageLoader { public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new ... | FsImageLoader { public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new ... |
@Test public void testLoadEmptyFSImage() throws IOException { try (RandomAccessFile file = new RandomAccessFile("src/test/resources/fsimage_0000000000000000000", "r")) { final FsImageData emptyImage = new FsImageLoader.Builder().build().load(file); AtomicBoolean rootVisited = new AtomicBoolean(false); new FsVisitor.Bui... | public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new FileInputStream(... | FsImageLoader { public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new ... | FsImageLoader { public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new ... | FsImageLoader { public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new ... | FsImageLoader { public FsImageData load(RandomAccessFile file) throws IOException { if (!FSImageUtil.checkFileFormat(file)) { throw new IOException("Unrecognized FSImage format (no magic header?)"); } FileSummary summary = FSImageUtil.loadSummary(file); String codec = summary.getCodec(); try (FileInputStream fin = new ... |
@Test public void testRun() { PathReportCommand pathReportCommand = new PathReportCommand(); pathReportCommand.mainCommand = new HdfsFSImageTool.MainCommand(); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (PrintStream printStream = new PrintStream(byteArrayOutputStream)) { pathRe... | @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { createReport(fsImageData); } } | PathReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { createReport(fsImageData); } } } | PathReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { createReport(fsImageData); } } } | PathReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { createReport(fsImageData); } } @Override void run(); } | PathReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { createReport(fsImageData); } } @Override void run(); } |
@Test public void testRunWithFilterForUserFoo() { PathReportCommand pathReportCommand = new PathReportCommand(); pathReportCommand.mainCommand = new HdfsFSImageTool.MainCommand(); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (PrintStream printStream = new PrintStream(byteArrayOut... | @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { createReport(fsImageData); } } | PathReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { createReport(fsImageData); } } } | PathReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { createReport(fsImageData); } } } | PathReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { createReport(fsImageData); } } @Override void run(); } | PathReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { createReport(fsImageData); } } @Override void run(); } |
@Test public void testVersion() { final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); HdfsFSImageTool.out = new PrintStream(byteArrayOutputStream); HdfsFSImageTool.err = HdfsFSImageTool.out; HdfsFSImageTool.run(new String[]{"-V"}); Pattern pattern = Pattern.compile("Version 1\\..*\n" + "Bui... | protected static int run(String[] args) { final IExecutionExceptionHandler exceptionHandler = (ex, commandLine, parseResult) -> { commandLine.getErr().println(commandLine.getColorScheme().errorText(ex.getMessage())); if (getRootLogger().isInfoEnabled()) { commandLine.getErr().println("Exiting - use option [-v] for more... | HdfsFSImageTool { protected static int run(String[] args) { final IExecutionExceptionHandler exceptionHandler = (ex, commandLine, parseResult) -> { commandLine.getErr().println(commandLine.getColorScheme().errorText(ex.getMessage())); if (getRootLogger().isInfoEnabled()) { commandLine.getErr().println("Exiting - use op... | HdfsFSImageTool { protected static int run(String[] args) { final IExecutionExceptionHandler exceptionHandler = (ex, commandLine, parseResult) -> { commandLine.getErr().println(commandLine.getColorScheme().errorText(ex.getMessage())); if (getRootLogger().isInfoEnabled()) { commandLine.getErr().println("Exiting - use op... | HdfsFSImageTool { protected static int run(String[] args) { final IExecutionExceptionHandler exceptionHandler = (ex, commandLine, parseResult) -> { commandLine.getErr().println(commandLine.getColorScheme().errorText(ex.getMessage())); if (getRootLogger().isInfoEnabled()) { commandLine.getErr().println("Exiting - use op... | HdfsFSImageTool { protected static int run(String[] args) { final IExecutionExceptionHandler exceptionHandler = (ex, commandLine, parseResult) -> { commandLine.getErr().println(commandLine.getColorScheme().errorText(ex.getMessage())); if (getRootLogger().isInfoEnabled()) { commandLine.getErr().println("Exiting - use op... |
@Test public void testHelp() { final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); HdfsFSImageTool.out = new PrintStream(byteArrayOutputStream); HdfsFSImageTool.err = HdfsFSImageTool.out; HdfsFSImageTool.run(new String[]{"-h"}); assertThat(byteArrayOutputStream.toString()) .isEqualTo("Analy... | protected static int run(String[] args) { final IExecutionExceptionHandler exceptionHandler = (ex, commandLine, parseResult) -> { commandLine.getErr().println(commandLine.getColorScheme().errorText(ex.getMessage())); if (getRootLogger().isInfoEnabled()) { commandLine.getErr().println("Exiting - use option [-v] for more... | HdfsFSImageTool { protected static int run(String[] args) { final IExecutionExceptionHandler exceptionHandler = (ex, commandLine, parseResult) -> { commandLine.getErr().println(commandLine.getColorScheme().errorText(ex.getMessage())); if (getRootLogger().isInfoEnabled()) { commandLine.getErr().println("Exiting - use op... | HdfsFSImageTool { protected static int run(String[] args) { final IExecutionExceptionHandler exceptionHandler = (ex, commandLine, parseResult) -> { commandLine.getErr().println(commandLine.getColorScheme().errorText(ex.getMessage())); if (getRootLogger().isInfoEnabled()) { commandLine.getErr().println("Exiting - use op... | HdfsFSImageTool { protected static int run(String[] args) { final IExecutionExceptionHandler exceptionHandler = (ex, commandLine, parseResult) -> { commandLine.getErr().println(commandLine.getColorScheme().errorText(ex.getMessage())); if (getRootLogger().isInfoEnabled()) { commandLine.getErr().println("Exiting - use op... | HdfsFSImageTool { protected static int run(String[] args) { final IExecutionExceptionHandler exceptionHandler = (ex, commandLine, parseResult) -> { commandLine.getErr().println(commandLine.getColorScheme().errorText(ex.getMessage())); if (getRootLogger().isInfoEnabled()) { commandLine.getErr().println("Exiting - use op... |
@Test public void testRun() { SummaryReportCommand summaryReportCommand = new SummaryReportCommand(); summaryReportCommand.mainCommand = new HdfsFSImageTool.MainCommand(); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (PrintStream printStream = new PrintStream(byteArrayOutputStrea... | @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.info("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageData, dir); log.info("Visiting finished [{}ms].", System.cur... | SummaryReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.info("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageData, d... | SummaryReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.info("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageData, d... | SummaryReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.info("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageData, d... | SummaryReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.info("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageData, d... |
@Test public void testRunWithFilterForUserFoo() { SummaryReportCommand summaryReportCommand = new SummaryReportCommand(); summaryReportCommand.mainCommand = new HdfsFSImageTool.MainCommand(); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (PrintStream printStream = new PrintStream(... | @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.info("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageData, dir); log.info("Visiting finished [{}ms].", System.cur... | SummaryReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.info("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageData, d... | SummaryReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.info("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageData, d... | SummaryReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.info("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageData, d... | SummaryReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.info("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageData, d... |
@Test public void testFilter() { final List<UserStats> list = Arrays.asList(new UserStats("foobar"), new UserStats("foo_bar"), new UserStats("fo_obar"), new UserStats("nofoobar")); String userNameFilter = "^foo.*"; List<UserStats> filtered = filterByUserName(list, userNameFilter); assertThat(filtered.size()).isEqualTo(... | static List<UserStats> filterByUserName(Collection<UserStats> userStats, String userNamePattern) { List<UserStats> filtered = new ArrayList<>(userStats); if (null != userNamePattern && !userNamePattern.isEmpty()) { Pattern pattern = Pattern.compile(userNamePattern); filtered.removeIf(u -> !pattern.matcher(u.userName).f... | SummaryReportCommand extends AbstractReportCommand { static List<UserStats> filterByUserName(Collection<UserStats> userStats, String userNamePattern) { List<UserStats> filtered = new ArrayList<>(userStats); if (null != userNamePattern && !userNamePattern.isEmpty()) { Pattern pattern = Pattern.compile(userNamePattern); ... | SummaryReportCommand extends AbstractReportCommand { static List<UserStats> filterByUserName(Collection<UserStats> userStats, String userNamePattern) { List<UserStats> filtered = new ArrayList<>(userStats); if (null != userNamePattern && !userNamePattern.isEmpty()) { Pattern pattern = Pattern.compile(userNamePattern); ... | SummaryReportCommand extends AbstractReportCommand { static List<UserStats> filterByUserName(Collection<UserStats> userStats, String userNamePattern) { List<UserStats> filtered = new ArrayList<>(userStats); if (null != userNamePattern && !userNamePattern.isEmpty()) { Pattern pattern = Pattern.compile(userNamePattern); ... | SummaryReportCommand extends AbstractReportCommand { static List<UserStats> filterByUserName(Collection<UserStats> userStats, String userNamePattern) { List<UserStats> filtered = new ArrayList<>(userStats); if (null != userNamePattern && !userNamePattern.isEmpty()) { Pattern pattern = Pattern.compile(userNamePattern); ... |
@Test public void testRun() { InodeInfoCommand infoCommand = new InodeInfoCommand(); infoCommand.mainCommand = new HdfsFSImageTool.MainCommand(); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (PrintStream printStream = new PrintStream(byteArrayOutputStream)) { infoCommand.mainComm... | @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String inodeId : inodeIds) { showInodeDetails(fsImageData, inodeId); } } } | InodeInfoCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String inodeId : inodeIds) { showInodeDetails(fsImageData, inodeId); } } } } | InodeInfoCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String inodeId : inodeIds) { showInodeDetails(fsImageData, inodeId); } } } } | InodeInfoCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String inodeId : inodeIds) { showInodeDetails(fsImageData, inodeId); } } } @Override void run(); } | InodeInfoCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String inodeId : inodeIds) { showInodeDetails(fsImageData, inodeId); } } } @Override void run(); } |
@Test public void testRun() { SmallFilesReportCommand command = new SmallFilesReportCommand(); command.mainCommand = new HdfsFSImageTool.MainCommand(); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (PrintStream printStream = new PrintStream(byteArrayOutputStream)) { command.mainCo... | @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.debug("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageData, dir); log.info("Visiting directory {} finished [{}ms]... | SmallFilesReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.debug("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageDat... | SmallFilesReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.debug("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageDat... | SmallFilesReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.debug("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageDat... | SmallFilesReportCommand extends AbstractReportCommand { @Override public void run() { final FsImageData fsImageData = loadFsImage(); if (null != fsImageData) { for (String dir : mainCommand.dirs) { log.debug("Visiting {} ...", dir); long start = System.currentTimeMillis(); final Report report = computeReport(fsImageDat... |
@Test public void testStatus_success() throws ApiException { when(statusApi.status()).thenReturn(new FirecloudSystemStatus()); assertThat(service.getFirecloudStatus()).isTrue(); } | @Override public boolean getFirecloudStatus() { try { statusApiProvider.get().status(); } catch (ApiException e) { log.log(Level.WARNING, "Firecloud status check request failed", e); String response = e.getResponseBody(); try { JSONObject errorBody = new JSONObject(response); JSONObject subSystemStatus = errorBody.getJ... | FireCloudServiceImpl implements FireCloudService { @Override public boolean getFirecloudStatus() { try { statusApiProvider.get().status(); } catch (ApiException e) { log.log(Level.WARNING, "Firecloud status check request failed", e); String response = e.getResponseBody(); try { JSONObject errorBody = new JSONObject(res... | FireCloudServiceImpl implements FireCloudService { @Override public boolean getFirecloudStatus() { try { statusApiProvider.get().status(); } catch (ApiException e) { log.log(Level.WARNING, "Firecloud status check request failed", e); String response = e.getResponseBody(); try { JSONObject errorBody = new JSONObject(res... | FireCloudServiceImpl implements FireCloudService { @Override public boolean getFirecloudStatus() { try { statusApiProvider.get().status(); } catch (ApiException e) { log.log(Level.WARNING, "Firecloud status check request failed", e); String response = e.getResponseBody(); try { JSONObject errorBody = new JSONObject(res... | FireCloudServiceImpl implements FireCloudService { @Override public boolean getFirecloudStatus() { try { statusApiProvider.get().status(); } catch (ApiException e) { log.log(Level.WARNING, "Firecloud status check request failed", e); String response = e.getResponseBody(); try { JSONObject errorBody = new JSONObject(res... |
@Test public void testLocalize_playgroundMode() throws org.pmiops.workbench.notebooks.ApiException { RuntimeLocalizeRequest req = new RuntimeLocalizeRequest() .notebookNames(ImmutableList.of("foo.ipynb")) .playgroundMode(true); stubGetWorkspace(WORKSPACE_NS, WORKSPACE_ID, LOGGED_IN_USER_EMAIL); RuntimeLocalizeResponse ... | @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.getWorkspaceNamespace(), dbWorkspace.getFirecloudNa... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... |
@Test public void testLocalize_differentNamespace() throws org.pmiops.workbench.notebooks.ApiException { RuntimeLocalizeRequest req = new RuntimeLocalizeRequest() .notebookNames(ImmutableList.of("foo.ipynb")) .playgroundMode(false); stubGetWorkspace(WORKSPACE_NS, WORKSPACE_ID, LOGGED_IN_USER_EMAIL); stubGetWorkspace("o... | @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.getWorkspaceNamespace(), dbWorkspace.getFirecloudNa... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... |
@Test public void testLocalize_noNotebooks() throws org.pmiops.workbench.notebooks.ApiException { RuntimeLocalizeRequest req = new RuntimeLocalizeRequest(); req.setPlaygroundMode(false); stubGetWorkspace(WORKSPACE_NS, WORKSPACE_ID, LOGGED_IN_USER_EMAIL); RuntimeLocalizeResponse resp = runtimeController.localize(BILLING... | @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.getWorkspaceNamespace(), dbWorkspace.getFirecloudNa... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... |
@Test public void getRuntime_validateActiveBilling() { doThrow(ForbiddenException.class) .when(mockWorkspaceService) .validateActiveBilling(WORKSPACE_NS, WORKSPACE_ID); assertThrows(ForbiddenException.class, () -> runtimeController.getRuntime(WORKSPACE_NS)); } | @Override public ResponseEntity<Runtime> getRuntime(String workspaceNamespace) { String firecloudWorkspaceName = lookupWorkspace(workspaceNamespace).getFirecloudName(); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( workspaceNamespace, firecloudWorkspaceName, WorkspaceAccessLevel.WRITER); workspac... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<Runtime> getRuntime(String workspaceNamespace) { String firecloudWorkspaceName = lookupWorkspace(workspaceNamespace).getFirecloudName(); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( workspaceNamespace, firecloudWor... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<Runtime> getRuntime(String workspaceNamespace) { String firecloudWorkspaceName = lookupWorkspace(workspaceNamespace).getFirecloudName(); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( workspaceNamespace, firecloudWor... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<Runtime> getRuntime(String workspaceNamespace) { String firecloudWorkspaceName = lookupWorkspace(workspaceNamespace).getFirecloudName(); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( workspaceNamespace, firecloudWor... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<Runtime> getRuntime(String workspaceNamespace) { String firecloudWorkspaceName = lookupWorkspace(workspaceNamespace).getFirecloudName(); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( workspaceNamespace, firecloudWor... |
@Test public void getRuntime_validateActiveBilling_checkAccessFirst() { doThrow(ForbiddenException.class) .when(mockWorkspaceService) .enforceWorkspaceAccessLevelAndRegisteredAuthDomain( WORKSPACE_NS, WORKSPACE_ID, WorkspaceAccessLevel.WRITER); assertThrows(ForbiddenException.class, () -> runtimeController.getRuntime(W... | @Override public ResponseEntity<Runtime> getRuntime(String workspaceNamespace) { String firecloudWorkspaceName = lookupWorkspace(workspaceNamespace).getFirecloudName(); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( workspaceNamespace, firecloudWorkspaceName, WorkspaceAccessLevel.WRITER); workspac... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<Runtime> getRuntime(String workspaceNamespace) { String firecloudWorkspaceName = lookupWorkspace(workspaceNamespace).getFirecloudName(); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( workspaceNamespace, firecloudWor... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<Runtime> getRuntime(String workspaceNamespace) { String firecloudWorkspaceName = lookupWorkspace(workspaceNamespace).getFirecloudName(); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( workspaceNamespace, firecloudWor... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<Runtime> getRuntime(String workspaceNamespace) { String firecloudWorkspaceName = lookupWorkspace(workspaceNamespace).getFirecloudName(); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( workspaceNamespace, firecloudWor... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<Runtime> getRuntime(String workspaceNamespace) { String firecloudWorkspaceName = lookupWorkspace(workspaceNamespace).getFirecloudName(); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( workspaceNamespace, firecloudWor... |
@Test public void localize_validateActiveBilling() { doThrow(ForbiddenException.class) .when(mockWorkspaceService) .validateActiveBilling(WORKSPACE_NS, WORKSPACE_ID); RuntimeLocalizeRequest req = new RuntimeLocalizeRequest(); assertThrows(ForbiddenException.class, () -> runtimeController.localize(WORKSPACE_NS, req)); } | @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.getWorkspaceNamespace(), dbWorkspace.getFirecloudNa... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... |
@Test public void localize_validateActiveBilling_checkAccessFirst() { doThrow(ForbiddenException.class) .when(mockWorkspaceService) .enforceWorkspaceAccessLevelAndRegisteredAuthDomain( WORKSPACE_NS, WORKSPACE_ID, WorkspaceAccessLevel.WRITER); RuntimeLocalizeRequest req = new RuntimeLocalizeRequest(); assertThrows(Forbi... | @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.getWorkspaceNamespace(), dbWorkspace.getFirecloudNa... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... | RuntimeController implements RuntimeApiDelegate { @Override public ResponseEntity<RuntimeLocalizeResponse> localize( String workspaceNamespace, RuntimeLocalizeRequest body) { DbWorkspace dbWorkspace = lookupWorkspace(workspaceNamespace); workspaceService.enforceWorkspaceAccessLevelAndRegisteredAuthDomain( dbWorkspace.g... |
@Test public void findDomainInfos() { cbCriteriaDao.save( DbCriteria.builder() .addDomainId(DomainType.CONDITION.toString()) .addType(CriteriaType.ICD9CM.toString()) .addCount(0L) .addHierarchy(true) .addStandard(false) .addParentId(0) .addFullText("term*[CONDITION_rank1]") .build()); DbDomainInfo dbDomainInfo = domain... | @Override public ResponseEntity<DomainInfoResponse> findDomainInfos(Long cdrVersionId, String term) { cdrVersionService.setCdrVersion(cdrVersionId); validateTerm(term); return ResponseEntity.ok( new DomainInfoResponse().items(cohortBuilderService.findDomainInfos(term))); } | CohortBuilderController implements CohortBuilderApiDelegate { @Override public ResponseEntity<DomainInfoResponse> findDomainInfos(Long cdrVersionId, String term) { cdrVersionService.setCdrVersion(cdrVersionId); validateTerm(term); return ResponseEntity.ok( new DomainInfoResponse().items(cohortBuilderService.findDomainI... | CohortBuilderController implements CohortBuilderApiDelegate { @Override public ResponseEntity<DomainInfoResponse> findDomainInfos(Long cdrVersionId, String term) { cdrVersionService.setCdrVersion(cdrVersionId); validateTerm(term); return ResponseEntity.ok( new DomainInfoResponse().items(cohortBuilderService.findDomainI... | CohortBuilderController implements CohortBuilderApiDelegate { @Override public ResponseEntity<DomainInfoResponse> findDomainInfos(Long cdrVersionId, String term) { cdrVersionService.setCdrVersion(cdrVersionId); validateTerm(term); return ResponseEntity.ok( new DomainInfoResponse().items(cohortBuilderService.findDomainI... | CohortBuilderController implements CohortBuilderApiDelegate { @Override public ResponseEntity<DomainInfoResponse> findDomainInfos(Long cdrVersionId, String term) { cdrVersionService.setCdrVersion(cdrVersionId); validateTerm(term); return ResponseEntity.ok( new DomainInfoResponse().items(cohortBuilderService.findDomainI... |
@Test public void findSurveyModules() { DbCriteria surveyCriteria = cbCriteriaDao.save( DbCriteria.builder() .addDomainId(DomainType.SURVEY.toString()) .addType(CriteriaType.PPI.toString()) .addSubtype(CriteriaSubType.QUESTION.toString()) .addCount(0L) .addHierarchy(true) .addStandard(false) .addParentId(0) .addConcept... | @Override public ResponseEntity<SurveysResponse> findSurveyModules(Long cdrVersionId, String term) { cdrVersionService.setCdrVersion(cdrVersionId); return ResponseEntity.ok( new SurveysResponse().items(cohortBuilderService.findSurveyModules(term))); } | CohortBuilderController implements CohortBuilderApiDelegate { @Override public ResponseEntity<SurveysResponse> findSurveyModules(Long cdrVersionId, String term) { cdrVersionService.setCdrVersion(cdrVersionId); return ResponseEntity.ok( new SurveysResponse().items(cohortBuilderService.findSurveyModules(term))); } } | CohortBuilderController implements CohortBuilderApiDelegate { @Override public ResponseEntity<SurveysResponse> findSurveyModules(Long cdrVersionId, String term) { cdrVersionService.setCdrVersion(cdrVersionId); return ResponseEntity.ok( new SurveysResponse().items(cohortBuilderService.findSurveyModules(term))); } @Autow... | CohortBuilderController implements CohortBuilderApiDelegate { @Override public ResponseEntity<SurveysResponse> findSurveyModules(Long cdrVersionId, String term) { cdrVersionService.setCdrVersion(cdrVersionId); return ResponseEntity.ok( new SurveysResponse().items(cohortBuilderService.findSurveyModules(term))); } @Autow... | CohortBuilderController implements CohortBuilderApiDelegate { @Override public ResponseEntity<SurveysResponse> findSurveyModules(Long cdrVersionId, String term) { cdrVersionService.setCdrVersion(cdrVersionId); return ResponseEntity.ok( new SurveysResponse().items(cohortBuilderService.findSurveyModules(term))); } @Autow... |
@Test public void findCriteriaBy() { DbCriteria icd9CriteriaParent = DbCriteria.builder() .addDomainId(DomainType.CONDITION.toString()) .addType(CriteriaType.ICD9CM.toString()) .addCount(0L) .addHierarchy(true) .addStandard(false) .addParentId(0L) .build(); cbCriteriaDao.save(icd9CriteriaParent); DbCriteria icd9Criteri... | @Override public ResponseEntity<CriteriaListResponse> findCriteriaBy( Long cdrVersionId, String domain, String type, Boolean standard, Long parentId) { cdrVersionService.setCdrVersion(cdrVersionId); validateDomain(domain); validateType(type); return ResponseEntity.ok( new CriteriaListResponse() .items(cohortBuilderServ... | CohortBuilderController implements CohortBuilderApiDelegate { @Override public ResponseEntity<CriteriaListResponse> findCriteriaBy( Long cdrVersionId, String domain, String type, Boolean standard, Long parentId) { cdrVersionService.setCdrVersion(cdrVersionId); validateDomain(domain); validateType(type); return Response... | CohortBuilderController implements CohortBuilderApiDelegate { @Override public ResponseEntity<CriteriaListResponse> findCriteriaBy( Long cdrVersionId, String domain, String type, Boolean standard, Long parentId) { cdrVersionService.setCdrVersion(cdrVersionId); validateDomain(domain); validateType(type); return Response... | CohortBuilderController implements CohortBuilderApiDelegate { @Override public ResponseEntity<CriteriaListResponse> findCriteriaBy( Long cdrVersionId, String domain, String type, Boolean standard, Long parentId) { cdrVersionService.setCdrVersion(cdrVersionId); validateDomain(domain); validateType(type); return Response... | CohortBuilderController implements CohortBuilderApiDelegate { @Override public ResponseEntity<CriteriaListResponse> findCriteriaBy( Long cdrVersionId, String domain, String type, Boolean standard, Long parentId) { cdrVersionService.setCdrVersion(cdrVersionId); validateDomain(domain); validateType(type); return Response... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.