Examples of StorageService


Examples of com.cloud.storage.StorageService

    }

    @Test
    public void testExecuteForResult() throws Exception {

        StorageService resourceService = Mockito.mock(StorageService.class);
        addImageStoreCmd._storageService = resourceService;

        ImageStore store = Mockito.mock(ImageStore.class);

        Mockito.when(resourceService.discoverImageStore(addImageStoreCmd))
                .thenReturn(store);

        ResponseGenerator responseGenerator = Mockito
                .mock(ResponseGenerator.class);
        addImageStoreCmd._responseGenerator = responseGenerator;
View Full Code Here

Examples of com.cloud.storage.StorageService

    }

    @Test
    public void testExecuteForNullResult() throws Exception {

        StorageService resourceService = Mockito.mock(StorageService.class);
        addImageStoreCmd._storageService = resourceService;

        Mockito.when(resourceService.discoverImageStore(addImageStoreCmd))
                .thenReturn(null);

        try {
            addImageStoreCmd.execute();
        } catch (ServerApiException exception) {
View Full Code Here

Examples of com.sparc.knappsack.components.services.StorageService

        response.setHeader("Expires", httpDateFormat.format(calendar.getTime()));

        final HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.parseMediaType(appFile.getType()));

        StorageService storageService = storageServiceFactory.getStorageService(appFile.getStorageType());

        long requestIfModifiedSince = request.getDateHeader("If-Modified-Since");
        if (requestIfModifiedSince >= appFile.getLastUpdate().getTime()) {
            response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
            return null;
View Full Code Here

Examples of io.fabric8.insight.storage.StorageService

        this.tracker.close();
    }

    @Override
    public void store(String type, long timestamp, String jsonData) {
        StorageService storage = this.tracker.getService();
        if (storage != null) {
            storage.store(type, timestamp, jsonData);
        }
    }
View Full Code Here

Examples of org.apache.cassandra.service.StorageService

   * @param args
   */
  public static void main(String[] args) throws Throwable
  {
    LogUtil.init();
        StorageService s = StorageService.instance();
        s.start();
    Loader loader = new Loader(s);
    loader.load("mbox_importer.xml");
  }
View Full Code Here

Examples of org.apache.cassandra.service.StorageService

        return map;
    }

    public static void main(String[] args) throws Throwable
    {
        StorageService ss = StorageService.instance();
        ss.updateTokenMetadata(BigInteger.valueOf(3), new EndPoint("A", 7000));
        ss.updateTokenMetadata(BigInteger.valueOf(6), new EndPoint("B", 7000));
        ss.updateTokenMetadata(BigInteger.valueOf(9), new EndPoint("C", 7000));
        ss.updateTokenMetadata(BigInteger.valueOf(12), new EndPoint("D", 7000));
        ss.updateTokenMetadata(BigInteger.valueOf(15), new EndPoint("E", 7000));
        ss.updateTokenMetadata(BigInteger.valueOf(18), new EndPoint("F", 7000));
        ss.updateTokenMetadata(BigInteger.valueOf(21), new EndPoint("G", 7000));
        ss.updateTokenMetadata(BigInteger.valueOf(24), new EndPoint("H", 7000));
       
        Runnable runnable = new LeaveJoinProtocolImpl( new EndPoint[]{new EndPoint("C", 7000), new EndPoint("D", 7000)}, new BigInteger[]{BigInteger.valueOf(22), BigInteger.valueOf(23)} );
        runnable.run();
    }
View Full Code Here

Examples of org.apache.cassandra.service.StorageService

            System.out.println("Usage : java com.facebook.infrastructure.tools.KeyChecker <file containing all keys>");
            System.exit(1);
        }
       
        LogUtil.init();
        StorageService s = StorageService.instance();
        s.start();
       
        /* Sleep for proper discovery */
        Thread.sleep(240000);
        /* Create the file for the missing keys */
        RandomAccessFile raf = new RandomAccessFile( "Missing-" + FBUtilities.getHostName() + ".dat", "rw");
View Full Code Here

