Examples of Tenant


Examples of org.apache.sling.tenant.Tenant

    @Override
    protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws IOException {
        String msg = null;
        final String cmd = req.getParameter("action");
        if ("create".equals(cmd)) {
            Tenant t = this.createTenant(req);
            if (t != null) {
                msg = String.format("Created Tenant %s (%s)", t.getName(), t.getDescription());
            } else {
                msg = "Cannot create tenant";
            }
        } else if ("remove".equals(cmd)) {
            this.removeTenant(req);
View Full Code Here

Examples of org.apache.sling.tenant.Tenant

        resp.sendRedirect(redirectTo);
    }

    private void removeTenant(HttpServletRequest request) {
        final String tenantId = request.getParameter(REQ_PRM_TENANT_ID);
        final Tenant tenant = this.tenantProvider.getTenant(tenantId);

        if (tenant != null) {
            this.tenantProvider.remove(tenant);
        }
    }
View Full Code Here

Examples of org.apache.sling.tenant.Tenant

        Iterator<Tenant> tenants = this.tenantProvider.getTenants();
        int count = 0;
        while (tenants.hasNext()) {
            count++;
            Tenant tenant = tenants.next();
            if (count == 1) {
                pw.printf("<p class='statline ui-state-highlight'>Registered Tenants</p>");
            }
            pw.println("<div class='ui-widget-header ui-corner-top buttonGroup'>");
            pw.printf("<span style='float: left; margin-left: 1em'>Tenant : %s </span>", escape(tenant.getName()));
            this.printForm(pw, tenant, "Remove", "remove");
            pw.println("</div>");
            pw.println("<table class='nicetable'><tbody>");

            pw.printf("<tr><td style='width: 30%%;'>Identifier</td><td>%s</td></tr>", escape(tenant.getId()));
            pw.printf("<tr><td style='width: 30%%;'>Name</td><td>%s</td></tr>", escape(tenant.getName()));
            pw.printf("<tr><td style='width: 30%%;'>Description</td><td>%s</td></tr>", escape(tenant.getDescription()));
            pw.println("</tbody></table>");
        }
        // no existing tenants
        if (count == 0) {
            pw.printf("<p class='statline ui-state-highlight'>There are not registered tenants</p>");
View Full Code Here

Examples of org.apache.sling.tenant.Tenant

    };

    @Test
    public void test_id() {
        Resource r = new MockResource(pt1, new HashMap<String, Object>());
        Tenant tenant1 = new TenantImpl(r);

        TestCase.assertEquals(t1, tenant1.getId());
        TestCase.assertNull(tenant1.getName());
        TestCase.assertNull(tenant1.getDescription());

        TestCase.assertFalse(tenant1.getPropertyNames().hasNext());

        TestCase.assertNull(tenant1.getProperty(Tenant.PROP_NAME));
        TestCase.assertNull(tenant1.getProperty(Tenant.PROP_DESCRIPTION));
        TestCase.assertNull(tenant1.getProperty(p1));
    }
View Full Code Here

Examples of org.apache.sling.tenant.Tenant

            {
                put(Tenant.PROP_NAME, n1);
                put(Tenant.PROP_DESCRIPTION, d1);
            }
        });
        Tenant tenant1 = new TenantImpl(r);

        TestCase.assertEquals(t1, tenant1.getId());
        TestCase.assertEquals(n1, tenant1.getName());
        TestCase.assertEquals(d1, tenant1.getDescription());

        Iterator<String> pi = tenant1.getPropertyNames();
        TestCase.assertTrue(propNamesDefault.contains(pi.next()));
        TestCase.assertTrue(propNamesDefault.contains(pi.next()));
        TestCase.assertFalse(pi.hasNext());

        TestCase.assertEquals(n1, tenant1.getProperty(Tenant.PROP_NAME));
        TestCase.assertEquals(d1, tenant1.getProperty(Tenant.PROP_DESCRIPTION));
        TestCase.assertNull(tenant1.getProperty(p1));

    }
View Full Code Here

Examples of org.apache.sling.tenant.Tenant

        Resource r = new MockResource(pt1, new HashMap<String, Object>() {
            {
                put(p1, p1);
            }
        });
        Tenant tenant1 = new TenantImpl(r);

        TestCase.assertEquals(t1, tenant1.getId());
        TestCase.assertNull(tenant1.getName());
        TestCase.assertNull(tenant1.getDescription());

        Iterator<String> pi = tenant1.getPropertyNames();
        TestCase.assertTrue(propNamesTest.contains(pi.next()));
        TestCase.assertFalse(pi.hasNext());

        TestCase.assertNull(tenant1.getProperty(Tenant.PROP_NAME));
        TestCase.assertNull(tenant1.getProperty(Tenant.PROP_DESCRIPTION));
        TestCase.assertEquals(p1, tenant1.getProperty(p1));
    }
View Full Code Here

Examples of org.apache.stratos.messaging.domain.tenant.Tenant

    public boolean tenantExists(int tenantId) {
        return tenantIdTenantMap.containsKey(tenantId);
    }

    public void removeTenant(int tenantId) {
        Tenant tenant = getTenant(tenantId);
        if(tenant != null) {
            tenantIdTenantMap.remove(tenant.getTenantId());
            tenantDomainTenantMap.remove(tenant.getTenantDomain());
        }
    }
View Full Code Here

Examples of org.exoplatform.container.multitenancy.Tenant

   {
      scheduler_ = quartzSchduler.getQuartzSheduler();
      containerName_ = pinfo.getContainerName();
      qtasks_ = qtasks;
      this.tenantsService = tService;
      Tenant tenant;
      try {
        tenant = tenantsService.getCurrentTanant();
      } catch (CurrentTenantNotSetException e) {
        tenant = null;
      }
View Full Code Here

Examples of org.jclouds.openstack.keystone.v2_0.domain.Tenant

               responseWithKeystoneAccess,
               authenticatedGET().endpoint(endpoint + "/v2.0/tenants/013ba41150a14830bec85ffe93353bcc").build(),
               HttpResponse.builder().statusCode(200).payload(
                        payloadFromResourceWithContentType("/tenant_details.json", APPLICATION_JSON)).build())
               .getTenantApi().get();
      Tenant tenant = api.get("013ba41150a14830bec85ffe93353bcc");
      assertNotNull(tenant);
      assertEquals(tenant, Tenant.builder().id("013ba41150a14830bec85ffe93353bcc").name("admin").build());
   }
View Full Code Here

Examples of org.jclouds.openstack.keystone.v2_0.domain.Tenant

               responseWithKeystoneAccess,
               authenticatedGET().endpoint(endpoint + "/v2.0/tenants?name=admin").build(),
               HttpResponse.builder().statusCode(200).payload(
                        payloadFromResourceWithContentType("/tenant_details.json", APPLICATION_JSON)).build())
               .getTenantApi().get();
      Tenant tenant = api.getByName("admin");
      assertNotNull(tenant);
      assertEquals(tenant, Tenant.builder().id("013ba41150a14830bec85ffe93353bcc").name("admin").build());
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.