test_class.declarator: MEDIA_TYPE_AUDIO_WAV = "audio/wav"
test_class.modifier: private static final
test_class.original_string: private static final String MEDIA_TYPE_AUDIO_WAV = "audio/wav";
test_class.type: String
test_class.var_name: MEDIA_TYPE_AUDIO_WAV
test_class.declarator: MEDIA_TYPE_AUDIO_OGG = "audio/ogg"
test_class.modifier: private static final
test_class.original_string: private static final String MEDIA_TYPE_AUDIO_OGG = "audio/ogg";
test_class.type: String
test_class.var_name: MEDIA_TYPE_AUDIO_OGG
test_class.declarator: MEDIA_TYPE_AUDIO_MPEG = "audio/mpeg"
test_class.modifier: private static final
test_class.original_string: private static final String MEDIA_TYPE_AUDIO_MPEG = "audio/mpeg";
test_class.type: String
test_class.var_name: MEDIA_TYPE_AUDIO_MPEG
test_class.declarator: testByteArray = new byte[] { 0, 1, 2 }
test_class.modifier: private final
test_class.original_string: private final byte[] testByteArray = new byte[] { 0, 1, 2 };
test_class.type: byte[]
test_class.var_name: testByteArray
test_class.file: bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioServletTest.java
test_class.identifier: AudioServletTest
test_class.superclass: extends AbstractAudioServletTest
test_case.body: @Test
      public void requestToMultitimeStreamCannotBeDoneAfterTheTimeoutOfTheStreamHasExipred() throws Exception {
          final int streamTimeout = 1;
  
          AudioStream audioStream = getByteArrayAudioStream(testByteArray, AudioFormat.CONTAINER_NONE,
                  AudioFormat.CODEC_MP3);
  
          final long beg = System.currentTimeMillis();
  
          String url = serveStream(audioStream, streamTimeout);
  
          Request request = getHttpRequest(url);
  
          ContentResponse response = request.send();
  
          final long end = System.currentTimeMillis();
  
          if (response.getStatus() == HttpStatus.NOT_FOUND_404) {
              assertThat("Response status 404 is only allowed if streamTimeout is exceeded.",
                      TimeUnit.MILLISECONDS.toSeconds(end - beg), greaterThan((long) streamTimeout));
          } else {
              assertThat("The response status was not as expected", response.getStatus(), is(HttpStatus.OK_200));
              assertThat("The response content was not as expected", response.getContent(), is(testByteArray));
              assertThat("The response media type was not as expected", response.getMediaType(),
                      is(MEDIA_TYPE_AUDIO_MPEG));
  
              assertThat("The audio stream was not added to the multitime streams",
                      audioServlet.getMultiTimeStreams().containsValue(audioStream), is(true));
          }
  
          waitForAssert(() -> {
              try {
                  request.send();
              } catch (Exception e) {
                  throw new IllegalStateException(e);
              }
              assertThat("The audio stream was not removed from multitime streams",
                      audioServlet.getMultiTimeStreams().containsValue(audioStream), is(false));
          });
  
          response = request.send();
          assertThat("The response status was not as expected", response.getStatus(), is(HttpStatus.NOT_FOUND_404));
      }
