小编Pra*_*tik的帖子

使用JSR223和groovy在jmeter中的控制台上不打印消息

println()内部static void main方法不会在任何地方打印任何内容,而只有println()在终端中打印.这是我的代码:

class CalcMain {
static void main(def args) throws Exception {
    ScriptEngineManager factory = new ScriptEngineManager();
    ScriptEngine engine = factory.getEngineByName("groovy");

    println("testing");
  }
}
Run Code Online (Sandbox Code Playgroud)

当我跑的时候显示通过(Jmeter中的绿色三角形),但在终端上没有打印任何东西

而简单的程序如

println("testing");
Run Code Online (Sandbox Code Playgroud)

打印在终端上.

有人可以让我知道我做错了吗?

谢谢

groovy jmeter jsr223

15
推荐指数
3
解决办法
2万
查看次数

java.io.IOException: Attempted read from closed stream

I am making a HTTPPost call using Apache HTTP Client and then I am trying to create an object from the response using Jackson. Here is my code:

private static final Logger log = Logger.getLogger(ReportingAPICall.class);
ObjectMapper mapper = new ObjectMapper();

public void makePublisherApiCall(String jsonRequest)
{
    String url = ReaderUtility.readPropertyFile().getProperty("hosturl");
    DefaultHttpClient client = new DefaultHttpClient();
    try {
        HttpPost postRequest = new HttpPost(url);
        StringEntity entity = new StringEntity(jsonRequest);
        postRequest.addHeader("content-type", "application/json");
        log.info("pub id :"+ExcelReader.publisherId);
        postRequest.addHeader("accountId", ExcelReader.publisherId);
        postRequest.setEntity(entity);
        HttpResponse postResponse = client.execute(postRequest);
        log.info(EntityUtils.toString(postResponse.getEntity()));

    // …
Run Code Online (Sandbox Code Playgroud)

java jackson apache-httpclient-4.x

14
推荐指数
3
解决办法
5万
查看次数

无法在Fragment中找到当前位置

我正在尝试使用Places API获取当前位置.请在下面找到代码

 public class PlaceFragment extends Fragment implements View.OnClickListener {

private Button currentLocation;

private View myFragmentView;

private GoogleApiClient mGoogleApiClient;

private static final int MY_PERMISSIONS_REQUEST_LOCATION = 101;


public PlaceFragment() {
    // Required empty public constructor
}


@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    mGoogleApiClient = new GoogleApiClient
            .Builder(getActivity())
            .addApi(Places.GEO_DATA_API)
            .addApi(Places.PLACE_DETECTION_API)
            .build();

}

@Override
public void onStart() {

    super.onStart();
    if (mGoogleApiClient != null)
        mGoogleApiClient.connect();

}

@Override
public void onStop() {

    if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
        mGoogleApiClient.disconnect();
    }
    super.onStop();

}

@Override …
Run Code Online (Sandbox Code Playgroud)

android location google-places-api

8
推荐指数
1
解决办法
1943
查看次数

locationclient.getlastlocation()始终在模拟器上返回null

我是Android世界的新手.我刚刚从Google推荐这个教程:http: //developer.android.com/training/location/retrieve-current.html

程序编译很好并在模拟器上启动应用程序,但是当我尝试找到mLocationClient.getLastLocation()时它返回null,总是

我搜索了将近一天,并且已经尝试从DDMS,telnet发送参数,切换谷歌MAP但仍然没有成功.

请帮帮我.

android location-client

3
推荐指数
1
解决办法
4189
查看次数

Java8 - 将Integer数组转换为多个单个元素列表

我有一个数组,我想创建List,每个列表只有一个数组元素.因此,对于数组{1,2,3},我想创建3个List,每个List分别包含元素1,2和3.

已经使用java 7完成了它,但想知道它是否可以使用java 8流,地图等解决

谢谢

java-8 java-stream

3
推荐指数
1
解决办法
85
查看次数

使用批处理脚本查找名称以 <> 开头的目录中的最新文件

所以我有一个正在创建日志文件的目录,我想读取最新的日志文件。该目录将包含日志文件、错误文件和一些其他每次都会创建的文件。我的日志文件的名称以 test-install-<>.log 开头

如何使用批处理脚本查找最新的日志文件。

谢谢

windows batch-file batch-processing

1
推荐指数
1
解决办法
7304
查看次数