Package com.sun.jersey.api.client

Examples of com.sun.jersey.api.client.UniformInterface


    final DataTempTargetRepositoryResource server = new DataTempTargetRepositoryResource(underlying);
    final TempTargetRepository client = new RemoteTempTargetRepository(URI.create("http://localhost/")) {
      @Override
      protected UniformInterface accessRemote(final URI uri) {
        assertTrue(uri.getPath().startsWith("/target/"));
        final UniformInterface builder = Mockito.mock(UniformInterface.class);
        Mockito.when(builder.get(FudgeMsg.class)).thenAnswer(new Answer<FudgeMsg>() {
          @Override
          public FudgeMsg answer(final InvocationOnMock invocation) throws Throwable {
            try {
              return (FudgeMsg) server.get(uri.getPath().substring(8)).getEntity();
            } catch (final WebApplicationException e) {
View Full Code Here


    final TempTargetRepository client = new RemoteTempTargetRepository(URI.create("http://localhost/")) {
      @SuppressWarnings("unchecked")
      @Override
      protected UniformInterface accessRemote(final URI uri) {
        assertTrue(uri.getPath().equals("/target"));
        final UniformInterface builder = Mockito.mock(UniformInterface.class);
        Mockito.doAnswer(new Answer<FudgeMsg>() {
          @Override
          public FudgeMsg answer(final InvocationOnMock invocation) throws Throwable {
            return (FudgeMsg) server.locateOrStore((FudgeMsg) invocation.getArguments()[1]).getEntity();
          }
View Full Code Here

    final DataConventionBundleSourceResource server = new DataConventionBundleSourceResource(underlying);
    final ConventionBundleSource client = new RemoteConventionBundleSource(URI.create("http://localhost/")) {
      @Override
      protected UniformInterface accessRemote(final URI uri) {
        assertTrue(uri.getPath().startsWith("/identifier/"));
        final UniformInterface builder = Mockito.mock(UniformInterface.class);
        Mockito.when(builder.get(ConventionBundle.class)).thenAnswer(new Answer<ConventionBundle>() {
          @Override
          public ConventionBundle answer(final InvocationOnMock invocation) throws Throwable {
            try {
              return OpenGammaFudgeContext.getInstance().fromFudgeMsg(ConventionBundle.class, (FudgeMsg) server.getByIdentifier(uri.getPath().substring(12)).getEntity());
            } catch (final WebApplicationException e) {
View Full Code Here

    final ConventionBundleSource client = new RemoteConventionBundleSource(URI.create("http://localhost/")) {
      @Override
      protected UniformInterface accessRemote(final URI uri) {
        assertTrue(uri.getPath().startsWith("/bundle"));
        assertTrue(uri.getQuery().startsWith("id="));
        final UniformInterface builder = Mockito.mock(UniformInterface.class);
        Mockito.when(builder.get(ConventionBundle.class)).thenAnswer(new Answer<ConventionBundle>() {
          @Override
          public ConventionBundle answer(final InvocationOnMock invocation) throws Throwable {
            try {
              return OpenGammaFudgeContext.getInstance().fromFudgeMsg(ConventionBundle.class, (FudgeMsg) server.getByBundle(Arrays.asList(uri.getQuery().substring(3))).getEntity());
            } catch (final WebApplicationException e) {
View Full Code Here

    final DataConventionBundleSourceResource server = new DataConventionBundleSourceResource(underlying);
    final ConventionBundleSource client = new RemoteConventionBundleSource(URI.create("http://localhost/")) {
      @Override
      protected UniformInterface accessRemote(final URI uri) {
        assertTrue(uri.getPath().startsWith("/unique/"));
        final UniformInterface builder = Mockito.mock(UniformInterface.class);
        Mockito.when(builder.get(ConventionBundle.class)).thenAnswer(new Answer<ConventionBundle>() {
          @Override
          public ConventionBundle answer(final InvocationOnMock invocation) throws Throwable {
            try {
              return OpenGammaFudgeContext.getInstance().fromFudgeMsg(ConventionBundle.class, (FudgeMsg) server.getByUniqueId(uri.getPath().substring(8)).getEntity());
            } catch (final WebApplicationException e) {
View Full Code Here

    final DataHistoricalTimeSeriesResolverResource server = new DataHistoricalTimeSeriesResolverResource(resolver, OpenGammaFudgeContext.getInstance());
    final HistoricalTimeSeriesResolver client = new RemoteHistoricalTimeSeriesResolver(URI.create("http://localhost/")) {
      @Override
      protected UniformInterface accessRemote(final URI uri) {
        assertTrue(uri.getPath().startsWith("/resolve/"));
        final UniformInterface builder = Mockito.mock(UniformInterface.class);
        Mockito.when(builder.get(FudgeMsg.class)).thenAnswer(new Answer<FudgeMsg>() {
          @Override
          public FudgeMsg answer(final InvocationOnMock invocation) throws Throwable {
            try {
              String[] str = uri.getPath().substring(9).split("/");
              DataHistoricalTimeSeriesResolverResource.Resolve resolve = server.resolve();
View Full Code Here

  private FunctionBlacklistProvider createClient(final ExecutorService executor, final JmsConnector jmsConnector, final DataFunctionBlacklistProviderResource server) {
    final FunctionBlacklistProvider client = new RemoteFunctionBlacklistProvider(URI.create("http://localhost/"), executor, jmsConnector) {
      @Override
      protected UniformInterface accessRemote(final URI uri) {
        final UniformInterface builder = Mockito.mock(UniformInterface.class);
        assertTrue(uri.getPath().startsWith("/name/"));
        final String[] s = uri.getPath().split("/");
        Mockito.when(builder.get(FudgeMsg.class)).thenAnswer(new Answer<Object>() {
          @Override
          public Object answer(final InvocationOnMock invocation) throws Throwable {
            try {
              return answerGet(server, s).getEntity();
            } catch (final WebApplicationException e) {
View Full Code Here

    final DataFunctionBlacklistPolicySourceResource server = new DataFunctionBlacklistPolicySourceResource(underlying, OpenGammaFudgeContext.getInstance());
    final FunctionBlacklistPolicySource client = new RemoteFunctionBlacklistPolicySource(URI.create("http://localhost/")) {
      @Override
      protected UniformInterface accessRemote(final URI uri) {
        assertTrue(uri.getPath().startsWith("/uid/"));
        final UniformInterface builder = Mockito.mock(UniformInterface.class);
        Mockito.when(builder.get(FudgeMsg.class)).thenAnswer(new Answer<FudgeMsg>() {
          @Override
          public FudgeMsg answer(final InvocationOnMock invocation) throws Throwable {
            try {
              return (FudgeMsg) server.getByUniqueId(uri.getPath().substring(5)).getEntity();
            } catch (WebApplicationException e) {
View Full Code Here

    final DataFunctionBlacklistPolicySourceResource server = new DataFunctionBlacklistPolicySourceResource(underlying, OpenGammaFudgeContext.getInstance());
    final FunctionBlacklistPolicySource client = new RemoteFunctionBlacklistPolicySource(URI.create("http://localhost/")) {
      @Override
      protected UniformInterface accessRemote(final URI uri) {
        assertTrue(uri.getPath().startsWith("/name/"));
        final UniformInterface builder = Mockito.mock(UniformInterface.class);
        Mockito.when(builder.get(FudgeMsg.class)).thenAnswer(new Answer<FudgeMsg>() {
          @Override
          public FudgeMsg answer(final InvocationOnMock invocation) throws Throwable {
            try {
              return (FudgeMsg) server.getByName(uri.getPath().substring(6)).getEntity();
            } catch (WebApplicationException e) {
View Full Code Here

  private ManageableFunctionBlacklistProvider createClient(final ExecutorService executor, final JmsConnector jmsConnector, final DataManageableFunctionBlacklistProviderResource server) {
    final ManageableFunctionBlacklistProvider client = new RemoteManageableFunctionBlacklistProvider(URI.create("http://localhost/"), executor, jmsConnector) {
      @Override
      protected UniformInterface accessRemote(final URI uri) {
        final UniformInterface builder = Mockito.mock(UniformInterface.class);
        assertTrue(uri.getPath().startsWith("/name/"));
        final String[] s = uri.getPath().split("/");
        Mockito.when(builder.get(FudgeMsg.class)).thenAnswer(new Answer<Object>() {
          @Override
          public Object answer(final InvocationOnMock invocation) throws Throwable {
            try {
              return answerGet(server, s).getEntity();
            } catch (final WebApplicationException e) {
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.client.UniformInterface

Copyright © 2018 www.massapicom. 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.