test_case.class_method_signature: AudioServletTest.requestToMultitimeStreamCannotBeDoneAfterTheTimeoutOfTheStreamHasExipred()
test_case.full_signature: @Test public void requestToMultitimeStreamCannotBeDoneAfterTheTimeoutOfTheStreamHasExipred()
test_case.identifier: requestToMultitimeStreamCannotBeDoneAfterTheTimeoutOfTheStreamHasExipred
test_case.invocations: getByteArrayAudioStream currentTimeMillis serveStream getHttpRequest send currentTimeMillis getStatus assertThat toSeconds greaterThan assertThat getStatus is assertThat getContent is assertThat getMediaType is assertThat containsValue getMultiTimeStreams is waitForAssert send assertThat containsValue getMultiTimeStreams is send assertThat getStatus is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void requestToMultitimeStreamCannotBeDoneAfterTheTimeoutOfTheStreamHasExipred()
focal_class.declarator: serialVersionUID = -3364664035854567854L
focal_class.modifier: private static final
focal_class.original_string: private static final long serialVersionUID = -3364664035854567854L;
focal_class.type: long
focal_class.var_name: serialVersionUID
focal_class.declarator: SERVLET_NAME = "/audio"
focal_class.modifier: private static final
focal_class.original_string: private static final String SERVLET_NAME = "/audio";
focal_class.type: String
focal_class.var_name: SERVLET_NAME
focal_class.declarator: oneTimeStreams = new ConcurrentHashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final Map<String, AudioStream> oneTimeStreams = new ConcurrentHashMap<>();
focal_class.type: Map<String, AudioStream>
focal_class.var_name: oneTimeStreams
focal_class.declarator: multiTimeStreams = new ConcurrentHashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final Map<String, FixedLengthAudioStream> multiTimeStreams = new ConcurrentHashMap<>();
focal_class.type: Map<String, FixedLengthAudioStream>
focal_class.var_name: multiTimeStreams
focal_class.declarator: streamTimeouts = new ConcurrentHashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final Map<String, Long> streamTimeouts = new ConcurrentHashMap<>();
focal_class.type: Map<String, Long>
focal_class.var_name: streamTimeouts
focal_class.file: bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioServlet.java
focal_class.identifier: AudioServlet
focal_class.interfaces: implements AudioHTTPServer
focal_class.class_method_signature: AudioServlet.AudioServlet(final @Reference HttpService httpService, final @Reference HttpContext httpContext)
focal_class.full_signature: @Activate public  AudioServlet(final @Reference HttpService httpService, final @Reference HttpContext httpContext)
focal_class.identifier: AudioServlet
focal_class.modifiers: @Activate public
focal_class.parameters: (final @Reference HttpService httpService, final @Reference HttpContext httpContext)
focal_class.signature:  AudioServlet(final @Reference HttpService httpService, final @Reference HttpContext httpContext)
focal_class.class_method_signature: AudioServlet.activate()
focal_class.full_signature: @Activate protected void activate()
focal_class.identifier: activate
focal_class.modifiers: @Activate protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void activate()
focal_class.class_method_signature: AudioServlet.deactivate()
focal_class.full_signature: @Deactivate protected void deactivate()
focal_class.identifier: deactivate
focal_class.modifiers: @Deactivate protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void deactivate()
focal_class.class_method_signature: AudioServlet.prepareInputStream(final String streamId, final HttpServletResponse resp)
focal_class.full_signature: private @Nullable InputStream prepareInputStream(final String streamId, final HttpServletResponse resp)
focal_class.identifier: prepareInputStream
focal_class.modifiers: private @Nullable
focal_class.parameters: (final String streamId, final HttpServletResponse resp)
focal_class.return: InputStream
focal_class.signature: InputStream prepareInputStream(final String streamId, final HttpServletResponse resp)
focal_class.class_method_signature: AudioServlet.substringAfterLast(String str, String separator)
focal_class.full_signature: private String substringAfterLast(String str, String separator)
focal_class.identifier: substringAfterLast
focal_class.modifiers: private
focal_class.parameters: (String str, String separator)
focal_class.return: String
focal_class.signature: String substringAfterLast(String str, String separator)
focal_class.class_method_signature: AudioServlet.substringBefore(String str, String separator)
focal_class.full_signature: private String substringBefore(String str, String separator)
focal_class.identifier: substringBefore
focal_class.modifiers: private
focal_class.parameters: (String str, String separator)
focal_class.return: String
focal_class.signature: String substringBefore(String str, String separator)
focal_class.class_method_signature: AudioServlet.doGet(@NonNullByDefault({}) HttpServletRequest req, @NonNullByDefault({}) HttpServletResponse resp)
focal_class.full_signature: @Override protected void doGet(@NonNullByDefault({}) HttpServletRequest req, @NonNullByDefault({}) HttpServletResponse resp)
focal_class.identifier: doGet
focal_class.modifiers: @Override protected
focal_class.parameters: (@NonNullByDefault({}) HttpServletRequest req, @NonNullByDefault({}) HttpServletResponse resp)
focal_class.return: void
focal_class.signature: void doGet(@NonNullByDefault({}) HttpServletRequest req, @NonNullByDefault({}) HttpServletResponse resp)
focal_class.class_method_signature: AudioServlet.removeTimedOutStreams()
focal_class.full_signature: private synchronized void removeTimedOutStreams()
focal_class.identifier: removeTimedOutStreams
focal_class.modifiers: private synchronized
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void removeTimedOutStreams()
focal_class.class_method_signature: AudioServlet.serve(AudioStream stream)
focal_class.full_signature: @Override public String serve(AudioStream stream)
focal_class.identifier: serve
focal_class.modifiers: @Override public
focal_class.parameters: (AudioStream stream)
focal_class.return: String
focal_class.signature: String serve(AudioStream stream)
focal_class.class_method_signature: AudioServlet.serve(FixedLengthAudioStream stream, int seconds)
focal_class.full_signature: @Override public String serve(FixedLengthAudioStream stream, int seconds)
focal_class.identifier: serve
focal_class.modifiers: @Override public
focal_class.parameters: (FixedLengthAudioStream stream, int seconds)
focal_class.return: String
focal_class.signature: String serve(FixedLengthAudioStream stream, int seconds)
focal_class.class_method_signature: AudioServlet.getMultiTimeStreams()
focal_class.full_signature:  Map<String, FixedLengthAudioStream> getMultiTimeStreams()
focal_class.identifier: getMultiTimeStreams
focal_class.parameters: ()
focal_class.return: Map<String, FixedLengthAudioStream>
focal_class.signature: Map<String, FixedLengthAudioStream> getMultiTimeStreams()
focal_class.class_method_signature: AudioServlet.getRelativeURL(String streamId)
focal_class.full_signature: private String getRelativeURL(String streamId)
focal_class.identifier: getRelativeURL
focal_class.modifiers: private
focal_class.parameters: (String streamId)
focal_class.return: String
focal_class.signature: String getRelativeURL(String streamId)
focal_class.superclass: extends SmartHomeServlet
focal_method.body: Map<String, FixedLengthAudioStream> getMultiTimeStreams() {
          return Collections.unmodifiableMap(multiTimeStreams);
      }
focal_method.class_method_signature: AudioServlet.getMultiTimeStreams()
focal_method.full_signature:  Map<String, FixedLengthAudioStream> getMultiTimeStreams()
focal_method.identifier: getMultiTimeStreams
focal_method.invocations: unmodifiableMap
focal_method.parameters: ()
focal_method.return: Map<String, FixedLengthAudioStream>
focal_method.signature: Map<String, FixedLengthAudioStream> getMultiTimeStreams()