コード例 #1
0
  @Test
  public void should_return_getBusinessObjectModel_return_null_when_no_bdm() throws Exception {
    // given
    doReturn(false).when(businessDataModelRepository).isDBMDeployed();

    // when then
    assertThat(businessDataModelRepository.getBusinessObjectModel()).isNull();
  }
コード例 #2
0
  @Test
  public void uninstall_should_ignore_exception_if_the_dependency_does_not_exist()
      throws Exception {
    doThrow(new SDependencyNotFoundException("error"))
        .when(dependencyService)
        .deleteDependency("BDR");

    businessDataModelRepository.uninstall(45l);
  }
コード例 #3
0
  @Test(expected = SBusinessDataRepositoryException.class)
  public void
      uninstall_should_throw_an_exception_if_an_exception_occurs_during_the_dependency_deletion()
          throws Exception {
    doThrow(new SDependencyDeletionException("error"))
        .when(dependencyService)
        .deleteDependency("BDR");

    businessDataModelRepository.uninstall(45l);
  }
コード例 #4
0
  @Test(expected = SBusinessDataRepositoryException.class)
  public void should_getBusinessObjectModel_throw_exception() throws Exception {
    // given
    final InputStream resourceAsStream = this.getClass().getResourceAsStream("client-bdm.zip");
    final byte[] clientBDMZip = IOUtil.getAllContentFrom(resourceAsStream);

    doReturn(true).when(businessDataModelRepository).isDBMDeployed();
    doReturn(clientBDMZip).when(businessDataModelRepository).getClientBDMZip();
    doThrow(IOException.class)
        .when(businessDataModelRepository)
        .getBusinessObjectModel(any(clientBDMZip.getClass()));

    // when then exception
    businessDataModelRepository.getBusinessObjectModel();
  }
コード例 #5
0
  @Test
  public void should_return_getBusinessObjectModel_return_bdm() throws Exception {
    // given
    final InputStream resourceAsStream = this.getClass().getResourceAsStream("client-bdm.zip");
    final byte[] clientBDMZip = IOUtil.getAllContentFrom(resourceAsStream);

    doReturn(true).when(businessDataModelRepository).isDBMDeployed();
    doReturn(clientBDMZip).when(businessDataModelRepository).getClientBDMZip();

    // when
    final BusinessObjectModel model = businessDataModelRepository.getBusinessObjectModel();

    // then
    assertThat(model)
        .as("should return the business model")
        .as("should return the bom")
        .isNotNull();
  }
コード例 #6
0
  @Test
  public void deployABOMShouldCreatetheBOMJARAndAddANewTenantDependency() throws Exception {
    final SDependency sDependency = mock(SDependency.class);
    final SDependencyMapping dependencyMapping = mock(SDependencyMapping.class);
    doReturn(sDependency)
        .when(businessDataModelRepository)
        .createSDependency(anyLong(), any(byte[].class));
    doReturn(dependencyMapping)
        .when(businessDataModelRepository)
        .createDependencyMapping(1, sDependency);

    BusinessObjectModel bom = BOMBuilder.aBOM().build();
    doReturn("some bytes".getBytes()).when(businessDataModelRepository).generateServerBDMJar(bom);

    businessDataModelRepository.createAndDeployServerBDMJar(1, bom);

    verify(dependencyService).createDependency(sDependency);
    verify(dependencyService).createDependencyMapping(dependencyMapping);
  }
コード例 #7
0
  @Test
  public void uninstall_should_delete_a_dependency() throws Exception {
    businessDataModelRepository.uninstall(45l);

    verify(dependencyService).deleteDependency("BDR");
  }