components/src/test/java/eu/internetofus/common/components/profile_manager/WeNetProfileManagerTestCase.java
/**
   * Should Add get delete and get social network relationships.
   *
   * @param vertx       that contains the event bus to use.
   * @param testContext context over the tests.
   */
Should Add get delete and get social network relationships.
@param vertx       that contains the event bus to use.
@param testContext context over the tests.
Should Add get delete and get social network relationships . @param vertx that contains the event bus to use . @param testContext context over the tests .
@Test
  public void shouldAddGetDeleteGetSocialNetworkRelationships(final Vertx vertx, final VertxTestContext testContext) {
    testContext.assertComplete(new SocialNetworkRelationshipTest().createModelExample(0, vertx, testContext))
        .onSuccess(relationship -> {
          final List<SocialNetworkRelationship> relationships = new ArrayList<>();
          relationships.add(relationship);
          final var relationship2 = new SocialNetworkRelationship();
          relationship2.appId = relationship.appId;
          relationship2.sourceId = relationship.sourceId;
          relationship2.targetId = relationship.targetId;
          relationship2.weight = Math.random();
          var i = 0;
          relationship2.type = SocialNetworkRelationshipType.values()[i];
          while (relationship2.type == relationship.type) {
            i++;
            relationship2.type = SocialNetworkRelationshipType.values()[i];
          }
          relationships.add(relationship2);
          testContext.assertComplete(WeNetProfileManager.createProxy(vertx)
              .addOrUpdateSocialNetworkRelationships(relationships)
              .compose(any -> WeNetProfileManager.createProxy(vertx).retrieveSocialNetworkRelationshipsPage(
                  relationship.appId, relationship.sourceId, relationship.targetId, null, null, null, null, 0, 100)))
              .onSuccess(page -> {
                testContext.verify(() -> assertThat(page.relationships).isNotEmpty().hasSize(2)
                    .contains(relationships.toArray(new SocialNetworkRelationship[0])));
                testContext.assertComplete(WeNetProfileManager.createProxy(vertx)
                    .deleteSocialNetworkRelationships(relationship.appId, relationship.sourceId, relationship.targetId,
                        null, null, null)
                    .compose(any -> WeNetProfileManager.createProxy(vertx).retrieveSocialNetworkRelationshipsPage(
                        relationship.appId, relationship.sourceId, relationship.targetId, null, null, null, null, 0,
                        100)))
                    .onSuccess(page2 -> {
                      testContext.verify(() -> assertThat(page2.relationships).isNullOrEmpty());
                      testContext.completeNow();
                    });
              });
        });
  }
@ Test public void shouldAddGetDeleteGetSocialNetworkRelationships ( final Vertx vertx , final VertxTestContext testContext ) { testContext . assertComplete ( new SocialNetworkRelationshipTest ( ) . createModelExample ( 0 , vertx , testContext ) ) . onSuccess ( relationship -> { final List < SocialNetworkRelationship > relationships = new ArrayList < > ( ) ; relationships . add ( relationship ) ; final var relationship2 = new SocialNetworkRelationship ( ) ; relationship2 . appId = relationship . appId ; relationship2 . sourceId = relationship . sourceId ; relationship2 . targetId = relationship . targetId ; relationship2 . weight = Math . random ( ) ; var i = 0 ; relationship2 . type = SocialNetworkRelationshipType . values ( ) [ i ] ; while ( relationship2 . type == relationship . type ) { i ++ ; relationship2 . type = SocialNetworkRelationshipType . values ( ) [ i ] ; } relationships . add ( relationship2 ) ; testContext . assertComplete ( WeNetProfileManager . createProxy ( vertx ) . addOrUpdateSocialNetworkRelationships ( relationships ) . compose ( any -> WeNetProfileManager . createProxy ( vertx ) . retrieveSocialNetworkRelationshipsPage ( relationship . appId , relationship . sourceId , relationship . targetId , null , null , null , null , 0 , 100 ) ) ) . onSuccess ( page -> { testContext . verify ( ( ) -> assertThat ( page . relationships ) . isNotEmpty ( ) . hasSize ( 2 ) . contains ( relationships . toArray ( new SocialNetworkRelationship [ 0 ] ) ) ) ; testContext . assertComplete ( WeNetProfileManager . createProxy ( vertx ) . deleteSocialNetworkRelationships ( relationship . appId , relationship . sourceId , relationship . targetId , null , null , null ) . compose ( any -> WeNetProfileManager . createProxy ( vertx ) . retrieveSocialNetworkRelationshipsPage ( relationship . appId , relationship . sourceId , relationship . targetId , null , null , null , null , 0 , 100 ) ) ) . onSuccess ( page2 -> { testContext . verify ( ( ) -> assertThat ( page2 . relationships ) . isNullOrEmpty ( ) ) ; testContext . completeNow ( ) ; } ) ; } ) ; } ) ; }
Should Add get delete and get social network relationships.
Should Add get delete and get social network relationships .