Search in sources :

Example 1 with MemcacheServer

use of org.platformlayer.service.memcache.model.MemcacheServer in project platformlayer by platformlayer.

the class ITMemcacheService method testCreateAndDeleteItem.

@Test
public void testCreateAndDeleteItem() throws Exception {
    String id = random.randomAlphanumericString(8);
    MemcacheServer memcache = new MemcacheServer();
    memcache.dnsName = id + ".test.platformlayer.org";
    memcache = putItem(id, memcache);
    memcache = waitForHealthy(memcache);
    InetSocketAddress socketAddress = getUniqueEndpoint(memcache);
    Assert.assertFalse(isPortOpen(socketAddress));
    openFirewall(memcache, MemcacheServerController.MEMCACHE_PORT);
    testMemcache(socketAddress);
}
Also used : InetSocketAddress(java.net.InetSocketAddress) MemcacheServer(org.platformlayer.service.memcache.model.MemcacheServer) PlatformLayerApiTest(org.platformlayer.tests.PlatformLayerApiTest) Test(org.testng.annotations.Test)

Example 2 with MemcacheServer

use of org.platformlayer.service.memcache.model.MemcacheServer in project platformlayer by platformlayer.

the class MemcacheServerController method addChildren.

@Override
protected void addChildren() throws OpsException {
    MemcacheServer model = OpsContext.get().getInstance(MemcacheServer.class);
    InstanceBuilder instance = InstanceBuilder.build(model.dnsName, this, model.getTags());
    // TODO: Memory _really_ needs to be configurable here!
    instance.publicPorts.add(MEMCACHE_PORT);
    instance.minimumMemoryMb = 1024;
    instance.hostPolicy.allowRunInContainer = true;
    addChild(instance);
    instance.addChild(PackageDependency.build("memcached"));
    MemcacheTemplateModel template = injected(MemcacheTemplateModel.class);
    instance.addChild(TemplatedFile.build(template, new File("/etc/memcached.conf")));
    // Collectd not restarting correctly (doesn't appear to be hostname problems??)
    // instance.addChild(CollectdCollector.build());
    {
        PublicEndpoint endpoint = injected(PublicEndpoint.class);
        // endpoint.network = null;
        endpoint.publicPort = MEMCACHE_PORT;
        endpoint.backendPort = MEMCACHE_PORT;
        endpoint.dnsName = model.dnsName;
        endpoint.tagItem = model.getKey();
        endpoint.parentItem = model.getKey();
        instance.addChild(endpoint);
    }
    instance.addChild(ManagedService.build("memcached"));
}
Also used : PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) MemcacheServer(org.platformlayer.service.memcache.model.MemcacheServer) TemplatedFile(org.platformlayer.ops.filesystem.TemplatedFile) File(java.io.File) InstanceBuilder(org.platformlayer.ops.instances.InstanceBuilder)

Aggregations

MemcacheServer (org.platformlayer.service.memcache.model.MemcacheServer)2 File (java.io.File)1 InetSocketAddress (java.net.InetSocketAddress)1 TemplatedFile (org.platformlayer.ops.filesystem.TemplatedFile)1 InstanceBuilder (org.platformlayer.ops.instances.InstanceBuilder)1 PublicEndpoint (org.platformlayer.ops.networks.PublicEndpoint)1 PlatformLayerApiTest (org.platformlayer.tests.PlatformLayerApiTest)1 Test (org.testng.annotations.Test)1