@Override
  protected void setup(TestContainer container) throws Exception {
    container.addBean(new APPConfigurationServiceBean());

    cs = container.get(APPConfigurationServiceBean.class);
    em = container.getPersistenceUnit("oscm-app");
  }
  @Override
  protected void setup(TestContainer container) throws Exception {
    container.addBean(new DataServiceBean());
    container.addBean(new BillingDataRetrievalServiceBean());
    ds = container.get(DataService.class);
    bdr = container.get(BillingDataRetrievalServiceLocal.class);

    createSubscriptionHistory(
        0L, 1001L, "2012-09-01 08:00:00", 0, ModificationType.ADD, SubscriptionStatus.ACTIVE, 0);
  }
  @Override
  protected void setup(TestContainer container) throws Exception {
    container.addBean(new DataServiceBean());
    container.enableInterfaceMocking(true);
    container.addBean(new ServiceProvisioningPartnerServiceLocalBean());

    ds = container.get(DataService.class);
    localService = container.get(ServiceProvisioningPartnerServiceLocal.class);

    createOrg();
  }
 @Override
 protected void setup(TestContainer container) {
   container.enableInterfaceMocking(true);
   dsMock = mock(DataService.class);
   when(dsMock.getCurrentUser()).thenReturn(givenUser());
   localizerMock = mock(LocalizerServiceLocal.class);
   when(localizerMock.getLocalizedTextFromDatabase(
           Mockito.anyString(), Mockito.anyLong(), Mockito.any(LocalizedObjectTypes.class)))
       .thenReturn(LOCALIZED_RESOURCE);
   logCollector.localizer = localizerMock;
 }
  @Override
  public void setup(final TestContainer container) throws Exception {
    instanceActivated = false;
    container.login("1");
    container.addBean(new DataServiceBean());
    container.addBean(new ConfigurationServiceStub());
    container.addBean(new AccountServiceStub());
    container.addBean(Mockito.mock(BillingDataRetrievalServiceLocal.class));
    container.addBean(new PortLocatorBean());
    container.addBean(new LocalizerServiceBean());
    container.addBean(
        new ApplicationServiceStub() {

          @Override
          public void activateInstance(Subscription subscription)
              throws TechnicalServiceNotAliveException, TechnicalServiceOperationException {
            instanceActivated = true;
          }
        });
    container.addBean(new PaymentServiceBean());

    mgr = container.get(DataService.class);
    paymentMgmt = container.get(PaymentService.class);

    runTX(
        new Callable<Void>() {
          @Override
          public Void call() throws Exception {
            createOrganizationRoles(mgr);
            createPaymentTypes(mgr);
            SupportedCountries.createSomeSupportedCountries(mgr);
            return null;
          }
        });
    Organization organization =
        runTX(
            new Callable<Organization>() {
              @Override
              public Organization call() throws Exception {
                Organization organization =
                    Organizations.createOrganization(mgr, OrganizationRoleType.TECHNOLOGY_PROVIDER);
                Organizations.createUserForOrg(mgr, organization, true, "ProvAdmin");
                return organization;
              }
            });
    providerId = organization.getOrganizationId();

    supplier =
        runTX(
            new Callable<Organization>() {
              @Override
              public Organization call() throws Exception {
                Organization organization =
                    Organizations.createOrganization(mgr, OrganizationRoleType.SUPPLIER);
                supplierUser = Organizations.createUserForOrg(mgr, organization, true, "SuppAdmin");
                return organization;
              }
            });
    supplierId = supplier.getOrganizationId();
  }
 @Override
 protected void setup(TestContainer container) throws Exception {
   em = container.getPersistenceUnit("oscm-app");
   opDAO.em = em;
 }
  @SuppressWarnings("unchecked")
  @Override
  protected void setup(TestContainer container) throws Exception {
    AESEncrypter.generateKey();

    container.addBean(configService = Mockito.mock(APPConfigurationServiceBean.class));
    container.addBean(Mockito.mock(ServiceInstanceDAO.class));

    container.addBean(Mockito.mock(APPConcurrencyServiceBean.class));
    container.addBean(Mockito.mock(ProductProvisioningServiceFactoryBean.class));
    container.addBean(Mockito.mock(APPCommunicationServiceBean.class));

    serviceMock = Mockito.mock(Service.class);
    besDAO = Mockito.mock(BesDAO.class);
    subcriptionService = Mockito.mock(SubscriptionService.class);
    identityService = Mockito.mock(EnhancedIdentityService.class);
    Mockito.doReturn(Arrays.asList(new VOUserDetails()))
        .when(besDAO)
        .getBESTechnologyManagers(Matchers.any(ServiceInstance.class));

    Mockito.doReturn(identityService)
        .when(besDAO)
        .getBESWebService(Matchers.eq(IdentityService.class), Matchers.any(ServiceInstance.class));

    Mockito.doNothing()
        .when(besDAO)
        .setUserCredentialsInContext(
            Matchers.any(BindingProvider.class), Matchers.anyString(),
            Matchers.anyString(), Matchers.anyMap());

    Mockito.doReturn(subcriptionService)
        .when(besDAO)
        .getBESWebService(
            Matchers.eq(SubscriptionService.class), Matchers.any(ServiceInstance.class));

    Mockito.doNothing()
        .when(subcriptionService)
        .completeAsyncSubscription(
            Matchers.anyString(), Matchers.anyString(), Matchers.any(VOInstanceInfo.class));
    Mockito.doNothing()
        .when(subcriptionService)
        .abortAsyncSubscription(
            Matchers.anyString(), Matchers.anyString(), Matchers.anyListOf(VOLocalizedText.class));
    Mockito.doReturn(subcriptionService)
        .when(serviceMock)
        .getPort(Matchers.any(QName.class), Matchers.eq(SubscriptionService.class));

    Mockito.doReturn(serviceMock)
        .when(besDAO)
        .createWebService(Matchers.any(URL.class), Matchers.any(QName.class));

    Mockito.doReturn(identityService)
        .when(serviceMock)
        .getPort(Matchers.any(QName.class), Matchers.eq(IdentityService.class));

    container.addBean(besDAO);
    container.addBean(Mockito.mock(OperationDAO.class));

    container.addBean(Mockito.mock(ServiceInstanceDAO.class));
    container.addBean(Mockito.mock(OperationServiceBean.class));

    container.addBean(authService = Mockito.spy(new APPAuthenticationServiceBean()));
    container.addBean(Mockito.mock(OperationServiceBean.class));

    container.addBean(new APPlatformServiceBean());
    controller = Mockito.mock(APPlatformController.class);
    InitialContext context = new InitialContext();
    context.bind("bss/app/controller/ess.vmware", controller);
    container.addBean(controller);

    besDAO = container.get(BesDAO.class);

    platformService = container.get(APPlatformService.class);

    em = container.getPersistenceUnit("oscm-app");

    defaultAuth = new PasswordAuthentication("user", "password");
  }