Examples of org.apache.cassandra.service.StorageService

    public static class BootstrapTokenVerbHandler implements IVerbHandler
    {
        public void doVerb(Message message, String id)
        {
            StorageService ss = StorageService.instance;
            String tokenString = StorageService.getPartitioner().getTokenFactory().toString(ss.getBootstrapToken());
            Message response = message.getInternalReply(tokenString.getBytes(Charsets.UTF_8));
            MessagingService.instance().sendReply(response, id, message.getFrom());
        }
View Full Code Here

Examples of org.apache.cassandra.service.StorageService

    }
   
    @Test
    public void testMulitipleAutomaticBootstraps() throws IOException
    {
        StorageService ss = StorageService.instance;
        generateFakeEndpoints(5);
        InetAddress[] addrs = new InetAddress[]
        {
            InetAddress.getByName("127.0.0.2")
            InetAddress.getByName("127.0.0.3")
            InetAddress.getByName("127.0.0.4")
            InetAddress.getByName("127.0.0.5")
        };
        InetAddress[] bootstrapAddrs = new InetAddress[]
        {
            InetAddress.getByName("127.0.0.12")
            InetAddress.getByName("127.0.0.13")
            InetAddress.getByName("127.0.0.14")
            InetAddress.getByName("127.0.0.15")
        };
        Map<InetAddress, Double> load = new HashMap<InetAddress, Double>();
        for (int i = 0; i < addrs.length; i++)
            load.put(addrs[i], (double)i+2);
       
        // give every node a bootstrap source.
        for (int i = 3; i >=0; i--)
        {
            InetAddress bootstrapSource = BootStrapper.getBootstrapSource(ss.getTokenMetadata(), load);
            assert bootstrapSource != null;
            assert bootstrapSource.equals(addrs[i]) : String.format("expected %s but got %s for %d", addrs[i], bootstrapSource, i);
            assert !ss.getTokenMetadata().getBootstrapTokens().containsValue(bootstrapSource);
           
            Range<Token> range = ss.getPrimaryRangeForEndpoint(bootstrapSource);
            Token token = StorageService.getPartitioner().midpoint(range.left, range.right);
            assert range.contains(token);
            ss.onChange(bootstrapAddrs[i], ApplicationState.STATUS, StorageService.instance.valueFactory.bootstrapping(token));
        }
       
        // any further attempt to bootsrtap should fail since every node in the cluster is splitting.
        try
        {
            BootStrapper.getBootstrapSource(ss.getTokenMetadata(), load);
            throw new AssertionError("This bootstrap should have failed.");
        }
        catch (RuntimeException ex)
        {
            // success!
        }
       
        // indicate that one of the nodes is done. see if the node it was bootstrapping from is still available.
        Range<Token> range = ss.getPrimaryRangeForEndpoint(addrs[2]);
        Token token = StorageService.getPartitioner().midpoint(range.left, range.right);
        ss.onChange(bootstrapAddrs[2], ApplicationState.STATUS, StorageService.instance.valueFactory.normal(token));
        load.put(bootstrapAddrs[2], 0d);
        InetAddress addr = BootStrapper.getBootstrapSource(ss.getTokenMetadata(), load);
        assert addr != null && addr.equals(addrs[2]);
    }
View Full Code Here

Examples of org.apache.cassandra.service.StorageService

    }

    @Test
    public void testGuessToken() throws IOException
    {
        StorageService ss = StorageService.instance;

        generateFakeEndpoints(5);

        InetAddress two = InetAddress.getByName("127.0.0.2");
        InetAddress three = InetAddress.getByName("127.0.0.3");
        InetAddress four = InetAddress.getByName("127.0.0.4");
        InetAddress five = InetAddress.getByName("127.0.0.5");

        Map<InetAddress, Double> load = new HashMap<InetAddress, Double>();
        load.put(two, 2.0);
        load.put(three, 3.0);
        load.put(four, 4.0);
        load.put(five, 5.0);

        TokenMetadata tmd = ss.getTokenMetadata();
        InetAddress source = BootStrapper.getBootstrapSource(tmd, load);
        assert five.equals(source) : five + " != " + source;

        InetAddress myEndpoint = InetAddress.getByName("127.0.0.1");
        Range<Token> range5 = ss.getPrimaryRangeForEndpoint(five);
        Token fakeToken = StorageService.getPartitioner().midpoint(range5.left, range5.right);
        assert range5.contains(fakeToken);
        ss.onChange(myEndpoint, ApplicationState.STATUS, StorageService.instance.valueFactory.bootstrapping(fakeToken));
        tmd = ss.getTokenMetadata();

        InetAddress source4 = BootStrapper.getBootstrapSource(tmd, load);
        assert four.equals(source4) : four + " != " + source4;
    }
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.